This commit is contained in:
Martin Rotter 2013-10-20 18:09:15 +02:00
parent 58fcce8f0a
commit dfd193b2de
10 changed files with 62 additions and 15 deletions

View File

@ -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

View File

@ -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() {

View File

@ -1,19 +1,16 @@
#ifndef CORNERBUTTON_H
#define CORNERBUTTON_H
#include <QPushButton>
#include <QToolButton>
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

View File

@ -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);

View File

@ -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:

View File

@ -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();

9
src/gui/statusbar.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "gui/statusbar.h"
StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
}
StatusBar::~StatusBar() {
qDebug("Destroying StatusBar instance.");
}

21
src/gui/statusbar.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef STATUSBAR_H
#define STATUSBAR_H
#include <QStatusBar>
class StatusBar : public QStatusBar {
Q_OBJECT
public:
// Constructors and destructors.
explicit StatusBar(QWidget *parent = 0);
virtual ~StatusBar();
signals:
public slots:
};
#endif // STATUSBAR_H

View File

@ -1,6 +1,5 @@
#include <QUrl>
#include <QApplication>
#include <QPushButton>
#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);
}

View File

@ -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);