Newspaper mode initial implementation.

This commit is contained in:
Martin Rotter 2014-01-03 13:15:05 +01:00
parent b2b2c06964
commit 6e7332036e
6 changed files with 46 additions and 11 deletions

View File

@ -153,6 +153,8 @@ endif(CMAKE_BUILD_TYPE STREQUAL "release" OR CMAKE_BUILD_TYPE STREQUAL "Release"
# Force Qt to use string builders. # Force Qt to use string builders.
add_definitions(-DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_USE_FAST_CONCATENATION)
add_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
# Unicode settings. # Unicode settings.
add_definitions(-DUNICODE -D_UNICODE) add_definitions(-DUNICODE -D_UNICODE)

View File

@ -136,6 +136,10 @@ void FeedMessageViewer::createConnections() {
m_messagesBrowser, SLOT(clear())); m_messagesBrowser, SLOT(clear()));
connect(m_messagesView, SIGNAL(currentMessageChanged(Message)), connect(m_messagesView, SIGNAL(currentMessageChanged(Message)),
m_messagesBrowser, SLOT(navigateToMessage(Message))); m_messagesBrowser, SLOT(navigateToMessage(Message)));
connect(m_messagesView, SIGNAL(openMessagesInNewspaperViewRequested(QList<Message>)),
m_messagesBrowser, SLOT(navigateToMessages(QList<Message>)));
connect(m_messagesView, SIGNAL(openMessageNewTabRequested(Message)), connect(m_messagesView, SIGNAL(openMessageNewTabRequested(Message)),
FormMain::getInstance()->m_ui->m_tabWidget, FormMain::getInstance()->m_ui->m_tabWidget,
SLOT(addBrowserWithMessage(Message))); SLOT(addBrowserWithMessage(Message)));

View File

@ -66,6 +66,8 @@ class MessagesView : public QTreeView {
signals: signals:
void openLinkMessageNewTabRequested(const QString &link); void openLinkMessageNewTabRequested(const QString &link);
void openMessageNewTabRequested(const Message &message); void openMessageNewTabRequested(const Message &message);
void openMessagesInNewspaperViewRequested(const QList<Message> &messages);
void currentMessageChanged(const Message &message); void currentMessageChanged(const Message &message);
void currentMessageRemoved(); void currentMessageRemoved();

View File

@ -182,6 +182,28 @@ void WebBrowser::navigateToMessage(const Message &message) {
IconThemeFactory::getInstance()->fromTheme("mail-mark-read")); IconThemeFactory::getInstance()->fromTheme("mail-mark-read"));
} }
void WebBrowser::navigateToMessages(const QList<Message> &messages) {
QString messages_layout;
QString default_message_layout = SkinFactory::getInstance()->getCurrentMarkup();
foreach (const Message &message, messages) {
messages_layout.append(default_message_layout.arg(message.m_title,
tr("Written by ") + (message.m_author.isEmpty() ?
tr("uknown author") :
message.m_author),
message.m_url,
message.m_contents,
message.m_created.toString(Qt::DefaultLocaleShortDate)));
}
QString layout_wrapper = SkinFactory::getInstance()->getCurrentMarkupLayout().arg(tr("Newspaper view"),
messages_layout);
m_webView->setHtml(layout_wrapper);
emit iconChanged(m_index,
IconThemeFactory::getInstance()->fromTheme("mail-mark-read"));
}
void WebBrowser::updateZoomGui() { void WebBrowser::updateZoomGui() {
m_btnResetZoom->setText(QString("%1%").arg(QString::number(m_webView->zoomFactor() * 100, m_btnResetZoom->setText(QString("%1%").arg(QString::number(m_webView->zoomFactor() * 100,
'f', 'f',

View File

@ -63,6 +63,9 @@ class WebBrowser : public TabContent {
// Navigates to message. // Navigates to message.
void navigateToMessage(const Message &message); void navigateToMessage(const Message &message);
// Navigates to messages via "newspaper" view.
void navigateToMessages(const QList<Message> &messages);
// Clears contents. // Clears contents.
void clear(); void clear();

View File

@ -107,7 +107,9 @@ void WebView::initializeActions() {
} }
void WebView::displayErrorPage() { void WebView::displayErrorPage() {
setHtml(SkinFactory::getInstance()->getCurrentMarkup().arg(tr("Page not found"), setHtml(SkinFactory::getInstance()->getCurrentMarkupLayout().arg(
tr("Error page"),
SkinFactory::getInstance()->getCurrentMarkup().arg(tr("Page not found"),
tr("Check your internet connection or website address"), tr("Check your internet connection or website address"),
QString(), QString(),
tr("This failure can be caused by:<br><ul>" tr("This failure can be caused by:<br><ul>"
@ -117,7 +119,7 @@ void WebView::displayErrorPage() {
"<li>target destination outage,</li>" "<li>target destination outage,</li>"
"<li>many other things.</li>" "<li>many other things.</li>"
"</ul>"), "</ul>"),
QDateTime::currentDateTime().toString(Qt::DefaultLocaleLongDate))); QDateTime::currentDateTime().toString(Qt::DefaultLocaleLongDate))));
} }
void WebView::popupContextMenu(const QPoint &pos) { void WebView::popupContextMenu(const QPoint &pos) {