OSDN Git Service

c13b54ec00a5dc7c22958042a4f442ff36ba4a0a
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / DatabaseStatus.java
1 /*\r
2  * This file is part of NixNote/NeighborNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\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
12  *\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
17  *\r
18 */\r
19 \r
20 package cx.fbn.nevernote.dialog;\r
21 \r
22 //**********************************************\r
23 //**********************************************\r
24 //* Show the current database status\r
25 //**********************************************\r
26 //**********************************************\r
27 \r
28 import java.text.NumberFormat;\r
29 \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
35 \r
36 public class DatabaseStatus extends QDialog {\r
37         QLabel indexNeeded;\r
38         QLabel syncNeeded;\r
39         QLabel noteCount;\r
40         QLabel notebookCount;\r
41         QLabel tagCount;\r
42         QLabel savedSearchCount;\r
43         QLabel resourceCount;\r
44         QLabel indexCount;\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
49         \r
50         // Constructor\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
55                 setLayout(grid);\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
66                 \r
67                 grid.addWidget(new QLabel(tr("Notebooks:")), 0,0);\r
68                 grid.addWidget(notebookCount, 0,1);\r
69                 \r
70                 grid.addWidget(new QLabel(tr("Tags:")), 1,0);\r
71                 grid.addWidget(tagCount, 1,1);\r
72                 \r
73                 grid.addWidget(new QLabel(tr("Total Notes:")), 2,0);\r
74                 grid.addWidget(noteCount, 2,1);\r
75                 \r
76                 grid.addWidget(new QLabel(tr("Unsynchronized Notes:")), 3,0);\r
77                 grid.addWidget(syncNeeded, 3, 1);\r
78                 \r
79                 grid.addWidget(new QLabel(tr("Unindexed Notes:")), 4,0);\r
80                 grid.addWidget(indexNeeded, 4, 1);\r
81                                 \r
82                 grid.addWidget(new QLabel(tr("Attachments/Images:")), 5,0);\r
83                 grid.addWidget(resourceCount, 5,1);\r
84 \r
85                 grid.addWidget(new QLabel(tr("Unindexed Attachments/Images:")), 6,0);\r
86                 grid.addWidget(resourceIndexNeeded, 6, 1);\r
87 \r
88                 grid.addWidget(new QLabel(tr("Saved Searches:")),7,0);\r
89                 grid.addWidget(savedSearchCount, 7,1);\r
90                 \r
91                 grid.addWidget(new QLabel(tr("Words In Index")), 8,0);\r
92                 grid.addWidget(indexCount, 8,1);\r
93                 \r
94                 grid.addWidget(new QLabel(tr("Tobal Behavior History:")), 9, 0);\r
95                 grid.addWidget(historyCount, 9,1);\r
96                 \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
102         }\r
103         \r
104         @SuppressWarnings("unused")\r
105         private void okPushed() {\r
106                 this.close();\r
107         }\r
108         public void setUnindexed(int d) {\r
109                 indexNeeded.setText(NumberFormat.getInstance().format(d));\r
110         }\r
111         public void setUnsynchronized(int d) {\r
112                 syncNeeded.setText(NumberFormat.getInstance().format(d));\r
113         }\r
114         public void setNoteCount(int d) {\r
115                 noteCount.setText(NumberFormat.getInstance().format(d));\r
116         }\r
117         public void setNotebookCount(int d) {\r
118                 notebookCount.setText(NumberFormat.getInstance().format(d));\r
119         }\r
120         public void setTagCount(int d) {\r
121                 tagCount.setText(NumberFormat.getInstance().format(d));\r
122         }\r
123         public void setSavedSearchCount(int d) {\r
124                 savedSearchCount.setText(NumberFormat.getInstance().format(d));\r
125         }\r
126         public void setResourceCount(int d) {\r
127                 resourceCount.setText(NumberFormat.getInstance().format(d));\r
128         }\r
129         public void setUnindexedResourceCount(int r)  {\r
130                 resourceIndexNeeded.setText(NumberFormat.getInstance().format(r));\r
131         }\r
132         public void setWordCount(int d) {\r
133                 indexCount.setText(NumberFormat.getInstance().format(d));\r
134         }\r
135         public void setHistoryCount(int d) {\r
136                 historyCount.setText(NumberFormat.getInstance().format(d));\r
137         }\r
138         public QPushButton getOkButton() {\r
139                 return ok;\r
140         }\r
141 }\r