2 * This file is part of NixNote/NeighborNote
\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 //**********************************************
\r
23 //**********************************************
\r
24 //* Show the current database status
\r
25 //**********************************************
\r
26 //**********************************************
\r
28 import java.text.NumberFormat;
\r
30 import com.trolltech.qt.gui.QDialog;
\r
31 import com.trolltech.qt.gui.QGridLayout;
\r
32 import com.trolltech.qt.gui.QIcon;
\r
33 import com.trolltech.qt.gui.QLabel;
\r
34 import com.trolltech.qt.gui.QPushButton;
\r
36 public class DatabaseStatus extends QDialog {
\r
40 QLabel notebookCount;
\r
42 QLabel savedSearchCount;
\r
43 QLabel resourceCount;
\r
45 QLabel resourceIndexNeeded;
\r
46 QLabel historyCount;
\r
47 private final QPushButton ok;
\r
48 private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
\r
51 public DatabaseStatus() {
\r
52 setWindowTitle(tr("Current Database Status"));
\r
53 setWindowIcon(new QIcon(iconPath+"database.png"));
\r
54 QGridLayout grid = new QGridLayout();
\r
56 noteCount = new QLabel();
\r
57 indexNeeded = new QLabel();
\r
58 syncNeeded = new QLabel();
\r
59 notebookCount = new QLabel();
\r
60 tagCount = new QLabel();
\r
61 savedSearchCount = new QLabel();
\r
62 resourceCount = new QLabel();
\r
63 resourceIndexNeeded = new QLabel();
\r
64 indexCount = new QLabel();
\r
65 historyCount = new QLabel();
\r
67 grid.addWidget(new QLabel(tr("Notebooks:")), 0,0);
\r
68 grid.addWidget(notebookCount, 0,1);
\r
70 grid.addWidget(new QLabel(tr("Tags:")), 1,0);
\r
71 grid.addWidget(tagCount, 1,1);
\r
73 grid.addWidget(new QLabel(tr("Total Notes:")), 2,0);
\r
74 grid.addWidget(noteCount, 2,1);
\r
76 grid.addWidget(new QLabel(tr("Unsynchronized Notes:")), 3,0);
\r
77 grid.addWidget(syncNeeded, 3, 1);
\r
79 grid.addWidget(new QLabel(tr("Unindexed Notes:")), 4,0);
\r
80 grid.addWidget(indexNeeded, 4, 1);
\r
82 grid.addWidget(new QLabel(tr("Attachments/Images:")), 5,0);
\r
83 grid.addWidget(resourceCount, 5,1);
\r
85 grid.addWidget(new QLabel(tr("Unindexed Attachments/Images:")), 6,0);
\r
86 grid.addWidget(resourceIndexNeeded, 6, 1);
\r
88 grid.addWidget(new QLabel(tr("Saved Searches:")),7,0);
\r
89 grid.addWidget(savedSearchCount, 7,1);
\r
91 grid.addWidget(new QLabel(tr("Words In Index")), 8,0);
\r
92 grid.addWidget(indexCount, 8,1);
\r
94 grid.addWidget(new QLabel(tr("Tobal Behavior History:")), 9, 0);
\r
95 grid.addWidget(historyCount, 9,1);
\r
97 QGridLayout buttonLayout = new QGridLayout();
\r
98 ok = new QPushButton(tr("OK"));
\r
99 ok.clicked.connect(this, "okPushed()");
\r
100 buttonLayout.addWidget(ok, 1, 1);
\r
101 grid.addLayout(buttonLayout,10,1);
\r
104 @SuppressWarnings("unused")
\r
105 private void okPushed() {
\r
108 public void setUnindexed(int d) {
\r
109 indexNeeded.setText(NumberFormat.getInstance().format(d));
\r
111 public void setUnsynchronized(int d) {
\r
112 syncNeeded.setText(NumberFormat.getInstance().format(d));
\r
114 public void setNoteCount(int d) {
\r
115 noteCount.setText(NumberFormat.getInstance().format(d));
\r
117 public void setNotebookCount(int d) {
\r
118 notebookCount.setText(NumberFormat.getInstance().format(d));
\r
120 public void setTagCount(int d) {
\r
121 tagCount.setText(NumberFormat.getInstance().format(d));
\r
123 public void setSavedSearchCount(int d) {
\r
124 savedSearchCount.setText(NumberFormat.getInstance().format(d));
\r
126 public void setResourceCount(int d) {
\r
127 resourceCount.setText(NumberFormat.getInstance().format(d));
\r
129 public void setUnindexedResourceCount(int r) {
\r
130 resourceIndexNeeded.setText(NumberFormat.getInstance().format(r));
\r
132 public void setWordCount(int d) {
\r
133 indexCount.setText(NumberFormat.getInstance().format(d));
\r
135 public void setHistoryCount(int d) {
\r
136 historyCount.setText(NumberFormat.getInstance().format(d));
\r
138 public QPushButton getOkButton() {
\r