Some changes made.
This commit is contained in:
parent
981f1eac76
commit
58fcce8f0a
4 changed files with 28 additions and 16 deletions
|
@ -211,6 +211,7 @@ void BaseWebView::paintEvent(QPaintEvent *event) {
|
||||||
QWebView::paintEvent(event);
|
QWebView::paintEvent(event);
|
||||||
|
|
||||||
// Draw additional frame.
|
// Draw additional frame.
|
||||||
|
/*
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
QStyleOptionFrameV3 style_option;
|
QStyleOptionFrameV3 style_option;
|
||||||
int frame_shape = QFrame::Sunken & QFrame::Shape_Mask;
|
int frame_shape = QFrame::Sunken & QFrame::Shape_Mask;
|
||||||
|
@ -224,6 +225,7 @@ void BaseWebView::paintEvent(QPaintEvent *event) {
|
||||||
style_option.midLineWidth = 0;
|
style_option.midLineWidth = 0;
|
||||||
|
|
||||||
style()->drawControl(QStyle::CE_ShapedFrame, &style_option, &painter, this);
|
style()->drawControl(QStyle::CE_ShapedFrame, &style_option, &painter, this);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseWebView::increaseWebPageZoom() {
|
bool BaseWebView::increaseWebPageZoom() {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
|
#include <QToolBar>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
#include "gui/feedmessageviewer.h"
|
#include "gui/feedmessageviewer.h"
|
||||||
#include "gui/webbrowser.h"
|
#include "gui/webbrowser.h"
|
||||||
|
@ -11,43 +12,50 @@
|
||||||
|
|
||||||
FeedMessageViewer::FeedMessageViewer(QWidget *parent)
|
FeedMessageViewer::FeedMessageViewer(QWidget *parent)
|
||||||
: TabContent(parent),
|
: TabContent(parent),
|
||||||
|
m_toolBar(new QToolBar(tr("Toolbar for messages"), this)),
|
||||||
m_messagesView(new MessagesView(this)),
|
m_messagesView(new MessagesView(this)),
|
||||||
m_feedsView(new FeedsView(this)),
|
m_feedsView(new FeedsView(this)),
|
||||||
m_messagesBrowser(new WebBrowser(this))
|
m_messagesBrowser(new WebBrowser(this))
|
||||||
{
|
{
|
||||||
|
m_messagesBrowser->setNavigationBarVisible(false);
|
||||||
initializeViews();
|
initializeViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedMessageViewer::initializeViews() {
|
void FeedMessageViewer::initializeViews() {
|
||||||
// Instantiate needed components.
|
// Instantiate needed components.
|
||||||
QHBoxLayout *vertical_layout = new QHBoxLayout(this);
|
QVBoxLayout *central_layout = new QVBoxLayout(this);
|
||||||
QSplitter *vertical_splitter = new QSplitter(Qt::Horizontal, this);
|
QSplitter *feed_splitter = new QSplitter(Qt::Horizontal, this);
|
||||||
QSplitter *message_splitter = new QSplitter(Qt::Vertical, this);
|
QSplitter *message_splitter = new QSplitter(Qt::Vertical, this);
|
||||||
|
|
||||||
// Set layout properties.
|
// Set layout properties.
|
||||||
vertical_layout->setMargin(0);
|
central_layout->setMargin(0);
|
||||||
vertical_layout->setSpacing(0);
|
central_layout->setSpacing(0);
|
||||||
|
|
||||||
// Set views.
|
// Set views.
|
||||||
m_feedsView->setFrameStyle(QFrame::NoFrame);
|
m_feedsView->setFrameStyle(QFrame::NoFrame);
|
||||||
m_messagesView->setFrameStyle(QFrame::NoFrame);
|
m_messagesView->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
// setup splitters.
|
// Setup splitters.
|
||||||
message_splitter->setHandleWidth(1);
|
message_splitter->setHandleWidth(1);
|
||||||
message_splitter->setChildrenCollapsible(false);
|
message_splitter->setChildrenCollapsible(false);
|
||||||
message_splitter->setStretchFactor(0, 1);
|
message_splitter->setStretchFactor(0, 1);
|
||||||
message_splitter->addWidget(m_messagesView);
|
message_splitter->addWidget(m_messagesView);
|
||||||
message_splitter->addWidget(m_messagesBrowser);
|
message_splitter->addWidget(m_messagesBrowser);
|
||||||
|
|
||||||
vertical_splitter->setHandleWidth(1);
|
feed_splitter->setHandleWidth(1);
|
||||||
vertical_splitter->setChildrenCollapsible(false);
|
feed_splitter->setChildrenCollapsible(false);
|
||||||
vertical_splitter->setStretchFactor(0, 1);
|
feed_splitter->setStretchFactor(0, 1);
|
||||||
vertical_splitter->addWidget(m_feedsView);
|
feed_splitter->addWidget(m_feedsView);
|
||||||
vertical_splitter->addWidget(message_splitter);
|
feed_splitter->addWidget(message_splitter);
|
||||||
vertical_layout->addWidget(vertical_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);
|
||||||
|
|
||||||
// Set layout as active.
|
// Set layout as active.
|
||||||
setLayout(vertical_layout);
|
setLayout(central_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedMessageViewer::~FeedMessageViewer() {
|
FeedMessageViewer::~FeedMessageViewer() {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
class WebBrowser;
|
class WebBrowser;
|
||||||
class FeedsView;
|
class FeedsView;
|
||||||
class MessagesView;
|
class MessagesView;
|
||||||
|
class QToolBar;
|
||||||
|
|
||||||
class FeedMessageViewer : public TabContent {
|
class FeedMessageViewer : public TabContent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -21,6 +22,7 @@ class FeedMessageViewer : public TabContent {
|
||||||
void initializeViews();
|
void initializeViews();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QToolBar *m_toolBar;
|
||||||
MessagesView *m_messagesView;
|
MessagesView *m_messagesView;
|
||||||
FeedsView *m_feedsView;
|
FeedsView *m_feedsView;
|
||||||
WebBrowser *m_messagesBrowser;
|
WebBrowser *m_messagesBrowser;
|
||||||
|
|
|
@ -46,6 +46,7 @@ WebBrowser::WebBrowser(QWidget *parent)
|
||||||
m_toolBar->layout()->setMargin(0);
|
m_toolBar->layout()->setMargin(0);
|
||||||
m_toolBar->setFloatable(false);
|
m_toolBar->setFloatable(false);
|
||||||
m_toolBar->setMovable(false);
|
m_toolBar->setMovable(false);
|
||||||
|
m_toolBar->setAllowedAreas(Qt::TopToolBarArea);
|
||||||
|
|
||||||
// Modify action texts.
|
// Modify action texts.
|
||||||
m_actionBack->setText(tr("Back"));
|
m_actionBack->setText(tr("Back"));
|
||||||
|
@ -60,16 +61,15 @@ WebBrowser::WebBrowser(QWidget *parent)
|
||||||
// Add needed actions into toolbar.
|
// Add needed actions into toolbar.
|
||||||
m_toolBar->addAction(m_actionBack);
|
m_toolBar->addAction(m_actionBack);
|
||||||
m_toolBar->addAction(m_actionForward);
|
m_toolBar->addAction(m_actionForward);
|
||||||
m_toolBar->addSeparator();
|
|
||||||
m_toolBar->addAction(m_actionReload);
|
m_toolBar->addAction(m_actionReload);
|
||||||
m_toolBar->addAction(m_actionStop);
|
m_toolBar->addAction(m_actionStop);
|
||||||
m_toolBar->addWidget(m_txtLocation);
|
m_toolBar->addWidget(m_txtLocation);
|
||||||
|
//m_toolBar->setContentsMargins(0, 0, 0, -3);
|
||||||
|
|
||||||
// Setup layout.
|
// Setup layout.
|
||||||
m_layout->addWidget(m_toolBar);
|
m_layout->addWidget(m_toolBar);
|
||||||
m_layout->addWidget(m_webView);
|
m_layout->addWidget(m_webView);
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
m_layout->setContentsMargins(0, -1, 0, 0);
|
|
||||||
|
|
||||||
setTabOrder(m_txtLocation, m_toolBar);
|
setTabOrder(m_txtLocation, m_toolBar);
|
||||||
setTabOrder(m_toolBar, m_webView);
|
setTabOrder(m_toolBar, m_webView);
|
||||||
|
@ -189,7 +189,7 @@ void WebBrowser::navigateToUrl(const QString &textual_url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WebBrowser::~WebBrowser() {
|
WebBrowser::~WebBrowser() {
|
||||||
qDebug("Erasing WebBrowser instance.");
|
qDebug("Destroying WebBrowser instance.");
|
||||||
|
|
||||||
// Remove this instance from the global list of web browsers.
|
// Remove this instance from the global list of web browsers.
|
||||||
m_runningWebBrowsers.removeAll(this);
|
m_runningWebBrowsers.removeAll(this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue