OSDN Git Service

Merge branch 'quota_bar' into development
authorDanil <danil@danil-laptop.(none)>
Sat, 30 Oct 2010 08:03:10 +0000 (15:03 +0700)
committerDanil <danil@danil-laptop.(none)>
Sat, 30 Oct 2010 08:03:10 +0000 (15:03 +0700)
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/gui/controls/QuotaProgressBar.java [new file with mode: 0644]

index 699e1fa..d944c26 100644 (file)
@@ -112,7 +112,6 @@ import com.trolltech.qt.gui.QPalette.ColorRole;
 import com.trolltech.qt.gui.QPixmap;
 import com.trolltech.qt.gui.QPrintDialog;
 import com.trolltech.qt.gui.QPrinter;
-import com.trolltech.qt.gui.QProgressBar;
 import com.trolltech.qt.gui.QSizePolicy;
 import com.trolltech.qt.gui.QSizePolicy.Policy;
 import com.trolltech.qt.gui.QSpinBox;
@@ -154,6 +153,7 @@ import cx.fbn.nevernote.gui.TableView;
 import cx.fbn.nevernote.gui.TagTreeWidget;
 import cx.fbn.nevernote.gui.Thumbnailer;
 import cx.fbn.nevernote.gui.TrashTreeWidget;
+import cx.fbn.nevernote.gui.controls.QuotaProgressBar;
 import cx.fbn.nevernote.sql.DatabaseConnection;
 import cx.fbn.nevernote.sql.WatchFolderRecord;
 import cx.fbn.nevernote.threads.IndexRunner;
@@ -196,7 +196,7 @@ public class NeverNote extends QMainWindow{
     public QToolBar            toolBar;                                        // The tool bar under the menu
     QComboBox                          searchField;                            // search filter bar on the toolbar;
     boolean                                    searchPerformed = false;        // Search was done?
-    QProgressBar                       quotaBar;                                       // The current quota usage
+    QuotaProgressBar           quotaBar;                                       // The current quota usage
     
     ApplicationLogger          logger;
     List<String>                       selectedNotebookGUIDs;          // List of notebook GUIDs
@@ -473,7 +473,7 @@ public class NeverNote extends QMainWindow{
        searchField.setDuplicatesEnabled(false);
        searchField.editTextChanged.connect(this,"searchFieldTextChanged(String)");
         
-       quotaBar = new QProgressBar();
+       quotaBar = new QuotaProgressBar();
        
        // Setup the thumbnail viewer
        thumbnailViewer = new ThumbnailViewer();
@@ -532,6 +532,9 @@ public class NeverNote extends QMainWindow{
                noteTableView.resetViewport.connect(this, "scrollToCurrentGuid()");
                noteTableView.doubleClicked.connect(this, "listDoubleClick()");
                listManager.trashSignal.countChanged.connect(trashTree, "updateCounts(Integer)");
+               
+               quotaBar.setMouseClickAction(menuBar.accountAction);
+               
                trashTree.load();
         trashTree.itemSelectionChanged.connect(this, "trashTreeSelection()");
                trashTree.setEmptyAction(menuBar.emptyTrashAction);
diff --git a/src/cx/fbn/nevernote/gui/controls/QuotaProgressBar.java b/src/cx/fbn/nevernote/gui/controls/QuotaProgressBar.java
new file mode 100644 (file)
index 0000000..46d521d
--- /dev/null
@@ -0,0 +1,35 @@
+package cx.fbn.nevernote.gui.controls;
+
+import com.trolltech.qt.gui.QAction;
+import com.trolltech.qt.gui.QMouseEvent;
+import com.trolltech.qt.gui.QProgressBar;
+
+/**
+ * Progress bar for showing remaining space for this month in evernote account
+ *  
+ * @author danil
+ *
+ */
+public class QuotaProgressBar extends QProgressBar {
+
+       private QAction mouseClickAction;
+
+       public QuotaProgressBar() {
+               setMouseTracking(true);
+       }
+
+       @Override
+       protected void mouseReleaseEvent(QMouseEvent arg__1) {
+               super.mouseReleaseEvent(arg__1);
+               
+               mouseClickAction.trigger();
+       }
+
+       public void setMouseClickAction(QAction mouseClickAction) {
+               this.mouseClickAction = mouseClickAction;
+       }
+
+       public QAction getMouseClickAction() {
+               return mouseClickAction;
+       }
+}