OSDN Git Service

データベースステータスページで連想ノートクリック回数を表示できるようにした
[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         QLabel rensoClickCount;\r
48         private final QPushButton ok;\r
49     private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");\r
50         \r
51         // Constructor\r
52         public DatabaseStatus() {\r
53                 setWindowTitle(tr("Current Database Status"));\r
54                 setWindowIcon(new QIcon(iconPath+"database.png"));\r
55                 QGridLayout grid = new QGridLayout();\r
56                 setLayout(grid);\r
57                 noteCount = new QLabel();\r
58                 indexNeeded = new QLabel();\r
59                 syncNeeded = new QLabel();\r
60                 notebookCount = new QLabel();\r
61                 tagCount = new QLabel();\r
62                 savedSearchCount = new QLabel();                \r
63                 resourceCount = new QLabel();\r
64                 resourceIndexNeeded = new QLabel();\r
65                 indexCount = new QLabel();\r
66                 historyCount = new QLabel();\r
67                 rensoClickCount = new QLabel();\r
68                 \r
69                 grid.addWidget(new QLabel(tr("Notebooks:")), 0,0);\r
70                 grid.addWidget(notebookCount, 0,1);\r
71                 \r
72                 grid.addWidget(new QLabel(tr("Tags:")), 1,0);\r
73                 grid.addWidget(tagCount, 1,1);\r
74                 \r
75                 grid.addWidget(new QLabel(tr("Total Notes:")), 2,0);\r
76                 grid.addWidget(noteCount, 2,1);\r
77                 \r
78                 grid.addWidget(new QLabel(tr("Unsynchronized Notes:")), 3,0);\r
79                 grid.addWidget(syncNeeded, 3, 1);\r
80                 \r
81                 grid.addWidget(new QLabel(tr("Unindexed Notes:")), 4,0);\r
82                 grid.addWidget(indexNeeded, 4, 1);\r
83                                 \r
84                 grid.addWidget(new QLabel(tr("Attachments/Images:")), 5,0);\r
85                 grid.addWidget(resourceCount, 5,1);\r
86 \r
87                 grid.addWidget(new QLabel(tr("Unindexed Attachments/Images:")), 6,0);\r
88                 grid.addWidget(resourceIndexNeeded, 6, 1);\r
89 \r
90                 grid.addWidget(new QLabel(tr("Saved Searches:")),7,0);\r
91                 grid.addWidget(savedSearchCount, 7,1);\r
92                 \r
93                 grid.addWidget(new QLabel(tr("Words In Index")), 8,0);\r
94                 grid.addWidget(indexCount, 8,1);\r
95                 \r
96                 grid.addWidget(new QLabel(tr("Tobal Behavior History:")), 9, 0);\r
97                 grid.addWidget(historyCount, 9,1);\r
98                 \r
99                 grid.addWidget(new QLabel(tr("Renso Note Click:")), 10, 0);\r
100                 grid.addWidget(rensoClickCount, 10, 1);\r
101                 \r
102                 QGridLayout buttonLayout = new QGridLayout();\r
103                 ok = new QPushButton(tr("OK"));\r
104                 ok.clicked.connect(this, "okPushed()");\r
105                 buttonLayout.addWidget(ok, 1, 1);\r
106                 grid.addLayout(buttonLayout,11,1);\r
107         }\r
108         \r
109         @SuppressWarnings("unused")\r
110         private void okPushed() {\r
111                 this.close();\r
112         }\r
113         public void setUnindexed(int d) {\r
114                 indexNeeded.setText(NumberFormat.getInstance().format(d));\r
115         }\r
116         public void setUnsynchronized(int d) {\r
117                 syncNeeded.setText(NumberFormat.getInstance().format(d));\r
118         }\r
119         public void setNoteCount(int d) {\r
120                 noteCount.setText(NumberFormat.getInstance().format(d));\r
121         }\r
122         public void setNotebookCount(int d) {\r
123                 notebookCount.setText(NumberFormat.getInstance().format(d));\r
124         }\r
125         public void setTagCount(int d) {\r
126                 tagCount.setText(NumberFormat.getInstance().format(d));\r
127         }\r
128         public void setSavedSearchCount(int d) {\r
129                 savedSearchCount.setText(NumberFormat.getInstance().format(d));\r
130         }\r
131         public void setResourceCount(int d) {\r
132                 resourceCount.setText(NumberFormat.getInstance().format(d));\r
133         }\r
134         public void setUnindexedResourceCount(int r)  {\r
135                 resourceIndexNeeded.setText(NumberFormat.getInstance().format(r));\r
136         }\r
137         public void setWordCount(int d) {\r
138                 indexCount.setText(NumberFormat.getInstance().format(d));\r
139         }\r
140         public void setHistoryCount(int d) {\r
141                 historyCount.setText(NumberFormat.getInstance().format(d));\r
142         }\r
143         public void setRensoClickCount(int d) {\r
144                 rensoClickCount.setText(NumberFormat.getInstance().format(d));\r
145         }\r
146         public QPushButton getOkButton() {\r
147                 return ok;\r
148         }\r
149 }\r