From dbbedc7b74893516ffc003da6ac648851ab6bb81 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 6 Nov 2013 20:08:14 +0100 Subject: [PATCH] Work on webbrowser. --- localization/rssguard_cs.ts | 76 +++++++++++++++++++++++++++++++++---- localization/rssguard_en.ts | 62 ++++++++++++++++++++++++++++++ src/gui/formmain.cpp | 10 +++-- src/gui/formmain.h | 5 ++- src/gui/tabwidget.cpp | 8 +++- src/gui/tabwidget.h | 1 + 6 files changed, 149 insertions(+), 13 deletions(-) diff --git a/localization/rssguard_cs.ts b/localization/rssguard_cs.ts index 25cac517a..c02063d80 100644 --- a/localization/rssguard_cs.ts +++ b/localization/rssguard_cs.ts @@ -71,6 +71,10 @@ Hyperlink Hypertextový odkaz + + Page not found + Stránka nenalezena + CornerButton @@ -79,6 +83,13 @@ Otevřít nový panel + + FeedMessageViewer + + Toolbar for messages + Panel zpráv + + FormAbout @@ -190,7 +201,39 @@ Web browser - Webový prohlížeč + Webový prohlížeč + + + &Current tab + &Aktivní panel + + + &Add tab + &Přidat panel + + + Add tab + Přidat panel + + + Close &all tabs except current one + Zavřít &všechny panely kromě aktivního + + + Close all tabs except current one + Zavřít všechny panely kromě aktivního + + + Close current &tab + Zavřít aktivní &panel + + + &No actions possible + Žádné &povolené akce + + + No actions are possible at this point of time. + Nejsou povoleny žádné akce. @@ -446,19 +489,19 @@ Active skin - + Aktivní vzhled Selected skin - + Vybraný vzhled Newly selected skin is activated after the applicaton gets restarted!!! - + Nově zvolený vzhled bude aktivován po znovuspuštění aplikace!!! Name - + Název @@ -476,6 +519,13 @@ <html><head/><body><p>RSS Guard je (velmi) jednoduchá čtečka kanálů. Podporuje všechny rozšířené formáty, včetně RSS, ATOM a RDF.</p><p>Ujistěte se, že projdete všechny funkce této aplikace. Pokud chcete nahlásit chybu nebo chcete v programu mít novou vlastnost, pak vyplňte <a href="https://sourceforge.net/p/rssguard/tickets"><span style=" text-decoration: underline; color:#0000ff;">hlášení o chybě</span></a>.</p><p>RSS Guard může být přeložen do libovolného jazyka. Kontaktujte <a href="mailto:rotter.martinos@gmail.com"><span style=" text-decoration: underline; color:#0000ff;">autora</span></a> v případě zájmu o překlad.</p><p><br/></p></body></html> + + LocationLineEdit + + Website address goes here + Adresu webové stránky zadejte sem + + QObject @@ -573,11 +623,23 @@ Zoom - + No title - + Bez názvu + + + Decrease zoom. + Oddálit aktivní webovou stránku. + + + Reset zoom to default. + Obnovit zoom na 100%. + + + Increase zoom. + Přiblížit aktivní webovou stránku. diff --git a/localization/rssguard_en.ts b/localization/rssguard_en.ts index 6be70e609..b751f5c31 100644 --- a/localization/rssguard_en.ts +++ b/localization/rssguard_en.ts @@ -71,6 +71,10 @@ Hyperlink + + Page not found + + CornerButton @@ -79,6 +83,13 @@ + + FeedMessageViewer + + Toolbar for messages + + + FormAbout @@ -192,6 +203,38 @@ Web browser + + &Current tab + + + + &Add tab + + + + Add tab + + + + Close &all tabs except current one + + + + Close all tabs except current one + + + + Close current &tab + + + + &No actions possible + + + + No actions are possible at this point of time. + + FormSettings @@ -470,6 +513,13 @@ + + LocationLineEdit + + Website address goes here + + + QObject @@ -573,5 +623,17 @@ No title + + Decrease zoom. + + + + Reset zoom to default. + + + + Increase zoom. + + diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index dabe56ea7..9a00f5251 100644 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -122,8 +122,8 @@ void FormMain::display() { QtSingleApplication::alert(this); } -void FormMain::cleanupResources() { - qDebug("Cleaning up resources before the application exits."); +void FormMain::onAboutToQuit() { + qDebug("Cleaning up resources and saving application state before it exits."); } bool FormMain::event(QEvent *event) { @@ -169,11 +169,13 @@ void FormMain::createConnections() { connect(m_ui->m_actionAboutGuard, SIGNAL(triggered()), this, SLOT(showAbout())); // General connections. - connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanupResources())); + connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); // Menu "Web browser" connections. connect(m_ui->m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(loadWebBrowserMenu(int))); + connect(m_ui->m_actionCloseCurrentTab, SIGNAL(triggered()), + m_ui->m_tabWidget, SLOT(closeCurrentTab())); } void FormMain::loadWebBrowserMenu(int index) { @@ -187,6 +189,8 @@ void FormMain::loadWebBrowserMenu(int index) { m_ui->m_menuCurrentTab->insertAction(NULL, m_ui->m_actionNoActions); } } + + m_ui->m_actionCloseCurrentTab->setEnabled(m_ui->m_tabWidget->tabBar()->tabType(index) == TabBar::Closable); } void FormMain::closeEvent(QCloseEvent *event) { diff --git a/src/gui/formmain.h b/src/gui/formmain.h index cbec1652c..66f0427cc 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -61,9 +61,10 @@ class FormMain : public QMainWindow { void switchFullscreenMode(bool turn_fullscreen_on); protected slots: - // Used for last-minute cleanups. - void cleanupResources(); + // Used for last-minute actions. + void onAboutToQuit(); + // Loads web browser menu if user selects to change tabs. void loadWebBrowserMenu(int index); // Displays various dialogs. diff --git a/src/gui/tabwidget.cpp b/src/gui/tabwidget.cpp index 537da534e..e726c8627 100644 --- a/src/gui/tabwidget.cpp +++ b/src/gui/tabwidget.cpp @@ -77,7 +77,13 @@ void TabWidget::setupIcons() { } void TabWidget::closeTab(int index) { - removeTab(index); + if (tabBar()->tabType(index) == TabBar::Closable) { + removeTab(index); + } +} + +void TabWidget::closeCurrentTab() { + closeTab(currentIndex()); } void TabWidget::removeTab(int index) { diff --git a/src/gui/tabwidget.h b/src/gui/tabwidget.h index 11e4b40cf..913cb83d4 100644 --- a/src/gui/tabwidget.h +++ b/src/gui/tabwidget.h @@ -60,6 +60,7 @@ class TabWidget : public QTabWidget { // Closes tab with given index and deletes contained widget. void closeTab(int index); + void closeCurrentTab(); // Adds new WebBrowser tab to global TabWidget. int addEmptyBrowser();