tweak toolbar editor a bit
This commit is contained in:
parent
ec983c1243
commit
08685eed0d
|
@ -43,10 +43,11 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
|
|
||||||
FeedMessageViewer::FeedMessageViewer(QWidget* parent) : TabContent(parent), m_toolBarsEnabled(true), m_listHeadersEnabled(true),
|
FeedMessageViewer::FeedMessageViewer(QWidget* parent)
|
||||||
m_toolBarFeeds(new FeedsToolBar(tr("Toolbar for feeds"), this)), m_toolBarMessages(new MessagesToolBar(tr("Toolbar for articles"), this)),
|
: TabContent(parent), m_toolBarsEnabled(true), m_listHeadersEnabled(true),
|
||||||
m_messagesView(new MessagesView(this)), m_feedsView(new FeedsView(this)),
|
m_toolBarFeeds(new FeedsToolBar(tr("Toolbar for feeds"), this)),
|
||||||
m_messagesBrowser(new MessagePreviewer(this)) {
|
m_toolBarMessages(new MessagesToolBar(tr("Toolbar for articles"), this)), m_messagesView(new MessagesView(this)),
|
||||||
|
m_feedsView(new FeedsView(this)), m_messagesBrowser(new MessagePreviewer(this)) {
|
||||||
initialize();
|
initialize();
|
||||||
initializeViews();
|
initializeViews();
|
||||||
createConnections();
|
createConnections();
|
||||||
|
@ -90,12 +91,10 @@ void FeedMessageViewer::loadSize() {
|
||||||
const Settings* settings = qApp->settings();
|
const Settings* settings = qApp->settings();
|
||||||
|
|
||||||
// Restore offsets of splitters.
|
// Restore offsets of splitters.
|
||||||
m_feedSplitter->setSizes(toList<int>(settings->value(GROUP(GUI),
|
m_feedSplitter->setSizes(toList<int>(settings->value(GROUP(GUI), SETTING(GUI::SplitterFeeds))));
|
||||||
SETTING(GUI::SplitterFeeds))));
|
|
||||||
|
|
||||||
if (settings->value(GROUP(GUI), SETTING(GUI::SplitterMessagesIsVertical)).toBool()) {
|
if (settings->value(GROUP(GUI), SETTING(GUI::SplitterMessagesIsVertical)).toBool()) {
|
||||||
m_messageSplitter->setSizes(toList<int>(settings->value(GROUP(GUI),
|
m_messageSplitter->setSizes(toList<int>(settings->value(GROUP(GUI), SETTING(GUI::SplitterMessagesVertical))));
|
||||||
SETTING(GUI::SplitterMessagesVertical))));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switchMessageSplitterOrientation();
|
switchMessageSplitterOrientation();
|
||||||
|
@ -132,14 +131,10 @@ void FeedMessageViewer::onMessageSplitterResized() {
|
||||||
qDebugNN << LOGSEC_GUI << "Message splitter moved.";
|
qDebugNN << LOGSEC_GUI << "Message splitter moved.";
|
||||||
|
|
||||||
if (m_messageSplitter->orientation() == Qt::Orientation::Vertical) {
|
if (m_messageSplitter->orientation() == Qt::Orientation::Vertical) {
|
||||||
qApp->settings()->setValue(GROUP(GUI),
|
qApp->settings()->setValue(GROUP(GUI), GUI::SplitterMessagesVertical, toVariant(m_messageSplitter->sizes()));
|
||||||
GUI::SplitterMessagesVertical,
|
|
||||||
toVariant(m_messageSplitter->sizes()));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qApp->settings()->setValue(GROUP(GUI),
|
qApp->settings()->setValue(GROUP(GUI), GUI::SplitterMessagesHorizontal, toVariant(m_messageSplitter->sizes()));
|
||||||
GUI::SplitterMessagesHorizontal,
|
|
||||||
toVariant(m_messageSplitter->sizes()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,18 +230,29 @@ void FeedMessageViewer::displayMessage(const Message& message, RootItem* root) {
|
||||||
|
|
||||||
void FeedMessageViewer::createConnections() {
|
void FeedMessageViewer::createConnections() {
|
||||||
// Filtering & searching.
|
// Filtering & searching.
|
||||||
connect(m_toolBarMessages, &MessagesToolBar::messageSearchPatternChanged, m_messagesView, &MessagesView::searchMessages);
|
connect(m_toolBarMessages,
|
||||||
|
&MessagesToolBar::messageSearchPatternChanged,
|
||||||
|
m_messagesView,
|
||||||
|
&MessagesView::searchMessages);
|
||||||
connect(m_toolBarFeeds, &FeedsToolBar::feedsFilterPatternChanged, m_feedsView, &FeedsView::filterItems);
|
connect(m_toolBarFeeds, &FeedsToolBar::feedsFilterPatternChanged, m_feedsView, &FeedsView::filterItems);
|
||||||
connect(m_toolBarMessages, &MessagesToolBar::messageHighlighterChanged, m_messagesView, &MessagesView::highlightMessages);
|
connect(m_toolBarMessages,
|
||||||
|
&MessagesToolBar::messageHighlighterChanged,
|
||||||
|
m_messagesView,
|
||||||
|
&MessagesView::highlightMessages);
|
||||||
connect(m_toolBarMessages, &MessagesToolBar::messageFilterChanged, this, &FeedMessageViewer::changeMessageFilter);
|
connect(m_toolBarMessages, &MessagesToolBar::messageFilterChanged, this, &FeedMessageViewer::changeMessageFilter);
|
||||||
|
|
||||||
connect(m_feedSplitter, &QSplitter::splitterMoved, this, &FeedMessageViewer::onFeedSplitterResized);
|
connect(m_feedSplitter, &QSplitter::splitterMoved, this, &FeedMessageViewer::onFeedSplitterResized);
|
||||||
connect(m_messageSplitter, &QSplitter::splitterMoved, this, &FeedMessageViewer::onMessageSplitterResized);
|
connect(m_messageSplitter, &QSplitter::splitterMoved, this, &FeedMessageViewer::onMessageSplitterResized);
|
||||||
|
|
||||||
connect(m_messagesView, &MessagesView::currentMessageRemoved, m_messagesBrowser, &MessagePreviewer::clear);
|
connect(m_messagesView, &MessagesView::currentMessageRemoved, m_messagesBrowser, &MessagePreviewer::clear);
|
||||||
connect(m_messagesBrowser, &MessagePreviewer::markMessageRead, m_messagesView->sourceModel(), &MessagesModel::setMessageReadById);
|
connect(m_messagesBrowser,
|
||||||
connect(m_messagesBrowser, &MessagePreviewer::markMessageImportant,
|
&MessagePreviewer::markMessageRead,
|
||||||
m_messagesView->sourceModel(), &MessagesModel::setMessageImportantById);
|
m_messagesView->sourceModel(),
|
||||||
|
&MessagesModel::setMessageReadById);
|
||||||
|
connect(m_messagesBrowser,
|
||||||
|
&MessagePreviewer::markMessageImportant,
|
||||||
|
m_messagesView->sourceModel(),
|
||||||
|
&MessagesModel::setMessageImportantById);
|
||||||
|
|
||||||
connect(m_messagesView, &MessagesView::currentMessageChanged, this, &FeedMessageViewer::displayMessage);
|
connect(m_messagesView, &MessagesView::currentMessageChanged, this, &FeedMessageViewer::displayMessage);
|
||||||
connect(m_messagesView, &MessagesView::openLinkMiniBrowser, m_messagesBrowser, &MessagePreviewer::loadUrl);
|
connect(m_messagesView, &MessagesView::openLinkMiniBrowser, m_messagesBrowser, &MessagePreviewer::loadUrl);
|
||||||
|
@ -257,7 +263,10 @@ void FeedMessageViewer::createConnections() {
|
||||||
|
|
||||||
// State of many messages is changed, then we need
|
// State of many messages is changed, then we need
|
||||||
// to reload selections.
|
// to reload selections.
|
||||||
connect(m_feedsView->sourceModel(), &FeedsModel::reloadMessageListRequested, m_messagesView, &MessagesView::reloadSelections);
|
connect(m_feedsView->sourceModel(),
|
||||||
|
&FeedsModel::reloadMessageListRequested,
|
||||||
|
m_messagesView,
|
||||||
|
&MessagesView::reloadSelections);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessagePreviewer* FeedMessageViewer::messagesBrowser() const {
|
MessagePreviewer* FeedMessageViewer::messagesBrowser() const {
|
||||||
|
@ -339,8 +348,7 @@ void FeedMessageViewer::initializeViews() {
|
||||||
|
|
||||||
void FeedMessageViewer::refreshVisualProperties() {
|
void FeedMessageViewer::refreshVisualProperties() {
|
||||||
const Qt::ToolButtonStyle button_style =
|
const Qt::ToolButtonStyle button_style =
|
||||||
static_cast<Qt::ToolButtonStyle>(qApp->settings()->value(GROUP(GUI),
|
static_cast<Qt::ToolButtonStyle>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::ToolbarStyle)).toInt());
|
||||||
SETTING(GUI::ToolbarStyle)).toInt());
|
|
||||||
|
|
||||||
m_toolBarFeeds->setToolButtonStyle(button_style);
|
m_toolBarFeeds->setToolButtonStyle(button_style);
|
||||||
m_toolBarMessages->setToolButtonStyle(button_style);
|
m_toolBarMessages->setToolButtonStyle(button_style);
|
||||||
|
@ -348,11 +356,11 @@ void FeedMessageViewer::refreshVisualProperties() {
|
||||||
const int icon_size = qApp->settings()->value(GROUP(GUI), SETTING(GUI::ToolbarIconSize)).toInt();
|
const int icon_size = qApp->settings()->value(GROUP(GUI), SETTING(GUI::ToolbarIconSize)).toInt();
|
||||||
|
|
||||||
if (icon_size > 0) {
|
if (icon_size > 0) {
|
||||||
m_toolBarFeeds->setIconSize({ icon_size, icon_size });
|
m_toolBarFeeds->setIconSize({icon_size, icon_size});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_toolBarFeeds->setIconSize({ qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize),
|
m_toolBarFeeds->setIconSize({qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize),
|
||||||
qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize) });
|
qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize)});
|
||||||
}
|
}
|
||||||
|
|
||||||
m_toolBarMessages->setIconSize(m_toolBarFeeds->iconSize());
|
m_toolBarMessages->setIconSize(m_toolBarFeeds->iconSize());
|
||||||
|
|
|
@ -72,18 +72,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Move action up</string>
|
<string>Move action up</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -94,18 +85,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Move action down</string>
|
<string>Move action down</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -123,18 +105,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Insert separator</string>
|
<string>Insert separator</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -145,18 +118,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Insert spacer</string>
|
<string>Insert spacer</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -174,18 +138,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Add selected action</string>
|
<string>Add selected action</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -196,18 +151,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Delete selected action</string>
|
<string>Delete selected action</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -218,18 +164,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Delete all actions</string>
|
<string>Delete all actions</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -240,18 +177,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Reset toolbar</string>
|
<string>Reset toolbar</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>22</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -176,8 +176,7 @@ void TextBrowserViewer::setUrl(const QUrl& url) {
|
||||||
is_error = true;
|
is_error = true;
|
||||||
nonconst_url = QUrl::fromUserInput(QSL(INTERNAL_URL_ADBLOCKED));
|
nonconst_url = QUrl::fromUserInput(QSL(INTERNAL_URL_ADBLOCKED));
|
||||||
|
|
||||||
// TODO: Zjednodušeně.
|
html_str = QSL("Blocked!!!<br/>%1").arg(url.toString());
|
||||||
html_str = qApp->skins()->adBlockedPage(url.toString(), block_result.m_blockedByFilter);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
|
@ -192,8 +191,7 @@ void TextBrowserViewer::setUrl(const QUrl& url) {
|
||||||
|
|
||||||
if (net_error != QNetworkReply::NetworkError::NoError) {
|
if (net_error != QNetworkReply::NetworkError::NoError) {
|
||||||
is_error = true;
|
is_error = true;
|
||||||
// TODO: lepší hlaška.
|
html_str = QSL("Error!<br/>%1").arg(NetworkFactory::networkErrorText(net_error));
|
||||||
html_str = "Error!";
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (content_type.startsWith(QSL("image/"))) {
|
if (content_type.startsWith(QSL("image/"))) {
|
||||||
|
@ -423,6 +421,16 @@ void TextBrowserViewer::setHtml(const QString& html, const QUrl& base_url) {
|
||||||
m_document.data()->m_resourcesForHtml.clear();
|
m_document.data()->m_resourcesForHtml.clear();
|
||||||
|
|
||||||
setHtmlPrivate(html, base_url);
|
setHtmlPrivate(html, base_url);
|
||||||
|
|
||||||
|
// TODO: implement RTL for viewers somehow?
|
||||||
|
/*
|
||||||
|
auto to = document()->defaultTextOption();
|
||||||
|
|
||||||
|
to.setTextDirection(Qt::LayoutDirection::RightToLeft);
|
||||||
|
to.setAlignment(Qt::AlignmentFlag::AlignRight);
|
||||||
|
|
||||||
|
document()->setDefaultTextOption(to);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBrowserViewer::setHtmlPrivate(const QString& html, const QUrl& base_url) {
|
void TextBrowserViewer::setHtmlPrivate(const QString& html, const QUrl& base_url) {
|
||||||
|
|
Loading…
Reference in New Issue