From ca916c847b6e913fa93ee085b2b05ff58b7e2f3f Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 31 Jan 2014 13:09:26 +0100 Subject: [PATCH] Rssguard now remembers fullscreen settings. --- resources/misc/db_init.sql | 6 +++--- resources/misc/db_init_memory.sql | 6 +++--- src/gui/formmain.cpp | 14 +++++++++++--- src/gui/formmain.h | 2 +- src/gui/formmain.ui | 7 ++----- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/resources/misc/db_init.sql b/resources/misc/db_init.sql index 991e99d12..55486f933 100644 --- a/resources/misc/db_init.sql +++ b/resources/misc/db_init.sql @@ -38,12 +38,12 @@ CREATE TABLE IF NOT EXISTS Feeds ( DROP TABLE IF EXISTS FeedsData; -- ! CREATE TABLE IF NOT EXISTS FeedsData ( - id INTEGER NOT NULL, + feed_id INTEGER NOT NULL, key TEXT NOT NULL, value TEXT, - PRIMARY KEY (id, key), - FOREIGN KEY (id) REFERENCES Feeds (id) + PRIMARY KEY (feed_id, key), + FOREIGN KEY (feed_id) REFERENCES Feeds (id) ); -- ! DROP TABLE IF EXISTS Messages; diff --git a/resources/misc/db_init_memory.sql b/resources/misc/db_init_memory.sql index 718de887c..ae69d87cf 100644 --- a/resources/misc/db_init_memory.sql +++ b/resources/misc/db_init_memory.sql @@ -36,12 +36,12 @@ CREATE TABLE IF NOT EXISTS Feeds ( DROP TABLE IF EXISTS FeedsData; -- ! CREATE TABLE IF NOT EXISTS FeedsData ( - id INTEGER NOT NULL, + feed_id INTEGER NOT NULL, key TEXT NOT NULL, value TEXT, - PRIMARY KEY (id, key), - FOREIGN KEY (id) REFERENCES Feeds (id) + PRIMARY KEY (feed_id, key), + FOREIGN KEY (feed_id) REFERENCES Feeds (id) ); -- ! DROP TABLE IF EXISTS Messages; diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index f93a6a712..d90ed51c0 100755 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -128,8 +128,8 @@ void FormMain::quit() { qApp->quit(); } -void FormMain::switchFullscreenMode(bool turn_fullscreen_on) { - if (turn_fullscreen_on) { +void FormMain::switchFullscreenMode() { + if (!isFullScreen()) { showFullScreen(); } else { showNormal(); @@ -256,6 +256,12 @@ void FormMain::loadSize() { "window_position", screen.center() - rect().center()).toPoint()); + // If user exited the application while in fullsreen mode, + // then re-enable it now. + if (settings->value(APP_CFG_GUI, "start_in_fullscreen", false).toBool()) { + switchFullscreenMode(); + } + // Adjust dimensions of "feeds & messages" widget. m_ui->m_tabWidget->feedMessageViewer()->loadSize(); } @@ -265,6 +271,8 @@ void FormMain::saveSize() { settings->setValue(APP_CFG_GUI, "window_position", pos()); settings->setValue(APP_CFG_GUI, "window_size", size()); + settings->setValue(APP_CFG_GUI, "start_in_fullscreen", isFullScreen()); + m_ui->m_tabWidget->feedMessageViewer()->saveSize(); } @@ -283,7 +291,7 @@ void FormMain::createConnections() { connect(m_ui->m_actionQuit, SIGNAL(triggered()), this, SLOT(quit())); // Menu "View" connections. - connect(m_ui->m_actionFullscreen, SIGNAL(triggered(bool)), this, SLOT(switchFullscreenMode(bool))); + connect(m_ui->m_actionFullscreen, SIGNAL(triggered()), this, SLOT(switchFullscreenMode())); // Menu "Tools" connections. connect(m_ui->m_actionSettings, SIGNAL(triggered()), this, SLOT(showSettings())); diff --git a/src/gui/formmain.h b/src/gui/formmain.h index 4731a2160..758974097 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -77,7 +77,7 @@ class FormMain : public QMainWindow { void switchVisibility(); // Turns on/off fullscreen mode - void switchFullscreenMode(bool turn_fullscreen_on); + void switchFullscreenMode(); protected slots: // Last-minute reactors. diff --git a/src/gui/formmain.ui b/src/gui/formmain.ui index 966bd48a4..c0c4d3c7e 100644 --- a/src/gui/formmain.ui +++ b/src/gui/formmain.ui @@ -187,17 +187,14 @@ - - true - - &Fullscreen mode + Switch &fullscreen/normal mode Switch fullscreen mode. - Ctrl+Shift+F + Ctrl+Shift+F