From: Akos Polster Date: Wed, 1 Sep 2010 22:49:55 +0000 (+0200) Subject: Improve icons. Move some menu items to the toolbar. Don't show buttons in current... X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;h=6337ac23cc03c51054b8f208abf9eb832d65a39e;hp=5d2c3cdf432afd91f2ee5851678a1f763493b10c;p=dorian Improve icons. Move some menu items to the toolbar. Don't show buttons in current book's information dialog. --- diff --git a/bookmarkinfodialog.cpp b/bookmarkinfodialog.cpp index cdc468a..7bdfb70 100644 --- a/bookmarkinfodialog.cpp +++ b/bookmarkinfodialog.cpp @@ -4,7 +4,7 @@ #include "book.h" BookmarkInfoDialog::BookmarkInfoDialog(Book *b, int i, QWidget *parent): - Dyalog(parent), + Dyalog(parent, true), book(b), index(i) { diff --git a/bookmarksdialog.cpp b/bookmarksdialog.cpp index 08c4079..fdfed5b 100644 --- a/bookmarksdialog.cpp +++ b/bookmarksdialog.cpp @@ -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; } } diff --git a/devtools.cpp b/devtools.cpp index 84fa2ca..a22e617 100644 --- a/devtools.cpp +++ b/devtools.cpp @@ -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); } diff --git a/devtools.h b/devtools.h index e9d7215..650c612 100644 --- a/devtools.h +++ b/devtools.h @@ -1,10 +1,12 @@ #ifndef DEVTOOLS_H #define DEVTOOLS_H -#include +#include "dyalog.h" + +class QWidget; /** Display developer tools. */ -class DevTools: public QDialog +class DevTools: public Dyalog { Q_OBJECT diff --git a/dorian.qrc b/dorian.qrc index 6e5a414..5af7502 100644 --- a/dorian.qrc +++ b/dorian.qrc @@ -1,11 +1,9 @@ - icons/document-properties.png icons/preferences-system.png icons/system-file-manager.png icons/developer.png icons/view-fullscreen.png - icons/mac/document-properties.png icons/mac/preferences-system.png icons/mac/system-file-manager.png icons/mac/developer.png @@ -42,5 +40,7 @@ icons/folder.png icons/view-normal.png icons/mac/view-normal.png + icons/info.png + icons/mac/info.png diff --git a/icons/document-properties.png b/icons/document-properties.png deleted file mode 100755 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 index 0000000..78c891d Binary files /dev/null and b/icons/info.png differ diff --git a/icons/library.png b/icons/library.png index d28acc8..aa6d77d 100644 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 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 index 0000000..bbb628c Binary files /dev/null and b/icons/mac/info.png differ diff --git a/icons/view-normal.png b/icons/view-normal.png index 2b40ab6..01879c3 100644 Binary files a/icons/view-normal.png and b/icons/view-normal.png differ diff --git a/infodialog.cpp b/infodialog.cpp index e2d0827..e541ceb 100644 --- a/infodialog.cpp +++ b/infodialog.cpp @@ -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")); diff --git a/infodialog.h b/infodialog.h index 67c05cb..c326bf9 100644 --- a/infodialog.h +++ b/infodialog.h @@ -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(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 74c0f4b..b049ab7 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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() diff --git a/mainwindow.h b/mainwindow.h index 4ac7f3f..5995075 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -60,8 +60,6 @@ private: QAction *fullScreenAction; QAction *forwardAction; QAction *backwardAction; - QAction *previousAction; - QAction *nextAction; QAction *chaptersAction; QToolBar *toolBar; QDialog *settings; diff --git a/widgets/dyalog.cpp b/widgets/dyalog.cpp index 427e496..d31e4d5 100644 --- a/widgets/dyalog.cpp +++ b/widgets/dyalog.cpp @@ -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); diff --git a/widgets/dyalog.h b/widgets/dyalog.h index 46ee5c6..020ad70 100644 --- a/widgets/dyalog.h +++ b/widgets/dyalog.h @@ -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);