2 * This file is part of NeverNote
\r
3 * Copyright 2009 Randy Baumgarte
\r
5 * This file may be licensed under the terms of of the
\r
6 * GNU General Public License Version 2 (the ``GPL'').
\r
8 * Software distributed under the License is distributed
\r
9 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
\r
10 * express or implied. See the GPL for the specific language
\r
11 * governing rights and limitations.
\r
13 * You should have received a copy of the GPL along with this
\r
14 * program. If not, go to http://www.gnu.org/licenses/gpl.html
\r
15 * or write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
20 package cx.fbn.nevernote.dialog;
\r
22 import java.text.NumberFormat;
\r
24 import com.trolltech.qt.gui.QDialog;
\r
25 import com.trolltech.qt.gui.QGridLayout;
\r
26 import com.trolltech.qt.gui.QIcon;
\r
27 import com.trolltech.qt.gui.QLabel;
\r
28 import com.trolltech.qt.gui.QPushButton;
\r
30 public class DatabaseStatus extends QDialog {
\r
34 QLabel notebookCount;
\r
36 QLabel savedSearchCount;
\r
37 QLabel resourceCount;
\r
39 private final QPushButton ok;
\r
40 private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
\r
43 public DatabaseStatus() {
\r
44 setWindowTitle(tr("Current Database Status"));
\r
45 setWindowIcon(new QIcon(iconPath+"database.png"));
\r
46 QGridLayout grid = new QGridLayout();
\r
48 noteCount = new QLabel();
\r
49 indexNeeded = new QLabel();
\r
50 syncNeeded = new QLabel();
\r
51 notebookCount = new QLabel();
\r
52 tagCount = new QLabel();
\r
53 savedSearchCount = new QLabel();
\r
54 resourceCount = new QLabel();
\r
55 indexCount = new QLabel();
\r
57 grid.addWidget(new QLabel(tr("Notebooks:")), 0,0);
\r
58 grid.addWidget(notebookCount, 0,1);
\r
60 grid.addWidget(new QLabel(tr("Tags:")), 1,0);
\r
61 grid.addWidget(tagCount, 1,1);
\r
63 grid.addWidget(new QLabel(tr("Total Notes:")), 2,0);
\r
64 grid.addWidget(noteCount, 2,1);
\r
66 grid.addWidget(new QLabel(tr("Unsynchronized Notes:")), 3,0);
\r
67 grid.addWidget(syncNeeded, 3, 1);
\r
69 grid.addWidget(new QLabel(tr("Unindexed Notes:")), 4,0);
\r
70 grid.addWidget(indexNeeded, 4, 1);
\r
72 grid.addWidget(new QLabel(tr("Attachments/Images:")), 5,0);
\r
73 grid.addWidget(resourceCount, 5,1);
\r
75 grid.addWidget(new QLabel(tr("Saved Searches:")),6,0);
\r
76 grid.addWidget(savedSearchCount, 6,1);
\r
78 grid.addWidget(new QLabel(tr("Words In Index")), 7,0);
\r
79 grid.addWidget(indexCount, 7,1);
\r
81 QGridLayout buttonLayout = new QGridLayout();
\r
82 ok = new QPushButton(tr("OK"));
\r
83 ok.clicked.connect(this, "okPushed()");
\r
84 buttonLayout.addWidget(ok, 1, 1);
\r
85 grid.addLayout(buttonLayout,8,1);
\r
88 @SuppressWarnings("unused")
\r
89 private void okPushed() {
\r
92 public void setUnindexed(int d) {
\r
93 indexNeeded.setText(NumberFormat.getInstance().format(d));
\r
95 public void setUnsynchronized(int d) {
\r
96 syncNeeded.setText(NumberFormat.getInstance().format(d));
\r
98 public void setNoteCount(int d) {
\r
99 noteCount.setText(NumberFormat.getInstance().format(d));
\r
101 public void setNotebookCount(int d) {
\r
102 notebookCount.setText(NumberFormat.getInstance().format(d));
\r
104 public void setTagCount(int d) {
\r
105 tagCount.setText(NumberFormat.getInstance().format(d));
\r
107 public void setSavedSearchCount(int d) {
\r
108 savedSearchCount.setText(NumberFormat.getInstance().format(d));
\r
110 public void setResourceCount(int d) {
\r
111 resourceCount.setText(NumberFormat.getInstance().format(d));
\r
113 public void setWordCount(int d) {
\r
114 indexCount.setText(NumberFormat.getInstance().format(d));
\r
116 public QPushButton getOkButton() {
\r