Optimizations.
This commit is contained in:
parent
e264614144
commit
0ceec084b2
@ -287,7 +287,6 @@ set(APP_SOURCES
|
||||
src/gui/tabwidget.cpp
|
||||
src/gui/tabbar.cpp
|
||||
src/gui/tabcontent.cpp
|
||||
src/gui/cornerbutton.cpp
|
||||
src/gui/feedmessageviewer.cpp
|
||||
src/gui/feedsview.cpp
|
||||
src/gui/messagesview.cpp
|
||||
@ -359,7 +358,6 @@ set(APP_HEADERS
|
||||
src/gui/tabwidget.h
|
||||
src/gui/tabbar.h
|
||||
src/gui/tabcontent.h
|
||||
src/gui/cornerbutton.h
|
||||
src/gui/feedmessageviewer.h
|
||||
src/gui/feedsview.h
|
||||
src/gui/messagesview.h
|
||||
|
@ -1,32 +0,0 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "gui/cornerbutton.h"
|
||||
|
||||
#include "gui/iconthemefactory.h"
|
||||
|
||||
|
||||
CornerButton::CornerButton(QWidget *parent) : QToolButton(parent) {
|
||||
//: Tooltip for "new tab" webbrowser corner button.
|
||||
setToolTip(tr("Open new web browser tab."));
|
||||
setAutoRaise(true);
|
||||
setIcon(IconThemeFactory::instance()->fromTheme("list-add"));
|
||||
}
|
||||
|
||||
CornerButton::~CornerButton() {
|
||||
qDebug("Destroying CornerButton instance.");
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef CORNERBUTTON_H
|
||||
#define CORNERBUTTON_H
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
|
||||
// TODO: potřebuju extra třídu? mozna presunout do tabwidgetu.
|
||||
class CornerButton : public QToolButton {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Contructors and destructors.
|
||||
explicit CornerButton(QWidget *parent = 0);
|
||||
virtual ~CornerButton();
|
||||
};
|
||||
|
||||
#endif // CORNERBUTTON_H
|
@ -34,5 +34,11 @@ void PlainToolButton::paintEvent(QPaintEvent *e) {
|
||||
Q_UNUSED(e)
|
||||
|
||||
QPainter p(this);
|
||||
icon().paint(&p, QRect(QPoint(0, 0), size()));
|
||||
QRect rect(QPoint(0, 0), size());
|
||||
|
||||
// TODO: adjustable "padding" of the icon.
|
||||
//rect.adjust(2, 2, -2, -2);
|
||||
|
||||
// Paint the icon.
|
||||
icon().paint(&p, rect);
|
||||
}
|
||||
|
@ -25,11 +25,11 @@
|
||||
#include "gui/webbrowser.h"
|
||||
#include "gui/formmain.h"
|
||||
#include "gui/feedmessageviewer.h"
|
||||
#include "gui/cornerbutton.h"
|
||||
#include "gui/plaintoolbutton.h"
|
||||
|
||||
#include <QUrl>
|
||||
#include <QApplication>
|
||||
#include <QMenu>
|
||||
#include <QToolButton>
|
||||
|
||||
|
||||
TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent), m_mainMenu(NULL) {
|
||||
@ -44,12 +44,18 @@ TabWidget::~TabWidget() {
|
||||
}
|
||||
|
||||
void TabWidget::setupCornerButton() {
|
||||
m_cornerButton = new CornerButton(this);
|
||||
setCornerWidget(m_cornerButton);
|
||||
m_cornerButton = new PlainToolButton(this);
|
||||
m_cornerButton->setAutoRaise(true);
|
||||
m_cornerButton->setToolTip(tr("Open new web browser tab."));
|
||||
m_cornerButton->setIcon(IconThemeFactory::instance()->fromTheme("list-add"));
|
||||
|
||||
connect(m_cornerButton, SIGNAL(clicked()), this, SLOT(addEmptyBrowser()));
|
||||
|
||||
setCornerWidget(m_cornerButton, Qt::TopRightCorner);
|
||||
}
|
||||
|
||||
void TabWidget::setupMainMenuButton() {
|
||||
m_menuButton = new QToolButton(this);
|
||||
m_menuButton = new PlainToolButton(this);
|
||||
m_menuButton->setAutoRaise(true);
|
||||
m_menuButton->setToolTip(tr("Displays main menu."));
|
||||
m_menuButton->setIcon(IconThemeFactory::instance()->fromTheme("application-menu"));
|
||||
@ -97,7 +103,6 @@ void TabWidget::tabRemoved(int index) {
|
||||
}
|
||||
|
||||
void TabWidget::createConnections() {
|
||||
connect(m_cornerButton, SIGNAL(clicked()), this, SLOT(addEmptyBrowser()));
|
||||
connect(tabBar(), SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
|
||||
connect(tabBar(), SIGNAL(emptySpaceDoubleClicked()), this, SLOT(addEmptyBrowser()));
|
||||
connect(tabBar(), SIGNAL(tabMoved(int,int)), this, SLOT(fixContentsAfterMove(int,int)));
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
class QMenu;
|
||||
class QToolButton;
|
||||
class CornerButton;
|
||||
class Message;
|
||||
class FeedMessageViewer;
|
||||
|
||||
@ -125,7 +124,7 @@ class TabWidget : public QTabWidget {
|
||||
const QUrl &initial_url = QUrl());
|
||||
|
||||
private:
|
||||
CornerButton *m_cornerButton;
|
||||
QToolButton *m_cornerButton;
|
||||
QToolButton *m_menuButton;
|
||||
QMenu *m_mainMenu;
|
||||
FeedMessageViewer *m_feedMessageViewer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user