Improve icons. Move some menu items to the toolbar. Don't show buttons in current...
authorAkos Polster <polster@marzipan.pipacs.com>
Wed, 1 Sep 2010 22:49:55 +0000 (00:49 +0200)
committerAkos Polster <polster@marzipan.pipacs.com>
Wed, 1 Sep 2010 22:49:55 +0000 (00:49 +0200)
17 files changed:
bookmarkinfodialog.cpp
bookmarksdialog.cpp
devtools.cpp
devtools.h
dorian.qrc
icons/document-properties.png [deleted file]
icons/info.png [new file with mode: 0644]
icons/library.png
icons/mac/document-properties.png [deleted file]
icons/mac/info.png [new file with mode: 0644]
icons/view-normal.png
infodialog.cpp
infodialog.h
mainwindow.cpp
mainwindow.h
widgets/dyalog.cpp
widgets/dyalog.h

index cdc468a..7bdfb70 100644 (file)
@@ -4,7 +4,7 @@
 #include "book.h"
 
 BookmarkInfoDialog::BookmarkInfoDialog(Book *b, int i, QWidget *parent):
-    Dyalog(parent),
+    Dyalog(parent, true),
     book(b),
     index(i)
 {
index 08c4079..fdfed5b 100644 (file)
@@ -82,8 +82,7 @@ void BookmarksDialog::onDelete(bool really)
     if (!really) {
         if (QMessageBox::Yes !=
             QMessageBox::question(this, tr("Delete bookmark"),
-                                  tr("Delete bookmark?"),
-                                  QMessageBox::Yes | QMessageBox::No)) {
+                tr("Delete bookmark?"), QMessageBox::Yes | QMessageBox::No)) {
             return;
         }
     }
index 84fa2ca..a22e617 100644 (file)
@@ -6,34 +6,18 @@
 #include "settings.h"
 #include "toolbuttonbox.h"
 
-DevTools::DevTools(QWidget *parent):
-        QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
-                Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint)
+DevTools::DevTools(QWidget *parent): Dyalog(parent, false)
 {
     setWindowTitle(tr("Developer"));
-    QScrollArea *scroller = new QScrollArea(this);
-    scroller->setFrameStyle(QFrame::NoFrame);
-#ifdef Q_WS_MAEMO_5
-    scroller->setProperty("FingerScrollable", true);
-    scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-#else
-    scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-    setSizeGripEnabled(true);
-#endif // Q_WS_MAEMO_5
-    scroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
-    QWidget *contents = new QWidget(scroller);
-    QVBoxLayout *layout = new QVBoxLayout(contents);
-
     QPushButton *clearSettings = new QPushButton("Clear persistent data", this);
     connect(clearSettings, SIGNAL(clicked()), this, SLOT(onClear()));
-    layout->addWidget(clearSettings);
+    addWidget(clearSettings);
 
-    QLabel *level = new QLabel(tr("Trace level:"), contents);
-    layout->addWidget(level);
+    QLabel *level = new QLabel(tr("Trace level:"), this);
+    addWidget(level);
 
     ToolButtonBox *box = new ToolButtonBox(this);
-    layout->addWidget(box);
+    addWidget(box);
     box->addButton(QtDebugMsg, tr("Debug"));
     box->addButton(QtWarningMsg, tr("Warning"));
     box->addButton(QtCriticalMsg, tr("Critical"));
@@ -41,26 +25,15 @@ DevTools::DevTools(QWidget *parent):
     box->toggle(Trace::level);
     connect(box, SIGNAL(buttonClicked(int)),
             this, SLOT(onLevelButtonClicked(int)));
-
-    contents->setLayout(layout);
-    scroller->setWidget(contents);
-
-    QHBoxLayout *dialogLayout = new QHBoxLayout();
-    dialogLayout->addWidget(scroller);
-    setLayout(dialogLayout);
 }
 
 void DevTools::onClear()
 {
     if (QMessageBox::Yes ==
-        QMessageBox::question(this, "Clear persistent data?",
-                              "Library and settings data will be cleared, "
-                              "application will be restarted. Continue?",
-                              QMessageBox::Yes
-#ifndef Q_WS_MAEMO_5
-                              , QMessageBox::No
-#endif
-                              )) {
+        QMessageBox::question(this, tr("Clear persistent data?"),
+                              tr("Library and settings will be cleared, "
+                                 "application will be restarted. Continue?"),
+                              QMessageBox::Yes | QMessageBox::No)) {
         QSettings().clear();
         QApplication::exit(1000);
     }
index e9d7215..650c612 100644 (file)
@@ -1,10 +1,12 @@
 #ifndef DEVTOOLS_H
 #define DEVTOOLS_H
 
-#include <QtGui>
+#include "dyalog.h"
+
+class QWidget;
 
 /** Display developer tools. */
-class DevTools: public QDialog
+class DevTools: public Dyalog
 {
     Q_OBJECT
 
index 6e5a414..5af7502 100644 (file)
@@ -1,11 +1,9 @@
 <RCC>
     <qresource prefix="/">
-        <file>icons/document-properties.png</file>
         <file>icons/preferences-system.png</file>
         <file>icons/system-file-manager.png</file>
         <file>icons/developer.png</file>
         <file>icons/view-fullscreen.png</file>
-        <file>icons/mac/document-properties.png</file>
         <file>icons/mac/preferences-system.png</file>
         <file>icons/mac/system-file-manager.png</file>
         <file>icons/mac/developer.png</file>
@@ -42,5 +40,7 @@
         <file>icons/folder.png</file>
         <file>icons/view-normal.png</file>
         <file>icons/mac/view-normal.png</file>
+        <file>icons/info.png</file>
+        <file>icons/mac/info.png</file>
     </qresource>
 </RCC>
diff --git a/icons/document-properties.png b/icons/document-properties.png
deleted file mode 100755 (executable)
index 8e5cb7b..0000000
Binary files a/icons/document-properties.png and /dev/null differ
diff --git a/icons/info.png b/icons/info.png
new file mode 100644 (file)
index 0000000..78c891d
Binary files /dev/null and b/icons/info.png differ
index d28acc8..aa6d77d 100644 (file)
Binary files a/icons/library.png and b/icons/library.png differ
diff --git a/icons/mac/document-properties.png b/icons/mac/document-properties.png
deleted file mode 100644 (file)
index bbb628c..0000000
Binary files a/icons/mac/document-properties.png and /dev/null differ
diff --git a/icons/mac/info.png b/icons/mac/info.png
new file mode 100644 (file)
index 0000000..bbb628c
Binary files /dev/null and b/icons/mac/info.png differ
index 2b40ab6..01879c3 100644 (file)
Binary files a/icons/view-normal.png and b/icons/view-normal.png differ
index e2d0827..e541ceb 100644 (file)
@@ -4,7 +4,8 @@
 #include "book.h"
 #include "library.h"
 
-InfoDialog::InfoDialog(Book *b, QWidget *parent): Dyalog(parent), book(b)
+InfoDialog::InfoDialog(Book *b, QWidget *parent, bool showButtons):
+        Dyalog(parent, showButtons), book(b)
 {
     setWindowTitle(tr("Book Details"));
 
index 67c05cb..c326bf9 100644 (file)
@@ -12,7 +12,7 @@ class InfoDialog: public Dyalog
     Q_OBJECT
 
 public:
-    explicit InfoDialog(Book *book, QWidget *parent = 0);
+    explicit InfoDialog(Book *book, QWidget *parent, bool showButtons = true);
 
 public slots:
     void onReadBook();
index 74c0f4b..b049ab7 100755 (executable)
@@ -85,16 +85,12 @@ MainWindow::MainWindow(QWidget *parent):
     toolBar->setIconSize(QSize(42, 42));
 #endif
 
-    previousAction = addToolBarAction(view, SLOT(goPrevious()), "previous");
-    nextAction = addToolBarAction(view, SLOT(goNext()), "next");
     chaptersAction = addToolBarAction(this, SLOT(showChapters()), "chapters");
     bookmarksAction = addToolBarAction(this, SLOT(showBookmarks()), "bookmarks");
+    infoAction = addToolBarAction(this, SLOT(showInfo()), "info");
+    libraryAction = addToolBarAction(this, SLOT(showLibrary()), "library");
 
 #ifdef Q_WS_MAEMO_5
-    infoAction = menuBar()->addAction(tr("Book details"));
-    connect(infoAction, SIGNAL(triggered()), this, SLOT(showInfo()));
-    libraryAction = menuBar()->addAction(tr("Library"));
-    connect(libraryAction, SIGNAL(triggered()), this, SLOT(showLibrary()));
     settingsAction = menuBar()->addAction(tr("Settings"));
     connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettings()));
     devToolsAction = menuBar()->addAction(tr("Developer"));
@@ -102,9 +98,6 @@ MainWindow::MainWindow(QWidget *parent):
     QAction *aboutAction = menuBar()->addAction(tr("About"));
     connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
 #else
-    infoAction = addToolBarAction(this, SLOT(showInfo()), "document-properties");
-    libraryAction = addToolBarAction(this, SLOT(showLibrary()),
-                                     "system-file-manager");
     settingsAction = addToolBarAction(this, SLOT(showSettings()),
                                       "preferences-system");
     devToolsAction = addToolBarAction(this, SLOT(showDevTools()), "developer");
@@ -267,7 +260,7 @@ void MainWindow::showSettings()
 void MainWindow::showInfo()
 {
     if (mCurrent.isValid()) {
-        (new InfoDialog(Library::instance()->book(mCurrent), this))->exec();
+        (new InfoDialog(Library::instance()->book(mCurrent), this, false))->exec();
     }
 }
 
@@ -352,13 +345,7 @@ void MainWindow::onPartLoadEnd(int index)
     }
 #ifdef Q_WS_MAEMO_5
     setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
-    previousAction->setIcon(QIcon(enablePrevious?
-        ":/icons/previous.png" : ":/icons/previous-disabled.png"));
-    nextAction->setIcon(QIcon(enableNext?
-        ":/icons/next.png": ":/icons/next-disabled.png"));
 #endif // Q_WS_MAEMO_5
-    previousAction->setEnabled(enablePrevious);
-    nextAction->setEnabled(enableNext);
 }
 
 void MainWindow::onAddBookmark()
index 4ac7f3f..5995075 100755 (executable)
@@ -60,8 +60,6 @@ private:
     QAction *fullScreenAction;
     QAction *forwardAction;
     QAction *backwardAction;
-    QAction *previousAction;
-    QAction *nextAction;
     QAction *chaptersAction;
     QToolBar *toolBar;
     QDialog *settings;
index 427e496..d31e4d5 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "dyalog.h"
 
-Dyalog::Dyalog(QWidget *parent) :
+Dyalog::Dyalog(QWidget *parent, bool showButtons):
     QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
                     Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint)
 {
@@ -32,7 +32,11 @@ Dyalog::Dyalog(QWidget *parent) :
         boxLayout = new QHBoxLayout(this);
     }
     boxLayout->addWidget(scroller);
-    boxLayout->addWidget(buttonBox);
+    if (showButtons) {
+        boxLayout->addWidget(buttonBox);
+    } else {
+        buttonBox->hide();
+    }
     setLayout(boxLayout);
 
     scroller->setWidget(content);
index 46ee5c6..020ad70 100644 (file)
@@ -15,7 +15,7 @@ class Dyalog: public QDialog
     Q_OBJECT
 
 public:
-    explicit Dyalog(QWidget *parent = 0);
+    explicit Dyalog(QWidget *parent, bool showButtons = true);
 
     /** Add widget to the scrollable content pane. */
     void addWidget(QWidget *widget);