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.QLabel;
\r
27 import com.trolltech.qt.gui.QPushButton;
\r
29 public class DatabaseStatus extends QDialog {
\r
33 QLabel notebookCount;
\r
35 QLabel savedSearchCount;
\r
36 QLabel resourceCount;
\r
38 private final QPushButton ok;
\r
41 public DatabaseStatus() {
\r
42 setWindowTitle("Current Database Status");
\r
43 QGridLayout grid = new QGridLayout();
\r
45 noteCount = new QLabel();
\r
46 indexNeeded = new QLabel();
\r
47 syncNeeded = new QLabel();
\r
48 notebookCount = new QLabel();
\r
49 tagCount = new QLabel();
\r
50 savedSearchCount = new QLabel();
\r
51 resourceCount = new QLabel();
\r
52 indexCount = new QLabel();
\r
54 grid.addWidget(new QLabel("Notebooks:"), 0,0);
\r
55 grid.addWidget(notebookCount, 0,1);
\r
57 grid.addWidget(new QLabel("Tags:"), 1,0);
\r
58 grid.addWidget(tagCount, 1,1);
\r
60 grid.addWidget(new QLabel("Total Notes:"), 2,0);
\r
61 grid.addWidget(noteCount, 2,1);
\r
63 grid.addWidget(new QLabel("Unsynchronized Notes:"), 3,0);
\r
64 grid.addWidget(syncNeeded, 3, 1);
\r
66 grid.addWidget(new QLabel("Unindexed Notes:"), 4,0);
\r
67 grid.addWidget(indexNeeded, 4, 1);
\r
69 grid.addWidget(new QLabel("Attachments/Images:"), 5,0);
\r
70 grid.addWidget(resourceCount, 5,1);
\r
72 grid.addWidget(new QLabel("Saved Searches:"),6,0);
\r
73 grid.addWidget(savedSearchCount, 6,1);
\r
75 grid.addWidget(new QLabel("Words In Index"), 7,0);
\r
76 grid.addWidget(indexCount, 7,1);
\r
78 QGridLayout buttonLayout = new QGridLayout();
\r
79 ok = new QPushButton("OK");
\r
80 ok.clicked.connect(this, "okPushed()");
\r
81 buttonLayout.addWidget(ok, 1, 1);
\r
82 grid.addLayout(buttonLayout,8,1);
\r
85 @SuppressWarnings("unused")
\r
86 private void okPushed() {
\r
89 public void setUnindexed(int d) {
\r
90 indexNeeded.setText(NumberFormat.getInstance().format(d));
\r
92 public void setUnsynchronized(int d) {
\r
93 syncNeeded.setText(NumberFormat.getInstance().format(d));
\r
95 public void setNoteCount(int d) {
\r
96 noteCount.setText(NumberFormat.getInstance().format(d));
\r
98 public void setNotebookCount(int d) {
\r
99 notebookCount.setText(NumberFormat.getInstance().format(d));
\r
101 public void setTagCount(int d) {
\r
102 tagCount.setText(NumberFormat.getInstance().format(d));
\r
104 public void setSavedSearchCount(int d) {
\r
105 savedSearchCount.setText(NumberFormat.getInstance().format(d));
\r
107 public void setResourceCount(int d) {
\r
108 resourceCount.setText(NumberFormat.getInstance().format(d));
\r
110 public void setWordCount(int d) {
\r
111 indexCount.setText(NumberFormat.getInstance().format(d));
\r
113 public QPushButton getOkButton() {
\r