diff options
69 files changed, 2068 insertions, 2620 deletions
diff --git a/i18n-projects b/i18n-projects index 62289baa..5d85792e 100644 --- a/i18n-projects +++ b/i18n-projects @@ -1,22 +1,26 @@ -# List of projects we want to make available as PO files in the -# lumina-i18n git repo +# List of projects we want to make available in the +# web-based translation interface +# NOTE: Format is as follows: +# "<Visible Project Name> <Directory within the source tree>" +# Files which contain translation strings are named "<Some_Name>_<Locale_Code>.ts" +# within the listed directory -# XXXXXX_LANG.ts <Qt project dir> -# ^^^^^^ File prefix for .ts file #Core -lumina-desktop src-qt5/core/lumina-desktop -lumina-info src-qt5/core/lumina-info -lumina-open src-qt5/core/lumina-open +lumina-desktop src-qt5/core/lumina-desktop/i18n +lumina-info src-qt5/core/lumina-info/i18n +lumina-open src-qt5/core/lumina-open/i18n #Core Utilities -lumina-config src-qt5/core-utils/lumina-config -lumina-search src-qt5/core-utils/lumina-search -lumina-xconfig src-qt5/core-utils/lumina-xconfig +lumina-config src-qt5/core-utils/lumina-config/i18n +lumina-search src-qt5/core-utils/lumina-search/i18n +lumina-xconfig src-qt5/core-utils/lumina-xconfig/i18n #Desktop Utilities -lumina-fm src-qt5/desktop-utils/lumina-fm -lumina-textedit src-qt5/desktop-utils/lumina-textedit -lumina-fileinfo src-qt5/desktop-utils/lumina-fileinfo -#lumina-terminal src-qt5/desktop-utils/lumina-terminal -lumina-screenshot src-qt5/desktop-utils/lumina-screenshot +lumina-archiver src-qt5/desktop-utils/lumina-archiver/i18n +lumina-calculator src-qt5/desktop-utils/lumina-calculator/i18n +lumina-fileinfo src-qt5/desktop-utils/lumina-fileinfo/i18n +lumina-fm src-qt5/desktop-utils/lumina-fm/i18n +lumina-mediaplayer src-qt5/desktop-utils/lumina-mediaplayer/i18n +lumina-screenshot src-qt5/desktop-utils/lumina-screenshot/i18n +lumina-textedit src-qt5/desktop-utils/lumina-textedit/i18n diff --git a/port-files/lumina-9999.ebuild b/port-files/lumina-9999.ebuild index c8dd7108..dca8574c 100644 --- a/port-files/lumina-9999.ebuild +++ b/port-files/lumina-9999.ebuild @@ -5,38 +5,61 @@ EAPI=6 -inherit git-r3 qmake-utils versionator - +inherit git-r3 qmake-utils DESCRIPTION="Lumina desktop environment" -HOMEPAGE="https://github.com/pcbsd/${PN}" -SRC_URI="" -EGIT_REPO_URI="${HOMEPAGE}" +HOMEPAGE="https://lumina-desktop.org/" +EGIT_REPO_URI="https://github.com/pcbsd/lumina" LICENSE="BSD" SLOT="0" -KEYWORDS="~x86 ~amd64" +KEYWORDS="" +IUSE="desktop-utils" -DEPEND="dev-qt/linguist-tools:5 - dev-qt/qtconcurrent:5 - dev-qt/qtcore:5 - dev-qt/qtmultimedia:5 +COMMON_DEPEND="dev-qt/qtcore:5 + dev-qt/qtconcurrent:5 + dev-qt/qtmultimedia:5[widgets] + dev-qt/qtsvg:5 dev-qt/qtnetwork:5 dev-qt/qtwidgets:5 dev-qt/qtx11extras:5 - x11-libs/libxcb + dev-qt/qtgui:5 + dev-qt/qtdeclarative:5 + x11-libs/libxcb:0 x11-libs/xcb-util x11-libs/xcb-util-image x11-libs/xcb-util-wm" -RDEPEND="${DEPEND} + +DEPEND="$COMMON_DEPEND + dev-qt/linguist-tools:5" + +RDEPEND="$COMMON_DEPEND + sys-fs/inotify-tools x11-misc/numlockx x11-wm/fluxbox - x11-apps/xbacklight + || ( x11-apps/xbacklight + sys-power/acpilight ) media-sound/alsa-utils sys-power/acpi app-admin/sysstat" -src_compile(){ +S="${WORKDIR}/${P/_/-}" + +src_prepare(){ + default + + if use !desktop-utils ; then + rm -rf src-qt5/desktop-utils || die + sed -e "/desktop-utils/d" -i src-qt5/src-qt5.pro || die + fi +} + +src_configure(){ + eqmake5 PREFIX="${EPREFIX}/usr" LIBPREFIX="${EPREFIX}/usr/$(get_libdir)" \ + DESTDIR="${D}" CONFIG+=WITH_I18N QMAKE_CFLAGS_ISYSTEM= +} - eqmake5 PREFIX="${ROOT}usr" LIBPREFIX="${ROOT}usr/lib" DESTDIR="${D}" CONFIG+="NO_I18N" - emake +src_install(){ + default + mv "${ED%/}"/etc/luminaDesktop.conf{.dist,} || die + rm "${ED%/}"/${PN}-* "${ED%/}"/start-${PN}-desktop || die } diff --git a/src-qt5/OS-detect.pri b/src-qt5/OS-detect.pri index eb7fd231..ac195000 100644 --- a/src-qt5/OS-detect.pri +++ b/src-qt5/OS-detect.pri @@ -75,7 +75,12 @@ isEmpty(OS){ #Apply any special rules for particular distros equals(LINUX_DISTRO,"Fedora"){ isEmpty(L_ETCDIR){ L_ETCDIR=/etc } - } + } + equals(LINUX_DISTRO,"Gentoo"){ + isEmpty(L_BINDIR){ L_BINDIR = $${PREFIX}/bin } + isEmpty(L_ETCDIR){ L_ETCDIR = $${PREFIX}/../etc } + isEmpty(L_MANDIR){ L_MANDIR = $${PREFIX}/share/man } + } }else{ OS="Unknown"; } diff --git a/src-qt5/core-utils/lumina-config/i18n/lumina-config_ca.ts b/src-qt5/core-utils/lumina-config/i18n/lumina-config_ca.ts index 67c68ecd..e1d54281 100644 --- a/src-qt5/core-utils/lumina-config/i18n/lumina-config_ca.ts +++ b/src-qt5/core-utils/lumina-config/i18n/lumina-config_ca.ts @@ -77,7 +77,7 @@ <source>This color scheme already exists. Overwrite it?</source> <translation>Aquest esquema de colors ja existeix. -Voleu sobreescriure'l?</translation> +Voleu sobreescriure'l?</translation> </message> <message> <location filename="../ColorDialog.cpp" line="121"/> @@ -164,7 +164,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../PanelWidget.ui" line="222"/> <source>Auto-hide Panel</source> - <translation>Amaga automàticament el plafó.</translation> + <translation>Amaga automàticament el plafó</translation> </message> <message> <location filename="../PanelWidget.ui" line="229"/> @@ -189,7 +189,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../PanelWidget.cpp" line="19"/> <source>Top/Left</source> - <translation>A dalt a l'esquerra</translation> + <translation>A dalt a l'esquerra</translation> </message> <message> <location filename="../PanelWidget.cpp" line="20"/> @@ -239,12 +239,12 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="80"/> <source>Desktop Bar</source> - <translation>Barra de l'escriptori</translation> + <translation>Barra de l'escriptori</translation> </message> <message> <location filename="../LPlugins.cpp" line="81"/> <source>This provides shortcuts to everything in the desktop folder - allowing easy access to all your favorite files/applications.</source> - <translation>Això proporciona dreceres a tot el que hi ha dins la carpeta de l'escriptori. Permet un accés fàcil a tots els vostres fitxers / aplicacions.</translation> + <translation>Això proporciona dreceres a tot el que hi ha dins la carpeta de l'escriptori. Permet un accés fàcil a tots els vostres fitxers / aplicacions.</translation> </message> <message> <location filename="../LPlugins.cpp" line="87"/> @@ -269,7 +269,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="109"/> <source>Keep track of your battery status.</source> - <translation>Feu un seguiment de l'estat de la bateria.</translation> + <translation>Feu un seguiment de l'estat de la bateria.</translation> </message> <message> <location filename="../LPlugins.cpp" line="115"/> @@ -279,7 +279,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="116"/> <source>View the current time and date.</source> - <translation>Mostra l'hora i la data actuals.</translation> + <translation>Mostra l'hora i la data actuals.</translation> </message> <message> <location filename="../LPlugins.cpp" line="122"/> @@ -289,7 +289,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="123"/> <source>View or change system settings (audio volume, screen brightness, battery life, virtual desktops).</source> - <translation>Vegeu o canvieu els paràmetres del sistema (volum de l'àudio, la brillantor, la vida de la bateria, els escriptoris virtuals).</translation> + <translation>Vegeu o canvieu els paràmetres del sistema (volum de l'àudio, la brillantor, la vida de la bateria, els escriptoris virtuals).</translation> </message> <message> <location filename="../LPlugins.cpp" line="129"/> @@ -310,17 +310,17 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="144"/> <source>Display area for dockable system applications</source> - <translation>Mostra l'àrea per a aplicacions de sistema acoblables</translation> + <translation>Mostra l'àrea per a aplicacions de sistema acoblables</translation> </message> <message> <location filename="../LPlugins.cpp" line="151"/> <source>Hide all open windows and show the desktop</source> - <translation>Amaga totes les finestres i mostra l'escriptori</translation> + <translation>Amaga totes les finestres i mostra l'escriptori</translation> </message> <message> <location filename="../LPlugins.cpp" line="157"/> <source>Start Menu</source> - <translation>Menú d'inici</translation> + <translation>Menú d'inici</translation> </message> <message> <location filename="../LPlugins.cpp" line="190"/> @@ -330,33 +330,33 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="191"/> <source>Display a calendar on the desktop</source> - <translation>Mostra un calendari a l'escriptori</translation> + <translation>Mostra un calendari a l'escriptori</translation> </message> <message> <location filename="../LPlugins.cpp" line="164"/> <location filename="../LPlugins.cpp" line="197"/> <source>Application Launcher</source> - <translation>Llançador d'aplicacions</translation> + <translation>Llançador d'aplicacions</translation> </message> <message> <location filename="../LPlugins.cpp" line="66"/> <source>User Menu</source> - <translation>Menú de l'usuari</translation> + <translation>Menú de l'usuari</translation> </message> <message> <location filename="../LPlugins.cpp" line="67"/> - <source>Start menu alternative focusing on the user's files, directories, and favorites.</source> - <translation>Inicia un menú alternatiu centrat en els fitxers, directoris i favorits de l'usuari.</translation> + <source>Start menu alternative focusing on the user's files, directories, and favorites.</source> + <translation>Inicia un menú alternatiu centrat en els fitxers, directoris i favorits de l'usuari.</translation> </message> <message> <location filename="../LPlugins.cpp" line="73"/> <source>Application Menu</source> - <translation>Menú d'aplicació</translation> + <translation>Menú d'aplicació</translation> </message> <message> <location filename="../LPlugins.cpp" line="74"/> <source>Start menu alternative which focuses on launching applications.</source> - <translation>Inicia un menú alternatiu centrat en el llançament d'aplicacions.</translation> + <translation>Inicia un menú alternatiu centrat en el llançament d'aplicacions.</translation> </message> <message> <location filename="../LPlugins.cpp" line="94"/> @@ -371,42 +371,42 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="101"/> <source>Workspace Switcher</source> - <translation>Canviador d'espais de treball</translation> + <translation>Canviador d'espais de treball</translation> </message> <message> <location filename="../LPlugins.cpp" line="130"/> <source>View and control any running application windows (group similar windows under a single button).</source> - <translation>Mostra i controla qualsevol finestra d'aplicació en execució (agrupa les finestres similars en un sol botó).</translation> + <translation>Mostra i controla qualsevol finestra d'aplicació en execució (agrupa les finestres similars en un sol botó).</translation> </message> <message> <location filename="../LPlugins.cpp" line="137"/> <source>View and control any running application windows (every individual window has a button)</source> - <translation>Mostra i controla qualsevol finestra d'aplicació en execució (cada finestra té un botó).</translation> + <translation>Mostra i controla qualsevol finestra d'aplicació en execució (cada finestra té un botó).</translation> </message> <message> <location filename="../LPlugins.cpp" line="150"/> <source>Show Desktop</source> - <translation>Mostra l'escriptori</translation> + <translation>Mostra l'escriptori</translation> </message> <message> <location filename="../LPlugins.cpp" line="158"/> <source>Unified system access and application launch menu.</source> - <translation>Menú unificat de llançador d'aplicacions i d'accés al sistema.</translation> + <translation>Menú unificat de llançador d'aplicacions i d'accés al sistema.</translation> </message> <message> <location filename="../LPlugins.cpp" line="165"/> <source>Pin an application shortcut directly to the panel</source> - <translation>Enganxa la drecera d'una aplicació directament al plafó</translation> + <translation>Enganxa la drecera d'una aplicació directament al plafó</translation> </message> <message> <location filename="../LPlugins.cpp" line="198"/> <source>Desktop button for launching an application</source> - <translation>Botó d'escriptori per iniciar una aplicació</translation> + <translation>Botó d'escriptori per iniciar una aplicació</translation> </message> <message> <location filename="../LPlugins.cpp" line="204"/> <source>Desktop Icons View</source> - <translation>Vista d'icones a l'escriptori</translation> + <translation>Vista d'icones a l'escriptori</translation> </message> <message> <location filename="../LPlugins.cpp" line="211"/> @@ -416,19 +416,19 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="212"/> <source>Keep simple text notes on your desktop</source> - <translation>Mantingueu notes de text senzilles a l'escriptori</translation> + <translation>Mantingueu notes de text senzilles a l'escriptori</translation> </message> <message> <location filename="../LPlugins.cpp" line="171"/> <location filename="../LPlugins.cpp" line="218"/> <source>Audio Player</source> - <translation>Reproductor d'àudio</translation> + <translation>Reproductor d'àudio</translation> </message> <message> <location filename="../LPlugins.cpp" line="172"/> <location filename="../LPlugins.cpp" line="219"/> <source>Play through lists of audio files</source> - <translation>Reprodueix llistes de fitxers d'àudio</translation> + <translation>Reprodueix llistes de fitxers d'àudio</translation> </message> <message> <location filename="../LPlugins.cpp" line="225"/> @@ -438,7 +438,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="226"/> <source>Keep track of system statistics such as CPU/Memory usage and CPU temperatures.</source> - <translation>Control de les estadístiques del sistema com ara l'ús de la CPU i la mèmòria i les temperatures de la CPU.</translation> + <translation>Control de les estadístiques del sistema com ara l'ús de la CPU i la mèmòria i les temperatures de la CPU.</translation> </message> <message> <location filename="../LPlugins.cpp" line="232"/> @@ -489,7 +489,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="285"/> <source>Show the desktop settings menu.</source> - <translation>Mostra el menú de paràmetres de l'escriptori.</translation> + <translation>Mostra el menú de paràmetres de l'escriptori.</translation> </message> <message> <location filename="../LPlugins.cpp" line="298"/> @@ -510,7 +510,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="205"/> <source>Configurable area for automatically showing desktop icons</source> - <translation>Àrea configurable per mostrar automàticament icones d'escriptori</translation> + <translation>Àrea configurable per mostrar automàticament icones d'escriptori</translation> </message> <message> <location filename="../LPlugins.cpp" line="263"/> @@ -525,13 +525,13 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="292"/> <source>List the open, minimized, active, and urgent application windows</source> - <translation>Llista les finestres d'aplicació obertes, minimitzades, actives i urgents.</translation> + <translation>Llista les finestres d'aplicació obertes, minimitzades, actives i urgents.</translation> </message> <message> <location filename="../LPlugins.cpp" line="179"/> <location filename="../LPlugins.cpp" line="306"/> <source>Run an external script to generate a user defined menu</source> - <translation>Executa un script extern per generar un menú definit per l'usuari.</translation> + <translation>Executa un script extern per generar un menú definit per l'usuari.</translation> </message> <message> <location filename="../LPlugins.cpp" line="312"/> @@ -541,7 +541,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="313"/> <source>Lock the current desktop session</source> - <translation>Bloqueja la sessió d'escriptori actual</translation> + <translation>Bloqueja la sessió d'escriptori actual</translation> </message> <message> <location filename="../LPlugins.cpp" line="323"/> @@ -591,7 +591,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="348"/> <source>Main background color for widgets that list or display collections of items.</source> - <translation>Color de fons principal per a ginys que llisten o mostres col·leccions d'ítems.</translation> + <translation>Color de fons principal per a ginys que llisten o mostres col·leccions d'ítems.</translation> </message> <message> <location filename="../LPlugins.cpp" line="353"/> @@ -636,7 +636,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="377"/> <source>Accent Color</source> - <translation>Color d'accentuació</translation> + <translation>Color d'accentuació</translation> </message> <message> <location filename="../LPlugins.cpp" line="378"/> @@ -646,7 +646,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../LPlugins.cpp" line="383"/> <source>Accent Color (Disabled)</source> - <translation>Color d'accentuació (inhabilitat)</translation> + <translation>Color d'accentuació (inhabilitat)</translation> </message> <message> <location filename="../LPlugins.cpp" line="384"/> @@ -706,7 +706,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/getPage.cpp" line="45"/> <source>Startup Settings</source> - <translation>Paràmetres de l'inici</translation> + <translation>Paràmetres de l'inici</translation> </message> <message> <location filename="../pages/getPage.cpp" line="45"/> @@ -761,7 +761,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/getPage.cpp" line="48"/> <source>Change window settings and appearances</source> - <translation>Canvia els paràmetres i l'aparença de les finestres</translation> + <translation>Canvia els paràmetres i l'aparença de les finestres</translation> </message> <message> <location filename="../pages/getPage.cpp" line="49"/> @@ -781,12 +781,12 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/getPage.cpp" line="49"/> <source>Desktop Plugins</source> - <translation>Connectors de l'escriptori</translation> + <translation>Connectors de l'escriptori</translation> </message> <message> <location filename="../pages/getPage.cpp" line="49"/> <source>Change what icons or tools are embedded on the desktop</source> - <translation>Canvia les icones o les eines encastades a l'escriptori</translation> + <translation>Canvia les icones o les eines encastades a l'escriptori</translation> </message> <message> <location filename="../pages/getPage.cpp" line="50"/> @@ -806,7 +806,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/getPage.cpp" line="51"/> <source>Change what options are shown on the desktop context menu</source> - <translation>Canvia les opcions que es mostren al menú contextual de l'escriptori</translation> + <translation>Canvia les opcions que es mostren al menú contextual de l'escriptori</translation> </message> <message> <location filename="../pages/getPage.cpp" line="52"/> @@ -831,12 +831,12 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/getPage.cpp" line="53"/> <source>User Settings</source> - <translation>Paràmetres de l'usuari</translation> + <translation>Paràmetres de l'usuari</translation> </message> <message> <location filename="../pages/getPage.cpp" line="53"/> <source>Change basic user settings such as time/date formats</source> - <translation>Canvieu els paràmetres d'usuari bàsics com ara el format de l'hora i la data</translation> + <translation>Canvieu els paràmetres d'usuari bàsics com ara el format de l'hora i la data</translation> </message> </context> <context> @@ -885,7 +885,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../ScriptDialog.cpp" line="64"/> <source>Select an icon file</source> - <translation>Seleccioneu un fitxer d'icona</translation> + <translation>Seleccioneu un fitxer d'icona</translation> </message> </context> <context> @@ -932,7 +932,7 @@ Voleu sobreescriure'l?</translation> <source>This theme already exists. Overwrite it?</source> <translation>Aquest tema ja existeix. -Voleu sobreescriure'l?</translation> +Voleu sobreescriure'l?</translation> </message> </context> <context> @@ -945,7 +945,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../mainWindow.ui" line="23"/> <source>toolBar</source> - <translation>Barra d'eines</translation> + <translation>Barra d'eines</translation> </message> <message> <location filename="../mainWindow.ui" line="50"/> @@ -1000,7 +1000,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_autostart.ui" line="39"/> <source>Add New Startup Service</source> - <translation>Afegeix un servei nou a l'inici</translation> + <translation>Afegeix un servei nou a l'inici</translation> </message> <message> <location filename="../pages/page_autostart.ui" line="75"/> @@ -1020,7 +1020,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_autostart.cpp" line="66"/> <source>Startup Services</source> - <translation>Serveis de l'inici</translation> + <translation>Serveis de l'inici</translation> </message> <message> <location filename="../pages/page_autostart.cpp" line="133"/> @@ -1030,7 +1030,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_autostart.cpp" line="133"/> <source>Application Binaries (*)</source> - <translation>Binaris d'aplicacions (*)</translation> + <translation>Binaris d'aplicacions (*)</translation> </message> <message> <location filename="../pages/page_autostart.cpp" line="136"/> @@ -1116,7 +1116,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_defaultapps.ui" line="269"/> <source>Set App</source> - <translation>Estableix l'aplicació</translation> + <translation>Estableix l'aplicació</translation> </message> <message> <location filename="../pages/page_defaultapps.ui" line="279"/> @@ -1235,7 +1235,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_fluxbox_keys.ui" line="184"/> <source>Note: Current key bindings need to be cleared and saved before they can be re-used.</source> - <translation>Nota: les associacions de tecles actuals s'han de netejar i desar abans que es puguin reutilitzar.</translation> + <translation>Nota: les associacions de tecles actuals s'han de netejar i desar abans que es puguin reutilitzar.</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.ui" line="220"/> @@ -1244,12 +1244,12 @@ Voleu sobreescriure'l?</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.ui" line="244"/> - <source>"Mod1": Alt key -"Mod4": Windows/Mac key -"Control": Ctrl key</source> - <translation>"Mod1": tecla Alt -"Mod4": tecla Windows/Mac -"Control": tecla Ctrl</translation> + <source>"Mod1": Alt key +"Mod4": Windows/Mac key +"Control": Ctrl key</source> + <translation>"Mod1": tecla Alt +"Mod4": tecla Windows/Mac +"Control": tecla Ctrl</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="70"/> @@ -1259,12 +1259,12 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="78"/> <source>Audio Volume Up</source> - <translation>Volum de l'àudio amunt</translation> + <translation>Volum de l'àudio amunt</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="79"/> <source>Audio Volume Down</source> - <translation>Volum de l'àudio avall</translation> + <translation>Volum de l'àudio avall</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="80"/> @@ -1307,7 +1307,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_fluxbox_settings.ui" line="81"/> <source>Number of Workspaces</source> - <translation>Nombre d'espais de treball</translation> + <translation>Nombre d'espais de treball</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.ui" line="98"/> @@ -1391,7 +1391,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_interface_desktop.ui" line="79"/> <source>Display Desktop Folder Contents</source> - <translation>Mostra els continguts de la carpeta de l'escriptori</translation> + <translation>Mostra els continguts de la carpeta de l'escriptori</translation> </message> <message> <location filename="../pages/page_interface_desktop.ui" line="86"/> @@ -1401,7 +1401,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_interface_desktop.cpp" line="56"/> <source>Desktop Settings</source> - <translation>Paràmetres de l'escriptori</translation> + <translation>Paràmetres de l'escriptori</translation> </message> </context> <context> @@ -1419,7 +1419,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_interface_menu.cpp" line="46"/> <source>Desktop Settings</source> - <translation>Paràmetres de l'escriptori</translation> + <translation>Paràmetres de l'escriptori</translation> </message> </context> <context> @@ -1442,7 +1442,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_interface_panels.cpp" line="58"/> <source>Desktop Settings</source> - <translation>Paràmetres de l'escriptori</translation> + <translation>Paràmetres de l'escriptori</translation> </message> </context> <context> @@ -1470,12 +1470,12 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_main.cpp" line="64"/> <source>Desktop Defaults</source> - <translation>Valors per defecte de l'escriptori</translation> + <translation>Valors per defecte de l'escriptori</translation> </message> <message> <location filename="../pages/page_main.cpp" line="68"/> <source>User Settings</source> - <translation>Paràmetres de l'usuari</translation> + <translation>Paràmetres de l'usuari</translation> </message> <message> <location filename="../pages/page_main.cpp" line="72"/> @@ -1485,7 +1485,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_main.cpp" line="158"/> <source>Desktop Settings</source> - <translation>Paràmetres de l'escriptori</translation> + <translation>Paràmetres de l'escriptori</translation> </message> </context> <context> @@ -1538,7 +1538,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_session_locale.cpp" line="47"/> <source>Desktop Settings</source> - <translation>Paràmetres de l'escriptori</translation> + <translation>Paràmetres de l'escriptori</translation> </message> <message> <location filename="../pages/page_session_locale.cpp" line="91"/> @@ -1556,7 +1556,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_session_options.ui" line="34"/> <source>Enable numlock on startup</source> - <translation>Habilita el bloqueig numèric a l'inici</translation> + <translation>Habilita el bloqueig numèric a l'inici</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="41"/> @@ -1576,22 +1576,22 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_session_options.ui" line="58"/> <source>Manage desktop app links</source> - <translation>Gestió dels enllaços de les aplicacions d'escriptori</translation> + <translation>Gestió dels enllaços de les aplicacions d'escriptori</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="65"/> <source>Show application crash data</source> - <translation>Mostra les dades de la fallada d'aplicacions</translation> + <translation>Mostra les dades de la fallada d'aplicacions</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="74"/> <source>Change User Icon</source> - <translation>Canvia la icona de l'usuari</translation> + <translation>Canvia la icona de l'usuari</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="112"/> <source>Time Format:</source> - <translation>Format de l'hora:</translation> + <translation>Format de l'hora:</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="124"/> @@ -1618,7 +1618,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_session_options.ui" line="234"/> <source>Reset Desktop Settings</source> - <translation>Restableix els paràmetres de l'escriptori</translation> + <translation>Restableix els paràmetres de l'escriptori</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="253"/> @@ -1643,17 +1643,17 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_session_options.cpp" line="20"/> <source>Time first then Date</source> - <translation>Primer l'hora, després la data</translation> + <translation>Primer l'hora, després la data</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="21"/> <source>Date first then Time</source> - <translation>Primer la data, després l'hora</translation> + <translation>Primer la data, després l'hora</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="81"/> <source>Desktop Settings</source> - <translation>Paràmetres de l'escriptori</translation> + <translation>Paràmetres de l'escriptori</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="124"/> @@ -1668,17 +1668,17 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_session_options.cpp" line="129"/> <source>Reset User Image</source> - <translation>Restableix la imatge de l'usuari</translation> + <translation>Restableix la imatge de l'usuari</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="129"/> <source>Would you like to reset the user image to the system default?</source> - <translation>Voleu restablir la imatge de l'usuari a la predeterminada del sistema?</translation> + <translation>Voleu restablir la imatge de l'usuari a la predeterminada del sistema?</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="168"/> <source>Valid Time Codes:</source> - <translation>Codis d'hora vàlids:</translation> + <translation>Codis d'hora vàlids:</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="169"/> @@ -1723,12 +1723,12 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_session_options.cpp" line="177"/> <source>Time Codes</source> - <translation>Codis d'hora</translation> + <translation>Codis d'hora</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="191"/> <source>Valid Date Codes:</source> - <translation>Codis d'hora vàlids:</translation> + <translation>Codis d'hora vàlids:</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="192"/> @@ -1801,7 +1801,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_theme.ui" line="36"/> <source>Desktop Theme</source> - <translation>Tema de l'escriptori</translation> + <translation>Tema de l'escriptori</translation> </message> <message> <location filename="../pages/page_theme.ui" line="42"/> @@ -1847,7 +1847,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_theme.ui" line="138"/> <source>Icon Pack:</source> - <translation>Paquet d'icones:</translation> + <translation>Paquet d'icones:</translation> </message> <message> <location filename="../pages/page_theme.ui" line="148"/> @@ -1857,7 +1857,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_theme.ui" line="192"/> <source>Application Themes</source> - <translation>Temes de l'aplicació</translation> + <translation>Temes de l'aplicació</translation> </message> <message> <location filename="../pages/page_theme.ui" line="198"/> @@ -1906,7 +1906,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_wallpaper.ui" line="90"/> <source>Single Background</source> - <translation>Fons d'escriptori únic</translation> + <translation>Fons d'escriptori únic</translation> </message> <message> <location filename="../pages/page_wallpaper.ui" line="100"/> @@ -2003,7 +2003,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_wallpaper.cpp" line="131"/> <source>Top Left</source> - <translation>Dalt a l'esquerra</translation> + <translation>Dalt a l'esquerra</translation> </message> <message> <location filename="../pages/page_wallpaper.cpp" line="132"/> @@ -2013,7 +2013,7 @@ Voleu sobreescriure'l?</translation> <message> <location filename="../pages/page_wallpaper.cpp" line="133"/> <source>Bottom Left</source> - <translation>A baix a l'esquerra</translation> + <translation>A baix a l'esquerra</translation> </message> <message> <location filename="../pages/page_wallpaper.cpp" line="134"/> @@ -2044,7 +2044,7 @@ Voleu sobreescriure'l?</translation> <location filename="../pages/page_wallpaper.cpp" line="233"/> <location filename="../pages/page_wallpaper.cpp" line="258"/> <source>Find Background Image Directory</source> - <translation>Troba el directori d'imatges de fons</translation> + <translation>Troba el directori d'imatges de fons</translation> </message> </context> </TS> diff --git a/src-qt5/core-utils/lumina-config/i18n/lumina-config_cs.ts b/src-qt5/core-utils/lumina-config/i18n/lumina-config_cs.ts index 82529d10..bd56ba09 100644 --- a/src-qt5/core-utils/lumina-config/i18n/lumina-config_cs.ts +++ b/src-qt5/core-utils/lumina-config/i18n/lumina-config_cs.ts @@ -11,7 +11,7 @@ <message> <location filename="../AppDialog.ui" line="20"/> <source>Search for....</source> - <translation>Hledat...</translation> + <translation>Hledat…</translation> </message> </context> <context> @@ -35,12 +35,12 @@ <location filename="../ColorDialog.ui" line="54"/> <location filename="../ColorDialog.ui" line="70"/> <source>...</source> - <translation>...</translation> + <translation>…</translation> </message> <message> <location filename="../ColorDialog.ui" line="67"/> <source>Manually set value for selection</source> - <translation>Ručně nastavit hodnotu pro výběr</translation> + <translation>Nastavit hodnotu pro výběr ručně</translation> </message> <message> <location filename="../ColorDialog.ui" line="95"/> @@ -60,7 +60,7 @@ <message> <location filename="../ColorDialog.ui" line="115"/> <source>Cancel</source> - <translation>Zrušit</translation> + <translation>Storno</translation> </message> <message> <location filename="../ColorDialog.ui" line="135"/> @@ -76,8 +76,8 @@ <location filename="../ColorDialog.cpp" line="98"/> <source>This color scheme already exists. Overwrite it?</source> - <translation>Toto barevné schéma již existuje. -Přepsat je?</translation> + <translation>Toto barevné schéma už existuje. +Přepsat?</translation> </message> <message> <location filename="../ColorDialog.cpp" line="121"/> @@ -88,7 +88,7 @@ Přepsat je?</translation> <message> <location filename="../ColorDialog.cpp" line="142"/> <source>Color Value</source> - <translation>Hodnota barvy</translation> + <translation>Barevná hodnota</translation> </message> <message> <location filename="../ColorDialog.cpp" line="142"/> @@ -101,17 +101,17 @@ Přepsat je?</translation> <message> <location filename="../GetPluginDialog.ui" line="14"/> <source>Select Plugin</source> - <translation>Vybrat modul</translation> + <translation>Vybrat zásuvný modul</translation> </message> <message> <location filename="../GetPluginDialog.ui" line="26"/> <source>Select a Plugin:</source> - <translation>Vybrat modul:</translation> + <translation>Vybrat zásuvný modul:</translation> </message> <message> <location filename="../GetPluginDialog.ui" line="57"/> <source>Cancel</source> - <translation>Zrušit</translation> + <translation>Storno</translation> </message> <message> <location filename="../GetPluginDialog.ui" line="77"/> @@ -144,7 +144,7 @@ Přepsat je?</translation> <message> <location filename="../PanelWidget.ui" line="138"/> <source> pixel(s) thick</source> - <translation> tloušťka obrazového bodu(ů)</translation> + <translation> tloušťka (obrazových bodů)</translation> </message> <message> <location filename="../PanelWidget.ui" line="157"/> @@ -174,17 +174,17 @@ Přepsat je?</translation> <message> <location filename="../PanelWidget.ui" line="250"/> <source>...</source> - <translation>...</translation> + <translation>…</translation> </message> <message> <location filename="../PanelWidget.ui" line="257"/> <source>Sample</source> - <translation>Příklad</translation> + <translation>Ukázka</translation> </message> <message> <location filename="../PanelWidget.ui" line="287"/> <source>Plugins</source> - <translation>Přídavné moduly</translation> + <translation>Zásuvné moduly</translation> </message> <message> <location filename="../PanelWidget.cpp" line="19"/> @@ -244,17 +244,17 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="81"/> <source>This provides shortcuts to everything in the desktop folder - allowing easy access to all your favorite files/applications.</source> - <translation>Toto poskytuje klávesové zkratky pro všechno ve složce pracovní plochy. Umožňuje snadný přístup ke všem oblíbeným souborům/aplikacím.</translation> + <translation>Toto poskytuje zkratky pro všechno ve složce pracovní plochy. Umožňuje snadný přístup ke všem oblíbeným souborům/aplikacím.</translation> </message> <message> <location filename="../LPlugins.cpp" line="87"/> <source>Spacer</source> - <translation>Mezera</translation> + <translation>Oddělovač</translation> </message> <message> <location filename="../LPlugins.cpp" line="88"/> <source>Invisible spacer to separate plugins.</source> - <translation>Neviditelná mezera pro oddělení přídavných modulů.</translation> + <translation>Neviditelný oddělovač pro oddělení zásuvných modulů.</translation> </message> <message> <location filename="../LPlugins.cpp" line="102"/> @@ -264,12 +264,12 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="108"/> <source>Battery Monitor</source> - <translation>Monitor baterie</translation> + <translation>Monitor akumulátoru</translation> </message> <message> <location filename="../LPlugins.cpp" line="109"/> <source>Keep track of your battery status.</source> - <translation>Sledovat stav baterie.</translation> + <translation>Sledovat stav akumulátoru.</translation> </message> <message> <location filename="../LPlugins.cpp" line="115"/> @@ -284,12 +284,12 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="122"/> <source>System Dashboard</source> - <translation>Palubní deska systému</translation> + <translation>Přehled o systému</translation> </message> <message> <location filename="../LPlugins.cpp" line="123"/> <source>View or change system settings (audio volume, screen brightness, battery life, virtual desktops).</source> - <translation>Zobrazit nebo změnit nastavení systému (hlasitost, jas obrazovky, životnost baterie, virtuální plochy).</translation> + <translation>Zobrazit nebo změnit nastavení systému (hlasitost, jas obrazovky, stav akumulátoru, virtuální plochy).</translation> </message> <message> <location filename="../LPlugins.cpp" line="129"/> @@ -300,17 +300,17 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="136"/> <source>Task Manager (No Groups)</source> - <translation>Správce úloh (žádné skupiny)</translation> + <translation>Správce úloh (bez skupin)</translation> </message> <message> <location filename="../LPlugins.cpp" line="143"/> <source>System Tray</source> - <translation>Oznamovací oblast panelu</translation> + <translation>Oznamovací oblast systémového panelu</translation> </message> <message> <location filename="../LPlugins.cpp" line="144"/> <source>Display area for dockable system applications</source> - <translation>Zobrazit oblast pro ukotvitelné systémové aplikace</translation> + <translation>Oblast obrazovky pro ukotvitelné systémové aplikace</translation> </message> <message> <location filename="../LPlugins.cpp" line="151"/> @@ -345,8 +345,8 @@ Přepsat je?</translation> </message> <message> <location filename="../LPlugins.cpp" line="67"/> - <source>Start menu alternative focusing on the user's files, directories, and favorites.</source> - <translation>Náhradní spouštěcí nabídka se zaměřením na uživatelovy soubory, adresáře a záložky (oblíbené).</translation> + <source>Start menu alternative focusing on the user's files, directories, and favorites.</source> + <translation>Alternativa ke spouštěcí nabídce se zaměřením na uživatelovy soubory, adresáře a oblíbené položky.</translation> </message> <message> <location filename="../LPlugins.cpp" line="73"/> @@ -356,7 +356,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="74"/> <source>Start menu alternative which focuses on launching applications.</source> - <translation>Náhradní spouštěcí nabídka se zaměřením na spouštění programů.</translation> + <translation>Alternativní spouštěcí nabídka se zaměřením na spouštění programů.</translation> </message> <message> <location filename="../LPlugins.cpp" line="94"/> @@ -376,12 +376,12 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="130"/> <source>View and control any running application windows (group similar windows under a single button).</source> - <translation>Zobrazit a ovládat všechna běžící okna s programy (seskupit podobná okna pod jedno tlačítko).</translation> + <translation>Zobrazit a ovládat všechna běžící okna s aplikacemi (seskupit podobná okna pod jedno tlačítko).</translation> </message> <message> <location filename="../LPlugins.cpp" line="137"/> <source>View and control any running application windows (every individual window has a button)</source> - <translation>Zobrazit a ovládat všechna běžící okna s programy (všechna jednotlivá okna mají tlačítko)</translation> + <translation>Zobrazit a ovládat všechna běžící okna s aplikacemi (pro každé okno zvlášť tlačítko)</translation> </message> <message> <location filename="../LPlugins.cpp" line="150"/> @@ -391,17 +391,17 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="158"/> <source>Unified system access and application launch menu.</source> - <translation>Sjednocený přístup k systému a k nabídce pro spouštění aplikací.</translation> + <translation>Sjednocená nabídka pro přístup k systému a spouštění aplikací.</translation> </message> <message> <location filename="../LPlugins.cpp" line="165"/> <source>Pin an application shortcut directly to the panel</source> - <translation>Přišpendlit klávesovou zkratku pro aplikaci přímo k panelu</translation> + <translation>Přišpendlit zástupce aplikace přímo na panel</translation> </message> <message> <location filename="../LPlugins.cpp" line="198"/> <source>Desktop button for launching an application</source> - <translation>Tlačítko pracovní plochy ke spuštění programu</translation> + <translation>Tlačítko pracovní plochy spouštějící aplikaci</translation> </message> <message> <location filename="../LPlugins.cpp" line="204"/> @@ -416,7 +416,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="212"/> <source>Keep simple text notes on your desktop</source> - <translation>Uchovat jednoduché textové poznámky na pracovní ploše</translation> + <translation>Mějte jednoduché textové poznámky přímo na pracovní ploše</translation> </message> <message> <location filename="../LPlugins.cpp" line="171"/> @@ -438,7 +438,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="226"/> <source>Keep track of system statistics such as CPU/Memory usage and CPU temperatures.</source> - <translation>Sledovat systémové statistiky jako zatížení procesoru/využití paměti a teplota procesoru.</translation> + <translation>Sledovat systémové statistiky jako zatížení procesoru / využití operační paměti a teplotu procesoru.</translation> </message> <message> <location filename="../LPlugins.cpp" line="232"/> @@ -448,7 +448,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="233"/> <source>Monitor RSS Feeds (Requires internet connection)</source> - <translation>Sledovat kanály RSS (vyžaduje internetové připojení)</translation> + <translation>Sledovat kanály RSS (vyžaduje připojení k Internetu)</translation> </message> <message> <location filename="../LPlugins.cpp" line="256"/> @@ -463,7 +463,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="264"/> <source>Browse the system with the default file manager.</source> - <translation>Procházet systém s výchozím správcem souborů.</translation> + <translation>Procházet systém pomocí výchozího správce souborů.</translation> </message> <message> <location filename="../LPlugins.cpp" line="270"/> @@ -474,7 +474,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="271"/> <source>Show the system applications menu.</source> - <translation>Ukázat nabídku se systémovými programy.</translation> + <translation>Zobrazit nabídku se systémovými aplikacemi.</translation> </message> <message> <location filename="../LPlugins.cpp" line="277"/> @@ -489,7 +489,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="285"/> <source>Show the desktop settings menu.</source> - <translation>Ukázat nabídku s nastaveními pracovní plochy.</translation> + <translation>Zobrazit nabídku s nastaveními pracovní plochy.</translation> </message> <message> <location filename="../LPlugins.cpp" line="298"/> @@ -505,12 +505,12 @@ Přepsat je?</translation> <location filename="../LPlugins.cpp" line="178"/> <location filename="../LPlugins.cpp" line="305"/> <source>Menu Script</source> - <translation>Nabídka skript</translation> + <translation>Skript nabídky</translation> </message> <message> <location filename="../LPlugins.cpp" line="205"/> <source>Configurable area for automatically showing desktop icons</source> - <translation>Nastavitelná oblast pro automatické ukazování ikon na ploše</translation> + <translation>Nastavitelná oblast pro automatické zobrazování ikon na ploše</translation> </message> <message> <location filename="../LPlugins.cpp" line="263"/> @@ -520,12 +520,12 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="284"/> <source>Preferences</source> - <translation>Nastavení</translation> + <translation>Předvolby</translation> </message> <message> <location filename="../LPlugins.cpp" line="292"/> <source>List the open, minimized, active, and urgent application windows</source> - <translation>Ukázat otevřená, zmenšená a činná okna aplikací a okna s naléhavými zprávami</translation> + <translation>Ukázat otevřená, minimalizovaná a aktivní okna aplikací a ta s naléhavými zprávami</translation> </message> <message> <location filename="../LPlugins.cpp" line="179"/> @@ -551,17 +551,17 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="324"/> <source>Color to use for all visible text.</source> - <translation>Barva všeho viditelného textu.</translation> + <translation>Barva veškerého viditelného textu.</translation> </message> <message> <location filename="../LPlugins.cpp" line="329"/> <source>Text (Disabled)</source> - <translation>Text (zakázáno)</translation> + <translation>Text (vypnuté)</translation> </message> <message> <location filename="../LPlugins.cpp" line="330"/> <source>Text color for disabled or inactive items.</source> - <translation>Barva textu pro zakázané nebo nečinné položky.</translation> + <translation>Barva textu pro vypnuté nebo nečinné položky.</translation> </message> <message> <location filename="../LPlugins.cpp" line="335"/> @@ -586,12 +586,12 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="347"/> <source>Base Window Color (Alternate)</source> - <translation>Základní barva okna (náhradní)</translation> + <translation>Základní barva okna (alternativní)</translation> </message> <message> <location filename="../LPlugins.cpp" line="348"/> <source>Main background color for widgets that list or display collections of items.</source> - <translation>Hlavní barva pozadí pro doplňky ukazující nebo znázorňující sbírky položek.</translation> + <translation>Hlavní barva pozadí pro doplňky ukazující nebo znázorňující sady položek.</translation> </message> <message> <location filename="../LPlugins.cpp" line="353"/> @@ -606,7 +606,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="359"/> <source>Primary Color (Disabled)</source> - <translation>Hlavní barva (zakázáno)</translation> + <translation>Hlavní barva (vypnuto)</translation> </message> <message> <location filename="../LPlugins.cpp" line="360"/> @@ -621,12 +621,12 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="366"/> <source>Alternate color for the theme.</source> - <translation>Náhradní barva pro vzhled.</translation> + <translation>Alternativní barva pro vzhled.</translation> </message> <message> <location filename="../LPlugins.cpp" line="371"/> <source>Secondary Color (Disabled)</source> - <translation>Vedlejší barva (zakázáno)</translation> + <translation>Vedlejší barva (vypnuto)</translation> </message> <message> <location filename="../LPlugins.cpp" line="372"/> @@ -646,12 +646,12 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="383"/> <source>Accent Color (Disabled)</source> - <translation>Barva zdůraznění (zakázáno)</translation> + <translation>Barva zdůraznění (vypnuto)</translation> </message> <message> <location filename="../LPlugins.cpp" line="384"/> <source>Color used for borders or other accents (more subdued).</source> - <translation>Barva používaná na okraje nebo jiná zdůraznění (tlumenější).</translation> + <translation>Barva používaná pro okraje nebo jiná zdůraznění (tlumenější).</translation> </message> <message> <location filename="../LPlugins.cpp" line="389"/> @@ -666,7 +666,7 @@ Přepsat je?</translation> <message> <location filename="../LPlugins.cpp" line="395"/> <source>Highlight Color (Disabled)</source> - <translation>Barva zvýraznění (zakázáno)</translation> + <translation>Barva zvýraznění (vypnuto)</translation> </message> <message> <location filename="../LPlugins.cpp" line="396"/> @@ -681,12 +681,12 @@ Přepsat je?</translation> <message> <location filename="../pages/getPage.cpp" line="42"/> <source>Change background image(s)</source> - <translation>Změnit obrázek(y) pozadí</translation> + <translation>Změnit obrázek na pozadí</translation> </message> <message> <location filename="../pages/getPage.cpp" line="43"/> <source>Theme Settings</source> - <translation>Nastavení vzhledu</translation> + <translation>Nastavení téma vzhledu</translation> </message> <message> <location filename="../pages/getPage.cpp" line="43"/> @@ -706,12 +706,12 @@ Přepsat je?</translation> <message> <location filename="../pages/getPage.cpp" line="45"/> <source>Startup Settings</source> - <translation>Nastavení spuštění systému</translation> + <translation>Nastavení spouštění</translation> </message> <message> <location filename="../pages/getPage.cpp" line="45"/> <source>Automatically start applications or services</source> - <translation>Automaticky spustit aplikace nebo služby</translation> + <translation>Automaticky spouštět aplikace nebo služby</translation> </message> <message> <location filename="../pages/getPage.cpp" line="42"/> @@ -721,12 +721,12 @@ Přepsat je?</translation> <message> <location filename="../pages/getPage.cpp" line="43"/> <source>Theme</source> - <translation>Vzhled</translation> + <translation>Téma vzhledu</translation> </message> <message> <location filename="../pages/getPage.cpp" line="45"/> <source>Autostart</source> - <translation>Automatické spuštění</translation> + <translation>Automatické spouštění</translation> </message> <message> <location filename="../pages/getPage.cpp" line="46"/> @@ -781,17 +781,17 @@ Přepsat je?</translation> <message> <location filename="../pages/getPage.cpp" line="49"/> <source>Desktop Plugins</source> - <translation>Přídavné moduly pracovní plochy</translation> + <translation>Zásuvné moduly pracovní plochy</translation> </message> <message> <location filename="../pages/getPage.cpp" line="49"/> <source>Change what icons or tools are embedded on the desktop</source> - <translation>Změnit, které ikony nebo nástroje jsou usazeny na pracovní ploše</translation> + <translation>Změnit které ikony nebo nástroje jsou vsazeny do pracovní plochy</translation> </message> <message> <location filename="../pages/getPage.cpp" line="50"/> <source>Panels and Plugins</source> - <translation>Panely a přídavné moduly</translation> + <translation>Panely a zásuvné moduly</translation> </message> <message> <location filename="../pages/getPage.cpp" line="50"/> @@ -801,22 +801,22 @@ Přepsat je?</translation> <message> <location filename="../pages/getPage.cpp" line="51"/> <source>Menu Plugins</source> - <translation>Přídavné moduly nabídky</translation> + <translation>Zásuvné moduly nabídky</translation> </message> <message> <location filename="../pages/getPage.cpp" line="51"/> <source>Change what options are shown on the desktop context menu</source> - <translation>Změnit, které volby jsou ukázány v související nabídce pracovní plochy</translation> + <translation>Změnit které volby jsou zobrazovány v kontextové nabídce pracovní plochy</translation> </message> <message> <location filename="../pages/getPage.cpp" line="52"/> <source>Locale Settings</source> - <translation>Jazyková nastavení</translation> + <translation>Místní a jazyková nastavení</translation> </message> <message> <location filename="../pages/getPage.cpp" line="52"/> <source>Change the default locale settings for this user</source> - <translation>Změnit výchozí nastavení jazyka pro tohoto uživatele</translation> + <translation>Změnit výchozí místní a jazyková nastavení pro tohoto uživatele</translation> </message> <message> <location filename="../pages/getPage.cpp" line="52"/> @@ -844,7 +844,7 @@ Přepsat je?</translation> <message> <location filename="../ScriptDialog.ui" line="14"/> <source>Setup a JSON Menu Script</source> - <translation>Nastavit skript nabídky JSON</translation> + <translation>Nastavit JSON skript nabídky</translation> </message> <message> <location filename="../ScriptDialog.ui" line="25"/> @@ -865,12 +865,12 @@ Přepsat je?</translation> <location filename="../ScriptDialog.ui" line="54"/> <location filename="../ScriptDialog.ui" line="87"/> <source>...</source> - <translation>...</translation> + <translation>…</translation> </message> <message> <location filename="../ScriptDialog.ui" line="126"/> <source>Cancel</source> - <translation>Zrušit</translation> + <translation>Storno</translation> </message> <message> <location filename="../ScriptDialog.ui" line="133"/> @@ -908,7 +908,7 @@ Přepsat je?</translation> <message> <location filename="../ThemeDialog.ui" line="74"/> <source>Cancel</source> - <translation>Zrušit</translation> + <translation>Storno</translation> </message> <message> <location filename="../ThemeDialog.ui" line="94"/> @@ -924,15 +924,15 @@ Přepsat je?</translation> <location filename="../ThemeDialog.cpp" line="65"/> <location filename="../ThemeDialog.cpp" line="82"/> <source>Theme Exists</source> - <translation>Vzhled existuje</translation> + <translation>Téma vzhledu existuje</translation> </message> <message> <location filename="../ThemeDialog.cpp" line="65"/> <location filename="../ThemeDialog.cpp" line="82"/> <source>This theme already exists. Overwrite it?</source> - <translation>Tento vzhled již existuje. -Přepsat jej?</translation> + <translation>Toto téma vzhledu už v systému existuje. +Přepsat?</translation> </message> </context> <context> @@ -955,7 +955,7 @@ Přepsat jej?</translation> <message> <location filename="../mainWindow.ui" line="53"/> <source>Save current changes</source> - <translation>Uložit nynější změny</translation> + <translation>Uložit stávající změny</translation> </message> <message> <location filename="../mainWindow.ui" line="56"/> @@ -971,13 +971,13 @@ Přepsat jej?</translation> <location filename="../mainWindow.ui" line="64"/> <location filename="../mainWindow.ui" line="67"/> <source>Back to overall settings</source> - <translation>Zpět do obecných nastavení</translation> + <translation>Zpět do celkových nastavení</translation> </message> <message> <location filename="../mainWindow.ui" line="78"/> <location filename="../mainWindow.ui" line="81"/> <source>Select monitor/desktop to configure</source> - <translation>Vybrat obrazovku/pracovní plochu k nastavení</translation> + <translation>Vybrat obrazovku / pracovní plochu k nastavení</translation> </message> <message> <location filename="../mainWindow.cpp" line="130"/> @@ -987,7 +987,7 @@ Přepsat jej?</translation> <message> <location filename="../mainWindow.cpp" line="130"/> <source>This page currently has unsaved changes, do you wish to save them now?</source> - <translation>Tato strana má teď neuložené změny. Chcete je nyní uložit?</translation> + <translation>Na této stránce aktuálně jsou neuložené změny. Chcete je nyní uložit?</translation> </message> </context> <context> @@ -1000,7 +1000,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_autostart.ui" line="39"/> <source>Add New Startup Service</source> - <translation>Přidat novou službu při spuštění</translation> + <translation>Přidat novou službu při spouštění</translation> </message> <message> <location filename="../pages/page_autostart.ui" line="75"/> @@ -1020,7 +1020,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_autostart.cpp" line="66"/> <source>Startup Services</source> - <translation>Služby při spuštění</translation> + <translation>Služby při spouštění</translation> </message> <message> <location filename="../pages/page_autostart.cpp" line="133"/> @@ -1063,12 +1063,12 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_compton.ui" line="32"/> <source>Disable Compositing Manager (session restart required)</source> - <translation>Zakázat kompozitního správce (požadováno opětovné spuštění sezení)</translation> + <translation>Vypnout kompozitního správce zobrazení (požadováno opětovné spuštění sezení)</translation> </message> <message> <location filename="../pages/page_compton.ui" line="39"/> <source>Only use compositing with GPU acceleration </source> - <translation>Použít pouze kompozici pomocí zrychlení přes grafický procesor </translation> + <translation>Použít pouze kompozici vykreslovanou prostředky grafického čipu </translation> </message> <message> <location filename="../pages/page_compton.cpp" line="37"/> @@ -1152,7 +1152,7 @@ Přepsat jej?</translation> <location filename="../pages/page_defaultapps.ui" line="128"/> <location filename="../pages/page_defaultapps.ui" line="138"/> <source>...</source> - <translation>...</translation> + <translation>…</translation> </message> <message> <location filename="../pages/page_defaultapps.cpp" line="42"/> @@ -1162,7 +1162,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_defaultapps.cpp" line="152"/> <source>Click to Set</source> - <translation>Klepnutím nastavit</translation> + <translation>Nastavte kliknutím</translation> </message> <message> <location filename="../pages/page_defaultapps.cpp" line="88"/> @@ -1205,7 +1205,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_keys.ui" line="107"/> <source>Action</source> - <translation>Činnost</translation> + <translation>Akce</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.ui" line="112"/> @@ -1235,7 +1235,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_keys.ui" line="184"/> <source>Note: Current key bindings need to be cleared and saved before they can be re-used.</source> - <translation>Poznámka: Nynější přiřazení kláves je třeba změnit a uložit, dříve než je bude možné opět použít.</translation> + <translation>Poznámka: Stávající přiřazení kláves je třeba vyčistit a uložit a až potom bude možné je znovu použít.</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.ui" line="220"/> @@ -1244,12 +1244,12 @@ Přepsat jej?</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.ui" line="244"/> - <source>"Mod1": Alt key -"Mod4": Windows/Mac key -"Control": Ctrl key</source> - <translation>"Mod1": Alt key -"Mod4": klávesa Windows/Mac -"Control": klávesa Ctrl</translation> + <source>"Mod1": Alt key +"Mod4": Windows/Mac key +"Control": Ctrl key</source> + <translation>"Mod1": Alt key +"Mod4": klávesa Windows/Mac +"Control": klávesa Ctrl</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="70"/> @@ -1259,27 +1259,27 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="78"/> <source>Audio Volume Up</source> - <translation>Zvýšit hlasitost zvuku</translation> + <translation>Zesílit zvuk</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="79"/> <source>Audio Volume Down</source> - <translation>Snížit hlasitost</translation> + <translation>Ztlumit zvuk</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="80"/> <source>Screen Brightness Up</source> - <translation>Zvýšit jas obrazovky</translation> + <translation>Zesvětlit obrazovku</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="81"/> <source>Screen Brightness Down</source> - <translation>Snížit jas obrazovky</translation> + <translation>Ztmavit obrazovku</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="82"/> <source>Take Screenshot</source> - <translation>Udělat snímek obrazovky</translation> + <translation>Zachytit snímek obrazovky</translation> </message> <message> <location filename="../pages/page_fluxbox_keys.cpp" line="83"/> @@ -1317,7 +1317,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_settings.ui" line="108"/> <source>Focus Policy</source> - <translation>Zaměřovací politika</translation> + <translation>Pravidlo zaměření okna</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.ui" line="118"/> @@ -1327,13 +1327,13 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_settings.ui" line="136"/> <source>Window Theme Preview</source> - <translation>Náhled na vzhled okna</translation> + <translation>Náhled vzhledu okna</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.ui" line="190"/> <location filename="../pages/page_fluxbox_settings.cpp" line="181"/> <source>No Preview Available</source> - <translation>Náhled není dostupný</translation> + <translation>Náhled není k dispozici</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="70"/> @@ -1343,12 +1343,12 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="75"/> <source>Click To Focus</source> - <translation>Klepnout pro zaměření</translation> + <translation>Zaměřit kliknutím</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="76"/> <source>Active Mouse Focus</source> - <translation>Činné zaměření myši</translation> + <translation>Aktivní zaměření myší</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="77"/> @@ -1358,12 +1358,12 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="80"/> <source>Align in a Row</source> - <translation>Zarovnat v řádku</translation> + <translation>Zarovnat vedle sebe</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="81"/> <source>Align in a Column</source> - <translation>Zarovnat ve sloupci</translation> + <translation>Zarovnat pod sebou</translation> </message> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="82"/> @@ -1373,7 +1373,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_fluxbox_settings.cpp" line="83"/> <source>Underneath Mouse</source> - <translation>Pod ukazovátkem myši</translation> + <translation>Pod ukazatelem myši</translation> </message> </context> <context> @@ -1386,7 +1386,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_interface_desktop.ui" line="26"/> <source>Embedded Utilities</source> - <translation>Začleněné obslužné programy</translation> + <translation>Vestavěné nástroje</translation> </message> <message> <location filename="../pages/page_interface_desktop.ui" line="79"/> @@ -1396,7 +1396,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_interface_desktop.ui" line="86"/> <source>Display Removable Media Icons</source> - <translation type="unfinished"></translation> + <translation>Zobrazovat ikony vyjímatelných médií</translation> </message> <message> <location filename="../pages/page_interface_desktop.cpp" line="56"/> @@ -1414,7 +1414,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_interface_menu.ui" line="38"/> <source>Context Menu Plugins</source> - <translation>Přídavné moduly pro související nabídku</translation> + <translation>Zásuvné moduly pro kontextovou nabídku</translation> </message> <message> <location filename="../pages/page_interface_menu.cpp" line="46"/> @@ -1437,7 +1437,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_interface_panels.ui" line="82"/> <source>Import</source> - <translation>Zavedení</translation> + <translation>Import</translation> </message> <message> <location filename="../pages/page_interface_panels.cpp" line="58"/> @@ -1455,7 +1455,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_main.ui" line="32"/> <source>Search for....</source> - <translation>Hledat...</translation> + <translation>Hledat…</translation> </message> <message> <location filename="../pages/page_main.cpp" line="56"/> @@ -1480,7 +1480,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_main.cpp" line="72"/> <source>System Settings</source> - <translation>Nastavení systému</translation> + <translation>Systémová nastavení</translation> </message> <message> <location filename="../pages/page_main.cpp" line="158"/> @@ -1498,7 +1498,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_locale.ui" line="32"/> <source>System localization settings (restart required)</source> - <translation>Nastavení jazyka systému (vyžaduje opětovné spuštění)</translation> + <translation>Nastavení jazyka systému (vyžaduje restart)</translation> </message> <message> <location filename="../pages/page_session_locale.ui" line="39"/> @@ -1528,7 +1528,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_locale.ui" line="89"/> <source>Collate</source> - <translation>Seřadit</translation> + <translation>Řazení</translation> </message> <message> <location filename="../pages/page_session_locale.ui" line="99"/> @@ -1556,32 +1556,32 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_options.ui" line="34"/> <source>Enable numlock on startup</source> - <translation>Povolit zapnutí číslicové klávesnice (NumLock) při spuštění</translation> + <translation>Zapnout číselný blok klávesnice (NumLock) při spuštění</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="41"/> <source>Play chimes on startup</source> - <translation>Při spuštění systému přehrávat zvonky</translation> + <translation>Doprovázet spouštění systému zvuky</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="48"/> <source>Play chimes on exit</source> - <translation>Při ukončení systému přehrávat zvonky</translation> + <translation>Doprovázet vypínání systému zvuky</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="55"/> <source>Automatically create/remove desktop symlinks for applications that are installed/removed</source> - <translation>Automaticky vytvořit/odstranit symbolické odkazy na pracovní plochu pro programy, jež jsou nainstalovány/odebrány</translation> + <translation>Automaticky vytvořit/odstranit symbolické odkazy na pracovní plochu pro aplikace, které jsou nainstalovány/odebrány</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="58"/> <source>Manage desktop app links</source> - <translation>Spravovat odkazy na programy na pracovní ploše</translation> + <translation>Spravovat odkazy na aplikace na pracovní ploše</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="65"/> <source>Show application crash data</source> - <translation>Ukázat údaje o pádu programu</translation> + <translation>Zobrazit údaje o pádu aplikace</translation> </message> <message> <location filename="../pages/page_session_options.ui" line="74"/> @@ -1633,12 +1633,12 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_options.cpp" line="18"/> <source>Time (Date as tooltip)</source> - <translation>Čas (datum jako nástrojová rada)</translation> + <translation>Čas (datum jako v bublinovém popisku)</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="19"/> <source>Date (Time as tooltip)</source> - <translation>Datum (čas jako nástrojová rada)</translation> + <translation>Datum (čas v bublinovém popisku)</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="20"/> @@ -1668,7 +1668,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_options.cpp" line="129"/> <source>Reset User Image</source> - <translation>Nastavit obrázek uživatele znovu</translation> + <translation>Vrátit obrázek uživatele na výchozí</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="129"/> @@ -1713,7 +1713,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_options.cpp" line="175"/> <source>%1: AM/PM (12-hour) clock (upper or lower case)</source> - <translation>%1: AM/PM (12-hodinové) hodiny (velká nebo malá písmena)</translation> + <translation>%1: Dop./Odp. (12-hodinové) hodiny (velká nebo malá písmena)</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="176"/> @@ -1748,7 +1748,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_options.cpp" line="195"/> <source>%1: Day as full name (localized)</source> - <translation>%1: Den jako plný název (lokalizovaný)</translation> + <translation>%1: Den jako úplný název (lokalizovaný)</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="196"/> @@ -1768,7 +1768,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_options.cpp" line="199"/> <source>%1: Month as full name (localized)</source> - <translation>%1: Měsíc jako plný název (lokalizovaný)</translation> + <translation>%1: Měsíc jako úplný název (lokalizovaný)</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="200"/> @@ -1783,7 +1783,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_session_options.cpp" line="202"/> <source>Text may be contained within single-quotes to ignore replacements</source> - <translation>Text musí být v jednoduchých závorkách, aby se přehlížela nahrazení</translation> + <translation>Text může obklopen jednoduchými uvozovkami, aby byla přehlížena nahrazování</translation> </message> <message> <location filename="../pages/page_session_options.cpp" line="203"/> @@ -1801,7 +1801,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_theme.ui" line="36"/> <source>Desktop Theme</source> - <translation>Vzhled plochy</translation> + <translation>Téma vzhledu plochy</translation> </message> <message> <location filename="../pages/page_theme.ui" line="42"/> @@ -1821,7 +1821,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_theme.ui" line="70"/> <source>Theme Template:</source> - <translation>Šablony vzhledů:</translation> + <translation>Šablona vzhledu:</translation> </message> <message> <location filename="../pages/page_theme.ui" line="86"/> @@ -1847,22 +1847,22 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_theme.ui" line="138"/> <source>Icon Pack:</source> - <translation>Balík symbolů:</translation> + <translation>Balík ikon:</translation> </message> <message> <location filename="../pages/page_theme.ui" line="148"/> <source>Mouse Cursors:</source> - <translation>Ukazovátka myši:</translation> + <translation>Ukazatele myši:</translation> </message> <message> <location filename="../pages/page_theme.ui" line="192"/> <source>Application Themes</source> - <translation>Vzhledy programů</translation> + <translation>Témata vzhledu aplikací</translation> </message> <message> <location filename="../pages/page_theme.ui" line="198"/> <source>Qt5 Theme Engine</source> - <translation>Stroj vzhledu Qt5</translation> + <translation>Engine téma vzhledu pro Qt5</translation> </message> <message> <location filename="../pages/page_theme.cpp" line="58"/> @@ -1911,7 +1911,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_wallpaper.ui" line="100"/> <source>Rotate Background</source> - <translation>Otočit pozadí</translation> + <translation>Střídat pozadí</translation> </message> <message> <location filename="../pages/page_wallpaper.ui" line="107"/> @@ -1963,12 +1963,12 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_wallpaper.cpp" line="120"/> <source>Directory (Single)</source> - <translation>Adresář (jeden)</translation> + <translation>Složka (jediná)</translation> </message> <message> <location filename="../pages/page_wallpaper.cpp" line="121"/> <source>Directory (Recursive)</source> - <translation>Adresář (rekurzivní)</translation> + <translation>Složka (vnořená)</translation> </message> <message> <location filename="../pages/page_wallpaper.cpp" line="122"/> @@ -2028,7 +2028,7 @@ Přepsat jej?</translation> <message> <location filename="../pages/page_wallpaper.cpp" line="142"/> <source>(use system default)</source> - <translation>(Použít výchozí nastavení systému)</translation> + <translation>(použít výchozí nastavení systému)</translation> </message> <message> <location filename="../pages/page_wallpaper.cpp" line="162"/> @@ -2044,7 +2044,7 @@ Přepsat jej?</translation> <location filename="../pages/page_wallpaper.cpp" line="233"/> <location filename="../pages/page_wallpaper.cpp" line="258"/> <source>Find Background Image Directory</source> - <translation>Najít adresář s obrázky pozadí</translation> + <translation>Najít složku s obrázky pozadí</translation> </message> </context> </TS> diff --git a/src-qt5/core-utils/lumina-config/mainWindow.ui b/src-qt5/core-utils/lumina-config/mainWindow.ui index 70e9895c..c4462f94 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.ui +++ b/src-qt5/core-utils/lumina-config/mainWindow.ui @@ -10,18 +10,12 @@ <height>400</height> </rect> </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> <widget class="QWidget" name="centralwidget"/> <widget class="QStatusBar" name="statusbar"/> <widget class="QToolBar" name="toolBar"> <property name="contextMenuPolicy"> <enum>Qt::CustomContextMenu</enum> </property> - <property name="windowTitle"> - <string>toolBar</string> - </property> <property name="movable"> <bool>false</bool> </property> diff --git a/src-qt5/core-utils/lumina-search/i18n/lumina-search_cs.ts b/src-qt5/core-utils/lumina-search/i18n/lumina-search_cs.ts index c7230c3a..3ed77603 100644 --- a/src-qt5/core-utils/lumina-search/i18n/lumina-search_cs.ts +++ b/src-qt5/core-utils/lumina-search/i18n/lumina-search_cs.ts @@ -16,12 +16,12 @@ <message> <location filename="../ConfigUI.ui" line="39"/> <source>...</source> - <translation>...</translation> + <translation>…</translation> </message> <message> <location filename="../ConfigUI.ui" line="48"/> <source>Excluded Directories</source> - <translation>Vyloučené adresáře</translation> + <translation>Vynechané složky</translation> </message> <message> <location filename="../ConfigUI.ui" line="119"/> @@ -31,12 +31,12 @@ <message> <location filename="../ConfigUI.cpp" line="41"/> <source>Select Search Directory</source> - <translation>Vyberte adresář pro hledání</translation> + <translation>Vyberte složku ve které hledat</translation> </message> <message> <location filename="../ConfigUI.cpp" line="54"/> <source>Exclude Directories</source> - <translation>Vyloučit adresáře</translation> + <translation>Vynechat složky</translation> </message> </context> <context> @@ -44,7 +44,7 @@ <message> <location filename="../MainUI.ui" line="14"/> <source>Search For...</source> - <translation>Hledat...</translation> + <translation>Co hledat…</translation> </message> <message> <location filename="../MainUI.ui" line="23"/> @@ -54,12 +54,12 @@ <message> <location filename="../MainUI.ui" line="30"/> <source>Configure search parameters</source> - <translation>Konfigurace parametrů hledání</translation> + <translation>Nastavení parametrů hledání</translation> </message> <message> <location filename="../MainUI.ui" line="40"/> <source>Stop Active Search</source> - <translation>Zastavit aktivní hledání</translation> + <translation>Zastavit probíhající hledání</translation> </message> <message> <location filename="../MainUI.ui" line="54"/> @@ -121,7 +121,7 @@ <message> <location filename="../MainUI.cpp" line="98"/> <source>Search: %1 -- Smart: %2</source> - <translation>Hledat: %1 -- Chytrý: %2</translation> + <translation>Hledat: %1 -- Chytré: %2</translation> </message> <message> <location filename="../MainUI.cpp" line="101"/> @@ -139,12 +139,12 @@ <message> <location filename="../Worker.cpp" line="42"/> <source>Searching: %1</source> - <translation>Hledám: %1</translation> + <translation>Hledání: %1</translation> </message> <message> <location filename="../Worker.cpp" line="64"/> <source>Starting Search: %1</source> - <translation>Spuštění hledání: %1</translation> + <translation>Spouštění hledání: %1</translation> </message> <message> <location filename="../Worker.cpp" line="112"/> diff --git a/src-qt5/core/libLumina/DesktopSettings.cpp b/src-qt5/core/libLumina/DesktopSettings.cpp index 47dc29de..8bda1ac5 100644 --- a/src-qt5/core/libLumina/DesktopSettings.cpp +++ b/src-qt5/core/libLumina/DesktopSettings.cpp @@ -238,6 +238,8 @@ QString DesktopSettings::rel_path(DesktopSettings::File file){ name="keys"; break; case DesktopSettings::Theme: name="theme"; break; + case DesktopSettings::Animation: + name="animations"; break; } return FILEPREFIX+name+".conf"; } diff --git a/src-qt5/core/libLumina/DesktopSettings.h b/src-qt5/core/libLumina/DesktopSettings.h index 57a85791..dcb10bb6 100644 --- a/src-qt5/core/libLumina/DesktopSettings.h +++ b/src-qt5/core/libLumina/DesktopSettings.h @@ -25,7 +25,7 @@ class DesktopSettings : public QObject{ Q_OBJECT public: - enum File{ System, Favorites, Environment, Session, Desktop, ContextMenu, Keys, Theme }; + enum File{ System, Favorites, Environment, Session, Desktop, ContextMenu, Keys, Theme, Animation }; DesktopSettings(QObject *parent = 0); ~DesktopSettings(); diff --git a/src-qt5/core/libLumina/ExternalProcess.h b/src-qt5/core/libLumina/ExternalProcess.h index a8a5e605..b1e56af8 100644 --- a/src-qt5/core/libLumina/ExternalProcess.h +++ b/src-qt5/core/libLumina/ExternalProcess.h @@ -44,7 +44,7 @@ private slots: } public: - ExternalProcess(QString logfile = "", bool manageCursors = true) : QProcess(){ + ExternalProcess(QString logfile = "", bool manageCursors = false) : QProcess(){ this->setProcessChannelMode(QProcess::MergedChannels); cursorRestored = !manageCursors; if(logfile.isEmpty()){ @@ -62,9 +62,9 @@ public: }*/ } - static void launch(QString program, QStringList args = QStringList()){ + static void launch(QString program, QStringList args = QStringList(), bool manageCursors = false){ //Quick launch of a process with logging disabled and automatic cleanup - ExternalProcess *tmp = new ExternalProcess(); + ExternalProcess *tmp = new ExternalProcess("", manageCursors); if(args.isEmpty()){ tmp->start(program); } else{ tmp->start(program, args); } } diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.cpp b/src-qt5/core/libLumina/NativeEmbedWidget.cpp index 80c843e0..ed0fd89c 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.cpp +++ b/src-qt5/core/libLumina/NativeEmbedWidget.cpp @@ -37,8 +37,8 @@ inline void registerClientEvents(WId id){ // ============ //Simplification functions for the XCB/XLib interactions void NativeEmbedWidget::syncWinSize(QSize sz){ - if(WIN==0){ return; } - if(!sz.isValid()){ sz = this->size(); } //use the current widget size + if(WIN==0 ){ return; } + else if(!sz.isValid()){ sz = this->size(); } //use the current widget size //qDebug() << "Sync Window Size:" << sz; if(sz == winSize){ return; } //no change const uint32_t valList[2] = {(uint32_t) sz.width(), (uint32_t) sz.height()}; @@ -58,9 +58,11 @@ void NativeEmbedWidget::hideWindow(){ void NativeEmbedWidget::showWindow(){ xcb_map_window(QX11Info::connection(), WIN->id()); + QTimer::singleShot(0,this, SLOT(repaintWindow())); } QImage NativeEmbedWidget::windowImage(QRect geom){ + //if(paused){ return QImage(); } //Pull the XCB pixmap out of the compositing layer xcb_pixmap_t pix = xcb_generate_id(QX11Info::connection()); xcb_composite_name_window_pixmap(QX11Info::connection(), WIN->id(), pix); @@ -85,7 +87,8 @@ QImage NativeEmbedWidget::windowImage(QRect geom){ // ============ NativeEmbedWidget::NativeEmbedWidget(QWidget *parent) : QWidget(parent){ WIN = 0; //nothing embedded yet - this->setSizeIncrement(2,2); + paused = false; + //this->setSizeIncrement(2,2); } bool NativeEmbedWidget::embedWindow(NativeWindow *window){ @@ -141,9 +144,22 @@ bool NativeEmbedWidget::isEmbedded(){ // ============== // PUBLIC SLOTS // ============== +//Pause/resume +void NativeEmbedWidget::pause(){ + if(winImage.isNull()){ repaintWindow(); } //make sure we have one image already cached first + paused = true; +} + +void NativeEmbedWidget::resume(){ + paused = false; + //syncWinSize(); + //showWindow(); + repaintWindow(); //update the cached image right away +} + void NativeEmbedWidget::resyncWindow(){ if(WIN==0){ return; } - return; //skip the stuff below (not working) + /*return; //skip the stuff below (not working) QRect geom = WIN->geometry(); //Send an artificial configureNotify event to the window with the global position/size included xcb_configure_notify_event_t event; @@ -158,12 +174,28 @@ void NativeEmbedWidget::resyncWindow(){ event.event = WIN->id(); event.response_type = XCB_CONFIGURE_NOTIFY; xcb_send_event(QX11Info::connection(), false, WIN->id(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY, (const char *) &event); - - xcb_flush(QX11Info::connection()); + */ + //Just jitter the window size by 1 pixel really quick so the window knows to update it's geometry + QSize sz = this->size(); + uint32_t valList[2] = {(uint32_t) sz.width()-1, (uint32_t) sz.height()}; + uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; + xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); + xcb_flush(QX11Info::connection()); + valList[0] = (uint32_t) sz.width(); + xcb_configure_window(QX11Info::connection(), WIN->id(), mask, valList); + xcb_flush(QX11Info::connection()); + syncWinSize(); + QTimer::singleShot(0, this, SLOT(repaintWindow()) ); } void NativeEmbedWidget::repaintWindow(){ - this->update(); + //qDebug() << "Update Window Image:" << !paused; + if(paused){ return; } + QImage tmp = windowImage( QRect(QPoint(0,0), this->size()) ); + if(!tmp.isNull()){ + winImage = tmp; + }//else{ qDebug() << "Got Null Image!!"; } + this->parentWidget()->update(); } // ============== // PROTECTED @@ -186,23 +218,30 @@ void NativeEmbedWidget::hideEvent(QHideEvent *ev){ } void NativeEmbedWidget::paintEvent(QPaintEvent *ev){ - //QWidget::paintEvent(ev); //ensure all the Qt-compositing is done first - if(this->size()!=winSize){ return; } //do not paint here - waiting to re-sync the sizes if(WIN==0){ QWidget::paintEvent(ev); return; } + else if( winImage.isNull() ){ /*QTimer::singleShot(0, this, SLOT(repaintWindow()) );*/ return; } + else if(paused){ return; } + //else if(this->size()!=winSize){ QTimer::singleShot(0,this, SLOT(syncWinSize())); return; } //do not paint here - waiting to re-sync the sizes + //else if(this->size() != winImage.size()){ QTimer::singleShot(0, this, SLOT(repaintWindow()) ); return; } //Need to paint the image from the window onto the widget as an overlay - QRect geom = QRect(0,0,this->width(), this->height()); //always paint the whole window - //qDebug() << "Get Paint image:" << ev->rect() << geom; - //geom = ev->rect(); //atomic updates - //geom.adjust(-1,-1,1,1); //add an additional pixel in each direction to be painted - //geom = geom.intersected(QRect(0,0,this->width(), this->height())); //ensure intersection with actual window - QImage img = windowImage(geom); - if(!img.isNull()){ - if(img.size() != geom.size()){ return; } + QRect geom = ev->rect(); //atomic updates + geom.adjust(-10,-10,10,10); //add an additional few pixels in each direction to be painted + geom = geom.intersected(QRect(0,0,this->width(), this->height())); //ensure intersection with actual window + if( !QRect(QPoint(0,0),winImage.size()).contains(geom) ){ QTimer::singleShot(0,this, SLOT(repaintWindow()) );return; } QPainter P(this); - P.drawImage( geom , img, QRect(geom.topLeft(), img.size()), Qt::NoOpaqueDetection); //1-to-1 mapping - //qDebug() << "Painted Rect:" << ev->rect() << this->geometry(); + P.setClipping(true); + P.setClipRect(0,0,this->width(), this->height()); + //qDebug() << "Paint Embed Window:" << geom << winImage.size(); + if(winImage.size() == this->size()){ + P.drawImage( geom , winImage, geom, Qt::NoOpaqueDetection); //1-to-1 mapping + //Note: Qt::NoOpaqueDetection Speeds up the paint by bypassing the checks to see if there are [semi-]transparent pixels + // Since this is an embedded image - we fully expect there to be transparency all/most of the time. + }else{ + P.drawImage( geom , winImage); + } + //else{ QImage scaled = winImage.scaled(geom.size()); P.drawImage(geom, scaled); } + //P.drawImage( geom , winImage, geom, Qt::NoOpaqueDetection); //1-to-1 mapping //Note: Qt::NoOpaqueDetection Speeds up the paint by bypassing the checks to see if there are [semi-]transparent pixels - // Since this is an embedded image - we fully expect there to be transparency most of the time. - } - //qDebug() << "Done Painting"; + // Since this is an embedded image - we fully expect there to be transparency all/most of the time. + } diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.h b/src-qt5/core/libLumina/NativeEmbedWidget.h index 78c11dfc..65e03c51 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.h +++ b/src-qt5/core/libLumina/NativeEmbedWidget.h @@ -24,6 +24,8 @@ class NativeEmbedWidget : public QWidget{ private: NativeWindow *WIN; QSize winSize; + QImage winImage; + bool paused; private slots: //Simplification functions @@ -41,7 +43,13 @@ public: bool detachWindow(); bool isEmbedded(); //status of the embed + + public slots: + //Pause/resume + void pause(); + void resume(); + void resyncWindow(); void repaintWindow(); diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/core/libLumina/NativeWindow.cpp index 94d39cb7..3c76ed00 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/core/libLumina/NativeWindow.cpp @@ -86,14 +86,23 @@ void NativeWindow::requestProperties(QList<NativeWindow::Property> props, QList< QRect NativeWindow::geometry(){ //Calculate the "full" geometry of the window + frame (if any) - QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), hash.value(NativeWindow::Size).toSize() ); + //Check that the size is between the min/max limitations + QSize size = hash.value(NativeWindow::Size).toSize(); + QSize min = hash.value(NativeWindow::MinSize).toSize(); + QSize max = hash.value(NativeWindow::MaxSize).toSize(); + if(min.isValid() && min.width() > size.width() ){ size.setWidth(min.width()); } + if(min.isValid() && min.height() > size.height()){ size.setHeight(min.height()); } + if(max.isValid() && max.width() < size.width() && max.width()>min.width()){ size.setWidth(max.width()); } + if(max.isValid() && max.height() < size.height() && max.height()>min.height()){ size.setHeight(max.height()); } + //Assemble the full geometry + QRect geom( hash.value(NativeWindow::GlobalPos).toPoint(), size ); //Now adjust the window geom by the frame margins QList<int> frame = hash.value(NativeWindow::FrameExtents).value< QList<int> >(); //Left,Right,Top,Bottom - qDebug() << "Calculate Geometry:" << geom << frame; + //qDebug() << "Calculate Geometry:" << geom << frame; if(frame.length()==4){ geom = geom.adjusted( -frame[0], -frame[2], frame[1], frame[3] ); } - qDebug() << " - Total:" << geom; + //qDebug() << " - Total:" << geom; return geom; } // ==== PUBLIC SLOTS === diff --git a/src-qt5/core/libLumina/RootSubWindow-animations.cpp b/src-qt5/core/libLumina/RootSubWindow-animations.cpp new file mode 100644 index 00000000..ac813e3a --- /dev/null +++ b/src-qt5/core/libLumina/RootSubWindow-animations.cpp @@ -0,0 +1,97 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootSubWindow.h" +#include <QDebug> + +QStringList RootSubWindow::validAnimations(NativeWindow::Property prop){ + QStringList valid; + if(prop == NativeWindow::Visible){ + valid << "zoom" << "wipe-center-vertical" << "wipe-center-horizontal" << "shade-top" << "shade-right" << "shade-left" << "shade-bottom"; + } + return valid; +} + +void RootSubWindow::loadAnimation(QString name, NativeWindow::Property prop, QVariant nval){ + animResetProp.clear(); + //Special case - random animation each time + if(name=="random"){ + QStringList valid = validAnimations(prop); + name = valid.at(qrand()%valid.length()); + } + //Now setup the animation + if(prop == NativeWindow::Visible){ + //NOTE: Assigns values for "invisible->visible" animation: will reverse it afterwards as needed + anim->setPropertyName("geometry"); + QRect geom = this->geometry(); + if(name == "zoom"){ + //Zoom to/from the center point + anim->setStartValue( QRect(geom.center(), QSize(0,0)) ); + anim->setEndValue(geom); + }else if(name == "wipe-center-vertical"){ + anim->setStartValue( QRect( geom.center().x(), geom.y(), 0, geom.height()) ); + anim->setEndValue( geom ); + }else if(name == "wipe-center-horizontal"){ + anim->setStartValue( QRect( geom.x(), geom.center().y(), geom.width(), 0) ); + anim->setEndValue( geom ); + }else if(name == "shade-top"){ + anim->setStartValue( QRect( geom.x(), geom.y(), geom.width(), 0) ); + anim->setEndValue( geom ); + }else if(name == "shade-bottom"){ + anim->setStartValue( QRect( geom.x(), geom.y()+geom.height(), geom.width(), 0) ); + anim->setEndValue( geom ); + }else if(name == "shade-left"){ + anim->setStartValue( QRect( geom.x(), geom.y(), 0, geom.height()) ); + anim->setEndValue( geom ); + }else if(name == "shade-right"){ + anim->setStartValue( QRect( geom.x()+geom.width(), geom.y(), 0, geom.height()) ); + anim->setEndValue( geom ); + }else{ + //Invalid/None animation + if(nval.toBool()){ this->show(); } + else{ this->hide(); } + return; + } + if(nval.toBool()){ + this->setGeometry( anim->startValue().toRect() ); //ensure the window is the initial geom before it becomes visible + }else{ + QVariant tmp = anim->startValue(); + anim->setStartValue(anim->endValue()); + anim->setEndValue(tmp); + animResetProp = anim->startValue(); + QTimer::singleShot(anim->duration(), this, SLOT(hide()) ); + } + WinWidget->pause(); + anim->start(); + this->show(); + } //end of Visibility animation +} + +void RootSubWindow::animFinished(){ + if(closing){ this->close(); return;} + else if(anim->propertyName()=="geometry"){ + if(!animResetProp.isNull()){ + /*qDebug() << "Animation Finished, Reset Geometry:" << animResetProp.toRect(); + qDebug() << " - Starting Value:" << anim->startValue().toRect(); + qDebug() << " - Ending Value:" << anim->endValue().toRect();*/ + this->setGeometry( animResetProp.toRect() ); + //Also ensure that the proper geometry is saved to the window structure + QRect curg = this->geometry(); + QRect wing = WIN->geometry(); + //qDebug() << " - After Animation Reset:" << curg << wing; + if(curg!=wing){ + QRect clientg = clientGlobalGeom(); + //qDebug() << "Sub Window geometry:" << clientg; + WIN->setProperties(QList< NativeWindow::Property>() << NativeWindow::Size << NativeWindow::GlobalPos, + QList<QVariant>() << clientg.size() << clientg.topLeft() ); + WinWidget->resyncWindow(); //also let the window know about the current geometry + } + } + } + animResetProp = QVariant(); //clear the variable + WinWidget->resume(); + +} diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 9ef6464e..322e524f 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -14,6 +14,7 @@ #define WIN_BORDER 5 #include <LIconCache.h> +#include <DesktopSettings.h> // === PUBLIC === RootSubWindow::RootSubWindow(QWidget *root, NativeWindow *win) : QFrame(root){ @@ -246,6 +247,14 @@ void RootSubWindow::LoadProperties( QList< NativeWindow::Property> list){ propertiesChanged(list, vals); } +QRect RootSubWindow::clientGlobalGeom(){ + QRect tot = this->geometry(); + QList<int> frame = WIN->property(NativeWindow::FrameExtents).value< QList<int> >(); + //Now adjust this to take out the frame + tot.adjust(frame[0], frame[2], -frame[1], -frame[3]); + return tot; +} + // === PUBLIC SLOTS === void RootSubWindow::clientClosed(){ //qDebug() << "Client Closed"; @@ -257,9 +266,9 @@ void RootSubWindow::LoadAllProperties(){ QList< NativeWindow::Property> list; list << NativeWindow::WinTypes << NativeWindow::WinActions << NativeWindow::States << NativeWindow::MinSize << NativeWindow::MaxSize << NativeWindow::Title << NativeWindow::ShortTitle - << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos << NativeWindow::Visible << NativeWindow::Active; + << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos;// << NativeWindow::Visible << NativeWindow::Active; LoadProperties(list); - WIN->requestProperty(NativeWindow::Visible, true); + //WIN->requestProperty(NativeWindow::Visible, true); } //Button Actions - public so they can be tied to key shortcuts and stuff as well @@ -296,6 +305,7 @@ void RootSubWindow::startMoving(){ activeState = Move; offset = this->mapFromGlobal(curpt); setMouseCursor(activeState, true); //this one is an override cursor + //WinWidget->pause(); //Also need to capture the mouse this->grabMouse(); } @@ -312,24 +322,8 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList switch(props[i]){ case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); - if(vals[i].toBool()){ - if(lastGeom.isNull()){ animResetProp = this->geometry(); } - else{ animResetProp = lastGeom; } - anim->setPropertyName("geometry"); - anim->setStartValue( QRect(animResetProp.toRect().center(), QSize(0,0)) ); - anim->setEndValue(animResetProp); - this->setGeometry( anim->startValue().toRect() ); //ensure the window is the initial geom before it becomes visible - anim->start(); - this->show(); - }else{ - animResetProp = this->geometry(); //hide event - should already be the right geom - lastGeom = this->geometry(); - anim->setPropertyName("geometry"); - anim->setStartValue(this->geometry()); - anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); - anim->start(); - QTimer::singleShot(anim->duration(), this, SLOT(hide()) ); - } + if(vals[i].toBool()){ loadAnimation( DesktopSettings::instance()->value(DesktopSettings::Animation, "window/appear", "random").toString(), NativeWindow::Visible, vals[i]); } + else{ loadAnimation( DesktopSettings::instance()->value(DesktopSettings::Animation, "window/disappear", "random").toString(), NativeWindow::Visible, vals[i]); } break; case NativeWindow::Title: titleLabel->setText(vals[i].toString()); @@ -340,11 +334,6 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList else{ otherB->setIcon(vals[i].value<QIcon>()); } break; case NativeWindow::GlobalPos: - //qDebug() << "Got Global Pos:" << this->pos() << WinWidget->mapToGlobal(QPoint(0,0)) << WIN->geometry().topLeft() << vals[i].toPoint(); - if(activeState == RootSubWindow::Normal){ - this->move( WIN->geometry().topLeft() ); - } - break; case NativeWindow::Size: //qDebug() << " - SIZE CHANGE"; if(WIN->property(NativeWindow::FrameExtents).isNull() && (i<props.indexOf(NativeWindow::FrameExtents)) ){ @@ -353,16 +342,25 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList vals << vals.takeAt(i); i--; }else if(anim->state() != QPropertyAnimation::Running ){ - if(vals[i].toSize() != WinWidget->size() && activeState==Normal){ - //qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); - WinWidget->resize(vals[i].toSize()); - this->resize( WIN->geometry().size() ); - //qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + if(WIN->property(NativeWindow::Size).toSize() != WinWidget->size() && activeState==Normal ){ + this->setGeometry(WIN->geometry()); } } break; case NativeWindow::MinSize: - WinWidget->setMinimumSize(vals[i].toSize()); + if(vals[i].toSize().isValid()){ + //Just larger than titlebar, with enough space for 8 characters in the titlebar (+4 buttons) + //qDebug() << "Got invalid Min Size: Set a reasonable default minimum"; + WinWidget->setMinimumSize( QSize( this->fontMetrics().height()*4 + this->fontMetrics().width("O")*10, this->fontMetrics().height()*10) ); + WIN->setProperty(NativeWindow::MinSize, WinWidget->minimumSize()); + }else{ + WinWidget->setMinimumSize(vals[i].toSize()); + } + if(WIN->property(NativeWindow::Size).toSize().width() < WinWidget->minimumSize().width() \ + || WIN->property(NativeWindow::Size).toSize().height() < WinWidget->minimumSize().height() ){ + WIN->setProperty(NativeWindow::Size, WinWidget->minimumSize(), true); //force this + //WinWidget->resize(WinWidget->minimumSize()); + } break; case NativeWindow::MaxSize: WinWidget->setMaximumSize(vals[i].toSize()); @@ -388,20 +386,6 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList } } -void RootSubWindow::animFinished(){ - if(closing){ this->close(); return;} - else if(anim->propertyName()=="geometry"){ - if(!animResetProp.isNull()){ - /*qDebug() << "Animation Finished, Reset Geometry:" << animResetProp; - qDebug() << " - Starting Value:" << anim->startValue(); - qDebug() << " - Ending Value:" << anim->endValue(); - qDebug() << " - Current Value:" << this->geometry();*/ - this->setGeometry( animResetProp.toRect() ); - } - } - animResetProp = QVariant(); //clear the variable -} - // === PROTECTED === void RootSubWindow::mousePressEvent(QMouseEvent *ev){ activate(); @@ -409,7 +393,7 @@ void RootSubWindow::mousePressEvent(QMouseEvent *ev){ //qDebug() << "Frame Mouse Press Event"; offset.setX(0); offset.setY(0); if(activeState != Normal){ return; } // do nothing - already in a state of grabbed mouse - this->activate(); + //this->activate(); if(this->childAt(ev->pos())!=0){ //Check for any non-left-click event and skip it if(ev->button()!=Qt::LeftButton){ return; } @@ -420,6 +404,8 @@ void RootSubWindow::mousePressEvent(QMouseEvent *ev){ activeState = getStateAtPoint(ev->pos(), true); //also have it set the offset variable } setMouseCursor(activeState, true); //this one is an override cursor + //if(activeState!=Normal){WinWidget->pause(); } + if(activeState!=Normal && activeState!=Move){WinWidget->pause(); } QFrame::mousePressEvent(ev); } @@ -498,7 +484,9 @@ void RootSubWindow::mouseMoveEvent(QMouseEvent *ev){ default: break; } - this->setGeometry(geom); + //if( (geom.width()%2==0 && geom.height()%2==0) || activeState==Move){ + this->setGeometry(geom); + //} } QFrame::mouseMoveEvent(ev); } @@ -511,6 +499,8 @@ void RootSubWindow::mouseReleaseEvent(QMouseEvent *ev){ otherM->popup(ev->globalPos()); return; } + if(activeState!=Normal){ WinWidget->resume(); } + if(activeState!=Normal && activeState!=Move){WinWidget->resume(); } activeState = Normal; QApplication::restoreOverrideCursor(); setMouseCursor( getStateAtPoint(ev->pos()) ); @@ -529,8 +519,5 @@ void RootSubWindow::moveEvent(QMoveEvent *ev){ QFrame::moveEvent(ev); if(!closing && anim->state()!=QAbstractAnimation::Running){ moveTimer->start(); - //WinWidget->resyncWindow(); - //WIN->requestProperty(NativeWindow::GlobalPos, ev->pos() ); } - } diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index de6aba89..079a6201 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -39,6 +39,7 @@ private: //Functions for getting/setting state ModState getStateAtPoint(QPoint pt, bool setoffset = false); //generally used for mouse location detection void setMouseCursor(ModState, bool override = false); //Update the mouse cursor based on state + //Native window embed objects NativeWindow *WIN; NativeEmbedWidget *WinWidget; @@ -60,10 +61,14 @@ private: void LoadProperties( QList< NativeWindow::Property> list); + static QStringList validAnimations(NativeWindow::Property); + public slots: void clientClosed(); void LoadAllProperties(); + QRect clientGlobalGeom(); + //Button Actions - public so they can be tied to key shortcuts and stuff as well void toggleMinimize(); void toggleMaximize(); @@ -77,6 +82,8 @@ public slots: private slots: void propertiesChanged(QList<NativeWindow::Property>, QList<QVariant>); + + void loadAnimation(QString name, NativeWindow::Property, QVariant nval); //new val void animFinished(); protected: diff --git a/src-qt5/core/libLumina/RootWindow-mgmt.cpp b/src-qt5/core/libLumina/RootWindow-mgmt.cpp new file mode 100644 index 00000000..e00ce9ce --- /dev/null +++ b/src-qt5/core/libLumina/RootWindow-mgmt.cpp @@ -0,0 +1,34 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootWindow.h" + +//Primary/private function +void RootWindow::arrangeWindows(RootSubWindow *primary, QString type){ + if(primary==0){ + //Get the currently active window and treat that as the primary + + } + //Now loop over the windows and arrange them as needed + +} + +// ================ +// Public slots for starting the arrangement routine(s) above +// ================ +void RootWindow::ArrangeWindows(WId *primary, QString type){ + +} + +void RootWindow::TileWindows(WId *primary, QString type){ + +} + +void RootWindow::CheckWindowPosition(WId, bool newwindow){ + //used after a "drop" to validate/snap/re-arrange window(s) as needed + // if "newwindow" is true, then this is the first-placement routine for a window before it initially appears + +} diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/RootWindow.cpp index 31faaf50..596755df 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/RootWindow.cpp @@ -10,6 +10,8 @@ #include <QScreen> #include <QDebug> +#define DEBUG 1 + // === PUBLIC === RootWindow::RootWindow() : QWidget(0, Qt::Window | Qt::BypassWindowManagerHint | Qt::WindowStaysOnBottomHint){ qRegisterMetaType<WId>("WId"); @@ -100,12 +102,14 @@ void RootWindow::updateScreenPixmap(screeninfo *info){ // === PUBLIC SLOTS === void RootWindow::ResizeRoot(){ + if(DEBUG){ qDebug() << "Resize Root..."; } QList<QScreen*> scrns = QApplication::screens(); //Update all the screen locations and ID's in the WALLPAPERS list QRect fullscreen; QStringList valid; //Update the size of the rootWindow itself for(int i=0; i<scrns.length(); i++){ + if(DEBUG){ qDebug() << " - Found Screen:" << scrns[i]->name() << scrns[i]->geometry(); } fullscreen = fullscreen.united(scrns[i]->geometry()); valid << scrns[i]->name(); for(int j=0; j<WALLPAPERS.length(); j++){ @@ -129,11 +133,13 @@ void RootWindow::ResizeRoot(){ } } //Trigger a repaint and send out any signals + if(DEBUG){ qDebug() << " - FullScreen Geometry:" << fullscreen; } this->setGeometry(fullscreen); this->update(); emit RootResized(fullscreen); if(!valid.isEmpty()){ emit NewScreens(valid); } if(!invalid.isEmpty()){ emit RemovedScreens(invalid); } + if(DEBUG){ qDebug() << " - Geom after change:" << this->geometry(); } } void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QString file){ @@ -148,6 +154,7 @@ void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QStrin } } if(!found){ + ResizeRoot(); //Need to create a new screeninfo structure QList<QScreen*> scrns = QApplication::screens(); for(int i=0; i<scrns.length(); i++){ @@ -169,7 +176,7 @@ void RootWindow::ChangeWallpaper(QString id, RootWindow::ScaleType scale, QStrin void RootWindow::NewWindow(NativeWindow *win){ RootSubWindow *subwin = 0; - qDebug() << "Got New Window:" << win->property(NativeWindow::Title); + //qDebug() << "Got New Window:" << win->property(NativeWindow::Title); for(int i=0; i<WINDOWS.length() && subwin==0; i++){ if(WINDOWS[i]->id() == win->id()){ subwin = WINDOWS[i]; } } @@ -178,6 +185,7 @@ void RootWindow::NewWindow(NativeWindow *win){ connect(win, SIGNAL(WindowClosed(WId)), this, SLOT(CloseWindow(WId)) ); WINDOWS << subwin; } + CheckWindowPosition(win->id(), true); //first-time run //win->setProperty(NativeWindow::Visible, true); //win->requestProperty( NativeWindow::Active, true); win->requestProperties(QList<NativeWindow::Property>() << NativeWindow::Visible << NativeWindow::Active, QList<QVariant>() << true << true); @@ -185,7 +193,7 @@ void RootWindow::NewWindow(NativeWindow *win){ void RootWindow::CloseWindow(WId win){ for(int i=0; i<WINDOWS.length(); i++){ - if(WINDOWS[i]->id() == win){ qDebug() << "Remove Window From Root List"; WINDOWS.takeAt(i)->clientClosed(); break; } + if(WINDOWS[i]->id() == win){ WINDOWS.takeAt(i)->clientClosed(); break; } } } @@ -196,10 +204,12 @@ void RootWindow::paintEvent(QPaintEvent *ev){ //qDebug() << "RootWindow: PaintEvent:" << ev->rect(); //<< QDateTime::currentDateTime()->toString(QDateTime::ShortDate); bool found = false; QPainter painter(this); + QRect geom = ev->rect(); + geom.adjust(-10,-10,10,10); //give it a few more pixels in each direction to repaint (noticing some issues in Qt 5.7.1) for(int i=0; i<WALLPAPERS.length(); i++){ - if(WALLPAPERS[i].area.intersects(ev->rect()) ){ + if(WALLPAPERS[i].area.intersects(geom) ){ found = true; - QRect intersect = WALLPAPERS[i].area.intersected(ev->rect()); + QRect intersect = WALLPAPERS[i].area.intersected(geom); painter.drawPixmap( intersect, WALLPAPERS[i].wallpaper, intersect.translated(-WALLPAPERS[i].area.x(), -WALLPAPERS[i].area.y()) ); } } diff --git a/src-qt5/core/libLumina/RootWindow.h b/src-qt5/core/libLumina/RootWindow.h index a7792752..2fd76cea 100644 --- a/src-qt5/core/libLumina/RootWindow.h +++ b/src-qt5/core/libLumina/RootWindow.h @@ -18,10 +18,11 @@ #include <QTimer> #include <QApplication> #include <QPaintEvent> -//#include <QMdiArea> #include "RootSubWindow.h" -#include "NativeWindow.h" + +#include <NativeWindow.h> +#include <DesktopSettings.h> class RootWindow : public QWidget{ Q_OBJECT @@ -49,6 +50,7 @@ private: //Window Management QList<RootSubWindow*> WINDOWS; + void arrangeWindows(RootSubWindow *primary = 0, QString type = ""); public slots: void ResizeRoot(); @@ -58,6 +60,11 @@ public slots: void NewWindow(NativeWindow*); void CloseWindow(WId); //automatically connected for any new native window + //Window arrangement functions - defined in "RootWindow-mgmt.cpp" + void ArrangeWindows(WId *primary = 0, QString type = ""); + void TileWindows(WId *primary = 0, QString type = ""); + void CheckWindowPosition(WId, bool newwindow = false); //used after a "drop" to validate/snap/re-arrange window(s) as needed + private slots: protected: diff --git a/src-qt5/core/libLumina/RootWindow.pri b/src-qt5/core/libLumina/RootWindow.pri index e4d5f00b..9426b6b4 100644 --- a/src-qt5/core/libLumina/RootWindow.pri +++ b/src-qt5/core/libLumina/RootWindow.pri @@ -1,7 +1,9 @@ # Files SOURCES *= $${PWD}/RootWindow.cpp \ - $${PWD}/RootSubWindow.cpp + $${PWD}/RootWindow-mgmt.cpp \ + $${PWD}/RootSubWindow.cpp \ + $${PWD}/RootSubWindow-animations.cpp HEADERS *= $${PWD}/RootWindow.h \ $${PWD}/RootSubWindow.h @@ -12,3 +14,4 @@ INCLUDEPATH *= ${PWD} include(LUtils.pri) include(NativeWindow.pri) include(LIconCache.pri) +include(DesktopSettings.pri) diff --git a/src-qt5/core/libLumina/XDGMime.cpp b/src-qt5/core/libLumina/XDGMime.cpp new file mode 100644 index 00000000..3983f6b5 --- /dev/null +++ b/src-qt5/core/libLumina/XDGMime.cpp @@ -0,0 +1,362 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2013-2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "XDGMime.h" +#include <LUtils.h> +#include <LuminaOS.h> + +static QStringList mimeglobs; +static qint64 mimechecktime; + +QString XDGMime::fromFileName(QString filename){ + //Convert a filename into a mimetype + return findAppMimeForFile(filename.section("/",-1),false); +} + +QStringList XDGMime::listFromFileName(QString filename){ + //Convert a filename into a list of mimetypes (arranged in descending priority) + return findAppMimeForFile(filename.section("/",-1),true).split("::::"); +} +QString XDGMime::toIconName(QString mime){ + if(!mime.contains("/") || mime.isEmpty() ){ return "unknown"; } //not a mime type + //Mime type to icon name + mime.replace("/","-"); //translate to icon mime name + return mime; +} + + +QStringList XDGMime::toFileExtensions(QString mime){ + QStringList out; + QStringList mimes = XDGMime::loadMimeFileGlobs2().filter(mime); + for(int i=0; i<mimes.length(); i++){ + out << mimes[i].section(":",2,2); // "*.<extension>" + } + //qDebug() << "Mime to Files:" << mime << out; + return out; +} + +// ==================== +// BACKEND FUNCTIONS +// ==================== +QStringList XDGMime::systemMimeDirs(){ + //Returns a list of all the directories where *.xml MIME files can be found + QStringList appDirs = QString(getenv("XDG_DATA_HOME")).split(":"); + appDirs << QString(getenv("XDG_DATA_DIRS")).split(":"); + if(appDirs.isEmpty()){ appDirs << "/usr/local/share" << "/usr/share"; } + //Now create a valid list + QStringList out; + for(int i=0; i<appDirs.length(); i++){ + if( QFile::exists(appDirs[i]+"/mime") ){ + out << appDirs[i]+"/mime"; + } + } + return out; +} + +QString XDGMime::findAppMimeForFile(QString filename, bool multiple){ + QString out; + QString extension = filename.section(".",1,-1); + if("."+extension == filename){ extension.clear(); } //hidden file without extension + //qDebug() << "MIME SEARCH:" << filename << extension; + QStringList mimefull = XDGMime::loadMimeFileGlobs2(); + QStringList mimes; + //Just in case the filename is a mimetype itself + if( mimefull.filter(":"+filename+":").length() == 1){ + return filename; + } +while(mimes.isEmpty()){ + //Check for an exact mimetype match + if(mimefull.filter(":"+extension+":").length() == 1){ + return extension; + } + //Look for globs at the end of the filename + if(!extension.isEmpty()){ + mimes = mimefull.filter(":*."+extension); + //If nothing found, try a case-insensitive search + if(mimes.isEmpty()){ mimes = mimefull.filter(":*."+extension, Qt::CaseInsensitive); } + //Now ensure that the filter was accurate (*.<extention>.<something> will still be caught) + for(int i=0; i<mimes.length(); i++){ + if(!filename.endsWith( mimes[i].section(":*",-1), Qt::CaseInsensitive )){ mimes.removeAt(i); i--; } + else if(mimes[i].section(":",0,0).length()==2){ mimes[i].prepend("0"); } //ensure 3-character priority number + else if(mimes[i].section(":",0,0).length()==1){ mimes[i].prepend("00"); } //ensure 3-character priority number + } + } + //Look for globs at the start of the filename + if(mimes.isEmpty()){ + mimes = mimefull.filter(":"+filename.left(2)); //look for the first 2 characters initially + //Note: This initial filter will only work if the wildcard (*) is not within the first 2 characters of the pattern + //Now ensure that the filter was accurate + for(int i=0; i<mimes.length(); i++){ + if(!filename.startsWith( mimes[i].section(":",3,-1,QString::SectionSkipEmpty).section("*",0,0), Qt::CaseInsensitive )){ mimes.removeAt(i); i--; } + } + } + if(mimes.isEmpty()){ + if(extension.contains(".")){ extension = extension.section(".",1,-1); } + else{ break; } + } + } //end of mimes while loop + mimes.sort(); //this automatically puts them in reverse weight order (100 on down) + QStringList matches; + //qDebug() << "Mimes:" << mimes; + for(int m=mimes.length()-1; m>=0; m--){ + QString mime = mimes[m].section(":",1,1,QString::SectionSkipEmpty); + matches << mime; + } + //qDebug() << "Matches:" << matches; + if(multiple && !matches.isEmpty() ){ out = matches.join("::::"); } + else if( !matches.isEmpty() ){ out = matches.first(); } + else{ //no mimetype found - assign one (internal only - no system database changes) + if(extension.isEmpty()){ out = "unknown/"+filename.toLower(); } + else{ out = "unknown/"+extension.toLower(); } + } + //qDebug() << "Out:" << out; + return out; +} + +QStringList XDGMime::listFileMimeDefaults(){ + //This will spit out a itemized list of all the mimetypes and relevant info + // Output format: <mimetype>::::<extension>::::<default>::::<localized comment> + QStringList mimes = XDGMime::loadMimeFileGlobs2(); + //Now start filling the output list + QStringList out; + for(int i=0; i<mimes.length(); i++){ + QString mimetype = mimes[i].section(":",1,1); + QStringList tmp = mimes.filter(mimetype); + //Collect all the different extensions with this mimetype + QStringList extlist; + for(int j=0; j<tmp.length(); j++){ + mimes.removeAll(tmp[j]); + extlist << tmp[j].section(":",2,2); + } + extlist.removeDuplicates(); //just in case + //Now look for a current default for this mimetype + QString dapp = XDGMime::findDefaultAppForMime(mimetype); //default app; + + //Create the output entry + //qDebug() << "Mime entry:" << i << mimetype << dapp; + out << mimetype+"::::"+extlist.join(", ")+"::::"+dapp+"::::"+XDGMime::findMimeComment(mimetype); + + i--; //go back one (continue until the list is empty) + } + return out; +} + +QString XDGMime::findMimeComment(QString mime){ + QString comment; + QStringList dirs = XDGMime::systemMimeDirs(); + QString lang = QString(getenv("LANG")).section(".",0,0); + QString shortlang = lang.section("_",0,0); + for(int i=0; i<dirs.length(); i++){ + if(QFile::exists(dirs[i]+"/"+mime+".xml")){ + QStringList info = LUtils::readFile(dirs[i]+"/"+mime+".xml"); + QStringList filter = info.filter("<comment xml:lang=\""+lang+"\">"); + //First look for a full language match, then short language, then general comment + if(filter.isEmpty()){ filter = info.filter("<comment xml:lang=\""+shortlang+"\">"); } + if(filter.isEmpty()){ filter = info.filter("<comment>"); } + if(!filter.isEmpty()){ + comment = filter.first().section(">",1,1).section("</",0,0); + break; + } + } + } + return comment; +} + +QString XDGMime::findDefaultAppForMime(QString mime){ + //First get the priority-ordered list of default file locations + QStringList dirs; + dirs << QString(getenv("XDG_CONFIG_HOME"))+"/lumina-mimeapps.list" \ + << QString(getenv("XDG_CONFIG_HOME"))+"/mimeapps.list"; + QStringList tmp = QString(getenv("XDG_CONFIG_DIRS")).split(":"); + for(int i=0; i<tmp.length(); i++){ dirs << tmp[i]+"/lumina-mimeapps.list"; } + for(int i=0; i<tmp.length(); i++){ dirs << tmp[i]+"/mimeapps.list"; } + dirs << QString(getenv("XDG_DATA_HOME"))+"/applications/lumina-mimeapps.list" \ + << QString(getenv("XDG_DATA_HOME"))+"/applications/mimeapps.list"; + tmp = QString(getenv("XDG_DATA_DIRS")).split(":"); + for(int i=0; i<tmp.length(); i++){ dirs << tmp[i]+"/applications/lumina-mimeapps.list"; } + for(int i=0; i<tmp.length(); i++){ dirs << tmp[i]+"/applications/mimeapps.list"; } + + //Now go through all the files in order of priority until a default is found + QString cdefault; + for(int i=0; i<dirs.length() && cdefault.isEmpty(); i++){ + if(!QFile::exists(dirs[i])){ continue; } + QStringList info = LUtils::readFile(dirs[i]); + if(info.isEmpty()){ continue; } + QStringList white; //lists to keep track of during the search (black unused at the moment) + QString workdir = dirs[i].section("/",0,-2); //just the directory + // qDebug() << "Check File:" << mime << dirs[i] << workdir; + int def = info.indexOf("[Default Applications]"); //find this line to start on + if(def>=0){ + for(int d=def+1; d<info.length(); d++){ + //qDebug() << "Check Line:" << info[d]; + if(info[d].startsWith("[")){ break; } //starting a new section now - finished with defaults + if(info[d].contains(mime+"=") ){ + white = info[d].section("=",1,-1).split(";") + white; //exact mime match - put at front of list + break; //already found exact match + }else if(info[d].contains("*") && info[d].contains("=") ){ + QRegExp rg(info[d].section("=",0,0), Qt::CaseSensitive, QRegExp::WildcardUnix); + if(rg.exactMatch(mime)){ + white << info[d].section("=",1,-1).split(";"); //partial mime match - put at end of list + } + } + } + } + // Now check for any white-listed files in this work dir + // find the full path to the file (should run even if nothing in this file) + //qDebug() << "WhiteList:" << white; + for(int w=0; w<white.length(); w++){ + if(white[w].isEmpty()){ continue; } + //First check for absolute paths to *.desktop file + if( white[w].startsWith("/") ){ + if( QFile::exists(white[w]) ){ cdefault=white[w]; break; } + else{ white.removeAt(w); w--; } //invalid file path - remove it from the list + } + //Now check for relative paths to file (in current priority-ordered work dir) + else if( QFile::exists(workdir+"/"+white[w]) ){ cdefault=workdir+"/"+white[w]; break; } + //Now go through the XDG DATA dirs and see if the file is in there + else{ + white[w] = LUtils::AppToAbsolute(white[w]); + if(QFile::exists(white[w])){ cdefault = white[w]; } + } + } + /* WRITTEN BUT UNUSED CODE FOR MIMETYPE ASSOCIATIONS + //Skip using this because it is simply an alternate/unsupported standard that conflicts with + the current mimetype database standards. It is better/faster to parse 1 or 2 database glob files + rather than have to iterate through hundreds of *.desktop files *every* time you need to + find an application + + if(addI<0 && remI<0){ + //Simple Format: <mimetype>=<*.desktop file>;<*.desktop file>;..... + // (usually only one desktop file listed) + info = info.filter(mimetype+"="); + //Load the listed default(s) + for(int w=0; w<info.length(); w++){ + white << info[w].section("=",1,50).split(";"); + } + }else{ + //Non-desktop specific mimetypes file: has a *very* convoluted/inefficient algorithm (required by spec) + if(addI<0){ addI = info.length(); } //no add section + if(remI<0){ remI = info.length(); } // no remove section: + //Whitelist items + for(int a=addI+1; a!=remI && a<info.length(); a++){ + if(info[a].contains(mimetype+"=")){ + QStringList tmp = info[a].section("=",1,50).split(";"); + for(int t=0; t<tmp.length(); t++){ + if(!black.contains(tmp[t])){ white << tmp[t]; } //make sure this item is not on the black list + } + break; + } + } + //Blacklist items + for(int a=remI+1; a!=addI && a<info.length(); a++){ + if(info[a].contains(mimetype+"=")){ black << info[a].section("=",1,50).split(";"); break;} + } + + //STEPS 3/4 not written yet + + } //End of non-DE mimetypes file */ + + } //End loop over file + return cdefault; +} + +QStringList XDGMime::findAvailableAppsForMime(QString mime){ + QStringList dirs = LUtils::systemApplicationDirs(); + QStringList out; + //Loop over all possible directories that contain *.destop files + // and check for the mimeinfo.cache file + for(int i=0; i<dirs.length(); i++){ + if(QFile::exists(dirs[i]+"/mimeinfo.cache")){ + QStringList matches = LUtils::readFile(dirs[i]+"/mimeinfo.cache").filter(mime+"="); + //Find any matches for our mimetype in the cache + for(int j=0; j<matches.length(); j++){ + QStringList files = matches[j].section("=",1,1).split(";",QString::SkipEmptyParts); + //Verify that each file exists before putting the full path to the file in the output + for(int m=0; m<files.length(); m++){ + if(QFile::exists(dirs[i]+"/"+files[m])){ + out << dirs[i]+"/"+files[m]; + }else if(files[m].contains("-")){ //kde4-<filename> -> kde4/<filename> (stupid KDE variations!!) + files[m].replace("-","/"); + if(QFile::exists(dirs[i]+"/"+files[m])){ + out << dirs[i]+"/"+files[m]; + } + } + } + } + } + } + //qDebug() << "Found Apps for Mime:" << mime << out << dirs; + return out; +} + +void XDGMime::setDefaultAppForMime(QString mime, QString app){ + QString filepath = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-mimeapps.list"; + QStringList cinfo = LUtils::readFile(filepath); + //If this is a new file, make sure to add the header appropriately + if(cinfo.isEmpty()){ cinfo << "#Automatically generated with lumina-config" << "# DO NOT CHANGE MANUALLY" << "[Default Applications]"; } + //Check for any current entry for this mime type + QStringList tmp = cinfo.filter(mime+"="); + int index = -1; + if(!tmp.isEmpty()){ index = cinfo.indexOf(tmp.first()); } + //Now add the new default entry (if necessary) + if(app.isEmpty()){ + if(index>=0){ cinfo.removeAt(index); } //Remove entry + }else{ + if(index<0){ + cinfo << mime+"="+app+";"; //new entry + }else{ + cinfo[index] = mime+"="+app+";"; //overwrite existing entry + } + } + LUtils::writeFile(filepath, cinfo, true); + return; +} + +QStringList XDGMime::findAVFileExtensions(){ + //output format: QDir name filter for valid A/V file extensions + QStringList globs = XDGMime::loadMimeFileGlobs2(); + QStringList av = globs.filter(":audio/"); + av << globs.filter(":video/"); + for(int i=0; i<av.length(); i++){ + //Just use all audio/video mimetypes (for now) + av[i] = av[i].section(":",2,2); + //Qt5 Auto detection (broken - QMediaPlayer seg faults with Qt 5.3 - 11/24/14) + /*if( QMultimedia::NotSupported != QMediaPlayer::hasSupport(av[i].section(":",1,1)) ){ av[i] = av[i].section(":",2,2); } + else{ av.removeAt(i); i--; }*/ + } + av.removeDuplicates(); + return av; +} + +QStringList XDGMime::loadMimeFileGlobs2(){ + //output format: <weight>:<mime type>:<file extension (*.something)> + if(mimeglobs.isEmpty() || (mimechecktime < (QDateTime::currentMSecsSinceEpoch()-30000)) ){ + //qDebug() << "Loading globs2 mime DB files"; + mimeglobs.clear(); + mimechecktime = QDateTime::currentMSecsSinceEpoch(); //save the current time this was last checked + QStringList dirs = XDGMime::systemMimeDirs(); + for(int i=0; i<dirs.length(); i++){ + if(QFile::exists(dirs[i]+"/globs2")){ + QFile file(dirs[i]+"/globs2"); + if(!file.exists()){ continue; } + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ continue; } + QTextStream in(&file); + while(!in.atEnd()){ + QString line = in.readLine(); + if(!line.startsWith("#")){ + mimeglobs << line.simplified(); + } + } + file.close(); + } + if(i==dirs.length()-1 && mimeglobs.isEmpty()){ + //Could not find the mimetype database on the system - use the fallback file distributed with Lumina + if(dirs.last()!= LOS::LuminaShare()){ dirs << LOS::LuminaShare(); } //just in case it was not installed + } + }//end loop over dirs + } + return mimeglobs; +} diff --git a/src-qt5/core/libLumina/XDGMime.h b/src-qt5/core/libLumina/XDGMime.h new file mode 100644 index 00000000..a8d91142 --- /dev/null +++ b/src-qt5/core/libLumina/XDGMime.h @@ -0,0 +1,57 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2013-2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// These structures/classes are for conforming to the FreeDesktop standards +// REFERENCE: +// (DATABASE) https://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec/ +// (APPLICATIONS) https://www.freedesktop.org/wiki/Specifications/mime-apps-spec/ +// Mime Application Version Compliance: 1.0.1 (11/14/14) (Skips random *.desktop parsing: ~80% compliant) +//=========================================== +#ifndef _LUMINA_LIBRARY_XDG_MIME_CLASS_H +#define _LUMINA_LIBRARY_XDG_MIME_CLASS_H + +#include <QFile> +#include <QDir> +#include <QFileInfo> +#include <QStringList> +#include <QString> +#include <QList> +#include <QDateTime> +#include <QTextStream> +#include <QRegExp> +#include <QDebug> + +class XDGMime{ +public: + // PRIMARY FUNCTIONS + static QString fromFileName(QString filename); //Convert a filename into a mimetype + static QStringList listFromFileName(QString filename); //Convert a filename into a list of mimetypes (arranged in descending priority) + static QString toIconName(QString mime); //Mime type to icon name + //Find the file extension for a particular mime-type + static QStringList toFileExtensions(QString mime); + + // LESSER-USED FUNCTIONS + //List all the mime-type directories + static QStringList systemMimeDirs(); + //Find the mime-type of a particular file extension + static QString findAppMimeForFile(QString filename, bool multiple = false); + // Simplification function for finding all info regarding current mime defaults + static QStringList listFileMimeDefaults(); + //Find the localized comment string for a particular mime-type + static QString findMimeComment(QString mime); + //Find the default application for a mime-type + static QString findDefaultAppForMime(QString mime); + //Fine the available applications for a mime-type + static QStringList findAvailableAppsForMime(QString mime); + //Set the default application for a mime-type + static void setDefaultAppForMime(QString mime, QString app); + //List all the registered audio/video file extensions + static QStringList findAVFileExtensions(); + //Load all the "globs2" mime database files + static QStringList loadMimeFileGlobs2(); + +}; +#endif diff --git a/src-qt5/core/libLumina/XDGMime.pri b/src-qt5/core/libLumina/XDGMime.pri new file mode 100644 index 00000000..f7cb8b6d --- /dev/null +++ b/src-qt5/core/libLumina/XDGMime.pri @@ -0,0 +1,10 @@ +#QT *= multimedia svg + +#XDG Mime Files +SOURCES *= $${PWD}/XDGMime.cpp +HEADERS *= $${PWD}/XDGMime.h + +INCLUDEPATH *= ${PWD} + +#include LUtils and LuminaOS +include(LUtils.pri) diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index 0b9a9b35..c6f79584 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -18,8 +18,6 @@ NativeWindowSystem* Lumina::NWS = 0; NativeEventFilter* Lumina::NEF = 0; LScreenSaver* Lumina::SS = 0; -//DesktopSettings* Lumina::SETTINGS = 0; -//Lumina::WM = 0; QThread* Lumina::EVThread = 0; RootWindow* Lumina::ROOTWIN = 0; XDGDesktopList* Lumina::APPLIST = 0; @@ -49,7 +47,6 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu //Now initialize the global objects (but do not start them yet) Lumina::NEF = new NativeEventFilter(); Lumina::NWS = new NativeWindowSystem(); - //Lumina::SETTINGS = new DesktopSettings(); Lumina::SS = new LScreenSaver(); //Now put the Native Window System into it's own thread to keep things snappy Lumina::EVThread = new QThread(); @@ -67,7 +64,6 @@ LSession::~LSession(){ //Clean up the global objects as needed if(Lumina::NEF!=0){ Lumina::NEF->deleteLater(); } if(Lumina::NWS!=0){ Lumina::NWS->deleteLater(); } - //if(Lumina::EFILTER!=0){ Lumina::EFILTER->deleteLater(); } if(Lumina::SS!=0){ Lumina::SS->deleteLater(); } if(Lumina::EVThread!=0){ if(Lumina::EVThread->isRunning()){ Lumina::EVThread->quit(); } @@ -385,11 +381,46 @@ void LSession::StartReboot(bool skipupdates){ QCoreApplication::exit(0); } -void LSession::LaunchApplication(QString app){ - +void LSession::LaunchApplication(QString exec){ + ExternalProcess::launch(exec); } -void LSession::LaunchStandardApplication(QString app){ +void LSession::LaunchStandardApplication(QString app, QStringList args){ + //Find/replace standardized apps with thier mimetypes + if(app.startsWith("--")){ app = "application/"+app.section("--",-1).simplified(); } + //First see if this is a mimetype with a default application + if(app.count("/")==1 && !app.startsWith("/")){ + QString mimeapp = XDGMime::findDefaultAppForMime(app); + if(!mimeapp.isEmpty()){ app = mimeapp; } + } + if(app.endsWith(".desktop")){ + //Get the XDGDesktop structure + XDGDesktop *desk = 0; bool cleanup = false; + if(app.startsWith("/") && QFile::exists(app)){ desk = new XDGDesktop(app); cleanup = true; } + if(!desk->isValid()){ + //Need to find the app within the current list + QHash<QString, XDGDesktop*>applist = Lumina::APPLIST->files; + if(cleanup){ desk->deleteLater(); desk = 0; cleanup = false; } + app = app.section("/",-1); //make sure this is a relative path + QStringList list = applist.keys().filter("/"+app); + if(!list.filter(QDir::homePath()).isEmpty()){ desk = applist[list.filter(QDir::homePath()).first()]; } //prefer user-override files + if(desk==0 || !desk->isValid()){ + desk = 0; + for(int i=0; i<list.length() && desk==0; i++){ + XDGDesktop *tmp = applist[list[i]]; + if(tmp->isValid()){ desk = tmp; } + } + } + } + if(desk!=0 && desk->isValid()){ + //Got the application - go ahead and assemble the startup command + QString exec = desk->generateExec(args); //args are embedded into the exec command as needed + ExternalProcess::launch(exec, QStringList(), desk->startupNotify); + } + if(cleanup){ desk->deleteLater(); } + }else{ + ExternalProcess::launch(app, args, false); // do not use startup notify cursor + } } diff --git a/src-qt5/core/lumina-desktop-unified/LSession.h b/src-qt5/core/lumina-desktop-unified/LSession.h index 0d666bfa..85cc050c 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.h +++ b/src-qt5/core/lumina-desktop-unified/LSession.h @@ -32,8 +32,8 @@ public slots: void StartLogout(); void StartShutdown(bool skipupdates = false); void StartReboot(bool skipupdates = false); - void LaunchApplication(QString app); - void LaunchStandardApplication(QString app); + void LaunchApplication(QString exec); + void LaunchStandardApplication(QString app, QStringList args = QStringList()); void reloadIconTheme(); //will emit the IconThemeChanged signal when ready void switchLocale(QString localeCode); //will emit the LocaleChanged signal when ready diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf index c1417b85..59959194 100644 --- a/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf +++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf @@ -4,5 +4,5 @@ Pause=Lockscreen Alt+L=Lockscreen [desktop] -Alt+F1=Launch: terminal -Print=Launch: screenshot +Alt+F1=Launch: --terminal +Print=Launch: --screenshot diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h index 1d0ab068..92f895c2 100644 --- a/src-qt5/core/lumina-desktop-unified/global-includes.h +++ b/src-qt5/core/lumina-desktop-unified/global-includes.h @@ -62,6 +62,7 @@ #include <NativeWindow.h> #include <NativeWindowSystem.h> #include <NativeEventFilter.h> +#include <XDGMime.h> // Standard C includes #include <unistd.h> diff --git a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro index defa66f4..79f2ba6f 100644 --- a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro @@ -19,6 +19,7 @@ include(../libLumina/DesktopSettings.pri) include(../libLumina/RootWindow.pri) include(../libLumina/ExternalProcess.pri) include(../libLumina/NativeWindow.pri) +include(../libLumina/XDGMime.pri) #include all the main individual source groups include(src-screensaver/screensaver.pri) diff --git a/src-qt5/core/lumina-desktop-unified/main.cpp b/src-qt5/core/lumina-desktop-unified/main.cpp index 0b67de46..8e40f7eb 100644 --- a/src-qt5/core/lumina-desktop-unified/main.cpp +++ b/src-qt5/core/lumina-desktop-unified/main.cpp @@ -30,6 +30,8 @@ int main(int argc, char ** argv) setenv("XDG_CURRENT_DESKTOP","Lumina",1); setenv("QT_NO_GLIB", "1", 1); //Disable the glib event loop within Qt at runtime (performance hit + bugs) unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default... + unsetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); //need exact-pixel measurements (no fake scaling) + //Startup the session if(DEBUG){ qDebug() << "Starting unified session"; } LSession a(argc, argv); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h index 1e3165ec..7fd21967 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h @@ -32,6 +32,8 @@ private slots: signals: void LockSession(); void showLeaveDialog(); + void LaunchStandardApplication(QString); + void LaunchApplication(QString); }; #endif diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp index 02f6a10f..dcede34c 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QVariant> #include <QSettings> #include <QGuiApplication> @@ -60,248 +32,199 @@ Q_LOGGING_CATEGORY(llthemeengine, "lthemeengine") //QT_QPA_PLATFORMTHEME=lthemeengine -lthemeenginePlatformTheme::lthemeenginePlatformTheme() -{ - if(QGuiApplication::desktopSettingsAware()) - { - readSettings(); - QMetaObject::invokeMethod(this, "applySettings", Qt::QueuedConnection); +lthemeenginePlatformTheme::lthemeenginePlatformTheme(){ + if(QGuiApplication::desktopSettingsAware()){ + readSettings(); + QMetaObject::invokeMethod(this, "applySettings", Qt::QueuedConnection); #ifdef QT_WIDGETS_LIB - QMetaObject::invokeMethod(this, "createFSWatcher", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "createFSWatcher", Qt::QueuedConnection); #endif - QGuiApplication::setFont(m_generalFont); + QGuiApplication::setFont(m_generalFont); } - qCDebug(llthemeengine) << "using lthemeengine plugin"; + qCDebug(llthemeengine) << "using lthemeengine plugin"; #ifdef QT_WIDGETS_LIB - if(!QStyleFactory::keys().contains("lthemeengine-style")) - qCCritical(llthemeengine) << "unable to find lthemeengine proxy style"; + if(!QStyleFactory::keys().contains("lthemeengine-style")) + qCCritical(llthemeengine) << "unable to find lthemeengine proxy style"; #endif } -lthemeenginePlatformTheme::~lthemeenginePlatformTheme() -{ - if(m_customPalette) - delete m_customPalette; +lthemeenginePlatformTheme::~lthemeenginePlatformTheme(){ + if(m_customPalette) + delete m_customPalette; } #if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) && !defined(QT_NO_DBUS) -QPlatformMenuBar *lthemeenginePlatformTheme::createPlatformMenuBar() const -{ - if(m_checkDBusGlobalMenu) - { - QDBusConnection conn = QDBusConnection::sessionBus(); - m_dbusGlobalMenuAvailable = conn.interface()->isServiceRegistered("com.canonical.AppMenu.Registrar"); - qCDebug(llthemeengine) << "D-Bus global menu:" << (m_dbusGlobalMenuAvailable ? "yes" : "no"); +QPlatformMenuBar *lthemeenginePlatformTheme::createPlatformMenuBar() const{ + if(m_checkDBusGlobalMenu){ + QDBusConnection conn = QDBusConnection::sessionBus(); + m_dbusGlobalMenuAvailable = conn.interface()->isServiceRegistered("com.canonical.AppMenu.Registrar"); + qCDebug(llthemeengine) << "D-Bus global menu:" << (m_dbusGlobalMenuAvailable ? "yes" : "no"); } - return (m_dbusGlobalMenuAvailable ? new QDBusMenuBar() : nullptr); + return (m_dbusGlobalMenuAvailable ? new QDBusMenuBar() : nullptr); } #endif #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) -QPlatformSystemTrayIcon *lthemeenginePlatformTheme::createPlatformSystemTrayIcon() const -{ - if(m_checkDBusTray) - { - QDBusMenuConnection conn; - m_dbusTrayAvailable = conn.isStatusNotifierHostRegistered(); - m_checkDBusTray = false; - qCDebug(llthemeengine) << "D-Bus system tray:" << (m_dbusTrayAvailable ? "yes" : "no"); +QPlatformSystemTrayIcon *lthemeenginePlatformTheme::createPlatformSystemTrayIcon() const{ + if(m_checkDBusTray){ + QDBusMenuConnection conn; + m_dbusTrayAvailable = conn.isStatusNotifierHostRegistered(); + m_checkDBusTray = false; + qCDebug(llthemeengine) << "D-Bus system tray:" << (m_dbusTrayAvailable ? "yes" : "no"); } - return (m_dbusTrayAvailable ? new QDBusTrayIcon() : nullptr); + return (m_dbusTrayAvailable ? new QDBusTrayIcon() : nullptr); } #endif -const QPalette *lthemeenginePlatformTheme::palette(QPlatformTheme::Palette type) const -{ - Q_UNUSED(type); - return (m_usePalette ? m_customPalette : nullptr); +const QPalette *lthemeenginePlatformTheme::palette(QPlatformTheme::Palette type) const{ + Q_UNUSED(type); + return (m_usePalette ? m_customPalette : nullptr); } -const QFont *lthemeenginePlatformTheme::font(QPlatformTheme::Font type) const -{ - if(type == QPlatformTheme::FixedFont) - return &m_fixedFont; - return &m_generalFont; +const QFont *lthemeenginePlatformTheme::font(QPlatformTheme::Font type) const{ + if(type == QPlatformTheme::FixedFont) + return &m_fixedFont; + return &m_generalFont; } -QVariant lthemeenginePlatformTheme::themeHint(QPlatformTheme::ThemeHint hint) const -{ - switch (hint) - { - case QPlatformTheme::CursorFlashTime: - return m_cursorFlashTime; - case MouseDoubleClickInterval: - return m_doubleClickInterval; - case QPlatformTheme::ToolButtonStyle: - return m_toolButtonStyle; - case QPlatformTheme::SystemIconThemeName: - return m_iconTheme; - case QPlatformTheme::StyleNames: - return QStringList() << "lthemeengine-style"; - case QPlatformTheme::IconThemeSearchPaths: - return lthemeengine::iconPaths(); - case DialogButtonBoxLayout: - return m_buttonBoxLayout; - case QPlatformTheme::UiEffects: - return m_uiEffects; +QVariant lthemeenginePlatformTheme::themeHint(QPlatformTheme::ThemeHint hint) const{ + switch (hint){ + case QPlatformTheme::CursorFlashTime: return m_cursorFlashTime; + case MouseDoubleClickInterval: return m_doubleClickInterval; + case QPlatformTheme::ToolButtonStyle: return m_toolButtonStyle; + case QPlatformTheme::SystemIconThemeName: return m_iconTheme; + case QPlatformTheme::StyleNames: return QStringList() << "lthemeengine-style"; + case QPlatformTheme::IconThemeSearchPaths: return lthemeengine::iconPaths(); + case DialogButtonBoxLayout: return m_buttonBoxLayout; + case QPlatformTheme::UiEffects: return m_uiEffects; #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) - case QPlatformTheme::WheelScrollLines: - return m_wheelScrollLines; + case QPlatformTheme::WheelScrollLines: return m_wheelScrollLines; #endif - default: - return QPlatformTheme::themeHint(hint); + default: return QPlatformTheme::themeHint(hint); } } -void lthemeenginePlatformTheme::applySettings() -{ - if(!QGuiApplication::desktopSettingsAware()) - return; - +void lthemeenginePlatformTheme::applySettings(){ + if(!QGuiApplication::desktopSettingsAware()) + return; #if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - if(!m_update) - { - //do not override application palette - if(QCoreApplication::testAttribute(Qt::AA_SetPalette)) - { - m_usePalette = false; - qCDebug(llthemeengine) << "palette support is disabled"; + if(!m_update){ + //do not override application palette + if(QCoreApplication::testAttribute(Qt::AA_SetPalette)){ + m_usePalette = false; + qCDebug(llthemeengine) << "palette support is disabled"; } - } + } #endif - #ifdef QT_WIDGETS_LIB - if(hasWidgets()) - { - qApp->setFont(m_generalFont); - - //Qt 5.6 or higher should be use themeHint function on application startup. - //So, there is no need to call this function first time. + if(hasWidgets()){ + qApp->setFont(m_generalFont); + //Qt 5.6 or higher should be use themeHint function on application startup. + //So, there is no need to call this function first time. #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) - if(m_update) - qApp->setWheelScrollLines(m_wheelScrollLines); + if(m_update) + qApp->setWheelScrollLines(m_wheelScrollLines); #else - qApp->setWheelScrollLines(m_wheelScrollLines); + qApp->setWheelScrollLines(m_wheelScrollLines); #endif - - if(m_update && qApp->style()->objectName() == "lthemeengine-style") //ignore application style - qApp->setStyle("lthemeengine-style"); //recreate style object - - if(m_update && m_usePalette) - { - if(m_customPalette) - qApp->setPalette(*m_customPalette); - else - qApp->setPalette(qApp->style()->standardPalette()); - } - + if(m_update && qApp->style()->objectName() == "lthemeengine-style") //ignore application style + qApp->setStyle("lthemeengine-style"); //recreate style object + if(m_update && m_usePalette){ + if(m_customPalette) + qApp->setPalette(*m_customPalette); + else + qApp->setPalette(qApp->style()->standardPalette()); + } //do not override application style if(m_prevStyleSheet == qApp->styleSheet()) - qApp->setStyleSheet(m_userStyleSheet); + qApp->setStyleSheet(m_userStyleSheet); else - qCDebug(llthemeengine) << "custom style sheet is disabled"; - m_prevStyleSheet = m_userStyleSheet; + qCDebug(llthemeengine) << "custom style sheet is disabled"; + m_prevStyleSheet = m_userStyleSheet; } #endif - QGuiApplication::setFont(m_generalFont); //apply font - QIcon::setThemeName(m_iconTheme); //apply icons - if(m_customPalette && m_usePalette) - QGuiApplication::setPalette(*m_customPalette); //apply palette - + QGuiApplication::setFont(m_generalFont); //apply font + QIcon::setThemeName(m_iconTheme); //apply icons + if(m_customPalette && m_usePalette) + QGuiApplication::setPalette(*m_customPalette); //apply palette #ifdef QT_WIDGETS_LIB - if(hasWidgets()) - { - foreach (QWidget *w, qApp->allWidgets()) - { - QEvent e(QEvent::ThemeChange); - QApplication::sendEvent(w, &e); - } + if(hasWidgets()){ + foreach (QWidget *w, qApp->allWidgets()){ + QEvent e(QEvent::ThemeChange); + QApplication::sendEvent(w, &e); + } } #endif - - if(!m_update) - m_update = true; + if(!m_update) + m_update = true; } - #ifdef QT_WIDGETS_LIB -void lthemeenginePlatformTheme::createFSWatcher() -{ - QFileSystemWatcher *watcher = new QFileSystemWatcher(this); - watcher->addPath(lthemeengine::configPath()); - QTimer *timer = new QTimer(this); - timer->setSingleShot(true); - timer->setInterval(3000); - connect(watcher, SIGNAL(directoryChanged(QString)), timer, SLOT(start())); - connect(timer, SIGNAL(timeout()), SLOT(updateSettings())); +void lthemeenginePlatformTheme::createFSWatcher(){ + QFileSystemWatcher *watcher = new QFileSystemWatcher(this); + watcher->addPath(lthemeengine::configPath()); + QTimer *timer = new QTimer(this); + timer->setSingleShot(true); + timer->setInterval(3000); + connect(watcher, SIGNAL(directoryChanged(QString)), timer, SLOT(start())); + connect(timer, SIGNAL(timeout()), SLOT(updateSettings())); } -void lthemeenginePlatformTheme::updateSettings() -{ - qCDebug(llthemeengine) << "updating settings.."; - readSettings(); - applySettings(); +void lthemeenginePlatformTheme::updateSettings(){ + qCDebug(llthemeengine) << "updating settings.."; + readSettings(); + applySettings(); } #endif -void lthemeenginePlatformTheme::readSettings() -{ - if(m_customPalette) - { - delete m_customPalette; - m_customPalette = 0; +void lthemeenginePlatformTheme::readSettings(){ + if(m_customPalette){ + delete m_customPalette; + m_customPalette = 0; } - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - - settings.beginGroup("Appearance"); - m_style = settings.value("style", "Fusion").toString(); - if(settings.value("custom_palette", false).toBool()) - { - QString schemePath = settings.value("color_scheme_path").toString(); - m_customPalette = new QPalette(loadColorScheme(schemePath)); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Appearance"); + m_style = settings.value("style", "Fusion").toString(); + if(settings.value("custom_palette", false).toBool()){ + QString schemePath = settings.value("color_scheme_path").toString(); + m_customPalette = new QPalette(loadColorScheme(schemePath)); } - m_iconTheme = settings.value("icon_theme").toString(); - settings.endGroup(); - - settings.beginGroup("Fonts"); - m_generalFont = settings.value("general", QPlatformTheme::font(QPlatformTheme::SystemFont)).value<QFont>(); - m_fixedFont = settings.value("fixed", QPlatformTheme::font(QPlatformTheme::FixedFont)).value<QFont>(); - settings.endGroup(); - - settings.beginGroup("Interface"); - m_doubleClickInterval = QPlatformTheme::themeHint(QPlatformTheme::MouseDoubleClickInterval).toInt(); - m_doubleClickInterval = settings.value("double_click_interval", m_doubleClickInterval).toInt(); - m_cursorFlashTime = QPlatformTheme::themeHint(QPlatformTheme::CursorFlashTime).toInt(); - m_cursorFlashTime = settings.value("cursor_flash_time", m_cursorFlashTime).toInt(); - m_buttonBoxLayout = QPlatformTheme::themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); - m_buttonBoxLayout = settings.value("buttonbox_layout", m_buttonBoxLayout).toInt(); - QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !settings.value("menus_have_icons", true).toBool()); - m_toolButtonStyle = settings.value("toolbutton_style", Qt::ToolButtonFollowStyle).toInt(); - m_wheelScrollLines = settings.value("wheel_scroll_lines", 3).toInt(); - - //load effects - m_uiEffects = QPlatformTheme::themeHint(QPlatformTheme::UiEffects).toInt(); - if(settings.childKeys().contains("gui_effects")) - { - QStringList effectList = settings.value("gui_effects").toStringList(); - m_uiEffects = 0; - if(effectList.contains("General")) - m_uiEffects |= QPlatformTheme::GeneralUiEffect; + m_iconTheme = settings.value("icon_theme").toString(); + settings.endGroup(); + settings.beginGroup("Fonts"); + m_generalFont = settings.value("general", QPlatformTheme::font(QPlatformTheme::SystemFont)).value<QFont>(); + m_fixedFont = settings.value("fixed", QPlatformTheme::font(QPlatformTheme::FixedFont)).value<QFont>(); + settings.endGroup(); + settings.beginGroup("Interface"); + m_doubleClickInterval = QPlatformTheme::themeHint(QPlatformTheme::MouseDoubleClickInterval).toInt(); + m_doubleClickInterval = settings.value("double_click_interval", m_doubleClickInterval).toInt(); + m_cursorFlashTime = QPlatformTheme::themeHint(QPlatformTheme::CursorFlashTime).toInt(); + m_cursorFlashTime = settings.value("cursor_flash_time", m_cursorFlashTime).toInt(); + m_buttonBoxLayout = QPlatformTheme::themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); + m_buttonBoxLayout = settings.value("buttonbox_layout", m_buttonBoxLayout).toInt(); + QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !settings.value("menus_have_icons", true).toBool()); + m_toolButtonStyle = settings.value("toolbutton_style", Qt::ToolButtonFollowStyle).toInt(); + m_wheelScrollLines = settings.value("wheel_scroll_lines", 3).toInt(); + //load effects + m_uiEffects = QPlatformTheme::themeHint(QPlatformTheme::UiEffects).toInt(); + if(settings.childKeys().contains("gui_effects")){ + QStringList effectList = settings.value("gui_effects").toStringList(); + m_uiEffects = 0; + if(effectList.contains("General")) + m_uiEffects |= QPlatformTheme::GeneralUiEffect; if(effectList.contains("AnimateMenu")) - m_uiEffects |= QPlatformTheme::AnimateMenuUiEffect; - if(effectList.contains("FadeMenu")) + m_uiEffects |= QPlatformTheme::AnimateMenuUiEffect; + if(effectList.contains("FadeMenu")) m_uiEffects |= QPlatformTheme::FadeMenuUiEffect; - if(effectList.contains("AnimateCombo")) - m_uiEffects |= QPlatformTheme::AnimateComboUiEffect; - if(effectList.contains("AnimateTooltip")) - m_uiEffects |= QPlatformTheme::AnimateTooltipUiEffect; - if(effectList.contains("FadeTooltip")) - m_uiEffects |= QPlatformTheme::FadeTooltipUiEffect; - if(effectList.contains("AnimateToolBox")) - m_uiEffects |= QPlatformTheme::AnimateToolBoxUiEffect; - } - + if(effectList.contains("AnimateCombo")) + m_uiEffects |= QPlatformTheme::AnimateComboUiEffect; + if(effectList.contains("AnimateTooltip")) + m_uiEffects |= QPlatformTheme::AnimateTooltipUiEffect; + if(effectList.contains("FadeTooltip")) + m_uiEffects |= QPlatformTheme::FadeTooltipUiEffect; + if(effectList.contains("AnimateToolBox")) + m_uiEffects |= QPlatformTheme::AnimateToolBoxUiEffect; + } //load style sheets #ifdef QT_WIDGETS_LIB QStringList qssPaths = settings.value("stylesheets").toStringList(); @@ -311,56 +234,44 @@ void lthemeenginePlatformTheme::readSettings() } #ifdef QT_WIDGETS_LIB -bool lthemeenginePlatformTheme::hasWidgets() -{ - return qobject_cast<QApplication *> (qApp) != nullptr; +bool lthemeenginePlatformTheme::hasWidgets(){ + return qobject_cast<QApplication *> (qApp) != nullptr; } #endif -QString lthemeenginePlatformTheme::loadStyleSheets(const QStringList &paths) -{ - QString content; - foreach (QString path, paths) - { - if(!QFile::exists(path)) - continue; - - QFile file(path); - file.open(QIODevice::ReadOnly); - content.append(file.readAll()); +QString lthemeenginePlatformTheme::loadStyleSheets(const QStringList &paths){ + QString content; + foreach (QString path, paths){ + if(!QFile::exists(path)) + continue; + QFile file(path); + file.open(QIODevice::ReadOnly); + content.append(file.readAll()); } - QRegExp regExp("//.*(\\n|$)"); - regExp.setMinimal(true); - content.remove(regExp); - return content; + QRegExp regExp("//.*(\\n|$)"); + regExp.setMinimal(true); + content.remove(regExp); + return content; } -QPalette lthemeenginePlatformTheme::loadColorScheme(const QString &filePath) -{ - QPalette customPalette; - QSettings settings(filePath, QSettings::IniFormat); - settings.beginGroup("ColorScheme"); - QStringList activeColors = settings.value("active_colors").toStringList(); - QStringList inactiveColors = settings.value("inactive_colors").toStringList(); - QStringList disabledColors = settings.value("disabled_colors").toStringList(); - settings.endGroup(); - - if(activeColors.count() == QPalette::NColorRoles && - inactiveColors.count() == QPalette::NColorRoles && - disabledColors.count() == QPalette::NColorRoles) - { - for (int i = 0; i < QPalette::NColorRoles; i++) - { - QPalette::ColorRole role = QPalette::ColorRole(i); - customPalette.setColor(QPalette::Active, role, QColor(activeColors.at(i))); - customPalette.setColor(QPalette::Inactive, role, QColor(inactiveColors.at(i))); - customPalette.setColor(QPalette::Disabled, role, QColor(disabledColors.at(i))); +QPalette lthemeenginePlatformTheme::loadColorScheme(const QString &filePath){ + QPalette customPalette; + QSettings settings(filePath, QSettings::IniFormat); + settings.beginGroup("ColorScheme"); + QStringList activeColors = settings.value("active_colors").toStringList(); + QStringList inactiveColors = settings.value("inactive_colors").toStringList(); + QStringList disabledColors = settings.value("disabled_colors").toStringList(); + settings.endGroup(); + if(activeColors.count() == QPalette::NColorRoles && inactiveColors.count() == QPalette::NColorRoles && disabledColors.count() == QPalette::NColorRoles){ + for (int i = 0; i < QPalette::NColorRoles; i++){ + QPalette::ColorRole role = QPalette::ColorRole(i); + customPalette.setColor(QPalette::Active, role, QColor(activeColors.at(i))); + customPalette.setColor(QPalette::Inactive, role, QColor(inactiveColors.at(i))); + customPalette.setColor(QPalette::Disabled, role, QColor(disabledColors.at(i))); } } - else - { - customPalette = *QPlatformTheme::palette(SystemPalette); //load fallback palette + else{ + customPalette = *QPlatformTheme::palette(SystemPalette); //load fallback palette } - - return customPalette; + return customPalette; } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.h index 3996b451..5313b73e 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef LTHEMEENGINEPLATFORMTHEME_H #define LTHEMEENGINEPLATFORMTHEME_H @@ -50,8 +22,7 @@ class QPlatformSystemTrayIcon; class QPlatformMenuBar; #endif -class lthemeenginePlatformTheme : public QObject, public QPlatformTheme -{ +class lthemeenginePlatformTheme : public QObject, public QPlatformTheme{ Q_OBJECT public: lthemeenginePlatformTheme(); diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/main.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/main.cpp index 37798f70..12e4a581 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/main.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/main.cpp @@ -1,46 +1,16 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <qpa/qplatformthemeplugin.h> #include "lthemeengineplatformtheme.h" QT_BEGIN_NAMESPACE -class lthemeenginePlatformThemePlugin: public QPlatformThemePlugin -{ +class lthemeenginePlatformThemePlugin: public QPlatformThemePlugin{ Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1" FILE "lthemeengine.json") public: QPlatformTheme *create(const QString &key, const QStringList ¶ms); }; -QPlatformTheme *lthemeenginePlatformThemePlugin::create(const QString &key, const QStringList ¶ms) -{ +QPlatformTheme *lthemeenginePlatformThemePlugin::create(const QString &key, const QStringList ¶ms){ Q_UNUSED(params); if (key.toLower() == "lthemeengine") return new lthemeenginePlatformTheme(); diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.cpp index c9833a30..2c66144f 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.cpp @@ -1,63 +1,29 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSettings> #include <lthemeengine/lthemeengine.h> #include "lthemeengineproxystyle.h" -lthemeengineProxyStyle::lthemeengineProxyStyle(const QString &key) : - QProxyStyle(key) -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - m_dialogButtonsHaveIcons = settings.value("Interface/dialog_buttons_have_icons", Qt::PartiallyChecked).toInt(); - m_activateItemOnSingleClick = settings.value("Interface/activate_item_on_single_click", Qt::PartiallyChecked).toInt(); +lthemeengineProxyStyle::lthemeengineProxyStyle(const QString &key) : QProxyStyle(key){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + m_dialogButtonsHaveIcons = settings.value("Interface/dialog_buttons_have_icons", Qt::PartiallyChecked).toInt(); + m_activateItemOnSingleClick = settings.value("Interface/activate_item_on_single_click", Qt::PartiallyChecked).toInt(); } -lthemeengineProxyStyle::~lthemeengineProxyStyle() -{ - //qDebug("%s", Q_FUNC_INFO); +lthemeengineProxyStyle::~lthemeengineProxyStyle(){ + //qDebug("%s", Q_FUNC_INFO); } -int lthemeengineProxyStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const -{ - if(hint == QStyle::SH_DialogButtonBox_ButtonsHaveIcons) - { - if(m_dialogButtonsHaveIcons == Qt::Unchecked) - return 0; - else if(m_dialogButtonsHaveIcons == Qt::Checked) - return 1; +int lthemeengineProxyStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const{ + if(hint == QStyle::SH_DialogButtonBox_ButtonsHaveIcons){ + if(m_dialogButtonsHaveIcons == Qt::Unchecked) + return 0; + else if(m_dialogButtonsHaveIcons == Qt::Checked) + return 1; } - else if(hint == QStyle::QStyle::SH_ItemView_ActivateItemOnSingleClick) - { - if(m_activateItemOnSingleClick == Qt::Unchecked) - return 0; - else if(m_activateItemOnSingleClick == Qt::Checked) - return 1; + else if(hint == QStyle::QStyle::SH_ItemView_ActivateItemOnSingleClick){ + if(m_activateItemOnSingleClick == Qt::Unchecked) + return 0; + else if(m_activateItemOnSingleClick == Qt::Checked) + return 1; } - return QProxyStyle::styleHint(hint, option, widget, returnData); + return QProxyStyle::styleHint(hint, option, widget, returnData); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.h index 47a18099..0d168897 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/lthemeengineproxystyle.h @@ -1,38 +1,9 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef LTHEMEENGINEPROXYSTYLE_H #define LTHEMEENGINEPROXYSTYLE_H #include <QProxyStyle> -class lthemeengineProxyStyle : public QProxyStyle -{ +class lthemeengineProxyStyle : public QProxyStyle{ Q_OBJECT public: explicit lthemeengineProxyStyle(const QString &key); diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/plugin.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/plugin.cpp index 9d63093e..fb9e5fb2 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/plugin.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-style/plugin.cpp @@ -1,39 +1,10 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QStylePlugin> #include <QSettings> #include <QStyleFactory> #include <lthemeengine/lthemeengine.h> #include "lthemeengineproxystyle.h" -class lthemeengineStylePlugin : public QStylePlugin -{ +class lthemeengineStylePlugin : public QStylePlugin{ Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "lthemeengine.json") @@ -41,8 +12,7 @@ public: QStyle *create(const QString &key); }; -QStyle *lthemeengineStylePlugin::create(const QString &key) -{ +QStyle *lthemeengineStylePlugin::create(const QString &key){ if (key == "lthemeengine-style") { QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp index b9175d6e..95f2c9b7 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QStyleFactory> #include <QMdiSubWindow> #include <QSettings> @@ -40,379 +12,273 @@ #include "ui_appearancepage.h" #include "ui_previewform.h" -AppearancePage::AppearancePage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::AppearancePage) -{ - m_ui->setupUi(this); - QStringList keys = QStyleFactory::keys(); - keys.removeAll("lthemeengine-style"); //hide lthemeengine proxy style - m_ui->styleComboBox->addItems(keys); - - connect(m_ui->paletteComboBox, SIGNAL(activated(int)), SLOT(updatePalette())); - connect(m_ui->customPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); - connect(m_ui->defaultPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); - - m_previewWidget = new QWidget(this); - m_previewUi = new Ui::PreviewForm(); - m_previewUi->setupUi(m_previewWidget); - QMdiSubWindow *w = m_ui->mdiArea->addSubWindow(m_previewWidget, Qt::CustomizeWindowHint - | Qt::WindowMinMaxButtonsHint - | Qt::WindowTitleHint); - w->move(10, 10); - - QMenu *menu = new QMenu(this); - menu->addAction(QIcon::fromTheme("list-add"), tr("Create"), this, SLOT(createColorScheme())); - m_changeColorSchemeAction = menu->addAction(tr("Edit"), this, SLOT(changeColorScheme())); - menu->addAction(tr("Create a Copy"), this, SLOT(copyColorScheme())); - m_renameColorSchemeAction = menu->addAction(tr("Rename"), this, SLOT(renameColorScheme())); - menu->addSeparator(); - m_removeColorSchemeAction = menu->addAction(tr("Remove"), this, SLOT(removeColorScheme())); - m_ui->colorSchemeButton->setMenu(menu); - - m_changeColorSchemeAction->setIcon(QIcon::fromTheme("accessories-text-editor")); - m_removeColorSchemeAction->setIcon(QIcon::fromTheme("list-remove")); - connect(menu, SIGNAL(aboutToShow()), SLOT(updateActions())); - - readSettings(); +AppearancePage::AppearancePage(QWidget *parent) : TabPage(parent), m_ui(new Ui::AppearancePage){ + m_ui->setupUi(this); + QStringList keys = QStyleFactory::keys(); + keys.removeAll("lthemeengine-style"); //hide lthemeengine proxy style + m_ui->styleComboBox->addItems(keys); + connect(m_ui->paletteComboBox, SIGNAL(activated(int)), SLOT(updatePalette())); + connect(m_ui->customPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); + connect(m_ui->defaultPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); + m_previewWidget = new QWidget(this); + m_previewUi = new Ui::PreviewForm(); + m_previewUi->setupUi(m_previewWidget); + QMdiSubWindow *w = m_ui->mdiArea->addSubWindow(m_previewWidget, Qt::CustomizeWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint); + w->move(10, 10); + + QMenu *menu = new QMenu(this); + menu->addAction(QIcon::fromTheme("list-add"), tr("Create"), this, SLOT(createColorScheme())); + m_changeColorSchemeAction = menu->addAction(tr("Edit"), this, SLOT(changeColorScheme())); + menu->addAction(tr("Create a Copy"), this, SLOT(copyColorScheme())); + m_renameColorSchemeAction = menu->addAction(tr("Rename"), this, SLOT(renameColorScheme())); + menu->addSeparator(); + m_removeColorSchemeAction = menu->addAction(tr("Remove"), this, SLOT(removeColorScheme())); + m_ui->colorSchemeButton->setMenu(menu); + m_changeColorSchemeAction->setIcon(QIcon::fromTheme("accessories-text-editor")); + m_removeColorSchemeAction->setIcon(QIcon::fromTheme("list-remove")); + connect(menu, SIGNAL(aboutToShow()), SLOT(updateActions())); + + readSettings(); } -AppearancePage::~AppearancePage() -{ - if(m_selectedStyle) - delete m_selectedStyle; +AppearancePage::~AppearancePage(){ + if(m_selectedStyle) + delete m_selectedStyle; delete m_ui; delete m_previewUi; } -void AppearancePage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Appearance"); - settings.setValue("style", m_ui->styleComboBox->currentText()); - settings.setValue("custom_palette", m_ui->customPaletteButton->isChecked()); - settings.setValue("color_scheme_path", m_ui->colorSchemeComboBox->currentData().toString()); - settings.endGroup(); +void AppearancePage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Appearance"); + settings.setValue("style", m_ui->styleComboBox->currentText()); + settings.setValue("custom_palette", m_ui->customPaletteButton->isChecked()); + settings.setValue("color_scheme_path", m_ui->colorSchemeComboBox->currentData().toString()); + settings.endGroup(); } -void AppearancePage::on_styleComboBox_activated(const QString &text) -{ - QStyle *style = QStyleFactory::create(text); - if(!style) - return; +void AppearancePage::on_styleComboBox_activated(const QString &text){ + QStyle *style = QStyleFactory::create(text); + if(!style) + return; setStyle(m_previewWidget, style); - if(m_selectedStyle) - delete m_selectedStyle; - m_selectedStyle = style; - - updatePalette(); + delete m_selectedStyle; + m_selectedStyle = style; + updatePalette(); } -void AppearancePage::on_colorSchemeComboBox_activated(int) -{ - m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); - updatePalette(); +void AppearancePage::on_colorSchemeComboBox_activated(int){ + m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); + updatePalette(); } -void AppearancePage::createColorScheme() -{ - QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:")); - if(name.isEmpty()) - return; - +void AppearancePage::createColorScheme(){ + QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:")); + if(name.isEmpty()) + return; if(!name.endsWith(".conf", Qt::CaseInsensitive)) - name.append(".conf"); - - if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1) - { - QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists") - .arg(name.section('.',0,0))); + name.append(".conf"); + if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1){ + QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists").arg(name.section('.',0,0))); return; - } - + } QString schemePath = lthemeengine::userColorSchemePath() + "/" + name; - createColorScheme(schemePath, palette()); m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), schemePath); } -void AppearancePage::changeColorScheme() -{ - if(m_ui->colorSchemeComboBox->currentIndex() < 0) - return; - - if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only") - .arg(m_ui->colorSchemeComboBox->currentText())); - return; +void AppearancePage::changeColorScheme(){ + if(m_ui->colorSchemeComboBox->currentIndex() < 0) + return; + if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only").arg(m_ui->colorSchemeComboBox->currentText())); + return; } - PaletteEditDialog d(m_customPalette, m_selectedStyle, this); connect(&d, SIGNAL(paletteChanged(QPalette)), SLOT(setPreviewPalette(QPalette))); - if(d.exec() == QDialog::Accepted) - { - m_customPalette = d.selectedPalette(); - createColorScheme(m_ui->colorSchemeComboBox->currentData().toString(), m_customPalette); + if(d.exec() == QDialog::Accepted){ + m_customPalette = d.selectedPalette(); + createColorScheme(m_ui->colorSchemeComboBox->currentData().toString(), m_customPalette); } updatePalette(); } -void AppearancePage::removeColorScheme() -{ - int index = m_ui->colorSchemeComboBox->currentIndex(); - if(index < 0 || m_ui->colorSchemeComboBox->count() <= 1) - return; - - if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only") - .arg(m_ui->colorSchemeComboBox->currentText())); - return; +void AppearancePage::removeColorScheme(){ + int index = m_ui->colorSchemeComboBox->currentIndex(); + if(index < 0 || m_ui->colorSchemeComboBox->count() <= 1) + return; + if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only").arg(m_ui->colorSchemeComboBox->currentText())); + return; } - - int button = QMessageBox::question(this, tr("Confirm Remove"), - tr("Are you sure you want to remove color scheme \"%1\"?") - .arg(m_ui->colorSchemeComboBox->currentText()), - QMessageBox::Yes | QMessageBox::No); + int button = QMessageBox::question(this, tr("Confirm Remove"),tr("Are you sure you want to remove color scheme \"%1\"?").arg(m_ui->colorSchemeComboBox->currentText()), QMessageBox::Yes | QMessageBox::No); if(button != QMessageBox::Yes) - return; - - if(QFile::remove(m_ui->colorSchemeComboBox->currentData().toString())) - { + return; + if(QFile::remove(m_ui->colorSchemeComboBox->currentData().toString())){ m_ui->colorSchemeComboBox->removeItem(index); on_colorSchemeComboBox_activated(0); - } + } } -void AppearancePage::copyColorScheme() -{ - if(m_ui->colorSchemeComboBox->currentIndex() < 0) - return; - - QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"), - QLineEdit::Normal, - tr("%1 (copy)").arg(m_ui->colorSchemeComboBox->currentText())); +void AppearancePage::copyColorScheme(){ + if(m_ui->colorSchemeComboBox->currentIndex() < 0) + return; + QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"),QLineEdit::Normal, tr("%1 (copy)").arg(m_ui->colorSchemeComboBox->currentText())); if(name.isEmpty() || name == m_ui->colorSchemeComboBox->currentText()) - return; - - if(!name.endsWith(".conf", Qt::CaseInsensitive)) - name.append(".conf"); - - if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1) - { - QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists") - .arg(name.section('.',0,0))); - return; - } - - QString newPath = lthemeengine::userColorSchemePath() + "/" + name; - QFile::copy(m_ui->colorSchemeComboBox->currentData().toString(), newPath); - m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), newPath); + return; + if(!name.endsWith(".conf", Qt::CaseInsensitive))name.append(".conf"); + if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1){ + QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists").arg(name.section('.',0,0))); + return; + } + QString newPath = lthemeengine::userColorSchemePath() + "/" + name; + QFile::copy(m_ui->colorSchemeComboBox->currentData().toString(), newPath); + m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), newPath); } -void AppearancePage::renameColorScheme() -{ - int index = m_ui->colorSchemeComboBox->currentIndex(); - +void AppearancePage::renameColorScheme(){ + int index = m_ui->colorSchemeComboBox->currentIndex(); if(index < 0) + return; + if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only").arg(m_ui->colorSchemeComboBox->currentText())); return; - - if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only") - .arg(m_ui->colorSchemeComboBox->currentText())); - return; - } - - QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"), - QLineEdit::Normal, m_ui->colorSchemeComboBox->currentText()); - if(name.isEmpty() || name == m_ui->colorSchemeComboBox->currentText()) - return; - - if(!name.endsWith(".conf", Qt::CaseInsensitive)) - name.append(".conf"); - - if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1) - { - QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists") - .arg(name.section('.',0,0))); + } + QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"), QLineEdit::Normal, m_ui->colorSchemeComboBox->currentText()); + if(name.isEmpty() || name == m_ui->colorSchemeComboBox->currentText()) return; - } - - QString newPath = lthemeengine::userColorSchemePath() + "/" + name; - QFile::rename(m_ui->colorSchemeComboBox->currentData().toString(), newPath); - m_ui->colorSchemeComboBox->setItemText(index, name.section('.',0,0)); - m_ui->colorSchemeComboBox->setItemData(index, newPath); + if(!name.endsWith(".conf", Qt::CaseInsensitive))name.append(".conf"); + if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1){ + QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists").arg(name.section('.',0,0))); + return; + } + QString newPath = lthemeengine::userColorSchemePath() + "/" + name; + QFile::rename(m_ui->colorSchemeComboBox->currentData().toString(), newPath); + m_ui->colorSchemeComboBox->setItemText(index, name.section('.',0,0)); + m_ui->colorSchemeComboBox->setItemData(index, newPath); } -void AppearancePage::updatePalette() -{ +void AppearancePage::updatePalette(){ if(!m_selectedStyle) - return; - - setPreviewPalette(m_ui->customPaletteButton->isChecked() ? - m_customPalette : m_selectedStyle->standardPalette()); + return; + setPreviewPalette(m_ui->customPaletteButton->isChecked() ? m_customPalette : m_selectedStyle->standardPalette()); } -void AppearancePage::setPreviewPalette(const QPalette &p) -{ - QPalette previewPalette = palette(); - - QPalette::ColorGroup colorGroup = QPalette::Disabled; - - if(m_ui->paletteComboBox->currentIndex() == 0) - { - colorGroup = QPalette::Active; - } - else if(m_ui->paletteComboBox->currentIndex() == 1) - { - colorGroup = QPalette::Inactive; +void AppearancePage::setPreviewPalette(const QPalette &p){ + QPalette previewPalette = palette(); + QPalette::ColorGroup colorGroup = QPalette::Disabled; + if(m_ui->paletteComboBox->currentIndex() == 0){ + colorGroup = QPalette::Active; } - - for (int i = 0; i < QPalette::NColorRoles; i++) - { - QPalette::ColorRole role = QPalette::ColorRole(i); - previewPalette.setColor(QPalette::Active, role, p.color(colorGroup, role)); - previewPalette.setColor(QPalette::Inactive, role, p.color(colorGroup, role)); - } - - setPalette(m_ui->mdiArea, previewPalette); + else if(m_ui->paletteComboBox->currentIndex() == 1){ + colorGroup = QPalette::Inactive; + } + for (int i = 0; i < QPalette::NColorRoles; i++){ + QPalette::ColorRole role = QPalette::ColorRole(i); + previewPalette.setColor(QPalette::Active, role, p.color(colorGroup, role)); + previewPalette.setColor(QPalette::Inactive, role, p.color(colorGroup, role)); + } + setPalette(m_ui->mdiArea, previewPalette); } -void AppearancePage::updateActions() -{ - if(m_ui->colorSchemeComboBox->count() == 0 || - !QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - m_changeColorSchemeAction->setVisible(false); - m_renameColorSchemeAction->setVisible(false); - m_removeColorSchemeAction->setVisible(false); - } - else - { - m_changeColorSchemeAction->setVisible(true); - m_renameColorSchemeAction->setVisible(true); - m_removeColorSchemeAction->setVisible(m_ui->colorSchemeComboBox->count() > 1); +void AppearancePage::updateActions(){ + if(m_ui->colorSchemeComboBox->count() == 0 || !QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + m_changeColorSchemeAction->setVisible(false); + m_renameColorSchemeAction->setVisible(false); + m_removeColorSchemeAction->setVisible(false); } + else{ + m_changeColorSchemeAction->setVisible(true); + m_renameColorSchemeAction->setVisible(true); + m_removeColorSchemeAction->setVisible(m_ui->colorSchemeComboBox->count() > 1); + } } -void AppearancePage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Appearance"); - QString style = settings.value("style", "Fusion").toString(); - m_ui->styleComboBox->setCurrentText(style); - - m_ui->customPaletteButton->setChecked(settings.value("custom_palette", false).toBool()); - QString colorSchemePath = settings.value("color_scheme_path").toString(); - - QDir("/").mkpath(lthemeengine::userColorSchemePath()); - findColorSchemes(lthemeengine::userColorSchemePath()); - findColorSchemes(lthemeengine::sharedColorSchemePath().join(", ")); - - if(m_ui->colorSchemeComboBox->count() == 0) - { - m_customPalette = palette(); //load fallback palette - } - else - { - int index = m_ui->colorSchemeComboBox->findData(colorSchemePath); - if(index >= 0) - m_ui->colorSchemeComboBox->setCurrentIndex(index); - m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); +void AppearancePage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Appearance"); + QString style = settings.value("style", "Fusion").toString(); + m_ui->styleComboBox->setCurrentText(style); + m_ui->customPaletteButton->setChecked(settings.value("custom_palette", false).toBool()); + QString colorSchemePath = settings.value("color_scheme_path").toString(); + QDir("/").mkpath(lthemeengine::userColorSchemePath()); + findColorSchemes(lthemeengine::userColorSchemePath()); + findColorSchemes(lthemeengine::sharedColorSchemePath().join(", ")); + if(m_ui->colorSchemeComboBox->count() == 0){ + m_customPalette = palette(); //load fallback palette } - + else{ + int index = m_ui->colorSchemeComboBox->findData(colorSchemePath); + if(index >= 0) + m_ui->colorSchemeComboBox->setCurrentIndex(index); + m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); + } on_styleComboBox_activated(m_ui->styleComboBox->currentText()); - settings.endGroup(); } -void AppearancePage::setStyle(QWidget *w, QStyle *s) -{ - foreach (QObject *o, w->children()) - { - if(o->isWidgetType()) - { - setStyle(qobject_cast<QWidget *>(o), s); - } +void AppearancePage::setStyle(QWidget *w, QStyle *s){ + foreach (QObject *o, w->children()){ + if(o->isWidgetType()){ + setStyle(qobject_cast<QWidget *>(o), s); } - w->setStyle(s); + } + w->setStyle(s); } -void AppearancePage::setPalette(QWidget *w, QPalette p) -{ - foreach (QObject *o, w->children()) - { - if(o->isWidgetType()) - { - setPalette(qobject_cast<QWidget *>(o), p); - } +void AppearancePage::setPalette(QWidget *w, QPalette p){ + foreach (QObject *o, w->children()){ + if(o->isWidgetType()){ + setPalette(qobject_cast<QWidget *>(o), p); + } } - w->setPalette(p); + w->setPalette(p); } -void AppearancePage::findColorSchemes(const QString &path) -{ - QDir dir(path); - dir.setFilter(QDir::Files); - dir.setNameFilters(QStringList() << "*.conf"); - - foreach (QFileInfo info, dir.entryInfoList()) - { - m_ui->colorSchemeComboBox->addItem(info.baseName(), info.filePath()); +void AppearancePage::findColorSchemes(const QString &path){ + QDir dir(path); + dir.setFilter(QDir::Files); + dir.setNameFilters(QStringList() << "*.conf"); + foreach (QFileInfo info, dir.entryInfoList()){ + m_ui->colorSchemeComboBox->addItem(info.baseName(), info.filePath()); } } -QPalette AppearancePage::loadColorScheme(const QString &filePath) -{ - QPalette customPalette; - QSettings settings(filePath, QSettings::IniFormat); - settings.beginGroup("ColorScheme"); - QStringList activeColors = settings.value("active_colors").toStringList(); - QStringList inactiveColors = settings.value("inactive_colors").toStringList(); - QStringList disabledColors = settings.value("disabled_colors").toStringList(); - settings.endGroup(); - - if(activeColors.count() == QPalette::NColorRoles && - inactiveColors.count() == QPalette::NColorRoles && - disabledColors.count() == QPalette::NColorRoles) - { - for (int i = 0; i < QPalette::NColorRoles; i++) - { - QPalette::ColorRole role = QPalette::ColorRole(i); - customPalette.setColor(QPalette::Active, role, QColor(activeColors.at(i))); - customPalette.setColor(QPalette::Inactive, role, QColor(inactiveColors.at(i))); - customPalette.setColor(QPalette::Disabled, role, QColor(disabledColors.at(i))); - } +QPalette AppearancePage::loadColorScheme(const QString &filePath){ + QPalette customPalette; + QSettings settings(filePath, QSettings::IniFormat); + settings.beginGroup("ColorScheme"); + QStringList activeColors = settings.value("active_colors").toStringList(); + QStringList inactiveColors = settings.value("inactive_colors").toStringList(); + QStringList disabledColors = settings.value("disabled_colors").toStringList(); + settings.endGroup(); + if(activeColors.count() == QPalette::NColorRoles && inactiveColors.count() == QPalette::NColorRoles && disabledColors.count() == QPalette::NColorRoles){ + for (int i = 0; i < QPalette::NColorRoles; i++){ + QPalette::ColorRole role = QPalette::ColorRole(i); + customPalette.setColor(QPalette::Active, role, QColor(activeColors.at(i))); + customPalette.setColor(QPalette::Inactive, role, QColor(inactiveColors.at(i))); + customPalette.setColor(QPalette::Disabled, role, QColor(disabledColors.at(i))); + } } - else - { - customPalette = palette(); //load fallback palette - } - + else{ + customPalette = palette(); //load fallback palette + } return customPalette; } -void AppearancePage::createColorScheme(const QString &name, const QPalette &palette) -{ - QSettings settings(name, QSettings::IniFormat); - settings.beginGroup("ColorScheme"); - - QStringList activeColors, inactiveColors, disabledColors; - for (int i = 0; i < QPalette::NColorRoles; i++) - { - QPalette::ColorRole role = QPalette::ColorRole(i); - activeColors << palette.color(QPalette::Active, role).name(); - inactiveColors << palette.color(QPalette::Inactive, role).name(); - disabledColors << palette.color(QPalette::Disabled, role).name(); +void AppearancePage::createColorScheme(const QString &name, const QPalette &palette){ + QSettings settings(name, QSettings::IniFormat); + settings.beginGroup("ColorScheme"); + QStringList activeColors, inactiveColors, disabledColors; + for (int i = 0; i < QPalette::NColorRoles; i++){ + QPalette::ColorRole role = QPalette::ColorRole(i); + activeColors << palette.color(QPalette::Active, role).name(); + inactiveColors << palette.color(QPalette::Inactive, role).name(); + disabledColors << palette.color(QPalette::Disabled, role).name(); } - - settings.setValue("active_colors",activeColors); - settings.setValue("inactive_colors",inactiveColors); - settings.setValue("disabled_colors",disabledColors); - - settings.endGroup(); - + settings.setValue("active_colors",activeColors); + settings.setValue("inactive_colors",inactiveColors); + settings.setValue("disabled_colors",disabledColors); + settings.endGroup(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h index 3a7752c7..23bab52f 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef APPEARANCEPAGE_H #define APPEARANCEPAGE_H @@ -39,14 +11,12 @@ class PreviewForm; class QStyle; class QAction; -class AppearancePage : public TabPage -{ +class AppearancePage : public TabPage{ Q_OBJECT public: explicit AppearancePage(QWidget *parent = 0); ~AppearancePage(); - void writeSettings(); private slots: diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp index 398a2436..13c92bf0 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QXmlStreamWriter> #include <QFile> #include <QDir> @@ -33,106 +5,80 @@ #include "fontconfigdialog.h" #include "ui_fontconfigdialog.h" -FontConfigDialog::FontConfigDialog(QWidget *parent) : - QDialog(parent), - m_ui(new Ui::FontConfigDialog) -{ - m_ui->setupUi(this); - - m_ui->hintingStyleComboBox->addItem(tr("None"), "hintnone"); - m_ui->hintingStyleComboBox->addItem(tr("Slight"), "hintslight"); - m_ui->hintingStyleComboBox->addItem(tr("Medium"), "hintmedium"); - m_ui->hintingStyleComboBox->addItem(tr("Full"), "hintfull"); - - m_ui->rgbaComboBox->addItem(tr("None"), "none"); - m_ui->rgbaComboBox->addItem("rgb", "rgb"); - m_ui->rgbaComboBox->addItem("bgr", "bgr"); - m_ui->rgbaComboBox->addItem("vrgb", "vrgb"); - m_ui->rgbaComboBox->addItem("vbgr", "vbgr"); - - m_ui->lcdFilterComboBox->addItem("lcdnone"); - m_ui->lcdFilterComboBox->addItem("lcddefault"); - m_ui->lcdFilterComboBox->addItem("lcdlight"); - m_ui->lcdFilterComboBox->addItem("lcdlegacy"); +FontConfigDialog::FontConfigDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::FontConfigDialog){ + m_ui->setupUi(this); + + m_ui->hintingStyleComboBox->addItem(tr("None"), "hintnone"); + m_ui->hintingStyleComboBox->addItem(tr("Slight"), "hintslight"); + m_ui->hintingStyleComboBox->addItem(tr("Medium"), "hintmedium"); + m_ui->hintingStyleComboBox->addItem(tr("Full"), "hintfull"); + m_ui->rgbaComboBox->addItem(tr("None"), "none"); + m_ui->rgbaComboBox->addItem("rgb", "rgb"); + m_ui->rgbaComboBox->addItem("bgr", "bgr"); + m_ui->rgbaComboBox->addItem("vrgb", "vrgb"); + m_ui->rgbaComboBox->addItem("vbgr", "vbgr"); + m_ui->lcdFilterComboBox->addItem("lcdnone"); + m_ui->lcdFilterComboBox->addItem("lcddefault"); + m_ui->lcdFilterComboBox->addItem("lcdlight"); + m_ui->lcdFilterComboBox->addItem("lcdlegacy"); } -FontConfigDialog::~FontConfigDialog() -{ - delete m_ui; +FontConfigDialog::~FontConfigDialog(){ + delete m_ui; } -void FontConfigDialog::accept() -{ - QDir::home().mkpath(".config/fontconfig/"); - QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; - qDebug("FontConfigDialog: fontconfig path: %s", qPrintable(path)); - - - if(QFile::exists(path)) - { - if(QMessageBox::question(this, tr("Font Configuration"), - tr("<i>%1</i> already exists. Do you want to replace it?").arg(path), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) - { - QDialog::reject(); - return; - } - - QFile::remove(path + ".back"); - QFile::copy(path, path + ".back"); +void FontConfigDialog::accept(){ + QDir::home().mkpath(".config/fontconfig/"); + QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; + qDebug("FontConfigDialog: fontconfig path: %s", qPrintable(path)); + if(QFile::exists(path)){ + if(QMessageBox::question(this, tr("Font Configuration"), tr("<i>%1</i> already exists. Do you want to replace it?").arg(path), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No){ + QDialog::reject(); + return; + } + QFile::remove(path + ".back"); + QFile::copy(path, path + ".back"); } - - QFile file(path); - if(!file.open(QIODevice::WriteOnly)) - { - qWarning("FontConfigDialog: unable to open file: %s", qPrintable(file.errorString())); - return; + QFile file(path); + if(!file.open(QIODevice::WriteOnly)){ + qWarning("FontConfigDialog: unable to open file: %s", qPrintable(file.errorString())); + return; } - - QXmlStreamWriter stream(&file); - stream.setAutoFormatting(true); - - stream.writeStartDocument(); - stream.writeDTD("<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">"); - stream.writeStartElement("fontconfig"); - + QXmlStreamWriter stream(&file); + stream.setAutoFormatting(true); + stream.writeStartDocument(); + stream.writeDTD("<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">"); + stream.writeStartElement("fontconfig"); + stream.writeStartElement("match"); + stream.writeAttribute("target", "font"); + writeOption(&stream, "antialias", "bool", m_ui->antialisingCheckBox->isChecked() ? "true" : "false"); + writeOption(&stream, "hinting", "bool", m_ui->hintingCheckBox->isChecked() ? "true" : "false"); + writeOption(&stream, "hintstyle", "const", m_ui->hintingStyleComboBox->currentData().toString()); + writeOption(&stream, "rgba", "const", m_ui->rgbaComboBox->currentData().toString()); + writeOption(&stream, "autohint", "bool", m_ui->autohinterCheckBox->isChecked() ? "true" : "false"); + writeOption(&stream, "lcdfilter", "const", m_ui->lcdFilterComboBox->currentText()); + writeOption(&stream, "dpi", "double", QString::number(m_ui->dpiSpinBox->value())); + stream.writeEndElement(); + if(m_ui->disableBoldAutohintCheckBox->isChecked()){ stream.writeStartElement("match"); stream.writeAttribute("target", "font"); - writeOption(&stream, "antialias", "bool", m_ui->antialisingCheckBox->isChecked() ? "true" : "false"); - writeOption(&stream, "hinting", "bool", m_ui->hintingCheckBox->isChecked() ? "true" : "false"); - writeOption(&stream, "hintstyle", "const", m_ui->hintingStyleComboBox->currentData().toString()); - writeOption(&stream, "rgba", "const", m_ui->rgbaComboBox->currentData().toString()); + stream.writeStartElement("test"); + stream.writeAttribute("name", "weight"); + stream.writeAttribute("compare", "more"); + stream.writeTextElement("const", "medium"); + stream.writeEndElement(); writeOption(&stream, "autohint", "bool", m_ui->autohinterCheckBox->isChecked() ? "true" : "false"); - writeOption(&stream, "lcdfilter", "const", m_ui->lcdFilterComboBox->currentText()); - writeOption(&stream, "dpi", "double", QString::number(m_ui->dpiSpinBox->value())); stream.writeEndElement(); - - if(m_ui->disableBoldAutohintCheckBox->isChecked()) - { - stream.writeStartElement("match"); - stream.writeAttribute("target", "font"); - - stream.writeStartElement("test"); - stream.writeAttribute("name", "weight"); - stream.writeAttribute("compare", "more"); - stream.writeTextElement("const", "medium"); - stream.writeEndElement(); - - writeOption(&stream, "autohint", "bool", m_ui->autohinterCheckBox->isChecked() ? "true" : "false"); - - stream.writeEndElement(); } - stream.writeEndElement(); - stream.writeEndDocument(); - - QDialog::accept(); + stream.writeEndElement(); + stream.writeEndDocument(); + QDialog::accept(); } -void FontConfigDialog::writeOption(QXmlStreamWriter *stream, const QString &name, const QString &type, const QString &value) -{ - stream->writeStartElement("edit"); - stream->writeAttribute("name", name); - stream->writeAttribute("mode", "assign"); - stream->writeTextElement(type, value); - stream->writeEndElement(); +void FontConfigDialog::writeOption(QXmlStreamWriter *stream, const QString &name, const QString &type, const QString &value){ + stream->writeStartElement("edit"); + stream->writeAttribute("name", name); + stream->writeAttribute("mode", "assign"); + stream->writeTextElement(type, value); + stream->writeEndElement(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h index 5b7e31a5..09991787 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef FONTCONFIGDIALOG_H #define FONTCONFIGDIALOG_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp index db48a3cc..8d1ed1ab 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSignalMapper> #include <QMessageBox> #include <QSettings> @@ -38,89 +10,70 @@ #include "fontconfigdialog.h" #include "ui_fontspage.h" -FontsPage::FontsPage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::FontsPage) -{ - m_ui->setupUi(this); - - QSignalMapper *mapper = new QSignalMapper(this); - mapper->setMapping(m_ui->changeGeneralFontButton, m_ui->generalFontLabel); - mapper->setMapping(m_ui->changeFixedWidthFontButton, m_ui->fixedFontLabel); - connect(m_ui->changeGeneralFontButton, SIGNAL(clicked()), mapper, SLOT(map())); - connect(m_ui->changeFixedWidthFontButton, SIGNAL(clicked()), mapper, SLOT(map())); - connect(mapper, SIGNAL(mapped(QWidget*)), SLOT(onFontChangeRequested(QWidget*))); +FontsPage::FontsPage(QWidget *parent) : TabPage(parent), m_ui(new Ui::FontsPage){ + m_ui->setupUi(this); - readSettings(); + QSignalMapper *mapper = new QSignalMapper(this); + mapper->setMapping(m_ui->changeGeneralFontButton, m_ui->generalFontLabel); + mapper->setMapping(m_ui->changeFixedWidthFontButton, m_ui->fixedFontLabel); + connect(m_ui->changeGeneralFontButton, SIGNAL(clicked()), mapper, SLOT(map())); + connect(m_ui->changeFixedWidthFontButton, SIGNAL(clicked()), mapper, SLOT(map())); + connect(mapper, SIGNAL(mapped(QWidget*)), SLOT(onFontChangeRequested(QWidget*))); + readSettings(); - //icons - m_ui->createFontsConfButton->setIcon(QIcon::fromTheme("document-new")); - m_ui->removeFontsConfButton->setIcon(QIcon::fromTheme("edit-delete")); + //icons + m_ui->createFontsConfButton->setIcon(QIcon::fromTheme("document-new")); + m_ui->removeFontsConfButton->setIcon(QIcon::fromTheme("edit-delete")); } -FontsPage::~FontsPage() -{ - delete m_ui; +FontsPage::~FontsPage(){ + delete m_ui; } -void FontsPage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Fonts"); - settings.setValue("general", m_ui->generalFontLabel->font()); - settings.setValue("fixed", m_ui->fixedFontLabel->font()); - settings.endGroup(); +void FontsPage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Fonts"); + settings.setValue("general", m_ui->generalFontLabel->font()); + settings.setValue("fixed", m_ui->fixedFontLabel->font()); + settings.endGroup(); } -void FontsPage::onFontChangeRequested(QWidget *widget) -{ - bool ok = false; - QFont font = QFontDialog::getFont (&ok, widget->font(), this); - if(ok) - { - widget->setFont(font); - qobject_cast<QLabel*>(widget)->setText(font.family () + " " + QString::number(font.pointSize ())); +void FontsPage::onFontChangeRequested(QWidget *widget){ + bool ok = false; + QFont font = QFontDialog::getFont (&ok, widget->font(), this); + if(ok){ + widget->setFont(font); + qobject_cast<QLabel*>(widget)->setText(font.family () + " " + QString::number(font.pointSize ())); } } -void FontsPage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Fonts"); - loadFont(&settings, m_ui->generalFontLabel, "general"); - loadFont(&settings, m_ui->fixedFontLabel, "fixed"); - settings.endGroup(); +void FontsPage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Fonts"); + loadFont(&settings, m_ui->generalFontLabel, "general"); + loadFont(&settings, m_ui->fixedFontLabel, "fixed"); + settings.endGroup(); } -void FontsPage::loadFont(QSettings *settings, QLabel *label, const QString &key) -{ - QFont font = settings->value(key, QApplication::font()).value<QFont>(); - label->setText(font.family () + " " + QString::number(font.pointSize ())); - label->setFont(font); +void FontsPage::loadFont(QSettings *settings, QLabel *label, const QString &key){ + QFont font = settings->value(key, QApplication::font()).value<QFont>(); + label->setText(font.family () + " " + QString::number(font.pointSize ())); + label->setFont(font); } -void FontsPage::on_createFontsConfButton_clicked() -{ - FontConfigDialog d(this); - d.exec(); +void FontsPage::on_createFontsConfButton_clicked(){ + FontConfigDialog d(this); + d.exec(); } -void FontsPage::on_removeFontsConfButton_clicked() -{ - QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; - - - if(QFile::exists(path)) - { - if(QMessageBox::question(this, tr("Remove Font Configuration"), - tr("Are you sure you want to delete <i>%1</i>?").arg(path), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) - { - return; - } - - QFile::remove(path + ".back"); - QFile::copy(path, path + ".back"); - QFile::remove(path); +void FontsPage::on_removeFontsConfButton_clicked(){ + QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; + if(QFile::exists(path)){ + if(QMessageBox::question(this, tr("Remove Font Configuration"), tr("Are you sure you want to delete <i>%1</i>?").arg(path), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No){ + return; } + QFile::remove(path + ".back"); + QFile::copy(path, path + ".back"); + QFile::remove(path); + } } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h index a9c5f1f6..2b522fee 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef FONTSPAGE_H #define FONTSPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp index ca9a3388..cfe002aa 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSettings> #include <QFileInfo> #include <QFileInfoList> @@ -37,178 +9,136 @@ #include "iconthemepage.h" #include "ui_iconthemepage.h" -IconThemePage::IconThemePage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::IconThemePage) -{ - m_ui->setupUi(this); - loadThemes(); - readSettings(); +IconThemePage::IconThemePage(QWidget *parent) : TabPage(parent), m_ui(new Ui::IconThemePage){ + m_ui->setupUi(this); + loadThemes(); + readSettings(); } -IconThemePage::~IconThemePage() -{ - delete m_ui; +IconThemePage::~IconThemePage(){ + delete m_ui; } -void IconThemePage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - QTreeWidgetItem *item = m_ui->treeWidget->currentItem(); - if(item) - settings.setValue("Appearance/icon_theme", item->data(3, Qt::UserRole)); +void IconThemePage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + QTreeWidgetItem *item = m_ui->treeWidget->currentItem(); + if(item) + settings.setValue("Appearance/icon_theme", item->data(3, Qt::UserRole)); } -void IconThemePage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - QString name = settings.value("Appearance/icon_theme").toString(); - - if(name.isEmpty()) - return; - - for(int i = 0; i < m_ui->treeWidget->topLevelItemCount(); ++i) - { - QTreeWidgetItem *item = m_ui->treeWidget->topLevelItem(i); - if(item->data(3, Qt::UserRole).toString() == name) - { - m_ui->treeWidget->setCurrentItem(item); - break; +void IconThemePage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + QString name = settings.value("Appearance/icon_theme").toString(); + if(name.isEmpty()) + return; + for(int i = 0; i < m_ui->treeWidget->topLevelItemCount(); ++i){ + QTreeWidgetItem *item = m_ui->treeWidget->topLevelItem(i); + if(item->data(3, Qt::UserRole).toString() == name){ + m_ui->treeWidget->setCurrentItem(item); + break; } - } + } } -void IconThemePage::loadThemes() -{ - QFileInfoList themeFileList; - foreach(QString path, lthemeengine::iconPaths()) - { - QDir dir(path); - dir.setFilter(QDir::Dirs | QDir::NoDotDot | QDir::NoDot); - foreach (QFileInfo info, dir.entryInfoList()) - { - QDir themeDir(info.absoluteFilePath()); - themeDir.setFilter(QDir::Files); - themeFileList << themeDir.entryInfoList(QStringList() << "index.theme"); - } +void IconThemePage::loadThemes(){ + QFileInfoList themeFileList; + foreach(QString path, lthemeengine::iconPaths()){ + QDir dir(path); + dir.setFilter(QDir::Dirs | QDir::NoDotDot | QDir::NoDot); + foreach (QFileInfo info, dir.entryInfoList()){ + QDir themeDir(info.absoluteFilePath()); + themeDir.setFilter(QDir::Files); + themeFileList << themeDir.entryInfoList(QStringList() << "index.theme"); + } } - - foreach(QFileInfo info, themeFileList) - { - loadTheme(info.canonicalFilePath()); + foreach(QFileInfo info, themeFileList){ + loadTheme(info.canonicalFilePath()); } } -void IconThemePage::loadTheme(const QString &path) -{ - QSettings config(path, QSettings::IniFormat); - config.setIniCodec("UTF-8"); - - config.beginGroup("Icon Theme"); - QStringList dirs = config.value("Directories").toStringList(); - if(dirs.isEmpty() || config.value("Hidden", false).toBool()) - return; - +void IconThemePage::loadTheme(const QString &path){ + QSettings config(path, QSettings::IniFormat); + config.setIniCodec("UTF-8"); + config.beginGroup("Icon Theme"); + QStringList dirs = config.value("Directories").toStringList(); + if(dirs.isEmpty() || config.value("Hidden", false).toBool()) + return; QString name, comment; QString lang = QLocale::system().name(); - name = config.value(QString("Name[%1]").arg(lang)).toString(); comment = config.value(QString("Comment[%1]").arg(lang)).toString(); - if(lang.contains("_")) - lang = lang.split("_").first(); - - if(name.isEmpty()) + lang = lang.split("_").first(); + if(name.isEmpty()) name = config.value(QString("Name[%1]").arg(lang)).toString(); - - if(comment.isEmpty()) - comment = config.value(QString("Comment[%1]").arg(lang)).toString(); - - if(name.isEmpty()) - name = config.value("Name").toString(); - - if(comment.isEmpty()) - comment = config.value("Comment").toString(); - - config.endGroup(); - - QIcon icon1 = findIcon(path, 24, "document-save"); - QIcon icon2 = findIcon(path, 24, "document-print"); - QIcon icon3 = findIcon(path, 24, "media-playback-stop"); - - QTreeWidgetItem *item = new QTreeWidgetItem(); - item->setIcon(0, icon1); - item->setIcon(1, icon2); - item->setIcon(2, icon3); - item->setText(3, name); - item->setData(3, Qt::UserRole, QFileInfo(path).path().section("/", -1)); - item->setToolTip(3, comment); - item->setSizeHint(0, QSize(24,24)); - m_ui->treeWidget->addTopLevelItem(item); - - m_ui->treeWidget->resizeColumnToContents(0); - m_ui->treeWidget->resizeColumnToContents(1); - m_ui->treeWidget->resizeColumnToContents(2); - m_ui->treeWidget->resizeColumnToContents(3); + if(comment.isEmpty()) + comment = config.value(QString("Comment[%1]").arg(lang)).toString(); + if(name.isEmpty()) + name = config.value("Name").toString(); + if(comment.isEmpty()) + comment = config.value("Comment").toString(); + config.endGroup(); + QIcon icon1 = findIcon(path, 24, "document-save"); + QIcon icon2 = findIcon(path, 24, "document-print"); + QIcon icon3 = findIcon(path, 24, "media-playback-stop"); + QTreeWidgetItem *item = new QTreeWidgetItem(); + item->setIcon(0, icon1); + item->setIcon(1, icon2); + item->setIcon(2, icon3); + item->setText(3, name); + item->setData(3, Qt::UserRole, QFileInfo(path).path().section("/", -1)); + item->setToolTip(3, comment); + item->setSizeHint(0, QSize(24,24)); + m_ui->treeWidget->addTopLevelItem(item); + m_ui->treeWidget->resizeColumnToContents(0); + m_ui->treeWidget->resizeColumnToContents(1); + m_ui->treeWidget->resizeColumnToContents(2); + m_ui->treeWidget->resizeColumnToContents(3); } -QIcon IconThemePage::findIcon(const QString &themePath, int size, const QString &name) -{ - QSettings config(themePath, QSettings::IniFormat); - config.beginGroup("Icon Theme"); - QStringList dirs = config.value("Directories").toStringList(); - QStringList parents = config.value("Inherits").toStringList(); - bool haveInherits = config.contains("Inherits"); - config.endGroup(); - - foreach (QString dir, dirs) - { - config.beginGroup(dir); - if(config.value("Size").toInt() == size) - { - QDir iconDir = QFileInfo(themePath).path() + "/" + dir; - iconDir.setFilter(QDir::Files); - iconDir.setNameFilters(QStringList () << name + ".*"); - if(iconDir.entryInfoList().isEmpty()) - continue; - return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); - } - config.endGroup(); +QIcon IconThemePage::findIcon(const QString &themePath, int size, const QString &name){ + QSettings config(themePath, QSettings::IniFormat); + config.beginGroup("Icon Theme"); + QStringList dirs = config.value("Directories").toStringList(); + QStringList parents = config.value("Inherits").toStringList(); + bool haveInherits = config.contains("Inherits"); + config.endGroup(); + foreach (QString dir, dirs){ + config.beginGroup(dir); + if(config.value("Size").toInt() == size){ + QDir iconDir = QFileInfo(themePath).path() + "/" + dir; + iconDir.setFilter(QDir::Files); + iconDir.setNameFilters(QStringList () << name + ".*"); + if(iconDir.entryInfoList().isEmpty()) + continue; + return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); + } + config.endGroup(); } - - foreach (QString dir, dirs) - { - config.beginGroup(dir); - if(abs(config.value("Size").toInt() - size) < 4) - { - QDir iconDir = QFileInfo(themePath).path() + "/" + dir; - iconDir.setFilter(QDir::Files); - iconDir.setNameFilters(QStringList () << name + ".*"); - if(iconDir.entryInfoList().isEmpty()) - continue; - return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); - } - config.endGroup(); + foreach (QString dir, dirs){ + config.beginGroup(dir); + if(abs(config.value("Size").toInt() - size) < 4){ + QDir iconDir = QFileInfo(themePath).path() + "/" + dir; + iconDir.setFilter(QDir::Files); + iconDir.setNameFilters(QStringList () << name + ".*"); + if(iconDir.entryInfoList().isEmpty()) + continue; + return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); } - - if (!haveInherits) - return QIcon(); - + config.endGroup(); + } + if (!haveInherits) + return QIcon(); parents.append("hicolor"); //add fallback themes parents.append("gnome"); parents.removeDuplicates(); - - foreach (QString parent, parents) - { - QString parentThemePath = QDir(QFileInfo(themePath).path() + "/../" + parent).canonicalPath() + "/index.theme"; - - if(!QFile::exists(parentThemePath) || parentThemePath == themePath) - continue; - + foreach (QString parent, parents){ + QString parentThemePath = QDir(QFileInfo(themePath).path() + "/../" + parent).canonicalPath() + "/index.theme"; + if(!QFile::exists(parentThemePath) || parentThemePath == themePath) + continue; QIcon icon = findIcon(parentThemePath, size, name); if(!icon.isNull()) - return icon; - } - + return icon; + } return QIcon(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h index 0ccd64e0..8a6635ef 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef ICONTHEMEPAGE_H #define ICONTHEMEPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp index a9f40080..a44e75e4 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSettings> #include <QApplication> #include <QDialogButtonBox> @@ -33,108 +5,84 @@ #include "interfacepage.h" #include "ui_interfacepage.h" -InterfacePage::InterfacePage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::InterfacePage) -{ - m_ui->setupUi(this); - - m_ui->buttonLayoutComboBox->addItem("Windows", QDialogButtonBox::WinLayout); - m_ui->buttonLayoutComboBox->addItem("Mac OS X", QDialogButtonBox::MacLayout); - m_ui->buttonLayoutComboBox->addItem("KDE", QDialogButtonBox::KdeLayout); - m_ui->buttonLayoutComboBox->addItem("GNOME", QDialogButtonBox::GnomeLayout); - - m_ui->toolButtonStyleComboBox->addItem(tr("Only display the icon"), Qt::ToolButtonIconOnly); - m_ui->toolButtonStyleComboBox->addItem(tr("Only display the text"), Qt::ToolButtonTextOnly); - m_ui->toolButtonStyleComboBox->addItem(tr("The text appears beside the icon"), Qt::ToolButtonTextBesideIcon); - m_ui->toolButtonStyleComboBox->addItem(tr("The text appears under the icon"), Qt::ToolButtonTextUnderIcon); - m_ui->toolButtonStyleComboBox->addItem(tr("Follow the application style"), Qt::ToolButtonFollowStyle); - - readSettings(); +InterfacePage::InterfacePage(QWidget *parent) : TabPage(parent), m_ui(new Ui::InterfacePage){ + m_ui->setupUi(this); + + m_ui->buttonLayoutComboBox->addItem("Windows", QDialogButtonBox::WinLayout); + m_ui->buttonLayoutComboBox->addItem("Mac OS X", QDialogButtonBox::MacLayout); + m_ui->buttonLayoutComboBox->addItem("KDE", QDialogButtonBox::KdeLayout); + m_ui->buttonLayoutComboBox->addItem("GNOME", QDialogButtonBox::GnomeLayout); + m_ui->toolButtonStyleComboBox->addItem(tr("Only display the icon"), Qt::ToolButtonIconOnly); + m_ui->toolButtonStyleComboBox->addItem(tr("Only display the text"), Qt::ToolButtonTextOnly); + m_ui->toolButtonStyleComboBox->addItem(tr("The text appears beside the icon"), Qt::ToolButtonTextBesideIcon); + m_ui->toolButtonStyleComboBox->addItem(tr("The text appears under the icon"), Qt::ToolButtonTextUnderIcon); + m_ui->toolButtonStyleComboBox->addItem(tr("Follow the application style"), Qt::ToolButtonFollowStyle); + readSettings(); } -InterfacePage::~InterfacePage() -{ - delete m_ui; +InterfacePage::~InterfacePage(){ + delete m_ui; } -void InterfacePage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Interface"); - settings.setValue("double_click_interval", m_ui->doubleClickIntervalSpinBox->value()); - settings.setValue("cursor_flash_time", m_ui->cursorFlashTimeSpinBox->value()); - settings.setValue("buttonbox_layout", m_ui->buttonLayoutComboBox->currentData()); - settings.setValue("menus_have_icons", m_ui->menuIconsCheckBox->isChecked()); - settings.setValue("activate_item_on_single_click", m_ui->singleClickCheckBox->checkState()); - settings.setValue("dialog_buttons_have_icons", m_ui->dialogIconsCheckBox->checkState()); - settings.setValue("toolbutton_style", m_ui->toolButtonStyleComboBox->currentData()); - settings.setValue("wheel_scroll_lines", m_ui->wheelScrollLinesSpinBox->value()); - - QStringList effects; - if(m_ui->guiEffectsCheckBox->isChecked()) - effects << "General"; - +void InterfacePage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Interface"); + settings.setValue("double_click_interval", m_ui->doubleClickIntervalSpinBox->value()); + settings.setValue("cursor_flash_time", m_ui->cursorFlashTimeSpinBox->value()); + settings.setValue("buttonbox_layout", m_ui->buttonLayoutComboBox->currentData()); + settings.setValue("menus_have_icons", m_ui->menuIconsCheckBox->isChecked()); + settings.setValue("activate_item_on_single_click", m_ui->singleClickCheckBox->checkState()); + settings.setValue("dialog_buttons_have_icons", m_ui->dialogIconsCheckBox->checkState()); + settings.setValue("toolbutton_style", m_ui->toolButtonStyleComboBox->currentData()); + settings.setValue("wheel_scroll_lines", m_ui->wheelScrollLinesSpinBox->value()); + QStringList effects; + if(m_ui->guiEffectsCheckBox->isChecked()) + effects << "General"; if(m_ui->menuEffectComboBox->currentIndex() == 1) - effects << "AnimateMenu"; + effects << "AnimateMenu"; else if(m_ui->menuEffectComboBox->currentIndex() == 2) - effects << "FadeMenu"; - - if(m_ui->comboBoxEffectComboBox->currentIndex() == 1) + effects << "FadeMenu"; + if(m_ui->comboBoxEffectComboBox->currentIndex() == 1) effects << "AnimateCombo"; - - if(m_ui->toolTipEffectComboBox->currentIndex() == 1) - effects << "AnimateTooltip"; - else if(m_ui->toolTipEffectComboBox->currentIndex() == 2) - effects << "FadeTooltip"; - - if(m_ui->toolBoxEffectComboBox->currentIndex() == 1) - effects << "AnimateToolBox"; - - settings.setValue("gui_effects", effects); - settings.endGroup(); + if(m_ui->toolTipEffectComboBox->currentIndex() == 1) + effects << "AnimateTooltip"; + else if(m_ui->toolTipEffectComboBox->currentIndex() == 2) + effects << "FadeTooltip"; + if(m_ui->toolBoxEffectComboBox->currentIndex() == 1) + effects << "AnimateToolBox"; + settings.setValue("gui_effects", effects); + settings.endGroup(); } -void InterfacePage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Interface"); - m_ui->doubleClickIntervalSpinBox->setValue(qApp->doubleClickInterval()); - m_ui->cursorFlashTimeSpinBox->setValue(qApp->cursorFlashTime()); - - m_ui->guiEffectsCheckBox->setChecked(qApp->isEffectEnabled(Qt::UI_General)); - - int layout = settings.value("buttonbox_layout", style()->styleHint(QStyle::SH_DialogButtonLayout)).toInt(); - int index = m_ui->buttonLayoutComboBox->findData(layout); - if(index >= 0) - m_ui->buttonLayoutComboBox->setCurrentIndex(index); - +void InterfacePage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Interface"); + m_ui->doubleClickIntervalSpinBox->setValue(qApp->doubleClickInterval()); + m_ui->cursorFlashTimeSpinBox->setValue(qApp->cursorFlashTime()); + m_ui->guiEffectsCheckBox->setChecked(qApp->isEffectEnabled(Qt::UI_General)); + int layout = settings.value("buttonbox_layout", style()->styleHint(QStyle::SH_DialogButtonLayout)).toInt(); + int index = m_ui->buttonLayoutComboBox->findData(layout); + if(index >= 0) + m_ui->buttonLayoutComboBox->setCurrentIndex(index); if(qApp->isEffectEnabled(Qt::UI_AnimateMenu)) - m_ui->menuEffectComboBox->setCurrentIndex(1); + m_ui->menuEffectComboBox->setCurrentIndex(1); else if(qApp->isEffectEnabled(Qt::UI_FadeMenu)) - m_ui->menuEffectComboBox->setCurrentIndex(2); - + m_ui->menuEffectComboBox->setCurrentIndex(2); if(qApp->isEffectEnabled(Qt::UI_AnimateCombo)) - m_ui->comboBoxEffectComboBox->setCurrentIndex(1); - - if(qApp->isEffectEnabled(Qt::UI_AnimateTooltip)) + m_ui->comboBoxEffectComboBox->setCurrentIndex(1); + if(qApp->isEffectEnabled(Qt::UI_AnimateTooltip)) m_ui->toolTipEffectComboBox->setCurrentIndex(1); - else if(qApp->isEffectEnabled(Qt::UI_FadeTooltip)) + else if(qApp->isEffectEnabled(Qt::UI_FadeTooltip)) m_ui->toolTipEffectComboBox->setCurrentIndex(2); - - if(qApp->isEffectEnabled(Qt::UI_AnimateToolBox)) - m_ui->toolBoxEffectComboBox->setCurrentIndex(1); - - m_ui->singleClickCheckBox->setCheckState((Qt::CheckState)settings.value("activate_item_on_single_click", Qt::PartiallyChecked).toInt()); - m_ui->dialogIconsCheckBox->setCheckState((Qt::CheckState)settings.value("dialog_buttons_have_icons", Qt::PartiallyChecked).toInt()); - m_ui->menuIconsCheckBox->setChecked(!qApp->testAttribute(Qt::AA_DontShowIconsInMenus)); - - int toolbarStyle = settings.value("toolbutton_style", Qt::ToolButtonFollowStyle).toInt(); - index = m_ui->toolButtonStyleComboBox->findData(toolbarStyle); - if(index >= 0) - m_ui->toolButtonStyleComboBox->setCurrentIndex(index); - - m_ui->wheelScrollLinesSpinBox->setValue(settings.value("wheel_scroll_lines", 3).toInt()); - - settings.endGroup(); + if(qApp->isEffectEnabled(Qt::UI_AnimateToolBox)) + m_ui->toolBoxEffectComboBox->setCurrentIndex(1); + m_ui->singleClickCheckBox->setCheckState((Qt::CheckState)settings.value("activate_item_on_single_click", Qt::PartiallyChecked).toInt()); + m_ui->dialogIconsCheckBox->setCheckState((Qt::CheckState)settings.value("dialog_buttons_have_icons", Qt::PartiallyChecked).toInt()); + m_ui->menuIconsCheckBox->setChecked(!qApp->testAttribute(Qt::AA_DontShowIconsInMenus)); + int toolbarStyle = settings.value("toolbutton_style", Qt::ToolButtonFollowStyle).toInt(); + index = m_ui->toolButtonStyleComboBox->findData(toolbarStyle); + if(index >= 0) + m_ui->toolButtonStyleComboBox->setCurrentIndex(index); + m_ui->wheelScrollLinesSpinBox->setValue(settings.value("wheel_scroll_lines", 3).toInt()); + settings.endGroup(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h index 637b6bf1..7946e599 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef INTERFACEPAGE_H #define INTERFACEPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp index 65328963..979c8c43 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QDir> #include <QLocale> #include "lthemeengine.h" @@ -35,98 +7,83 @@ #endif -QString lthemeengine::configPath() -{ - return QDir::homePath() + "/.config/lthemeengine/"; +QString lthemeengine::configPath(){ + return QDir::homePath() + "/.config/lthemeengine/"; } -QString lthemeengine::configFile() -{ - return configPath() + "lthemeengine.conf"; +QString lthemeengine::configFile(){ + return configPath() + "lthemeengine.conf"; } -QStringList lthemeengine::iconPaths() -{ - QString xdgDataDirs = qgetenv("XDG_DATA_DIRS"); - QString xdgDataHome = qgetenv("XDG_DATA_HOME"); - - QStringList paths; - paths << QDir::homePath() + "/.icons/"; - - if(xdgDataDirs.isEmpty()) - { - paths << "/usr/share/icons"; - paths << "/usr/local/share/icons"; +QStringList lthemeengine::iconPaths(){ + QString xdgDataDirs = qgetenv("XDG_DATA_DIRS"); + QString xdgDataHome = qgetenv("XDG_DATA_HOME"); + QStringList paths; + paths << QDir::homePath() + "/.icons/"; + if(xdgDataDirs.isEmpty()){ + paths << "/usr/share/icons"; + paths << "/usr/local/share/icons"; } - else - { - foreach (QString p, xdgDataDirs.split(":")) - paths << QDir(p + "/icons/").absolutePath(); + else{ + foreach (QString p, xdgDataDirs.split(":")) + paths << QDir(p + "/icons/").absolutePath(); } - - if(xdgDataHome.isEmpty()) - xdgDataHome = QDir::homePath() + "/.local/share"; - + if(xdgDataHome.isEmpty()) + xdgDataHome = QDir::homePath() + "/.local/share"; paths << "/usr/share/pixmaps"; paths << xdgDataHome + "/icons"; paths.removeDuplicates(); - //remove invalid - foreach (QString p, paths) - { - if(!QDir(p).exists()) - paths.removeAll(p); - } - return paths; + foreach (QString p, paths){ + if(!QDir(p).exists()) + paths.removeAll(p); + } + return paths; } -QString lthemeengine::userStyleSheetPath() -{ - return configPath() + "qss/"; +QString lthemeengine::userStyleSheetPath(){ + return configPath() + "qss/"; } -QStringList lthemeengine::sharedStyleSheetPath() - { - QStringList dirs; - dirs << QString(getenv("XDG_CONFIG_HOME")); - dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); - for(int i=0; i<dirs.length(); i++){ - dirs[i].append("/lthemeengine/colors/"); +QStringList lthemeengine::sharedStyleSheetPath(){ + QStringList dirs; + dirs << QString(getenv("XDG_CONFIG_HOME")); + dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); + for(int i=0; i<dirs.length(); i++){ + dirs[i].append("/lthemeengine/colors/"); } - if(dirs.isEmpty()){ - dirs << LTHEMEENGINE_DATADIR"/lthemeengine/qss/"; //no XDG settings - use the hardcoded path + if(dirs.isEmpty()){ + dirs << LTHEMEENGINE_DATADIR"/lthemeengine/qss/"; //no XDG settings - use the hardcoded path } - return dirs; + return dirs; } - QString lthemeengine::userColorSchemePath(){ - return configPath() + "colors/"; - } +QString lthemeengine::userColorSchemePath(){ + return configPath() + "colors/"; +} -QStringList lthemeengine::sharedColorSchemePath() - { - QStringList dirs; - dirs << QString(getenv("XDG_CONFIG_HOME")); - dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); - for(int i=0; i<dirs.length(); i++){ - dirs[i].append("/lthemeengine/colors/"); +QStringList lthemeengine::sharedColorSchemePath(){ + QStringList dirs; + dirs << QString(getenv("XDG_CONFIG_HOME")); + dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); + for(int i=0; i<dirs.length(); i++){ + dirs[i].append("/lthemeengine/colors/"); } - if(dirs.isEmpty()){ - dirs << LTHEMEENGINE_DATADIR"/lthemeengine/colors/"; //no XDG settings - use the hardcoded path + if(dirs.isEmpty()){ + dirs << LTHEMEENGINE_DATADIR"/lthemeengine/colors/"; //no XDG settings - use the hardcoded path } - return dirs; - } + return dirs; +} -QString lthemeengine::systemLanguageID() -{ +QString lthemeengine::systemLanguageID(){ #ifdef Q_OS_UNIX - QByteArray v = qgetenv ("LC_ALL"); - if (v.isEmpty()) - v = qgetenv ("LC_MESSAGES"); + QByteArray v = qgetenv ("LC_ALL"); + if (v.isEmpty()) + v = qgetenv ("LC_MESSAGES"); if (v.isEmpty()) - v = qgetenv ("LANG"); - if (!v.isEmpty()) + v = qgetenv ("LANG"); + if (!v.isEmpty()) return QLocale (v).name(); #endif - return QLocale::system().name(); + return QLocale::system().name(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h index 171f720a..93a1d433 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef LTHEMEENGINE_H #define LTHEMEENGINE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp index 1961d17d..55d0fc36 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QApplication> #include <QLibraryInfo> #include <QLocale> @@ -36,49 +8,34 @@ #include <QStyleFactory> #include "mainwindow.h" -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - QTranslator translator; - QString locale = lthemeengine::systemLanguageID(); - translator.load(QString(":/lthemeengine_") + locale); - app.installTranslator(&translator); - - QTranslator qt_translator; - qt_translator.load(QLibraryInfo::location (QLibraryInfo::TranslationsPath) + "/qtbase_" + locale); - app.installTranslator(&qt_translator); - - qDebug("Configuration path: %s", qPrintable(lthemeengine::configPath())); - qDebug("Shared QSS path: %s", qPrintable(lthemeengine::sharedStyleSheetPath().join(", "))); - - //checking environment - QStringList errorMessages; - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - - if(env.contains("QT_STYLE_OVERRIDE")) - { - errorMessages << app.translate("main", "Please remove the <b>QT_STYLE_OVERRIDE</b> environment variable"); +int main(int argc, char **argv){ + QApplication app(argc, argv); + QTranslator translator; + QString locale = lthemeengine::systemLanguageID(); + translator.load(QString(":/lthemeengine_") + locale); + app.installTranslator(&translator); + QTranslator qt_translator; + qt_translator.load(QLibraryInfo::location (QLibraryInfo::TranslationsPath) + "/qtbase_" + locale); + app.installTranslator(&qt_translator); + qDebug("Configuration path: %s", qPrintable(lthemeengine::configPath())); + qDebug("Shared QSS path: %s", qPrintable(lthemeengine::sharedStyleSheetPath().join(", "))); + //checking environment + QStringList errorMessages; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + if(env.contains("QT_STYLE_OVERRIDE")){ + errorMessages << app.translate("main", "Please remove the <b>QT_STYLE_OVERRIDE</b> environment variable"); } - - if(env.value("QT_QPA_PLATFORMTHEME") != "lthemeengine") - { - errorMessages << app.translate("main", "The <b>QT_QPA_PLATFORMTHEME</b> environment " - "variable is not set correctly"); + if(env.value("QT_QPA_PLATFORMTHEME") != "lthemeengine"){ + errorMessages << app.translate("main", "The <b>QT_QPA_PLATFORMTHEME</b> environment variable is not set correctly"); } - - if(!QStyleFactory::keys().contains("lthemeengine-style")) - { - errorMessages << app.translate("main", "Unable to find <b>liblthemeengine-style.so</b>"); + if(!QStyleFactory::keys().contains("lthemeengine-style")){ + errorMessages << app.translate("main", "Unable to find <b>liblthemeengine-style.so</b>"); } - - if(!errorMessages.isEmpty()) - { - QMessageBox::critical(0, app.translate("main", "Error"), errorMessages.join("<br><br>")); - return 0; + if(!errorMessages.isEmpty()){ + QMessageBox::critical(0, app.translate("main", "Error"), errorMessages.join("<br><br>")); + return 0; } - - MainWindow w; - w.show(); - - return app.exec(); + MainWindow w; + w.show(); + return app.exec(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp index ed658e2e..c93b1052 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QApplication> #include <QSettings> #include "lthemeengine.h" @@ -37,54 +9,41 @@ #include "qsspage.h" #include "ui_mainwindow.h" -MainWindow::MainWindow(QWidget *parent) : - QWidget(parent), - m_ui(new Ui::MainWindow) -{ - m_ui->setupUi(this); - m_ui->tabWidget->addTab(new AppearancePage(this), tr("Appearance")); - m_ui->tabWidget->addTab(new FontsPage(this), tr("Fonts")); - m_ui->tabWidget->addTab(new IconThemePage(this), tr("Icon Theme")); - m_ui->tabWidget->addTab(new InterfacePage(this), tr("Interface")); +MainWindow::MainWindow(QWidget *parent) : QWidget(parent), m_ui(new Ui::MainWindow){ + m_ui->setupUi(this); + m_ui->tabWidget->addTab(new AppearancePage(this), tr("Appearance")); + m_ui->tabWidget->addTab(new FontsPage(this), tr("Fonts")); + m_ui->tabWidget->addTab(new IconThemePage(this), tr("Icon Theme")); + m_ui->tabWidget->addTab(new InterfacePage(this), tr("Interface")); #ifdef USE_WIDGETS - m_ui->tabWidget->addTab(new QSSPage(this), tr("Style Sheets")); + m_ui->tabWidget->addTab(new QSSPage(this), tr("Style Sheets")); #endif - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - restoreGeometry(settings.value("SettingsWindow/geometry").toByteArray()); - - setWindowIcon(QIcon::fromTheme("preferences-desktop-theme")); - - m_ui->versionLabel->setText(tr("Version: %1").arg(LTHEMEENGINE_VERSION_STR)); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + restoreGeometry(settings.value("SettingsWindow/geometry").toByteArray()); + setWindowIcon(QIcon::fromTheme("preferences-desktop-theme")); + m_ui->versionLabel->setText(tr("Version: %1").arg(LTHEMEENGINE_VERSION_STR)); } -MainWindow::~MainWindow() -{ - delete m_ui; +MainWindow::~MainWindow(){ + delete m_ui; } -void MainWindow::closeEvent(QCloseEvent *) -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.setValue("SettingsWindow/geometry", saveGeometry()); +void MainWindow::closeEvent(QCloseEvent *){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.setValue("SettingsWindow/geometry", saveGeometry()); } -void MainWindow::on_buttonBox_clicked(QAbstractButton *button) -{ - int id = m_ui->buttonBox->standardButton(button); - if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Apply) - { - for(int i = 0; i < m_ui->tabWidget->count(); ++i) - { - TabPage *p = qobject_cast<TabPage*>(m_ui->tabWidget->widget(i)); - if(p) - p->writeSettings(); +void MainWindow::on_buttonBox_clicked(QAbstractButton *button){ + int id = m_ui->buttonBox->standardButton(button); + if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Apply){ + for(int i = 0; i < m_ui->tabWidget->count(); ++i){ + TabPage *p = qobject_cast<TabPage*>(m_ui->tabWidget->widget(i)); + if(p) + p->writeSettings(); } } - - if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Cancel) - { - close(); - qApp->quit(); + if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Cancel){ + close(); + qApp->quit(); } } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h index f532141c..749949a6 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef MAINWINDOW_H #define MAINWINDOW_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp index 0f8fcf66..8a8e86d0 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QPalette> #include <QColorDialog> #include <QSettings> @@ -33,114 +5,91 @@ #include "paletteeditdialog.h" #include "ui_paletteeditdialog.h" -PaletteEditDialog::PaletteEditDialog(const QPalette &palette, QStyle *currentStyle, QWidget *parent) : - QDialog(parent), - m_ui(new Ui::PaletteEditDialog) -{ - m_currentStyle = currentStyle; - m_ui->setupUi(this); - m_ui->tableWidget->setColumnCount(3); - m_ui->tableWidget->setRowCount(QPalette::NColorRoles); - m_ui->tableWidget->verticalHeader()->setDefaultSectionSize(fontMetrics().lineSpacing() + 10); - m_ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); - m_ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - - QStringList labels; - labels << tr("Active") << tr("Inactive") << tr("Disabled"); - m_ui->tableWidget->setHorizontalHeaderLabels(labels); - setPalette(palette); - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - restoreGeometry(settings.value("PaletteEditor/geometry").toByteArray()); +PaletteEditDialog::PaletteEditDialog(const QPalette &palette, QStyle *currentStyle, QWidget *parent) : QDialog(parent), m_ui(new Ui::PaletteEditDialog){ + m_currentStyle = currentStyle; + m_ui->setupUi(this); + m_ui->tableWidget->setColumnCount(3); + m_ui->tableWidget->setRowCount(QPalette::NColorRoles); + m_ui->tableWidget->verticalHeader()->setDefaultSectionSize(fontMetrics().lineSpacing() + 10); + m_ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); + m_ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + QStringList labels; + labels << tr("Active") << tr("Inactive") << tr("Disabled"); + m_ui->tableWidget->setHorizontalHeaderLabels(labels); + setPalette(palette); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + restoreGeometry(settings.value("PaletteEditor/geometry").toByteArray()); } -PaletteEditDialog::~PaletteEditDialog() -{ - delete m_ui; +PaletteEditDialog::~PaletteEditDialog(){ + delete m_ui; } -QPalette PaletteEditDialog::selectedPalette() const -{ - QPalette palette; - for(int i = 0; i < QPalette::NColorRoles; i++) - { - palette.setBrush(QPalette::Active, QPalette::ColorRole(i), m_ui->tableWidget->item(i,0)->backgroundColor()); - palette.setBrush(QPalette::Inactive, QPalette::ColorRole(i), m_ui->tableWidget->item(i,1)->backgroundColor()); - palette.setBrush(QPalette::Disabled, QPalette::ColorRole(i), m_ui->tableWidget->item(i,2)->backgroundColor()); +QPalette PaletteEditDialog::selectedPalette() const{ + QPalette palette; + for(int i = 0; i < QPalette::NColorRoles; i++){ + palette.setBrush(QPalette::Active, QPalette::ColorRole(i), m_ui->tableWidget->item(i,0)->backgroundColor()); + palette.setBrush(QPalette::Inactive, QPalette::ColorRole(i), m_ui->tableWidget->item(i,1)->backgroundColor()); + palette.setBrush(QPalette::Disabled, QPalette::ColorRole(i), m_ui->tableWidget->item(i,2)->backgroundColor()); } - return palette; + return palette; } -void PaletteEditDialog::setPalette(const QPalette &palette) -{ - for(int i = 0; i < QPalette::NColorRoles; i++) - { - if(!m_ui->tableWidget->item(i,0)) - m_ui->tableWidget->setItem(i, 0, new QTableWidgetItem()); - if(!m_ui->tableWidget->item(i,1)) - m_ui->tableWidget->setItem(i, 1, new QTableWidgetItem()); +void PaletteEditDialog::setPalette(const QPalette &palette){ + for(int i = 0; i < QPalette::NColorRoles; i++){ + if(!m_ui->tableWidget->item(i,0)) + m_ui->tableWidget->setItem(i, 0, new QTableWidgetItem()); + if(!m_ui->tableWidget->item(i,1)) + m_ui->tableWidget->setItem(i, 1, new QTableWidgetItem()); if(!m_ui->tableWidget->item(i,2)) - m_ui->tableWidget->setItem(i, 2, new QTableWidgetItem()); - - m_ui->tableWidget->item(i,0)->setBackgroundColor(palette.color(QPalette::Active, QPalette::ColorRole(i))); - m_ui->tableWidget->item(i,1)->setBackgroundColor(palette.color(QPalette::Inactive, QPalette::ColorRole(i))); - m_ui->tableWidget->item(i,2)->setBackgroundColor(palette.color(QPalette::Disabled, QPalette::ColorRole(i))); + m_ui->tableWidget->setItem(i, 2, new QTableWidgetItem()); + m_ui->tableWidget->item(i,0)->setBackgroundColor(palette.color(QPalette::Active, QPalette::ColorRole(i))); + m_ui->tableWidget->item(i,1)->setBackgroundColor(palette.color(QPalette::Inactive, QPalette::ColorRole(i))); + m_ui->tableWidget->item(i,2)->setBackgroundColor(palette.color(QPalette::Disabled, QPalette::ColorRole(i))); } - - QStringList labels; - labels << tr("Window text") << tr("Button background") << tr("Bright") << tr("Less bright") << tr("Dark") << tr("Less dark") - << tr("Normal text") << tr("Bright text") << tr("Button text") << tr("Normal background") << tr("Window") << tr("Shadow") - << tr("Highlight") << tr("Highlighted text") << tr("Link") << tr("Visited link") - << tr("Alternate background") << tr("Default") << tr("Tooltip background") << tr("Tooltip text"); - m_ui->tableWidget->setVerticalHeaderLabels(labels); + QStringList labels; + labels << tr("Window text") << tr("Button background") << tr("Bright") << tr("Less bright") << tr("Dark") << tr("Less dark") << tr("Normal text") << tr("Bright text") << tr("Button text") << tr("Normal background") << tr("Window") << tr("Shadow") << tr("Highlight") << tr("Highlighted text") << tr("Link") << tr("Visited link") << tr("Alternate background") << tr("Default") << tr("Tooltip background") << tr("Tooltip text"); + m_ui->tableWidget->setVerticalHeaderLabels(labels); } -void PaletteEditDialog::hideEvent(QHideEvent *) -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.setValue("PaletteEditor/geometry", saveGeometry()); +void PaletteEditDialog::hideEvent(QHideEvent *){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.setValue("PaletteEditor/geometry", saveGeometry()); } -void PaletteEditDialog::on_tableWidget_itemClicked(QTableWidgetItem *item) -{ - QColor color = QColorDialog::getColor(item->backgroundColor(), this, tr("Select Color")); - if(color.isValid()) - { - item->setBackgroundColor(color); - emit paletteChanged(selectedPalette()); +void PaletteEditDialog::on_tableWidget_itemClicked(QTableWidgetItem *item){ + QColor color = QColorDialog::getColor(item->backgroundColor(), this, tr("Select Color")); + if(color.isValid()){ + item->setBackgroundColor(color); + emit paletteChanged(selectedPalette()); } } -void PaletteEditDialog::on_resetPaletteButton_clicked() -{ - setPalette(m_currentStyle->standardPalette()); - emit paletteChanged(selectedPalette()); +void PaletteEditDialog::on_resetPaletteButton_clicked(){ + setPalette(m_currentStyle->standardPalette()); + emit paletteChanged(selectedPalette()); } -void PaletteEditDialog::on_buildInactiveButton_clicked() -{ - QPalette palette = selectedPalette(); - for(int i = 0; i < QPalette::NColorRoles; i++) - { - palette.setColor(QPalette::Inactive, QPalette::ColorRole(i), - palette.color(QPalette::Active, QPalette::ColorRole(i))); +void PaletteEditDialog::on_buildInactiveButton_clicked(){ + QPalette palette = selectedPalette(); + for(int i = 0; i < QPalette::NColorRoles; i++){ + palette.setColor(QPalette::Inactive, QPalette::ColorRole(i), + palette.color(QPalette::Active, QPalette::ColorRole(i))); } - setPalette(palette); - emit paletteChanged(selectedPalette()); + setPalette(palette); + emit paletteChanged(selectedPalette()); } -void PaletteEditDialog::on_buildDisabledButton_clicked() -{ - QPalette palette = selectedPalette(); - for(int i = 0; i < QPalette::NColorRoles; i++) - { - palette.setColor(QPalette::Disabled, QPalette::ColorRole(i), - palette.color(QPalette::Active, QPalette::ColorRole(i))); +void PaletteEditDialog::on_buildDisabledButton_clicked(){ + QPalette palette = selectedPalette(); + for(int i = 0; i < QPalette::NColorRoles; i++){ + palette.setColor(QPalette::Disabled, QPalette::ColorRole(i), + palette.color(QPalette::Active, QPalette::ColorRole(i))); } - palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::darkGray); - palette.setColor(QPalette::Disabled, QPalette::WindowText, Qt::darkGray); - palette.setColor(QPalette::Disabled, QPalette::Text, Qt::darkGray); - palette.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::darkGray); - setPalette(palette); - emit paletteChanged(selectedPalette()); + palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::darkGray); + palette.setColor(QPalette::Disabled, QPalette::WindowText, Qt::darkGray); + palette.setColor(QPalette::Disabled, QPalette::Text, Qt::darkGray); + palette.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::darkGray); + setPalette(palette); + emit paletteChanged(selectedPalette()); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h index c8691a3c..040692f6 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef PALETTEEDITDIALOG_H #define PALETTEEDITDIALOG_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp index b92b5619..aa4bb810 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp @@ -1,85 +1,45 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QFile> #include <QSettings> #include "lthemeengine.h" #include "qsseditordialog.h" #include "ui_qsseditordialog.h" -QSSEditorDialog::QSSEditorDialog(const QString &filePath, QWidget *parent) : - QDialog(parent), - m_ui(new Ui::QSSEditorDialog) -{ - m_ui->setupUi(this); - m_filePath = filePath; - - QFile file(filePath); - file.open(QIODevice::ReadOnly); - m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll())); - setWindowTitle(tr("%1 - Style Sheet Editor").arg(file.fileName())); - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - restoreGeometry(settings.value("QSSEditor/geometry").toByteArray()); +QSSEditorDialog::QSSEditorDialog(const QString &filePath, QWidget *parent) : QDialog(parent), m_ui(new Ui::QSSEditorDialog){ + m_ui->setupUi(this); + m_filePath = filePath; + QFile file(filePath); + file.open(QIODevice::ReadOnly); + m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll())); + setWindowTitle(tr("%1 - Style Sheet Editor").arg(file.fileName())); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + restoreGeometry(settings.value("QSSEditor/geometry").toByteArray()); } -QSSEditorDialog::~QSSEditorDialog() -{ - delete m_ui; +QSSEditorDialog::~QSSEditorDialog(){ + delete m_ui; } -void QSSEditorDialog::save() -{ - QFile file(m_filePath); - file.open(QIODevice::WriteOnly); - file.write(m_ui->textEdit->toPlainText().toUtf8()); +void QSSEditorDialog::save(){ + QFile file(m_filePath); + file.open(QIODevice::WriteOnly); + file.write(m_ui->textEdit->toPlainText().toUtf8()); } -void QSSEditorDialog::hideEvent(QHideEvent *) -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.setValue("QSSEditor/geometry", saveGeometry()); +void QSSEditorDialog::hideEvent(QHideEvent *){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.setValue("QSSEditor/geometry", saveGeometry()); } -void QSSEditorDialog::on_buttonBox_clicked(QAbstractButton *button) -{ - QDialogButtonBox::StandardButton id = m_ui->buttonBox->standardButton(button); - if(id == QDialogButtonBox::Ok) - { - save(); - accept(); - } - else if(id == QDialogButtonBox::Save) - { - save(); +void QSSEditorDialog::on_buttonBox_clicked(QAbstractButton *button){ + QDialogButtonBox::StandardButton id = m_ui->buttonBox->standardButton(button); + if(id == QDialogButtonBox::Ok){ + save(); + accept(); } - else - { - reject(); + else if(id == QDialogButtonBox::Save){ + save(); } + else{ + reject(); + } } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h index e2a6c773..ea615e81 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef QSSEDITORDIALOG_H #define QSSEDITORDIALOG_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp index 10f21f48..c9bfc14a 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSettings> #include <QDir> #include <QInputDialog> @@ -40,193 +12,145 @@ #define QSS_FULL_PATH_ROLE (Qt::ItemDataRole(Qt::UserRole)) #define QSS_WRITABLE_ROLE (Qt::ItemDataRole(Qt::UserRole + 1)) -QSSPage::QSSPage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::QSSPage) -{ - m_ui->setupUi(this); - QDir("/").mkpath(lthemeengine::userStyleSheetPath()); - - m_menu = new QMenu(this); - m_menu->addAction(QIcon::fromTheme("accessories-text-editor"), tr("Edit"), this, SLOT(on_editButton_clicked())); - m_menu->addAction(tr("Rename"), this, SLOT(on_renameButton_clicked())); - m_menu->addSeparator(); - m_menu->addAction(QIcon::fromTheme("edit-delete"), tr("Remove"), this, SLOT(on_removeButton_clicked())); - - readSettings(); - - //icons - m_ui->createButton->setIcon(QIcon::fromTheme("document-new")); - m_ui->editButton->setIcon(QIcon::fromTheme("accessories-text-editor")); - m_ui->removeButton->setIcon(QIcon::fromTheme("edit-delete")); +QSSPage::QSSPage(QWidget *parent) : TabPage(parent), m_ui(new Ui::QSSPage){ + m_ui->setupUi(this); + QDir("/").mkpath(lthemeengine::userStyleSheetPath()); + m_menu = new QMenu(this); + m_menu->addAction(QIcon::fromTheme("accessories-text-editor"), tr("Edit"), this, SLOT(on_editButton_clicked())); + m_menu->addAction(tr("Rename"), this, SLOT(on_renameButton_clicked())); + m_menu->addSeparator(); + m_menu->addAction(QIcon::fromTheme("edit-delete"), tr("Remove"), this, SLOT(on_removeButton_clicked())); + readSettings(); + //icons + m_ui->createButton->setIcon(QIcon::fromTheme("document-new")); + m_ui->editButton->setIcon(QIcon::fromTheme("accessories-text-editor")); + m_ui->removeButton->setIcon(QIcon::fromTheme("edit-delete")); } -QSSPage::~QSSPage() -{ - delete m_ui; +QSSPage::~QSSPage(){ + delete m_ui; } -void QSSPage::writeSettings() -{ - QStringList styleSheets; - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - - for(int i = 0; i < m_ui->qssListWidget->count(); ++i) - { - QListWidgetItem *item = m_ui->qssListWidget->item(i); - if(item->checkState() == Qt::Checked) - styleSheets << item->data(QSS_FULL_PATH_ROLE).toString(); +void QSSPage::writeSettings(){ + QStringList styleSheets; + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + for(int i = 0; i < m_ui->qssListWidget->count(); ++i){ + QListWidgetItem *item = m_ui->qssListWidget->item(i); + if(item->checkState() == Qt::Checked) + styleSheets << item->data(QSS_FULL_PATH_ROLE).toString(); } - - settings.setValue("Interface/stylesheets", styleSheets); + settings.setValue("Interface/stylesheets", styleSheets); } -void QSSPage::on_qssListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *) -{ - if(current) - { - m_ui->editButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool()); - m_ui->removeButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool()); - m_ui->renameButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool()); +void QSSPage::on_qssListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *){ + if(current){ + m_ui->editButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool()); + m_ui->removeButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool()); + m_ui->renameButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool()); } - else - { - m_ui->editButton->setEnabled(false); - m_ui->removeButton->setEnabled(false); - m_ui->renameButton->setEnabled(false); + else{ + m_ui->editButton->setEnabled(false); + m_ui->removeButton->setEnabled(false); + m_ui->renameButton->setEnabled(false); } } -void QSSPage::on_createButton_clicked() -{ - QString name = QInputDialog::getText(this, tr("Enter Style Sheet Name"), tr("File name:")); - if(name.isEmpty()) - return; - +void QSSPage::on_createButton_clicked(){ + QString name = QInputDialog::getText(this, tr("Enter Style Sheet Name"), tr("File name:")); + if(name.isEmpty()) + return; if(!name.endsWith(".qss", Qt::CaseInsensitive)) - name.append(".qss"); - - QString filePath = lthemeengine::userStyleSheetPath() + name; - - if(QFile::exists(filePath)) - { + name.append(".qss"); + QString filePath = lthemeengine::userStyleSheetPath() + name; + if(QFile::exists(filePath)){ QMessageBox::warning(this, tr("Error"), tr("The file \"%1\" already exists").arg(filePath)); return; - } - - //creating empty file - QFile file(filePath); - file.open(QIODevice::WriteOnly); - file.close(); - - //creating item - QFileInfo info(filePath); - QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); - item->setToolTip(info.filePath()); - item->setData(QSS_FULL_PATH_ROLE, info.filePath()); - item->setData(QSS_WRITABLE_ROLE, info.isWritable()); - item->setCheckState(Qt::Unchecked); + } + //creating empty file + QFile file(filePath); + file.open(QIODevice::WriteOnly); + file.close(); + //creating item + QFileInfo info(filePath); + QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); + item->setToolTip(info.filePath()); + item->setData(QSS_FULL_PATH_ROLE, info.filePath()); + item->setData(QSS_WRITABLE_ROLE, info.isWritable()); + item->setCheckState(Qt::Unchecked); } -void QSSPage::on_editButton_clicked() -{ - QListWidgetItem *item = m_ui->qssListWidget->currentItem(); - if(item) - { - QSSEditorDialog dialog(item->data(QSS_FULL_PATH_ROLE).toString(), this); - dialog.exec(); +void QSSPage::on_editButton_clicked(){ + QListWidgetItem *item = m_ui->qssListWidget->currentItem(); + if(item){ + QSSEditorDialog dialog(item->data(QSS_FULL_PATH_ROLE).toString(), this); + dialog.exec(); } } -void QSSPage::on_removeButton_clicked() -{ - QListWidgetItem *item = m_ui->qssListWidget->currentItem(); - if(!item) - return; - - int button = QMessageBox::question(this, tr("Confirm Remove"), - tr("Are you sure you want to remove style sheet \"%1\"?") - .arg(item->text()), - QMessageBox::Yes | QMessageBox::No); - if(button == QMessageBox::Yes) - { - QFile::remove(item->data(QSS_FULL_PATH_ROLE).toString()); - delete item; - } +void QSSPage::on_removeButton_clicked(){ + QListWidgetItem *item = m_ui->qssListWidget->currentItem(); + if(!item) + return; + int button = QMessageBox::question(this, tr("Confirm Remove"),tr("Are you sure you want to remove style sheet \"%1\"?").arg(item->text()), QMessageBox::Yes | QMessageBox::No); + if(button == QMessageBox::Yes){ + QFile::remove(item->data(QSS_FULL_PATH_ROLE).toString()); + delete item; + } } -void QSSPage::readSettings() -{ - //load stylesheets - m_ui->qssListWidget->clear(); - findStyleSheets(lthemeengine::userStyleSheetPath()); - findStyleSheets(lthemeengine::sharedStyleSheetPath().join(", ")); - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - QStringList styleSheets = settings.value("Interface/stylesheets").toStringList(); - for(int i = 0; i < m_ui->qssListWidget->count(); ++i) - { - QListWidgetItem *item = m_ui->qssListWidget->item(i); - if(styleSheets.contains(item->data(QSS_FULL_PATH_ROLE).toString())) - item->setCheckState(Qt::Checked); - else - item->setCheckState(Qt::Unchecked); +void QSSPage::readSettings(){ + //load stylesheets + m_ui->qssListWidget->clear(); + findStyleSheets(lthemeengine::userStyleSheetPath()); + findStyleSheets(lthemeengine::sharedStyleSheetPath().join(", ")); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + QStringList styleSheets = settings.value("Interface/stylesheets").toStringList(); + for(int i = 0; i < m_ui->qssListWidget->count(); ++i){ + QListWidgetItem *item = m_ui->qssListWidget->item(i); + if(styleSheets.contains(item->data(QSS_FULL_PATH_ROLE).toString())) + item->setCheckState(Qt::Checked); + else + item->setCheckState(Qt::Unchecked); } } -void QSSPage::findStyleSheets(const QString &path) -{ - QDir dir(path); - dir.setFilter(QDir::Files); - dir.setNameFilters(QStringList() << "*.qss"); - - foreach (QFileInfo info, dir.entryInfoList()) - { - QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); - item->setToolTip(info.filePath()); - item->setData(QSS_FULL_PATH_ROLE, info.filePath()); - item->setData(QSS_WRITABLE_ROLE, info.isWritable()); +void QSSPage::findStyleSheets(const QString &path){ + QDir dir(path); + dir.setFilter(QDir::Files); + dir.setNameFilters(QStringList() << "*.qss"); + foreach (QFileInfo info, dir.entryInfoList()){ + QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); + item->setToolTip(info.filePath()); + item->setData(QSS_FULL_PATH_ROLE, info.filePath()); + item->setData(QSS_WRITABLE_ROLE, info.isWritable()); } } -void QSSPage::on_renameButton_clicked() -{ - QListWidgetItem *item = m_ui->qssListWidget->currentItem(); - if(!item) - return; - - QString name = QInputDialog::getText(this, tr("Rename Style Sheet"), tr("Style sheet name:"), - QLineEdit::Normal, item->text(), 0); +void QSSPage::on_renameButton_clicked(){ + QListWidgetItem *item = m_ui->qssListWidget->currentItem(); + if(!item) + return; + QString name = QInputDialog::getText(this, tr("Rename Style Sheet"), tr("Style sheet name:"), QLineEdit::Normal, item->text(), 0); if(name.isEmpty()) - return; - - if(!m_ui->qssListWidget->findItems(name, Qt::MatchExactly).isEmpty()) - { - QMessageBox::warning(this, tr("Error"), tr("The style sheet \"%1\" already exists").arg(name)); - return; - } - - if(!name.endsWith(".qss", Qt::CaseInsensitive)) - name.append(".qss"); - - QString newPath = lthemeengine::userStyleSheetPath() + name; - - if(!QFile::rename(item->data(QSS_FULL_PATH_ROLE).toString(), newPath)) - { + return; + if(!m_ui->qssListWidget->findItems(name, Qt::MatchExactly).isEmpty()){ + QMessageBox::warning(this, tr("Error"), tr("The style sheet \"%1\" already exists").arg(name)); + return; + } + if(!name.endsWith(".qss", Qt::CaseInsensitive)) name.append(".qss"); + QString newPath = lthemeengine::userStyleSheetPath() + name; + if(!QFile::rename(item->data(QSS_FULL_PATH_ROLE).toString(), newPath)){ QMessageBox::warning(this, tr("Error"), tr("Unable to rename file")); - return; - } - - item->setText(name); - item->setData(QSS_FULL_PATH_ROLE, newPath); - item->setToolTip(newPath); + return; + } + item->setText(name); + item->setData(QSS_FULL_PATH_ROLE, newPath); + item->setToolTip(newPath); } -void QSSPage::on_qssListWidget_customContextMenuRequested(const QPoint &pos) -{ - QListWidgetItem *item = m_ui->qssListWidget->currentItem(); - if(item && item->data(QSS_WRITABLE_ROLE).toBool()) - { - m_menu->exec(m_ui->qssListWidget->viewport()->mapToGlobal(pos)); - } +void QSSPage::on_qssListWidget_customContextMenuRequested(const QPoint &pos){ + QListWidgetItem *item = m_ui->qssListWidget->currentItem(); + if(item && item->data(QSS_WRITABLE_ROLE).toBool()){ + m_menu->exec(m_ui->qssListWidget->viewport()->mapToGlobal(pos)); + } } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h index 665f68c0..1fe0ed73 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef QSSPAGE_H #define QSSPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp index 251ce024..a8f4b959 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp @@ -1,33 +1,4 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include "tabpage.h" -TabPage::TabPage(QWidget *parent) : QWidget(parent) -{ +TabPage::TabPage(QWidget *parent) : QWidget(parent){ } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h index ac285054..b4dd57d1 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef TABPAGE_H #define TABPAGE_H diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.ui b/src-qt5/desktop-utils/lumina-archiver/MainUI.ui index 0fc9eadf..7de273a1 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.ui @@ -10,9 +10,6 @@ <height>294</height> </rect> </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> @@ -155,9 +152,6 @@ </widget> <widget class="QStatusBar" name="statusbar"/> <widget class="QToolBar" name="toolBar"> - <property name="windowTitle"> - <string>toolBar</string> - </property> <property name="movable"> <bool>false</bool> </property> diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts index 8d9a0462..7053564c 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts @@ -235,7 +235,7 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="573"/> <source>Auto-Extract</source> - <translation type="unfinished"></translation> + <translation>Extreu automàticament</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="587"/> @@ -336,8 +336,8 @@ </message> <message> <location filename="../widgets/DirWidget2.cpp" line="536"/> - <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> - <translation>No s'ha pogut trobar la utilitat "lumina-fileinfo" al sistema. Si us plau, instal·leu-la primer.</translation> + <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> + <translation>No s'ha pogut trobar la utilitat "lumina-fileinfo" al sistema. Si us plau, instal·leu-la primer.</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="562"/> @@ -640,7 +640,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.ui" line="246"/> <source>Show Image Previews</source> - <translation type="unfinished"></translation> + <translation>Mostra previsualitzacions d'imatges</translation> </message> <message> <location filename="../MainUI.ui" line="251"/> @@ -730,17 +730,17 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.ui" line="428"/> <source>Show Directory Tree Window</source> - <translation type="unfinished"></translation> + <translation>Mostra la finestra de l'arbre de directoris</translation> </message> <message> <location filename="../MainUI.ui" line="431"/> <source>Show Directory Tree Pane</source> - <translation type="unfinished"></translation> + <translation>Mostra el plafó de l'arbre de directoris</translation> </message> <message> <location filename="../MainUI.ui" line="434"/> <source>Ctrl+P</source> - <translation type="unfinished"></translation> + <translation>Ctrl+P</translation> </message> <message> <location filename="../MainUI.ui" line="178"/> diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_cs.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_cs.ts index 153d4962..365d477a 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_cs.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_cs.ts @@ -783,16 +783,12 @@ Nové umístění: %2</translation> <translation>Zobrazit tlačítka akcí</translation> </message> <message> -<<<<<<< HEAD <location filename="../MainUI.ui" line="245"/> <source>Load Thumbnails</source> <translation>Načíst náhledy</translation> </message> <message> - <location filename="../MainUI.ui" line="253"/> -======= <location filename="../MainUI.ui" line="254"/> ->>>>>>> 86f6fadf45c2b87749cffac82411d2371448da53 <source>Ctrl+F</source> <translation>Ctrl+F</translation> </message> diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts index 874a041b..d29a466c 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts @@ -336,8 +336,8 @@ </message> <message> <location filename="../widgets/DirWidget2.cpp" line="536"/> - <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> - <translation>Sistemoje nepavyko rasti "lumina-fileinfo" paslaugų programos. Prašome, iš pradžių, ją įdiegti.</translation> + <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> + <translation>Sistemoje nepavyko rasti "lumina-fileinfo" paslaugų programos. Prašome, iš pradžių, ją įdiegti.</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="562"/> @@ -566,8 +566,8 @@ Nauja vieta: %2</translation> </message> <message> <location filename="../gitWizard.ui" line="232"/> - <source>Click "Next" to start downloading the repository</source> - <translation>Spustelėkite "Kitas", kad pradėtumėte saugyklos atsisiuntimą</translation> + <source>Click "Next" to start downloading the repository</source> + <translation>Spustelėkite "Kitas", kad pradėtumėte saugyklos atsisiuntimą</translation> </message> <message> <location filename="../gitWizard.h" line="58"/> @@ -865,7 +865,7 @@ Nauja vieta: %2</translation> <message> <location filename="../MainUI.cpp" line="238"/> <source>CTRL+E</source> - <translation>CTRL(VALD)+E</translation> + <translation>CTRL(Vald)+E</translation> </message> <message> <location filename="../MainUI.cpp" line="356"/> diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_cs.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_cs.ts index dce6b94f..23a9fea9 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_cs.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_cs.ts @@ -109,7 +109,7 @@ <message> <location filename="../MainUI.ui" line="499"/> <source>toolBar</source> - <translation>Nástrojová lišta</translation> + <translation>lištaNástrojů</translation> </message> <message> <location filename="../MainUI.ui" line="526"/> diff --git a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts index f3ce74a4..5c1902a5 100644 --- a/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts +++ b/src-qt5/desktop-utils/lumina-screenshot/i18n/l-screenshot_da.ts @@ -109,7 +109,7 @@ <message> <location filename="../MainUI.ui" line="499"/> <source>toolBar</source> - <translation>værktøjsbjælke</translation> + <translation>værktøjsLinje</translation> </message> <message> <location filename="../MainUI.ui" line="526"/> diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui index a09f1bb1..de5c1ee1 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui @@ -13,9 +13,6 @@ <property name="contextMenuPolicy"> <enum>Qt::NoContextMenu</enum> </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> @@ -249,9 +246,6 @@ <property name="contextMenuPolicy"> <enum>Qt::CustomContextMenu</enum> </property> - <property name="windowTitle"> - <string>toolBar</string> - </property> <property name="movable"> <bool>false</bool> </property> diff --git a/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_cs.ts b/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_cs.ts index 4a3cf767..cf7686bb 100644 --- a/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_cs.ts +++ b/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_cs.ts @@ -53,7 +53,7 @@ <message> <location filename="../MainUI.ui" line="17"/> <source>MainWindow</source> - <translation>Hlavní okno</translation> + <translation>HlavníOkno</translation> </message> <message> <location filename="../MainUI.ui" line="66"/> @@ -132,7 +132,7 @@ <message> <location filename="../MainUI.ui" line="252"/> <source>toolBar</source> - <translation>Nástrojová lišta</translation> + <translation>lištaNástrojů</translation> </message> <message> <location filename="../MainUI.ui" line="278"/> diff --git a/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_da.ts b/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_da.ts index 6e91558b..d54a43e4 100644 --- a/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_da.ts +++ b/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_da.ts @@ -53,7 +53,7 @@ <message> <location filename="../MainUI.ui" line="17"/> <source>MainWindow</source> - <translation>Hovedvindue</translation> + <translation>HovedVindue</translation> </message> <message> <location filename="../MainUI.ui" line="66"/> @@ -132,7 +132,7 @@ <message> <location filename="../MainUI.ui" line="252"/> <source>toolBar</source> - <translation>værktøjsbjælke</translation> + <translation>værktøjsLinje</translation> </message> <message> <location filename="../MainUI.ui" line="278"/> diff --git a/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_lt.ts b/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_lt.ts index f99633ce..817898bc 100644 --- a/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_lt.ts +++ b/src-qt5/desktop-utils/lumina-textedit/i18n/l-te_lt.ts @@ -132,7 +132,7 @@ <message> <location filename="../MainUI.ui" line="252"/> <source>toolBar</source> - <translation>įrankių juosta</translation> + <translation>Įrankių juosta</translation> </message> <message> <location filename="../MainUI.ui" line="278"/> |