Many many changes.

This commit is contained in:
Martin Rotter 2013-07-30 18:54:36 +02:00
parent fcb257022b
commit c6c19ab43f
27 changed files with 722 additions and 314 deletions

View File

@ -171,6 +171,9 @@ set(APP_SOURCES
src/gui/basewebview.cpp
src/gui/baselineedit.cpp
src/gui/locationlineedit.cpp
src/gui/tabwidget.cpp
src/gui/tabbar.cpp
src/gui/tabcontent.cpp
# CORE sources.
src/core/debugging.cpp
@ -209,6 +212,9 @@ set(APP_HEADERS
src/gui/basewebview.h
src/gui/baselineedit.h
src/gui/locationlineedit.h
src/gui/tabwidget.h
src/gui/tabbar.h
src/gui/tabcontent.h
# CORE headers.
src/core/basenetworkaccessmanager.h

View File

@ -96,27 +96,19 @@
</message>
<message>
<source>&lt;b&gt;%8&lt;/b&gt;&lt;br&gt;&lt;b&gt;Version:&lt;/b&gt; %1 (build on %2 with CMake %3)&lt;br&gt;&lt;b&gt;Revision:&lt;/b&gt; %4&lt;br&gt;&lt;b&gt;Build date:&lt;/b&gt; %5&lt;br&gt;&lt;b&gt;Qt:&lt;/b&gt; %6 (compiled against %7)&lt;br&gt;</source>
<translation>&lt;b&gt;%8&lt;/b&gt;&lt;br&gt;&lt;b&gt;Verze:&lt;/b&gt; %1 (OS při sestavování %2 verze CMake %3)&lt;br&gt;&lt;b&gt;Revize:&lt;/b&gt; %4&lt;br&gt;&lt;b&gt;Datum sestavení:&lt;/b&gt; %5&lt;br&gt;&lt;b&gt;Qt:&lt;/b&gt; %6 (při kompilaci %7)&lt;br&gt;</translation>
</message>
<message>
<source>&lt;body&gt;Authors and contributors:&lt;ul&gt;&lt;li&gt;Martin Rotter (&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail.com&lt;/a&gt;) (author of RSS Guard)&lt;/li&gt;&lt;li&gt;snakebite &amp; tiheum (authors of KFaenza/Faenza icon theme)&lt;/li&gt;&lt;li&gt;Digia Plc (author of QtSingleApplication component)&lt;/li&gt;&lt;li&gt;Artem Galichkin (&lt;a href=&quot;mailto://doomer3d@gmail.com&quot;&gt;doomer3d@gmail.com&lt;/a&gt;) (author of original QKeySequenceWidget component)&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;body&gt;Authors and contributors:&lt;ul&gt;&lt;li&gt;Martin Rotter (&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail.com&lt;/a&gt;) (author of RSS Guard)&lt;/li&gt;&lt;li&gt;snakebite &amp; tiheum (authors of KFaenza/Faenza icon theme)&lt;/li&gt;&lt;li&gt;Digia Plc (author of QtSingleApplication component)&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;body&gt;RSS Guard is a (very) tiny feed reader.&lt;br&gt;&lt;br&gt;This software is distributed under the terms of GNU General Public License, version 3 or later.&lt;br&gt;&lt;br&gt;Contacts:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail&lt;/a&gt; ~email&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.rssguard.sf.net&quot;&gt;www.rssguard.sf.net&lt;/a&gt; ~website&lt;/li&gt;&lt;/ul&gt;You can obtain source code for Qonverter from its website.&lt;br&gt;&lt;br&gt;&lt;br&gt;Copyright © 2011-%1 Martin Rotter&lt;/body&gt;</source>
<translation type="unfinished"></translation>
<source>&lt;body&gt;RSS Guard is a (very) tiny feed reader.&lt;br&gt;&lt;br&gt;This software is distributed under the terms of GNU General Public License, version 3.&lt;br&gt;&lt;br&gt;Contacts:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail&lt;/a&gt; ~email&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.rssguard.sf.net&quot;&gt;www.rssguard.sf.net&lt;/a&gt; ~website&lt;/li&gt;&lt;/ul&gt;You can obtain source code for RSS Guard from its website.&lt;br&gt;&lt;br&gt;&lt;br&gt;Copyright © 2011-%1 Martin Rotter&lt;/body&gt;</source>
<translation>&lt;body&gt;RSS Guard je (velmi) jednoduchá čtečka kanálů.&lt;br&gt;&lt;br&gt;Tento software je šířen pod licencí GNU General Public, verze 3.&lt;br&gt;&lt;br&gt;Kontakty:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail&lt;/a&gt; ~email&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.rssguard.sf.net&quot;&gt;www.rssguard.sf.net&lt;/a&gt; ~webová stránka&lt;/li&gt;&lt;/ul&gt;Zdrojové kódy aplikace RSS Guard lze získat na její webové stránce.&lt;br&gt;&lt;br&gt;&lt;br&gt;Copyright © 2011-%1 Martin Rotter&lt;/body&gt;</translation>
</message>
</context>
<context>
<name>FormMain</name>
<message>
<source>MainWindow</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;File</source>
<translation>&amp;Soubor</translation>
@ -149,30 +141,6 @@
<source>&amp;Settings</source>
<translation>Na&amp;stavení</translation>
</message>
<message>
<source>Tab 1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tab 2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+I</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+E</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+Q</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+S</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;About RSS Guard</source>
<translation>&amp;O aplikaci RSS Guard</translation>
@ -182,183 +150,171 @@
<translation>&amp;Režime celé obrazovky</translation>
</message>
<message>
<source>Ctrl+Shift+F</source>
<translation type="unfinished"></translation>
<source>Feeds</source>
<translation type="unfinished">Kanály</translation>
</message>
<message>
<source>Browser your feeds and messages</source>
<translation type="unfinished">Procházej své kanály a zprávy</translation>
</message>
<message>
<source>Web browser</source>
<translation>Webový prohlížeč</translation>
</message>
</context>
<context>
<name>FormSettings</name>
<message>
<source>General</source>
<translation type="unfinished"></translation>
<translation>Obecné</translation>
</message>
<message>
<source>User interface</source>
<translation type="unfinished"></translation>
<translation>Uživatelské rozhraní</translation>
</message>
<message>
<source>Icon theme</source>
<translation type="unfinished"></translation>
<translation>Téma ikon</translation>
</message>
<message>
<source>system icon theme (default)</source>
<translation type="unfinished"></translation>
<translation>systémové téma ikon (výchozí)</translation>
</message>
<message>
<source>Settings</source>
<translation type="unfinished"></translation>
<translation>Nastavení</translation>
</message>
<message>
<source>Keyboard shortcuts</source>
<translation type="unfinished"></translation>
<translation>Klávesové zkratky</translation>
</message>
<message>
<source>Language</source>
<translation type="unfinished"></translation>
<translation>Lokalizacce</translation>
</message>
<message>
<source>Proxy</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Launch RSS Guard on operating system startup</source>
<translation type="unfinished"></translation>
<translation>Spouštět RSS Guard při spuštěníí operačního systému</translation>
</message>
<message>
<source>Icons &amp;&amp; skins</source>
<translation type="unfinished"></translation>
<translation>Ikony &amp;&amp; skiny</translation>
</message>
<message>
<source>Skin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Notifications</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Tray icon</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>disable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>enable</source>
<translation type="unfinished"></translation>
<translation>Notifikační ikona</translation>
</message>
<message>
<source>When main window is closed, then</source>
<translation type="unfinished"></translation>
<translation>Je-li hlavní okno aplikace zavřeno, pak</translation>
</message>
<message>
<source>hide it.</source>
<translation type="unfinished"></translation>
<translation>jej pouze skrýt (aplikace běží na pozadí).</translation>
</message>
<message>
<source>quit the application.</source>
<translation type="unfinished"></translation>
<translation>aplikaci ukončit.</translation>
</message>
<message>
<source>Start application hidden</source>
<translation type="unfinished"></translation>
<translation>Spouštět aplikaci skrytou</translation>
</message>
<message>
<source>Web browser</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Color of website loading progress bar</source>
<translation type="unfinished"></translation>
<translation>Webový prohlížeč</translation>
</message>
<message>
<source>&amp;Change...</source>
<translation type="unfinished"></translation>
<translation>&amp;Změnit...</translation>
</message>
<message>
<source>Use custom color for web browser progress bar</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Miscellaneous</source>
<translation type="unfinished"></translation>
<translation>Použít barevný průběhový pás při načítání stránky</translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
<translation>Typ</translation>
</message>
<message>
<source>Host</source>
<translation type="unfinished"></translation>
<translation>Server</translation>
</message>
<message>
<source>Hostname or IP of your proxy server</source>
<translation type="unfinished"></translation>
<translation>Webový název IP adresa proxy serveru</translation>
</message>
<message>
<source>Port</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Username</source>
<translation type="unfinished"></translation>
<translation>Uživatelské jméno</translation>
</message>
<message>
<source>Your username for proxy server authentication</source>
<translation type="unfinished"></translation>
<translation>Vaše uživatelské jméno pro autentifikaci</translation>
</message>
<message>
<source>Password</source>
<translation type="unfinished"></translation>
<translation>Heslo</translation>
</message>
<message>
<source>Your password for proxy server authentication</source>
<translation type="unfinished"></translation>
<translation>Vaše heslo pro autentifikaci</translation>
</message>
<message>
<source>Display password</source>
<translation type="unfinished"></translation>
<translation>Zobrazit heslo</translation>
</message>
<message>
<source>Password is stored in plain string in RSS Guard configuration file.</source>
<translation type="unfinished"></translation>
<translation>Heslo je uloženo v nezašifrované podobě jako prostý text v souboru s nastavením aplikace RSS Guard.</translation>
</message>
<message>
<source>Code</source>
<translation type="unfinished"></translation>
<translation>Kód</translation>
</message>
<message>
<source>Version</source>
<translation type="unfinished"></translation>
<translation>Verze</translation>
</message>
<message>
<source>Author</source>
<translation type="unfinished"></translation>
<translation>Autor</translation>
</message>
<message>
<source>Email</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Select color for web browser progress bar</source>
<translation type="unfinished"></translation>
<translation>Zvolit barvu pro průběhový pás při načítání stránky</translation>
</message>
<message>
<source>No proxy</source>
<translation type="unfinished"></translation>
<translation>Žádné proxy</translation>
</message>
<message>
<source>Socks5</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Http</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Language of Qonverter was changed. Note that changes will take effect on next Qonverter start.</source>
<translation type="unfinished"></translation>
<translation type="obsolete">Jazyk</translation>
</message>
<message>
<source>Do you want to restart now?</source>
@ -372,16 +328,70 @@
<source>Problem with RSS Guard restart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Qonverter couldn&apos;t be restarted, please restart it manually for changes to take effect.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> (not supported on this platform)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>disable (Tray icon is not available.)</source>
<source>Tray area &amp;&amp; notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tabs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close tabs with</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Left mouse button double-click</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Middle mouse button single-click</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open new tabs with left mouse button double-click on tab bar</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable mouse gestures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mouse gestures work with right mouse button. Possible gestures are:
&lt;ul&gt;
&lt;li&gt;previous web page (drag mouse left)&lt;/li&gt;
&lt;li&gt;next web page (drag mouse right)&lt;/li&gt;
&lt;li&gt;reload current web page (drag mouse up)&lt;/li&gt;
&lt;li&gt;open new web browser tab (drag mouse down)&lt;/li&gt;
&lt;/ul&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Web browser &amp; proxy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Language of RSS Guard was changed. Note that changes will take effect on next Qonverter start.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RSS Guard couldn&apos;t be restarted, please restart it manually for changes to take effect.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable (Tray icon is not available.)</source>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -99,24 +99,16 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;body&gt;Authors and contributors:&lt;ul&gt;&lt;li&gt;Martin Rotter (&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail.com&lt;/a&gt;) (author of RSS Guard)&lt;/li&gt;&lt;li&gt;snakebite &amp; tiheum (authors of KFaenza/Faenza icon theme)&lt;/li&gt;&lt;li&gt;Digia Plc (author of QtSingleApplication component)&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;</source>
<source>&lt;body&gt;Authors and contributors:&lt;ul&gt;&lt;li&gt;Martin Rotter (&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail.com&lt;/a&gt;) (author of RSS Guard)&lt;/li&gt;&lt;li&gt;snakebite &amp; tiheum (authors of KFaenza/Faenza icon theme)&lt;/li&gt;&lt;li&gt;Digia Plc (author of QtSingleApplication component)&lt;/li&gt;&lt;li&gt;Artem Galichkin (&lt;a href=&quot;mailto://doomer3d@gmail.com&quot;&gt;doomer3d@gmail.com&lt;/a&gt;) (author of original QKeySequenceWidget component)&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;body&gt;RSS Guard is a (very) tiny feed reader.&lt;br&gt;&lt;br&gt;This software is distributed under the terms of GNU General Public License, version 3 or later.&lt;br&gt;&lt;br&gt;Contacts:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail&lt;/a&gt; ~email&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.rssguard.sf.net&quot;&gt;www.rssguard.sf.net&lt;/a&gt; ~website&lt;/li&gt;&lt;/ul&gt;You can obtain source code for Qonverter from its website.&lt;br&gt;&lt;br&gt;&lt;br&gt;Copyright © 2011-%1 Martin Rotter&lt;/body&gt;</source>
<source>&lt;body&gt;RSS Guard is a (very) tiny feed reader.&lt;br&gt;&lt;br&gt;This software is distributed under the terms of GNU General Public License, version 3.&lt;br&gt;&lt;br&gt;Contacts:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;mailto://rotter.martinos@gmail.com&quot;&gt;rotter.martinos@gmail&lt;/a&gt; ~email&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.rssguard.sf.net&quot;&gt;www.rssguard.sf.net&lt;/a&gt; ~website&lt;/li&gt;&lt;/ul&gt;You can obtain source code for RSS Guard from its website.&lt;br&gt;&lt;br&gt;&lt;br&gt;Copyright © 2011-%1 Martin Rotter&lt;/body&gt;</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormMain</name>
<message>
<source>MainWindow</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;File</source>
<translation type="unfinished"></translation>
@ -149,30 +141,6 @@
<source>&amp;Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tab 1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tab 2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+I</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+E</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+Q</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+S</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;About RSS Guard</source>
<translation type="unfinished"></translation>
@ -182,7 +150,15 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl+Shift+F</source>
<source>Feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browser your feeds and messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Web browser</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -232,22 +208,10 @@
<source>Skin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tray icon</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>disable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>enable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When main window is closed, then</source>
<translation type="unfinished"></translation>
@ -268,10 +232,6 @@
<source>Web browser</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Color of website loading progress bar</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Change...</source>
<translation type="unfinished"></translation>
@ -280,10 +240,6 @@
<source>Use custom color for web browser progress bar</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Miscellaneous</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
@ -356,10 +312,6 @@
<source>Http</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Language of Qonverter was changed. Note that changes will take effect on next Qonverter start.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to restart now?</source>
<translation type="unfinished"></translation>
@ -372,16 +324,70 @@
<source>Problem with RSS Guard restart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Qonverter couldn&apos;t be restarted, please restart it manually for changes to take effect.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> (not supported on this platform)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>disable (Tray icon is not available.)</source>
<source>Tray area &amp;&amp; notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tabs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close tabs with</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Left mouse button double-click</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Middle mouse button single-click</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open new tabs with left mouse button double-click on tab bar</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable mouse gestures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Mouse gestures work with right mouse button. Possible gestures are:
&lt;ul&gt;
&lt;li&gt;previous web page (drag mouse left)&lt;/li&gt;
&lt;li&gt;next web page (drag mouse right)&lt;/li&gt;
&lt;li&gt;reload current web page (drag mouse up)&lt;/li&gt;
&lt;li&gt;open new web browser tab (drag mouse down)&lt;/li&gt;
&lt;/ul&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Web browser &amp; proxy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Language of RSS Guard was changed. Note that changes will take effect on next Qonverter start.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RSS Guard couldn&apos;t be restarted, please restart it manually for changes to take effect.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Disable (Tray icon is not available.)</source>
<translation type="unfinished"></translation>
</message>
</context>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -120,7 +120,6 @@ void BaseWebView::mousePressEvent(QMouseEvent *event) {
m_gestureOrigin = event->pos();
}
// TODO: Add mouse gestures (from quite-rss).
QWebView::mousePressEvent(event);
}

View File

@ -28,7 +28,6 @@ void DynamicShortcutsWidget::updateShortcuts() {
void DynamicShortcutsWidget::populate(const QList<QAction *> actions) {
m_actionBindings.clear();
// TODO: Make labels smaller correctly and review this method.
int row_id = 0;
bool second_column = false;

View File

@ -7,6 +7,7 @@
#include "gui/webbrowser.h"
#include "gui/themefactory.h"
#include "gui/systemtrayicon.h"
#include "gui/tabbar.h"
#include "core/settings.h"
#include "core/defs.h"
#include "qtsingleapplication/qtsingleapplication.h"
@ -20,10 +21,14 @@ FormMain::FormMain(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::FormMain
// Initialize singleton.
s_instance = this;
// Prepare main window.
prepareMenus();
prepareTabs();
// Establish connections.
createConnections();
prepareMenus();
setupIcons();
}
FormMain::~FormMain() {
@ -51,6 +56,58 @@ QList<QAction*> FormMain::getActions() {
return actions;
}
void FormMain::prepareTabs() {
// Create widget for "Feeds" page and add it.
WebBrowser *browser = new WebBrowser(m_ui->m_tabWidget);
int index_of_browser = m_ui->m_tabWidget->addTab(static_cast<TabContent*>(browser),
QIcon(),
tr("Feeds"),
TabBar::FeedReader);
m_ui->m_tabWidget->setTabToolTip(index_of_browser, tr("Browser your feeds and messages"));
}
void FormMain::addEmptyBrowser() {
addBrowser(false, true);
}
void FormMain::addLinkedBrowser() {
}
void FormMain::addBrowser(bool move_after_current,
bool make_active,
const QUrl &initial_url) {
// Create new WebBrowser.
WebBrowser *browser = new WebBrowser(m_ui->m_tabWidget);
int final_index;
if (move_after_current) {
// Insert web browser after current tab.
final_index = m_ui->m_tabWidget->insertTab(m_ui->m_tabWidget->currentIndex() + 1,
browser,
QIcon(),
tr("Web browser"),
TabBar::Closable);
}
else {
// Add new browser as the last tab.
final_index = m_ui->m_tabWidget->addTab(browser,
QIcon(),
tr("Web browser"),
TabBar::Closable);
}
// Load initial web page if desired.
if (initial_url.isValid()) {
browser->navigateToUrl(initial_url);
}
// Make new web browser active if desired.
if (make_active) {
m_ui->m_tabWidget->setCurrentIndex(final_index);
}
}
void FormMain::prepareMenus() {
// Setup menu for tray icon.
if (SystemTrayIcon::isSystemTrayAvailable()) {
@ -138,6 +195,14 @@ void FormMain::setupIcons() {
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
browser->setupIcons();
}
// Find tab, which contains "Feeds" page and reload its icon.
for (int index = 0; index < m_ui->m_tabWidget->count(); index++) {
if (m_ui->m_tabWidget->tabBar()->tabType(index) == TabBar::FeedReader) {
m_ui->m_tabWidget->setTabIcon(index, QIcon(APP_ICON_PATH));
break;
}
}
}
void FormMain::createConnections() {
@ -155,6 +220,10 @@ void FormMain::createConnections() {
// General connections.
connect(qApp, &QCoreApplication::aboutToQuit, this, &FormMain::cleanupResources);
// TabWidget connections.
connect(m_ui->m_tabWidget->tabBar(), &TabBar::emptySpaceDoubleClicked,
this, &FormMain::addEmptyBrowser);
}
void FormMain::closeEvent(QCloseEvent *event) {

View File

@ -2,7 +2,7 @@
#define FORMMAIN_H
#include <QMainWindow>
#include <QTimer>
#include <QUrl>
#include "ui_formmain.h"
@ -11,6 +11,7 @@ class FormMain : public QMainWindow {
Q_OBJECT
public:
// Constructors and destructors.
explicit FormMain(QWidget *parent = 0);
virtual ~FormMain();
@ -21,12 +22,16 @@ class FormMain : public QMainWindow {
// NOTE: This is used for setting dynamic shortcuts for given actions.
QList<QAction*> getActions();
// Singleton accessor.
static FormMain *getInstance();
protected:
// Creates all needed menus and sets them up.
void prepareMenus();
// Initializes "Feeds" tab and related stuff.
void prepareTabs();
// Creates needed connections for this window.
void createConnections();
@ -56,11 +61,24 @@ class FormMain : public QMainWindow {
void switchFullscreenMode(bool turn_fullscreen_on);
protected slots:
// Used for last-minute cleanups.
void cleanupResources();
// Displays various dialogs.
void showSettings();
void showAbout();
// Adds new WebBrowser tab to global TabWidget.
void addEmptyBrowser();
// Adds new WebBrowser with link. This is used when user
// selects to "Open link in new tab.".
void addLinkedBrowser();
// General method for adding WebBrowsers.
void addBrowser(bool move_after_current,
bool make_active,
const QUrl &initial_url = QUrl());
private:
Ui::FormMain *m_ui;

View File

@ -11,14 +11,14 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string notr="true">MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<widget class="TabWidget" name="m_tabWidget">
<property name="currentIndex">
<number>0</number>
<number>-1</number>
</property>
<property name="documentMode">
<bool>true</bool>
@ -26,45 +26,6 @@
<property name="movable">
<bool>true</bool>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="WebBrowser" name="widget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
</attribute>
<widget class="QToolButton" name="toolButton">
<property name="geometry">
<rect>
<x>140</x>
<y>110</y>
<width>61</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="application-exit">
<normaloff/>
</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
@ -116,7 +77,7 @@
<string>&amp;Import</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+I</string>
<string notr="true">Ctrl+Shift+I</string>
</property>
</action>
<action name="m_actionExport">
@ -124,7 +85,7 @@
<string>E&amp;xport</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+E</string>
<string notr="true">Ctrl+Shift+E</string>
</property>
</action>
<action name="m_actionQuit">
@ -132,7 +93,7 @@
<string>&amp;Quit</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+Q</string>
<string notr="true">Ctrl+Shift+Q</string>
</property>
</action>
<action name="m_actionSettings">
@ -140,13 +101,16 @@
<string>&amp;Settings</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
<string notr="true">Ctrl+Shift+S</string>
</property>
</action>
<action name="m_actionAboutGuard">
<property name="text">
<string>&amp;About RSS Guard</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+Shift+A</string>
</property>
</action>
<action name="m_actionFullscreen">
<property name="checkable">
@ -156,15 +120,15 @@
<string>&amp;Fullscreen mode</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+F</string>
<string notr="true">Ctrl+Shift+F</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>WebBrowser</class>
<extends>QWidget</extends>
<header>webbrowser.h</header>
<class>TabWidget</class>
<extends>QTabWidget</extends>
<header>tabwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>

View File

@ -7,6 +7,7 @@
#include "gui/themefactory.h"
#include "gui/systemtrayicon.h"
#include "gui/formmain.h"
#include "gui/webbrowser.h"
#include "core/settings.h"
#include "core/defs.h"
#include "core/localization.h"
@ -205,7 +206,7 @@ void FormSettings::saveLanguage() {
Settings::getInstance()->setValue(APP_CFG_GEN, "language", new_lang);
QMessageBox msg_question(this);
msg_question.setText(tr("Language of Qonverter was changed. Note that changes will take effect on next Qonverter start."));
msg_question.setText(tr("Language of RSS Guard was changed. Note that changes will take effect on next Qonverter start."));
msg_question.setInformativeText(tr("Do you want to restart now?"));
msg_question.setWindowTitle(tr("Language changed"));
msg_question.setIcon(QMessageBox::Question);
@ -216,7 +217,7 @@ void FormSettings::saveLanguage() {
if (!QProcess::startDetached(qApp->applicationFilePath())) {
QMessageBox::warning(this,
tr("Problem with RSS Guard restart"),
tr("Qonverter couldn't be restarted, please restart it manually for changes to take effect."));
tr("RSS Guard couldn't be restarted, please restart it manually for changes to take effect."));
}
else {
qApp->quit();
@ -283,7 +284,7 @@ void FormSettings::loadInterface() {
}
// Tray icon is not supported on this machine.
else {
m_ui->m_radioTrayOff->setText(tr("disable (Tray icon is not available.)"));
m_ui->m_radioTrayOff->setText(tr("Disable (Tray icon is not available.)"));
m_ui->m_radioTrayOff->setChecked(true);
m_ui->m_grpTray->setDisabled(true);
}
@ -315,6 +316,17 @@ void FormSettings::loadInterface() {
}
#endif
}
// Load tab settings.
m_ui->m_checkCloseTabsMiddleClick->setChecked(Settings::getInstance()->value(APP_CFG_GUI,
"tab_close_mid_button",
true).toBool());
m_ui->m_checkCloseTabsDoubleClick->setChecked(Settings::getInstance()->value(APP_CFG_GUI,
"tab_close_double_button",
true).toBool());
m_ui->m_checkNewTabDoubleClick->setChecked(Settings::getInstance()->value(APP_CFG_GUI,
"tab_new_double_button",
true).toBool());
}
void FormSettings::saveInterface() {
@ -336,5 +348,16 @@ void FormSettings::saveInterface() {
}
// Save selected icon theme.
ThemeFactory::setCurrentIconTheme(m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString());
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();
if (!selected_icon_theme.isEmpty()) {
ThemeFactory::setCurrentIconTheme(selected_icon_theme);
}
// Save tab settings.
Settings::getInstance()->setValue(APP_CFG_GUI, "tab_close_mid_button",
m_ui->m_checkCloseTabsMiddleClick->isChecked());
Settings::getInstance()->setValue(APP_CFG_GUI, "tab_close_double_button",
m_ui->m_checkCloseTabsDoubleClick->isChecked());
Settings::getInstance()->setValue(APP_CFG_GUI, "tab_new_double_button",
m_ui->m_checkNewTabDoubleClick->isChecked());
}

View File

@ -115,7 +115,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_tabIconSkin">
<attribute name="title">
@ -149,7 +149,7 @@
</widget>
<widget class="QWidget" name="m_tabNotifications">
<attribute name="title">
<string>Notifications</string>
<string>Tray area &amp;&amp; notifications</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0" colspan="2">
@ -208,6 +208,46 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="m_tabTabs">
<attribute name="title">
<string>Tabs</string>
</attribute>
<layout class="QFormLayout" name="formLayout_7">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="m_grbCloseTabs">
<property name="title">
<string>Close tabs with</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="m_checkCloseTabsDoubleClick">
<property name="text">
<string>Left mouse button double-click</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="m_checkCloseTabsMiddleClick">
<property name="text">
<string>Middle mouse button single-click</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkNewTabDoubleClick">
<property name="text">
<string>Open new tabs with left mouse button double-click on tab bar</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -265,15 +305,18 @@
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<widget class="QTabWidget" name="m_tabBrowserProxy">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="m_tabBrowser">
<attribute name="title">
<string>Web browser</string>
</attribute>
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="m_checkBrowserProgressColor">
<property name="text">
@ -284,26 +327,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_lblBrowserProgressColor">
<property name="text">
<string>Color of website loading progress bar</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>20</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="m_btnBrowserProgressColor">
<property name="text">
<string>&amp;Change...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_checkMouseGestures">
<property name="text">
@ -330,9 +353,22 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="m_btnBrowserProgressColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Change...</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<widget class="QWidget" name="m_tabProxy">
<attribute name="title">
<string>Proxy</string>
</attribute>
@ -345,6 +381,9 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_cmbProxyType</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
@ -358,6 +397,9 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_txtProxyHost</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
@ -380,6 +422,9 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_spinProxyPort</cstring>
</property>
</widget>
</item>
<item>
@ -405,6 +450,9 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_txtProxyUsername</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
@ -425,6 +473,9 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_txtProxyPassword</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
@ -535,8 +586,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
<x>257</x>
<y>404</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@ -551,8 +602,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
<x>325</x>
<y>404</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
@ -583,12 +634,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>370</x>
<y>108</y>
<x>261</x>
<y>37</y>
</hint>
<hint type="destinationlabel">
<x>292</x>
<y>135</y>
<x>261</x>
<y>37</y>
</hint>
</hints>
</connection>
@ -599,12 +650,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>370</x>
<y>108</y>
<x>261</x>
<y>37</y>
</hint>
<hint type="destinationlabel">
<x>478</x>
<y>135</y>
<x>261</x>
<y>37</y>
</hint>
</hints>
</connection>
@ -615,28 +666,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>417</x>
<y>108</y>
<x>261</x>
<y>37</y>
</hint>
<hint type="destinationlabel">
<x>417</x>
<y>162</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_checkBrowserProgressColor</sender>
<signal>toggled(bool)</signal>
<receiver>m_lblBrowserProgressColor</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>300</x>
<y>48</y>
</hint>
<hint type="destinationlabel">
<x>275</x>
<y>73</y>
<x>261</x>
<y>37</y>
</hint>
</hints>
</connection>
@ -651,8 +686,8 @@
<y>48</y>
</hint>
<hint type="destinationlabel">
<x>544</x>
<y>74</y>
<x>667</x>
<y>54</y>
</hint>
</hints>
</connection>

73
src/gui/tabbar.cpp Normal file
View File

@ -0,0 +1,73 @@
#include <QMouseEvent>
#include "core/defs.h"
#include "core/settings.h"
#include "gui/tabbar.h"
TabBar::TabBar(QWidget *parent) : QTabBar(parent) {
setDocumentMode(true);
setUsesScrollButtons(true);
setContextMenuPolicy(Qt::CustomContextMenu);
}
TabBar::~TabBar() {
}
void TabBar::setTabType(int index, const TabBar::TabType &type) {
setTabData(index, QVariant(type));
}
TabBar::TabType TabBar::tabType(int index) {
return static_cast<TabBar::TabType>(tabData(index).value<int>());
}
void TabBar::mousePressEvent(QMouseEvent *event) {
QTabBar::mousePressEvent(event);
int tab_index = tabAt(event->pos());
// Check if user clicked on some tab or on empty space.
if (tab_index >= 0) {
// Check if user clicked tab with middle button.
// NOTE: This needs to be done here because
// destination does not know the original event.
if (event->button() & Qt::MiddleButton && Settings::getInstance()->value(APP_CFG_GUI,
"tab_close_mid_button",
true).toBool()) {
if (tabType(tab_index) == TabBar::Closable) {
// This tab is closable, so we can close it.
emit tabCloseRequested(tab_index);
}
}
}
}
void TabBar::mouseDoubleClickEvent(QMouseEvent *event) {
QTabBar::mouseDoubleClickEvent(event);
int tab_index = tabAt(event->pos());
// Check if user clicked on some tab or on empty space.
if (tab_index >= 0) {
// Check if user clicked tab with middle button.
// NOTE: This needs to be done here because
// destination does not know the original event.
if (event->button() & Qt::LeftButton && Settings::getInstance()->value(APP_CFG_GUI,
"tab_close_double_button",
true).toBool()) {
if (tabType(tab_index) == TabBar::Closable) {
// This tab is closable, so we can close it.
emit tabCloseRequested(tab_index);
}
}
}
// Check if new tab should be opened with initial web browser.
// NOTE: This check could be unnecesary here and should be done in
// destination object but we keep it here for consistency.
else if (Settings::getInstance()->value(APP_CFG_GUI,
"tab_new_double_button",
true).toBool()) {
emit emptySpaceDoubleClicked();
}
}

34
src/gui/tabbar.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef TABBAR_H
#define TABBAR_H
#include <QTabBar>
class TabBar : public QTabBar {
Q_OBJECT
public:
enum TabType {
FeedReader = 1000,
NonClosable = 1001,
Closable = 1002
};
explicit TabBar(QWidget *parent = 0);
virtual ~TabBar();
// Getter/setter for tab type.
void setTabType(int index, const TabBar::TabType &type);
TabBar::TabType tabType(int index);
protected:
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
signals:
// Emmited if empty space on tab bar is double clicked.
void emptySpaceDoubleClicked();
};
#endif // TABBAR_H

16
src/gui/tabcontent.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "gui/tabcontent.h"
TabContent::TabContent(QWidget *parent) : QWidget(parent), m_index(-1) {
}
TabContent::~TabContent() {
}
void TabContent::setIndex(int index) {
m_index = index;
}
int TabContent::index() const {
return m_index;
}

28
src/gui/tabcontent.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef TABCONTENT_H
#define TABCONTENT_H
#include <QWidget>
class WebBrowser;
// Base class for all widgets which are placed inside tabs of TabWidget
class TabContent : public QWidget {
Q_OBJECT
public:
TabContent(QWidget *parent = 0);
virtual ~TabContent();
virtual int index() const;
virtual void setIndex(int index);
// Obtains instance contained in this TabContent.
// This is used for obtaining the menu from the instance and so on.
virtual WebBrowser *webBrowser() = 0;
private:
int m_index;
};
#endif // TABCONTENT_H

60
src/gui/tabwidget.cpp Normal file
View File

@ -0,0 +1,60 @@
#include "gui/tabwidget.h"
#include "gui/tabbar.h"
TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent) {
setTabBar(new TabBar(this));
createConnections();
}
TabWidget::~TabWidget() {
qDebug("Destroying TabWidget instance.");
}
void TabWidget::createConnections() {
connect(tabBar(), &QTabBar::tabCloseRequested, this, &TabWidget::closeTab);
}
TabBar *TabWidget::tabBar() {
return static_cast<TabBar*>(QTabWidget::tabBar());
}
void TabWidget::closeTab(int index) {
removeTab(index);
}
void TabWidget::removeTab(int index) {
widget(index)->deleteLater();
QTabWidget::removeTab(index);
}
int TabWidget::addTab(TabContent *widget, const QIcon &icon,
const QString &label, const TabBar::TabType &type) {
int index = QTabWidget::addTab(widget, icon, label);
tabBar()->setTabType(index, type);
return index;
}
int TabWidget::addTab(TabContent *widget, const QString &label, const TabBar::TabType &type) {
int index = QTabWidget::addTab(widget, label);
tabBar()->setTabType(index, type);
return index;
}
int TabWidget::insertTab(int index, QWidget *widget, const QIcon &icon,
const QString &label, const TabBar::TabType &type) {
int tab_index = QTabWidget::insertTab(index, widget, icon, label);
tabBar()->setTabType(tab_index, type);
return tab_index;
}
int TabWidget::insertTab(int index, QWidget *widget, const QString &label,
const TabBar::TabType &type) {
int tab_index = QTabWidget::insertTab(index, widget, label);
tabBar()->setTabType(tab_index, type);
return tab_index;
}

41
src/gui/tabwidget.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef TABWIDGET_H
#define TABWIDGET_H
#include <QTabWidget>
#include "gui/tabbar.h"
#include "gui/tabcontent.h"
class TabWidget : public QTabWidget {
Q_OBJECT
public:
// Constructors and destructors.
explicit TabWidget(QWidget *parent = 0);
virtual ~TabWidget();
// Manimulators for tabs.
int addTab(TabContent *widget, const QString &,
const TabBar::TabType &type = TabBar::NonClosable);
int addTab(TabContent *widget, const QIcon &icon,
const QString &label, const TabBar::TabType &type = TabBar::NonClosable);
int insertTab(int index, QWidget *widget, const QString &label,
const TabBar::TabType &type = TabBar::Closable);
int insertTab(int index, QWidget *widget, const QIcon &icon,
const QString &label, const TabBar::TabType &type = TabBar::NonClosable);
void removeTab(int index);
// Returns tab bar.
TabBar *tabBar();
protected:
// Creates necesary connections.
void createConnections();
public slots:
// Closes tab with given index and deletes contained widget.
void closeTab(int index);
};
#endif // TABWIDGET_H

View File

@ -58,10 +58,10 @@ void ThemeFactory::setCurrentIconTheme(const QString &theme_name) {
Settings::getInstance()->setValue(APP_CFG_GUI,
"icon_theme",
theme_name);
loadCurrentIconTheme();
loadCurrentIconTheme(true);
}
void ThemeFactory::loadCurrentIconTheme() {
void ThemeFactory::loadCurrentIconTheme(bool notify_widgets) {
QString theme_name = getCurrentIconTheme();
QStringList installed_themes = getInstalledIconThemes();
@ -82,9 +82,11 @@ void ThemeFactory::loadCurrentIconTheme() {
// NOTE: Event is delivered even if custom icon theme is not set
// as active, because all widgets need to do initial
// icons initialization based in the event receival.
foreach (QWidget *widget, QtSingleApplication::allWidgets()) {
QtSingleApplication::postEvent((QObject*) widget,
new ThemeFactoryEvent());
if (notify_widgets) {
foreach (QWidget *widget, QtSingleApplication::allWidgets()) {
QtSingleApplication::postEvent((QObject*) widget,
new ThemeFactoryEvent());
}
}
}

View File

@ -11,11 +11,6 @@ class ThemeFactory {
ThemeFactory();
public:
enum Type {
SYSTEM,
USER
};
// Adds custom application path to be search for icons.
static void setupSearchPaths();
@ -25,7 +20,9 @@ class ThemeFactory {
static QStringList getInstalledIconThemes();
// Loads name of selected icon theme for the application and activates it.
static void loadCurrentIconTheme();
// NOTE: All existing widgets get a chance to repaint its icons if
// notify_widgets is true.
static void loadCurrentIconTheme(bool notify_widgets);
// Returns name of currently activated theme for the application.
static QString getCurrentIconTheme();

View File

@ -19,7 +19,7 @@ QPointer<WebBrowserNetworkAccessManager> WebBrowser::m_networkManager;
QList<WebBrowser*> WebBrowser::m_runningWebBrowsers;
WebBrowser::WebBrowser(QWidget *parent)
: QWidget(parent), m_layout(new QVBoxLayout(this)),
: TabContent(parent), m_layout(new QVBoxLayout(this)),
m_toolBar(new QToolBar(tr("Navigation panel"), this)),
m_webView(new BaseWebView(this)),
m_txtLocation(new LocationLineEdit(this)),
@ -32,11 +32,6 @@ WebBrowser::WebBrowser(QWidget *parent)
// NOTE: This is used primarily for dynamic icon theme switching.
m_runningWebBrowsers.append(this);
// TODO: Make this better, add location box, search box, better icons for buttons,
// note that icons must be loaded via separate method,
// and main window will be responsible for reloading
// icons on all web browsers.
// Set properties of some components.
m_toolBar->layout()->setMargin(0);
m_toolBar->setFloatable(false);
@ -64,18 +59,26 @@ WebBrowser::WebBrowser(QWidget *parent)
m_layout->addWidget(m_toolBar);
m_layout->addWidget(m_webView);
m_layout->setMargin(0);
m_layout->setContentsMargins(0, -1, 0, 0);
createConnections();
setupIcons();
}
void WebBrowser::createConnections() {
// When user confirms new url, then redirect to it.
connect(m_txtLocation, &LocationLineEdit::submitted,
this, &WebBrowser::navigateToUrl);
connect(m_txtLocation,
&LocationLineEdit::submitted,
this,
static_cast<void (WebBrowser::*)(const QString &url)>(&WebBrowser::navigateToUrl));
// If new page loads, then update current url.
connect(m_webView, &BaseWebView::urlChanged,
this, &WebBrowser::updateUrl);
// Signal forwarding.
connect(m_webView, &BaseWebView::newTabRequested,
this, &WebBrowser::newTabRequested);
// Change location textbox status according to webpage status.
connect(m_webView, &BaseWebView::loadProgress,
m_txtLocation, &LocationLineEdit::setProgress);
@ -87,14 +90,16 @@ void WebBrowser::updateUrl(const QUrl &url) {
m_txtLocation->setText(url.toString());
}
void WebBrowser::navigateToUrl(const QString &textual_url) {
QUrl extracted_url = QUrl::fromUserInput(textual_url);
if (extracted_url.isValid()) {
m_webView->load(extracted_url);
void WebBrowser::navigateToUrl(const QUrl &url) {
if (url.isValid()) {
m_webView->load(url);
}
}
void WebBrowser::navigateToUrl(const QString &textual_url) {
navigateToUrl(QUrl::fromUserInput(textual_url));
}
WebBrowser::~WebBrowser() {
qDebug("Erasing WebBrowser instance.");
@ -105,6 +110,14 @@ WebBrowser::~WebBrowser() {
delete m_layout;
}
WebBrowser *WebBrowser::webBrowser() {
return this;
}
QMenu *WebBrowser::globalMenu() {
return nullptr;
}
void WebBrowser::setupIcons() {
m_actionBack->setIcon(ThemeFactory::fromTheme("go-previous"));
m_actionForward->setIcon(ThemeFactory::fromTheme("go-next"));
@ -123,7 +136,6 @@ void WebBrowser::setNavigationBarVisible(bool visible) {
WebBrowserNetworkAccessManager *WebBrowser::globalNetworkManager() {
if (m_networkManager.isNull()) {
// TODO: Not sure if qApp is needed here.
m_networkManager = new WebBrowserNetworkAccessManager(qApp);
}

View File

@ -3,14 +3,17 @@
#include <QWidget>
#include "gui/tabcontent.h"
class QToolBar;
class QVBoxLayout;
class LocationLineEdit;
class BaseWebView;
class WebBrowserNetworkAccessManager;
class QMenu;
class WebBrowser : public QWidget {
class WebBrowser : public TabContent {
Q_OBJECT
public:
@ -21,6 +24,13 @@ class WebBrowser : public QWidget {
// Reloads icons for all buttons.
void setupIcons();
// Returns this instance.
// NOTE: This is needed due to TabContent interface.
WebBrowser *webBrowser();
// Returns global menu for this web browser.
QMenu *globalMenu();
// Returns pointer to global network access manager
// for web browsers.
// NOTE: All web browsers use shared network access manager,
@ -31,8 +41,13 @@ class WebBrowser : public QWidget {
static QList<WebBrowser*> runningWebBrowsers();
public slots:
// Switches visibility of navigation bar.
void setNavigationBarVisible(bool visible);
// Loads new url into the web browser.
void navigateToUrl(const QString &url);
void navigateToUrl(const QUrl &url);
protected:
// Creates necessary connections.
void createConnections();
@ -41,8 +56,8 @@ class WebBrowser : public QWidget {
// Updates url (for example on location text box).
void updateUrl(const QUrl &url);
// Loads new url into the web browser.
void navigateToUrl(const QString &url);
signals:
void newTabRequested();
private:
QVBoxLayout *m_layout;

View File

@ -62,8 +62,9 @@ int main(int argc, char *argv[]) {
QtSingleApplication::addLibraryPath(APP_PLUGIN_PATH);
#endif
// Add an extra path for non-system icon themes.
// Add an extra path for non-system icon themes and set current icon theme.
ThemeFactory::setupSearchPaths();
ThemeFactory::loadCurrentIconTheme(false);
// Load localization and setup locale before any widget is constructed.
LoadLocalization();
@ -110,7 +111,7 @@ int main(int argc, char *argv[]) {
// Load icon theme from settings.
// NOTE: Make sure that this is done after main window and
// other startup widgets are created.
ThemeFactory::loadCurrentIconTheme();
//ThemeFactory::loadCurrentIconTheme();
// Setup single-instance behavior.
QObject::connect(&application, &QtSingleApplication::messageReceived,