From dfd193b2de528ffe629fd5d0c8aee5e998dbb4d5 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sun, 20 Oct 2013 18:09:15 +0200 Subject: [PATCH] aaa --- CMakeLists.txt | 2 ++ src/gui/cornerbutton.cpp | 5 ++++- src/gui/cornerbutton.h | 9 +++------ src/gui/feedmessageviewer.cpp | 16 +++++++++++++--- src/gui/feedmessageviewer.h | 6 ++++++ src/gui/formmain.cpp | 3 +++ src/gui/statusbar.cpp | 9 +++++++++ src/gui/statusbar.h | 21 +++++++++++++++++++++ src/gui/tabwidget.cpp | 3 --- src/gui/webbrowser.cpp | 3 +-- 10 files changed, 62 insertions(+), 15 deletions(-) create mode 100644 src/gui/statusbar.cpp create mode 100644 src/gui/statusbar.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b687b236e..5bb716597 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,6 +194,7 @@ set(APP_SOURCES src/gui/feedmessageviewer.cpp src/gui/feedsview.cpp src/gui/messagesview.cpp + src/gui/statusbar.cpp # CORE sources. src/core/debugging.cpp @@ -242,6 +243,7 @@ set(APP_HEADERS src/gui/feedmessageviewer.h src/gui/feedsview.h src/gui/messagesview.h + src/gui/statusbar.h # CORE headers. src/core/settings.h diff --git a/src/gui/cornerbutton.cpp b/src/gui/cornerbutton.cpp index 87a666eac..dd9de2901 100644 --- a/src/gui/cornerbutton.cpp +++ b/src/gui/cornerbutton.cpp @@ -1,8 +1,11 @@ #include "gui/cornerbutton.h" +#include "gui/iconthemefactory.h" -CornerButton::CornerButton(QWidget *parent) : QPushButton(parent) { +CornerButton::CornerButton(QWidget *parent) : QToolButton(parent) { setToolTip(tr("Open new tab")); + setAutoRaise(true); + setIcon(IconThemeFactory::getInstance()->fromTheme("list-add")); } CornerButton::~CornerButton() { diff --git a/src/gui/cornerbutton.h b/src/gui/cornerbutton.h index 0447178d3..2341d2bd3 100644 --- a/src/gui/cornerbutton.h +++ b/src/gui/cornerbutton.h @@ -1,19 +1,16 @@ #ifndef CORNERBUTTON_H #define CORNERBUTTON_H -#include +#include -class CornerButton : public QPushButton { +class CornerButton : public QToolButton { Q_OBJECT public: + // Contructors and destructors. explicit CornerButton(QWidget *parent = 0); virtual ~CornerButton(); - - signals: - - public slots: }; #endif // CORNERBUTTON_H diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index 695885d89..f69a9eaec 100644 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -17,10 +17,22 @@ FeedMessageViewer::FeedMessageViewer(QWidget *parent) m_feedsView(new FeedsView(this)), m_messagesBrowser(new WebBrowser(this)) { - m_messagesBrowser->setNavigationBarVisible(false); + initialize(); initializeViews(); } +void FeedMessageViewer::initialize() { + // Initialize/populate toolbar. + m_toolBar->setFloatable(false); + m_toolBar->setMovable(false); + m_toolBar->setAllowedAreas(Qt::TopToolBarArea); + + m_toolBar->addAction(QIcon::fromTheme("application-exit"), "aaa"); + + // Finish web/message browser setup. + m_messagesBrowser->setNavigationBarVisible(false); +} + void FeedMessageViewer::initializeViews() { // Instantiate needed components. QVBoxLayout *central_layout = new QVBoxLayout(this); @@ -48,8 +60,6 @@ void FeedMessageViewer::initializeViews() { feed_splitter->addWidget(m_feedsView); feed_splitter->addWidget(message_splitter); - m_toolBar->addAction(QIcon::fromTheme("application-exit"), "aaa"); - // Add toolbar and main feeds/messages widget to main layout. central_layout->addWidget(m_toolBar); central_layout->addWidget(feed_splitter); diff --git a/src/gui/feedmessageviewer.h b/src/gui/feedmessageviewer.h index 511527b1e..4151e9f61 100644 --- a/src/gui/feedmessageviewer.h +++ b/src/gui/feedmessageviewer.h @@ -13,12 +13,18 @@ class FeedMessageViewer : public TabContent { Q_OBJECT public: + // Constructors and destructors. explicit FeedMessageViewer(QWidget *parent = 0); virtual ~FeedMessageViewer(); + // WebBrowser getter from TabContent interface. WebBrowser *webBrowser(); protected: + // Initializes some properties of the widget. + void initialize(); + + // Initializes both messages/feeds views. void initializeViews(); private: diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index cd196d731..463a9e3fa 100644 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -7,6 +7,7 @@ #include "gui/iconthemefactory.h" #include "gui/systemtrayicon.h" #include "gui/tabbar.h" +#include "gui/statusbar.h" #include "core/settings.h" #include "core/defs.h" #include "qtsingleapplication/qtsingleapplication.h" @@ -20,6 +21,8 @@ FormMain::FormMain(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::FormMain // Initialize singleton. s_instance = this; + setStatusBar(new StatusBar(this)); + // Prepare main window and tabs. prepareMenus(); diff --git a/src/gui/statusbar.cpp b/src/gui/statusbar.cpp new file mode 100644 index 000000000..c9889bef6 --- /dev/null +++ b/src/gui/statusbar.cpp @@ -0,0 +1,9 @@ +#include "gui/statusbar.h" + + +StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) { +} + +StatusBar::~StatusBar() { + qDebug("Destroying StatusBar instance."); +} diff --git a/src/gui/statusbar.h b/src/gui/statusbar.h new file mode 100644 index 000000000..f754fb988 --- /dev/null +++ b/src/gui/statusbar.h @@ -0,0 +1,21 @@ +#ifndef STATUSBAR_H +#define STATUSBAR_H + +#include + + +class StatusBar : public QStatusBar { + Q_OBJECT + + public: + // Constructors and destructors. + explicit StatusBar(QWidget *parent = 0); + virtual ~StatusBar(); + + signals: + + public slots: + +}; + +#endif // STATUSBAR_H diff --git a/src/gui/tabwidget.cpp b/src/gui/tabwidget.cpp index 41eef3a01..537da534e 100644 --- a/src/gui/tabwidget.cpp +++ b/src/gui/tabwidget.cpp @@ -1,6 +1,5 @@ #include #include -#include #include "core/defs.h" #include "core/settings.h" @@ -25,8 +24,6 @@ TabWidget::~TabWidget() { void TabWidget::setupCornerButton() { m_cornerButton = new CornerButton(this); - m_cornerButton->setFlat(true); - m_cornerButton->setIcon(IconThemeFactory::getInstance()->fromTheme("list-add")); setCornerWidget(m_cornerButton); } diff --git a/src/gui/webbrowser.cpp b/src/gui/webbrowser.cpp index 4bef6cc8b..a0128f71b 100644 --- a/src/gui/webbrowser.cpp +++ b/src/gui/webbrowser.cpp @@ -43,7 +43,6 @@ WebBrowser::WebBrowser(QWidget *parent) m_runningWebBrowsers.append(this); // Set properties of some components. - m_toolBar->layout()->setMargin(0); m_toolBar->setFloatable(false); m_toolBar->setMovable(false); m_toolBar->setAllowedAreas(Qt::TopToolBarArea); @@ -64,12 +63,12 @@ WebBrowser::WebBrowser(QWidget *parent) m_toolBar->addAction(m_actionReload); m_toolBar->addAction(m_actionStop); m_toolBar->addWidget(m_txtLocation); - //m_toolBar->setContentsMargins(0, 0, 0, -3); // Setup layout. m_layout->addWidget(m_toolBar); m_layout->addWidget(m_webView); m_layout->setMargin(0); + m_layout->setSpacing(0); setTabOrder(m_txtLocation, m_toolBar); setTabOrder(m_toolBar, m_webView);