Many changes, reworked some things.

This commit is contained in:
Martin Rotter 2013-12-10 13:29:38 +01:00
parent 1e6e5a7f63
commit df9682835c
13 changed files with 67 additions and 7 deletions

View File

@ -245,6 +245,7 @@ set(APP_SOURCES
src/gui/feedsview.cpp
src/gui/messagesview.cpp
src/gui/statusbar.cpp
src/gui/messagebox.cpp
# CORE sources.
src/core/debugging.cpp
@ -297,6 +298,7 @@ set(APP_HEADERS
src/gui/feedsview.h
src/gui/messagesview.h
src/gui/statusbar.h
src/gui/messagebox.h
# CORE headers.
src/core/settings.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -127,8 +127,20 @@ QSqlDatabase DatabaseFactory::addConnection(const QString &connection_name) {
return initialize(connection_name);
}
else {
return QSqlDatabase::addDatabase(DATABASE_DRIVER,
connection_name);
QSqlDatabase database = QSqlDatabase::addDatabase(DATABASE_DRIVER,
connection_name);
QDir db_path(getDatabasePath());
QFile db_file(db_path.absoluteFilePath(APP_DB_FILE));
// Setup database file path.
database.setDatabaseName(db_file.fileName());
if (!database.open()) {
qFatal("Database was NOT opened. Delivered error message: '%s'",
qPrintable(database.lastError().text()));
}
return database;
}
}

View File

@ -5,7 +5,7 @@
#if QT_VERSION >= 0x050000
#include <qwebkitglobal.h>
#elif QT_VERSION >= 0x040600
#else
#include <qwebkitversion.h>
#endif
@ -19,10 +19,7 @@
#define APP_AUTHORS "@APP_AUTHOR@"
#define APP_URL "@APP_URL@"
#define APP_VERSION "@APP_VERSION@"
#if QT_VERSION >= 0x040600
#define APP_USERAGENT QString("@APP_NAME@/@APP_VERSION@ (@APP_URL@) on @CMAKE_SYSTEM@; Webkit/") + qWebKitVersion()
#endif
#define TEXT_TITLE_LIMIT 30
#define MAX_ZOOM_FACTOR 10.0

View File

@ -34,6 +34,9 @@ void FeedMessageViewer::createConnections() {
m_messagesBrowser, SLOT(clear()));
connect(m_messagesView, SIGNAL(currentMessageChanged(Message)),
m_messagesBrowser, SLOT(navigateToMessage(Message)));
connect(m_messagesView, SIGNAL(openMessageNewTabRequested(Message)),
FormMain::getInstance()->m_ui->m_tabWidget,
SLOT(addBrowserWithMessage(Message)));
// Toolbar forwardings.
connect(FormMain::getInstance()->m_ui->m_actionSwitchImportanceOfSelectedMessages,

View File

@ -1,4 +1,5 @@
#include <QCloseEvent>
#include <QMessageBox>
#include "gui/formmain.h"
#include "gui/formabout.h"
@ -146,6 +147,8 @@ void FormMain::display() {
}
void FormMain::onCommitData(QSessionManager &manager) {
Q_UNUSED(manager);
qDebug("OS asked application to commit its data.");
}

View File

@ -76,7 +76,7 @@ class FormMain : public QMainWindow {
// Displays various dialogs.
void showSettings();
void showAbout();
private:
Ui::FormMain *m_ui;
QMenu *m_trayMenu;

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

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

20
src/gui/messagebox.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef MESSAGEBOX_H
#define MESSAGEBOX_H
#include <QMessageBox>
class MessageBox : public QMessageBox {
Q_OBJECT
public:
explicit MessageBox(QWidget *parent = 0);
virtual ~MessageBox();
signals:
public slots:
};
#endif // MESSAGEBOX_H

View File

@ -183,6 +183,10 @@ void MessagesView::openSelectedSourceMessagesInternally() {
void MessagesView::openSelectedMessagesInternally() {
// TODO: otevre vybrane nactene zpravy v internich tabech
foreach (const QModelIndex &index, selectionModel()->selectedRows()) {
emit openMessageNewTabRequested(m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row()));
}
}
void MessagesView::markSelectedMessagesRead() {

View File

@ -51,6 +51,7 @@ class MessagesView : public QTreeView {
const QItemSelection &deselected);
signals:
void openMessageNewTabRequested(const Message &message);
void currentMessageChanged(const Message &message);
void currentMessageRemoved();

View File

@ -174,6 +174,12 @@ int TabWidget::insertTab(int index, QWidget *widget, const QString &label,
return tab_index;
}
int TabWidget::addBrowserWithMessage(const Message &message) {
int new_index = addBrowser(false, false);
static_cast<WebBrowser*>(widget(new_index))->navigateToMessage(message);
return new_index;
}
int TabWidget::addEmptyBrowser() {
return addBrowser(false, true);
}

View File

@ -9,6 +9,7 @@
class CornerButton;
class Message;
class TabWidget : public QTabWidget {
Q_OBJECT
@ -72,6 +73,8 @@ class TabWidget : public QTabWidget {
// Closes all "closable" tabs except the active tab.
void closeAllTabsExceptCurrent();
int addBrowserWithMessage(const Message &message);
// Adds new WebBrowser tab to global TabWidget.
int addEmptyBrowser();