diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 2ecec14..0000000 --- a/AUTHORS +++ /dev/null @@ -1,13 +0,0 @@ -Upstream Authors: - LXQt team: http://lxqt.org - Razor team: http://razor-qt.org - -Copyright: - Copyright (c) 2010-2012 Razor team - Copyright (c) 2012-2017 LXQt team - -License: GPL-2 and LGPL-2.1+ -The full text of the licenses can be found in the 'LICENSE' file. - -The lxqt-config-cursor component is based on the "qt-xcurtheme" project -and is licensed under GPL 2, GPL 3, LGPL-2, LGPL-2.1 and WTFPL 2. diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index ebf9b09..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,559 +0,0 @@ - -lxqt-config-0.12.0 / 2017-10-21 -=============================== - - * Set patch version - * Use $XDG_CONFIG_HOME/mimeapps.list for mime data instead of $XDG_DATA_HOME/applications/mimeapps.list (#129) - * Don't export github templates - * Update monitorsettingsdialog.ui - * lxqt-config-locale: corrected/reworded Save Changed Settings dialog - * Add/update *lt.desktop files - * lxq-config-monitor: set Qt::AA_UseHighDpiPixmaps to true - * lxqt-config-locale: set Qt::AA_UseHighDpiPixmaps to true - * lxqt-config-input: set Qt::AA_UseHighDpiPixmaps to true - * lxqt-config-file-ass.: set Qt::AA_UseHighDpiPixmaps to true - * lxqt-config-brightness: set Qt::AA_UseHighDpiPixmaps to true - * lxqt-config-appearance: set Qt::AA_UseHighDpiPixmaps to true - * liblxqt-config-cursor: set Qt::AA_UseHighDpiPixmaps to true - * Added QCommandLineParser and basic cli interface to lxqt-config-monitor - * Added QCommandLineParser and basic cli interface to lxqt-config-locale - * Added QCommandLineParser and basic cli interface to lxqt-config-input - * Added QCommandLineParser and basic cli interface to lxqt-config-file-associations - * Added version info to lxqt-config-brightness cli - * Added QCommandLineParser and basic cli interface to lxqt-config-appearance - * Added QCommandLineParser and basic cli interface to lxqt-config - * Added LXQT_CONFIG_PATCH_VERSION - * Fixed typo in appearance_pl_PL.desktop (#124) - * i18n: added some *.desktop for Polish language - * Fixes (#121) - * appearance: Fix typo from @aca544479 - * lxqt-config-file-associations: Sets the initial focus (#120) - * appearance: Add icon FollowColorScheme configuration (#119) - * Show non-primary screens in UI. (#116) - * Removes unneeded include_directories() entry - * Fixes a FTBFS with CMake v3.8 - * Use const iterators - * Update AUTHORS - -0.11.1 / 2017-01-01 -=================== - - * Release 0.11.1: Update changelog - * lxqt-config-monitor: remove unnecessary wait before settings load (#114) - * Fix self icontheme update (#113) - * liblxqt-config-cursor: Don't check for null pointer before deleting it - * liblxqt-config-cursor: Explicitly ignore function return value - * Updated and added *_da.desktop files and removed da_DK - * Use FindXCB CMake module - * Activate items on releasing Enter instead of pressing it. (#78) - * Update and rename lxqt-config_fr_FR.desktop to lxqt-config_fr.desktop - * Fix faulty link in README.md - * if not set, set the build type to Release - * Desktop entry files: Update French translation - * lxqt-config: Avoid multiple spawn on auto-repeat - * Fix loading of translations for brightness - * Create lxqt-config-brightness_it.desktop - * Remove cpack (#104) - * lxqt-config-brightness: Add GenericName and Comment to desktop entry - -0.11.0 / 2016-09-24 -=================== - - * Release 0.11.0: Add changelog - * appearance: Avoid blocking when setting wallpaper - * appearance: Do (not) change wallpaper with theme - * all: Remove XdgIcon & XdgIconLoader usage - * brightness: Add change confirmation dialog - * brightness: Correct indentation - * Update README.md - * Replaces deprecated QStyleOptionViewItemVx - * Add Catalan translations - * Add and Update Arabic Translations for Desktop Files - * lxqt-config-monitor: Correct loadsettings.cpp - * lxqt-config-monitor: Use QGuiApplication - * I18n: Fix Plural String (#94) - * fixed crash when selecting "extended view" while second monitor is off (#91) - * build: Add optional build for subcomponents - * lxqt-config-appearance: Fix a null pointer dereference (#93) - * Add README.md - * lxqt-config-brightness: Remove compiler warning - * lxqt-config-brightness: Add libxcb dependency - * lxqt-config-brightness: Use *_LDFLAGS in target_link_libraries - * lxqt-config-appearance: Use fewer XdgIcon* stuff (#92) - * lxqt-config-appearance: Use the new XdgIconLoader library (#90) - * build: Use external translations (#89) - * ts-files removal (#88) - * Use const references with the foreach iterator - * translations: russian translation update (#85) - * font config: make it possible to write custom fontconfig files (#83) - * view: Use icon/decoration size based on styling - * Set grid size according to font and icon sizes. - * lxqt-config-brightness: Use arrow keys to change settings. - * Desktop file translation to Spanish added. - * lxqt-config-brigness: Set brightness value by command line. - * Removed not needed LICENSE - * lxqt-config-brightness: Increase or decrease brightness using command line. - * Create lxqt-config-locale_it.desktop - * Rename from lxqt-config-brightness-settings to lxqt-config-brightness. - * lxqt-config-brightness-settings: Some files changes their licenses from GPL to LGPL. - * lxqt-config-brightness-settings lxqt translations module added. - * lxqt-config-brightness-settings added. - * fix typo skiping -> skipping - * build: Fix FTBFS by reverting the @a7220cb - * Bum year in AUTHORS - * lxqt-config-brightness-settings has been added. It can change brightness and gamma. It's a X11 tool because libKScreen can not change brightness or gamma yet. - * lxqt-config: Load/store window size on begin/end - * categorizedview: Use correct signature - * lxqt-config: Remove homemade "activation logic" - * Settings are saved in QSettings format instead JSON format. - * Set position widget used bad scale. The real widget size is not set until the widget is shown. - * Remove blue square in GUI position - * Fast options added. - * GUI only lets one primary output. - * Icons aren't installed. - * Check KScreen reply is OK. Changes in interface. - * liblxqt is used to write autostart entry. - * Don't track IDE settings - * KScreen is slow loading screen modes at starting. Wait for modes ready. - * KScreen sometimes changes id of modes. If mode exists and it is OK, settings will be applied. - * Save settings dialog added. - * Initial support for different paths of xkb base.lst in different OSes. - * A couple of bug fixes Check if the memory was allocated after malloc() and realloc() calls Fix typo - * Update german translation - * Fix warning on translation - * Replace slang with a more traditional wording - * build: Use CMAKE_INSTALL_FULL_LIBDIR for RPATH - * Fixes an FTBFS on lxqt-config-locale_ru.desktop - * Update Russian translations - * apearance: Support "System" theme preview - * Italian translation update - * lxqt-config: Add CTRL+Q shortcut for closing - *_hu.ts files updated, *hu_HU.ts files deleted - * Mkdir $XDG_CONFIG_HOME/autostart or ~/.config/autostart, if not exists. - * lxqt-config-appearance: Choose the icon with the matching size - -0.10.0 / 2015-11-02 -=================== - - * Update translations - * Fix license file - * Set saved settings at session start. - * lxqt-config-monitor: Correctly link to liblxqt - * lxqt-config-monitor: GUI for positioning - * lxqt-config-monito: Handle the clone combobox - * lxqt-config-monitor: Fix activation of second screen - * lxqt-config-monitor: Screen rotation - * lxqt-config-monitor: Tabs to spaces - * lxqt-config-monitor: Remove duplicate modes from list - * lxqt-config-monitor: Sort output modes - * lxqt-config-monitor: clean-up, old code removed - * lxqt-config-monitor: fix for reverting to previous configuration - * lxqt-config-monitor: refactoring and improvements - * lxqt-config-monitor: Use a separate combobox for clones - * lxqt-config-monitor: Actually update the config on setting screen position - * lxqt-config-monitor: Display EDID information in an additional tab - * lxqt-config-monitor: Attempt at an even simpler UI (#502) - * lxqt-config-monitor: Replace xrandr by KScreen - * lxqt-config-monitor: Remove backlight/brightness support - * Make the lxqt-config-locale chosen settings work - * Fix a few typos in file “info-for-developers.txt” - * Removed some compile warnings - * OnlyShowIn=LXQt; - * Add an option to automatically turn on numlock after login (implemented in lxqt-session). - * Initial support for locale config, based on formats KCMS. - * Rename LxQt to LXQt everywhere - * Update Greek (el) translation Remove country variant from language code - * lxqt-config: add correct rpath into lxqt-config-input & lxqt-config-appearance to find liblxqt-config-cursor.so installed into private directory - * Drop country-specific Italian translations - * Updated and created italian .desktop files - * Fix mouse settings persistency - * fixes lxde/lxqt #785 AUTHORS changed, list the used licenses LXQt license header added - * Description: Install private .so file into proper directory. Author: Andrew Lee (李健秋) - * Add copyright headers - * Handles CMake policy CMP0063 - * Uses LXQtCompilerSettings CMake module - * Fix cursor settings location - * Updates translations sources - * CMake: Adds Runtime and Devel install COMPONENTs - * Coding style changes - * Removes unneeded include_directories() entries - * Use CMAKE_AUTORCC - * Get rid of qt5_wrap_cpp() MOC variables - * Use CMAKE_AUTOUIC - * Drops LIB_SUFFIX, use GNUInstallDirs - * fix build with qt 5.5 - * Makes it compile in superbuild mode - * Updated german translation. - * Updates the build system to the Targets infrastructure - * polish regarding lxqt-config.desktop - * Remove trailing whitespaces - * Fix naming and links - * Include X-LXQt category in lxqt-config menu - * ApplyDialog renamed to SaveSettings. - * Rename and delete saved settings added. - * Bug always unify monitors fixed. - * lxqt-config-appearance: minimum configurable font size -> 4px - * Fix function name - * Update lxqt-config-input_it.ts - * Hungarian translations update, lxqt-config-monitor.desktop.in fixed - * Testing changes in the buttonbar of LxQt::ConfigDialog. - * Update Russian translation - * lxqt-configure-appearance: Reload icons from the user selected theme - * The last xrandr backend commit. Save settings added. Framebuffer screen size fixed. - * First save settings implementation. - * Update lxqt-config-cursor_it_IT.ts - * Framebuffer size is calculated on xrand backend. - * Update to keep up with our QIconLoader - * Added reset values. - * Remove testing parameters - * Apply page added - * Updated to LxQt::ConfigDialog. - * Added SVG icon for monitor in monitor position. - * Polish translation update - * Reorganizing the code. Support for long names in resolution modes . - * Reorganizing the code. Support for long names in resolution modes. - * Reorganizing the code. Support for long names in resolution modes. - * New modes name bug fixed. - * lxqt-config-appearance/icontheme: String performance enhancements - * Handles previews for inherited icon themes - * file-associations:Return from the busy cursor only after the Ui stuff ended - * Remove an unneeded dependency on KWindowSystem - -0.9.0 / 2015-01-31 -================== - - * Delay loading of application icons in the app-chooser dialog for faster loading. - * Make the user aware of still ongoing work (Application Chooser) - * Bad English fixed - * Capitalize themes' names - * Create lxqt-config-monitor_it_IT.ts - * Update lxqt-config-appearance_it.desktop - * Added german translation for file association dialogue - * Added german translation for input device settings. - * Create lxqt-config-file-associations_it.ts - * Update lxqt-config-appearance_it.ts - * Update lxqt-config-appearance_it_IT.ts - * Added german translation for monitor settings. - * Update Japanese translation - * Fix PT desktop file names and paths. - * Portuguese language update - * Updates translations sources - * Documenting the code: Magnetic attraction without javascript. - * Magnetic attraction procedure has been documented. - * Added confirm dialog before saving. - * Added backlight control and position control button. - * Update lxqt-config-cursor_ja.ts - * - Unify naming for a unique lxqt. No more suffixes - * Write to mimeapps.list rather than defaults.list - * If directory ~/.config/autostart/ doesn't exists, it is created. Save doesn't close window. - * Use the new LxQt::SingleApplication - * Add windows icon - * CMakeLists code reformatting - * CMakeLists maintenance - * Renames .ts files that used _template in their name - * Moves and renames translations files around - * Uses the new translations cmake modules - * - Add option autohint - Fix compatibility with KDE fonts settings - * Activate System Settings items with enter key. Fixes lxde/lxde-qt#355 - * Update Russian translation - * Drop Qt4 support in code - * Clean up CMakeLists.txt and drop Qt 4 support - -0.8.0 / 2014-10-10 -================== - - * Adapts to translations infrastructure - * Option to set single-click as default and sigle-click handling in system settings' main window - * Qt4 and Qt5 compiling fixed - * Compiling in Qt4 fixed. - * Fix #273 - File fonts.conf is created as folder if doesn't exist. - * Make initial panel receive focus - * Adapt to use QtMimeTypes/XdgMimeType - * Restore translations. - * Use our custom TimeoutDialog to replace QProgressDialog and provide a "cancel" button and show better text in the progress bar. - * Little fix for the broken stacked widget. - * Replace the scrolled UI with a left list and a right stacked widget to provide usability. - * Don't use Qt QObject properties in mode changes. Use MonitorWidget class properties instead. - * Fixed: Some ugly code has been changed. - * Fixed: Error reading monitor name. - * Fixed: Restore position of monitor when user cancels settings. - * Fixed: If no relative monitor is selected, then position is disabled. - * Fixed: Disable position options when output is unified at start. Fixed: No cicles in relative positions at start. - * Fixed: Timeout dialog is now modal. - * Fixed: If monitor is turned off, brightness is set to 0. Fixed: Quick options close window on click. - * Read vendor from EDID. - * Fixed: Gamma error when monitor is turned off. - * Gamma control implemented. - * Added brightness control. Some bugs fixed reading xrandr properties. - * Little adjustment to the UI. Delete unused methods. - * Refactor the code, make things more OOP-style. * Slight adjustment to the UI. - * Add code to determine the position of monitors and their relationship on startup. - * Add a new parser for the output of "xrandr --verbose" to get more detailed monitor info, including gamma. - * Add initial translation support and an incomplete zh_TW locale to lxqt-config-monitor. - * Integrate the Makefile of lxqt-config-monitor to build it as part of lxqt-config. - * Move lxqt-config-monitor into a subdirectory. - * Use QWindow::windowHandle()->winId() to replace QWidget::winId() due to a bug of Qt5. - * Added: Save settings in autostart desktop file. - * Added timeout dialog. When settings are applied, a timeout dialog is shown. If user doesn't press "Yes" button, settings are restored. - * Monitor position can be changed. Outputs can be diferent. Position of outputs can be chosen. If system has got two monitors, wizard will be shown to config them. - * Modules for xrandr and GUI. Now new backends can be added. - * Split xrandr settings from UI. - * Readme updated. - * Remove all Glib dependencies. - * Initial commit - * Fix bug #242: lxqt-config-input: Mouse acceleration & sensitivity settings are not saved. - * Fix missing libxcb linking so building with llvm/clang now works. - * Fixes layout on the Fonts Config Ui - * Avoid putting system programs in "LXQt settings" category since they belong to "System settings". - * Add to lxqt-config.menu to avoid duplicated items in "Other Settings" section. This fixed lxde-qt bug #186. - * Rename lxqt-config-cursor to liblxqt-config-cursor since it's a library. - * Show cursors by using raw xcb calls since Qt5 does not support creating QCursor based on native cursor handle. - * Write Qt settings to lxqt.conf instead of the deprecated Trolltech.conf in Qt5. - * Make the code compile with both Qt4 and Qt5. - * Fix keyboard layout settings reading and writting - * Cleanup header style - * Use new LXQt header files. - * Use preferred header style. - * Make sure all enums are handled in switch - * Fix a null dereference - * Remove unnecessary use of alloca, which is not portable. - -0.7.0 / 2014-05-07 -================== - - * Mention lxqt-config-cursor in AUTHORS - * Include some optional components in LXQt settings. - * Remove duplicate COPYING file - * Update COPYING - * Update categories to match proper ones in .desktop files - * String changes LxQt -> LXQt and LXDE-Qt -> LXQt without refactoring classes, namespaces and so on - * removal of old templates in translations - -0.6.99 / 2014-05-01 -=================== - - * Update manpages - * Update AUTHORS - * Add CPack rules for creating tarball - * config-input: Fix a typo - * Preserve the config values in lxqt-session config file. * Support setting key used to switch layouts. - * Add keys used to switch layout to the combox box. - * Add very primitive support for settings keyboard layout via setxkbmap. - * Add a basic skeleton for keyboard layout settings. - * lxqt-config-file-associations: Wording in main window - * Assorted improvements to .desktop files - * Man page improvements - * Correctly save the cursor theme name to lxqt session config file. - * Correctly write current cursor theme name to ~/.icons/default/index.theme. Deprecate the use of XCURSOR_THEME environment variable. - * Support changing double click interval, whell scroll lines, and cursor flash time for Qt programs. Little adjustment of UI. - * Fix incorrect linking to liblxqt-config-cursor. - * Add missing desktop entry file for lxqt-config-input. Some cleanup. - * Rename lxqt-config-mouse to lxqt-config-cursor to reflect what it does. Remove unnecessary desktop entry files and do some makefile cleanup. - * Try to integrate lxqt-config-appearance with lxqt-config-mouse so we can select cursor themes in lxqt-config-appearance, too. - * Total redesign of lxqt-config-input using LxQt::ConfigDialog and integrate lxqt-config-mouse. - * Fix lxqt-config-appearance: write config files on widget destruction properly - * Fix dpi settings and add a timeout to 1.5 sec delay to writing fontconfig file. - * Read/write ~/.config/fontconfig/fonts.conf file for settings antialias, hinting, and dpi. - * Write a fontconfig config file to ~/.config/fonts.conf at the same time. - * Fix bugs in font configurations - * Try to add very basic font configurations - * Add support for toolbar button styles and single click activation for item views - * Add support for Qt style selection to lxqt-config-appearance. - * Removed CMAKE_SOURCE_DIR usage from CMakeLists.txt files - * Fix XDG_MENU_PREFIX and use correct config.menu file. - * Support changing the wallpaper of pcmanfm-qt. - * Fix renaming bugs, replacing lxqt-qt with lxde-qt - * Finish the crazy razor=>lxqt renaming tasks. - * Fix wrong config name. - * Project name added to cmake file - * Fix wrong Exec lines in desktop entry files. - * Fix broken build and rename binaries to lxqt-config-*. - * Add COPYING file for razor-config-mouse since it's GPL'd rather than using LGPL. - * Add COPYING and AUTHORS - * Make razor-config-fileassociations compile with qt 4.6 - * Corrected include line in mimetypeviewer.cpp - * X-RAZOR changed to Razor in desktop files - * Make config-file-associations dialogs appear faster - * config-file-associations: removed placeholder text from search field - * config-file-associations: add search icon to search lineedit - * Removed heading from mimetypeviewer in config-file-associations - * razor-config-file-associations: Set focus correctly when opening applicationchooser - * razor-config-file-associations: remove connect to nonexisting ok-slot - * razor-config-file-associations: clean up qDebug lines - * config-file-associations, clear mimeinfo frames in mimetypeviewer, when no mimetype chosen - * Sorting of applications in config-file-associations - * config-file-associations adapt detection of applications to xdg-mime behavior - * razor-config: load model content after the window appears on screen (we need to provide some user feedback immediately) - * config-file-associations, mimetypeviewer: change tab-order and initial focus - * Added search functionality to config-file-associations, MimetypeViewer - * config-file-associations, mimetypeviewer: Replaced QTreeWidget with QTreeView and new class MimetypeItemModel as model - * config-file-associations: minor changes to mimetypeviewer looks - * config-file-associations: Changed application listwidget back to treewidget, and dropped \handles\ listwidget - * Improved (hopefuly) layout and look of config-fileassociations, application chooser - * config-file-associations: changed treewidget to listwidget in applicationchooser - * razor-config-file-associations, improved layout for mimetype-viewer - * Added application razor-config-file-associations - * fixed appearance icons display + huge filesystem access optimization in this area - * Update fixes for qcategorizedview - * Make config center icon labels not wrap as much - * fixed #488 Display a message if no cursor theme is found - * Fix various build falures - * Add translation support for qtconfig entry - * preliminary manpages primary for razorqt and usefully in venenux - * Suppressed warning "variable «currSize» set but not used" in the razorqt-config/src/qcategorizedview/qcategorizedview.cpp:496:29 - * Suppressed warning "variable «currSize» set but not used" in the razorqt-config/src/qcategorizedview/qcategorizedview.cpp:496:29 - * Translations updated - * Translations updated - * Translations - * Delete bad en_GB translations - * Install translations into correct places - * Update translations - * Enable translations for some components that were missing them - * Minor fixes - * Translations updated - * Removed line num from TS files. - * razor-config: wrap text - * Make it possible to build modules separately - * Translations - * Deleted old translation methods. - * New translation infrastructure - * Translation for razor-config-appearance - * Fix for Issue #290 Fails to build on BSD - * Updated ts.src files - * removed useles window title - * fixed #336: remove the "razor" prefix from razor-config dialog - * config app for notifications - * Remove RazorNotification classes (no license/copyright) - * add module names to includes and tidy up the coding style - * Update razorqt-config/razor-config-mouse/thememodel.h - * Update razorqt-config/razor-config-mouse/selectwnd.h - * Update razorqt-config/razor-config-mouse/previewwidget.h - * Update razorqt-config/razor-config-mouse/itemdelegate.h - * Update razorqt-config/razor-config-mouse/crtheme.h - * fix coding style errors - * fix coding style errors - * fix coding style errors - * fix coding style errors - * fix coding style errors - * fix coding style errors - * fix coding style errors - * fix coding style errors - * Ts.src files updated. - * add module name to include - * add module names to includes - * add module names to includes and fix style errors - * fix coding style errors - * add module names to includes - * add module names to includes - * add module names to includes - * add module names to includes - * Language name zh_CN.GB2312 braked cmake process. - * Translations updated - * Environments should be "Razor", not "RAZOR" Thanks Alec Moskvin - * Renames razor-config-notificationd window title - * Small fixes in the razor-config-appearance Thanks PICCORO Lenz McKAY. still need some fixeds: iconthemeconfig.h:38: error: expected class-name before ‘{’ token and also the moc ui_mainwindow.h must be renamed too in iconthemeconfig.h - * Fix header - * Small fixes in the razor-config-appearance - * razor-config GUI improvement - * razor-config based on XDG Desktop Menu Specification 2 - * fixed #261 Fix missing icons in razor config center - * default arguments for notification client lib - * quick compilation fix - * razor-config based on XDG Desktop Menu Specification - * Composition on by default - * GUI for change razor theme. - * Fixing cmake error - * fixed wrongly set license for new files. It's LGPL2+ - * much better razor-config layout for icons - * config center: align icons into grid; do not show self; OnlyShowIn check - * reworked config stuff. No more special config registering. All 'Settings' desktop files are displayed in razor-config (grouped) - * Typos in code. Thanks Aaron Lewis. * In razor-runner , providers item: title() was typed as tile() * For RazorSettings class , settingsChanged() was typed as settigsChanged() - * Minor modifications and code cleanup - * Minor ui modifications. Moving default icon to notificationd instead of widget notification - * Setting min & max position according to QDesktopWidget - * Changing notification ui. Adding default notitifaction icon. Embedding icons in notification - * Properly install config Correct desktop file - * Proper default values - * Proper id number assigned to notifications Properly remove notification by quint32 id - * Proper configuration - * Rename file to match class name - * Remove custom settings, use razor ones - * Adding razor-config-notificationd - * tweaks for qtconfig installation - * qtconfig for razor-config - * Transifex desktop: sr_BA.ts should be a local - * Transifex desktop: local translations - * Transifex desktop: cmake files - * Transifex desktop: Translations pulled - * Transifex desktop: Reomove translations from desktop.in - * Transifex desktop: desktop->desktop.in - * Update Tradidtional Chinese Translations - * Add Traditional Chinese Translations - * Translations update - * Added support for the online translation service. www.transifex.net - * RazorApplication class implemented; all modules ported to this class - * fixed #76: razor-config should respect mouse behaviour - * Serbian translation files - * Serbian translations (2 variants) - * Greek translation by iosifidis - * Added danish translations - * Russian translation - * fix #169: italian translation - * Add function to use alternative icons - * Relicense - * Convert Appearance dialog to use RazorConfigDialog - * Fix gmail.ru -> gmail.com - * Czech translations (cs_CZ) Desktop files - * fixed #138: system settings icons - * SVK translation finalized - * Initial german [de] translation - * Close Issue #120 - * License audit - * Add Chinese(simplified) translation files. - * License audit - * HU translation by Kristóf Kiszel - * Initial spanish translation - * Add Slovak (sk) translation - * Removes one empty line from .desktop file - * Adds newline to the end of .desktop files - * Czech translations (cs_CZ) - * Fix a few typos - * XdgDesktopFile is implicitly shared - * huge refactoring of the libraries build organization - * config mouse: close button as in the other tools - * Razor-config-appearance: incorrect translation path - * config: better item layouting in razor-config - * config appearance: make icons fully visible - * Razor-config: Fixes for razor-config-appearance - * Razor-config: New razor-config-appearance - * Razor-config: New razor-config-appearance - * display icon theme fixes - * forgotten debugs - * config icons: show progress when it searches for themes - * icon theme config - initial revision - * Razor-config-mouse: Added check for zlib in CMakeLists.txt - * moc warnings cleanup - * GPL->LGPL where I'm the author - * config: remove toolbars - * Polish translation part X - * Fix: Desktop Menu Specification category must be X-RAZOR. - * Russian translations - * unify razor-config look - * Added razor-application.menu - * razor-config can open items by Enter key too - * fixed desktop files - * fix donfig desktp files install for rpm - * razor-config-mousetheme -> razor-config-mouse rename - * do not use direct lib name for X11 stuff - * issue #37 - Config-mousetheme show not all themes, my KDE show 6 themes but razor only 1. (mHidden attribute fixed) - * homepage updated + auto replacement script - * adding missing libraries to fedora build - * show only in RAZOR; close/undo changes actions - * small refactoring in mouse config - * fixed #35: razor-config-mousetheme saves are not persistent - * final fix for build error #34 - * potential fix for #34 - * mouse theme configurator - * fix for #33: razorqt doesn't build - * config tools are registered in config center; desktop file for CC - * initial revision of "config tool". Very simple but functional. diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 8828c3c..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) - -project(lxqt-config) -set(LXQT_CONFIG_PROJECT "${PROJECT_NAME}") - -option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) -option(WITH_INPUT "Build the 'lxqt-config-input'" ON) -option(WITH_FILE_ASSOCIATIONS "Build the 'lxqt-config-file-associations'" ON) -option(WITH_APPEARANCE "Build the 'lxqt-config-appearance'" ON) -option(WITH_MONITOR "Build the 'lxqt-config-monitor'" ON) -option(WITH_BRIGHTNESS "Build the 'lxqt-config-brightness'" ON) -option(WITH_LOCALE "Build the 'lxqt-config-locale'" ON) - -include(GNUInstallDirs) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) - -find_package(Qt5Widgets REQUIRED) -find_package(Qt5DBus REQUIRED) -find_package(Qt5Xml REQUIRED) -find_package(Qt5Concurrent REQUIRED) -find_package(Qt5X11Extras REQUIRED) -find_package(Qt5LinguistTools REQUIRED) -find_package(lxqt REQUIRED) - -include(LXQtCompilerSettings NO_POLICY_SCOPE) - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -# Patch Version -set(LXQT_CONFIG_PATCH_VERSION 0) - -set(LXQT_CONFIG_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_CONFIG_PATCH_VERSION}) -add_definitions("-DLXQT_CONFIG_VERSION=\"${LXQT_CONFIG_VERSION}\"") - -include(LXQtTranslate) - -add_subdirectory(src) -if (WITH_INPUT OR WITH_APPEARANCE) - add_subdirectory(liblxqt-config-cursor) -endif() -if (WITH_INPUT) - add_subdirectory(lxqt-config-input) -endif() -if (WITH_FILE_ASSOCIATIONS) - add_subdirectory(lxqt-config-file-associations) -endif() -if (WITH_APPEARANCE) - add_subdirectory(lxqt-config-appearance) -endif() -if (WITH_MONITOR) - add_subdirectory(lxqt-config-monitor) -endif() -if (WITH_BRIGHTNESS) - add_subdirectory(lxqt-config-brightness) -endif() -if (WITH_LOCALE) - add_subdirectory(lxqt-config-locale) -endif() diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 20fb9c7..0000000 --- a/LICENSE +++ /dev/null @@ -1,458 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/README.md b/README.md deleted file mode 100644 index 61bcde8..0000000 --- a/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# lxqt-config - -## Overview - -This repository is providing several tools involved in the configuration of both LXQt and the underlying operating system. - -On the one hand it is featuring several GUI tools to configure topics like general appearance, pointer devices or screen resolutions. -On the other hand there's a GUI "Configuration Center" which summarizes all those configuration tools as well as counterparts of other LXQt components or third-party applications. - -### Configuration GUI tools - -#### LXQt Appearance Configuration - -Appearance of LXQt, that is topics like icon and LXQt theme or fonts. - -![LXQt Appearance Configuration (lxqt-config-appearance)](lxqt-config-appearance.png) - -Binary `lxqt-config-appearance`. - -#### Brightness - -Brightness settings of output devices. - -Technically colors are adjusted to simulate varying brightness if the system LXQt is running on doesn't allow for adjusting the brightness itself. - -Binary `lxqt-config-brightness`. - -#### File Associations - -Assigns MIME types to applications used to handle them. Not too user-friendly so far, see e. g. discussion in https://github.com/lxde/lxqt/issues/433. - -Binary `lxqt-config-file-associations`. - -#### Keyboard and Mouse - -Configures hardware of pointer devices. Settings like repeat delay and interval of keyboards or acceleration of pointer devices. - -Binary `lxqt-config-input`. - -#### Locale - -Locale used within LXQt sessions. Basically this GUI sets the well-known environment variables like `LANG` or `LC_*`. The settings apply to the session as a whole, that is to applications running within LXQt sessions but not belonging to LXQt, too. - -Binary `lxqt-config-locale`. - -#### Monitor Settings - -Adjusts screen resolutions, positioning of screens and the likes. - -Binary `lxqt-config-monitor`. - -### Configuration Center - -The "Configuration Center" (binary `lxqt-config`) is summarizing and providing various configuration GUIs. - -![Configuration Center (lxqt-config)](lxqt-config.png) - -First of all these are the ones belonging to repository lxqt-config described [above](https://github.com/lxde/lxqt-config#configuration-gui-tools). Next, it is hosting counterparts of several other LXQt components like "Desktop Notifications" of [lxqt-notificationd](https://github.com/lxde/lxqt-notificationd), "Shortcut Keys" of [lxqt-globalkeyshortcuts](https://github.com/lxde/lxqt-globalkeyshortcuts) or the tools provided by [lxqt-admin](https://github.com/lxde/lxqt-admin). Third-party applications can include their configuration tools in "Configuration Center", too. This applies e. g. to "Connman UI Setup" of [cmst](https://github.com/andrew-bibb/cmst) or "SDDM Configuration" of [sddm-config-editor](https://github.com/hagabaka/sddm-config-editor). - -## Installation - -### Compiling source code - -Runtime dependencies are Xcursor, qtsvg, KScreen and [liblxqt](https://github.com/lxde/liblxqt). -Additional build dependencies are CMake and optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information. - -Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` has to be set to `/usr` on most operating systems, depending on the way library paths are dealt with on 64bit systems variables like `CMAKE_INSTALL_LIBDIR` may have to be set as well. - -To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual. - -### Binary packages - -The library is provided by all major Linux distributions like Arch Linux, Debian (as of Debian stretch only), Fedora and openSUSE. Just use your package manager to search for string `lxqt-config`. - -## Usage - -Both the various configuration tools and the Configuration Center can be launched from the panel's main menu - Preferences - LXQt settings. Obviously the former can be launched from the latter, too. diff --git a/liblxqt-config-cursor/CMakeLists.txt b/liblxqt-config-cursor/CMakeLists.txt deleted file mode 100644 index 42e7f0d..0000000 --- a/liblxqt-config-cursor/CMakeLists.txt +++ /dev/null @@ -1,98 +0,0 @@ -project(lxqt-config-cursor) -find_package(X11 REQUIRED) - -find_package(XCB REQUIRED xcb) -include_directories(${XCB_INCLUDE_DIRS}) -link_libraries(${XCB_LIBRARIES}) - -include_directories ( - ${X11_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/xcr -) - -set(lxqt-config-cursor_HDRS - thememodel.h - previewwidget.h - itemdelegate.h - selectwnd.h - warninglabel.h -) - -set(lxqt-config-cursor_SRCS - crtheme.cpp - selectwnd.cpp - xcr/xcrimg.cpp - xcr/xcrxcur.cpp - xcr/xcrthemefx.cpp - xcr/xcrtheme.cpp - xcr/xcrthemexp.cpp - cfgfile.cpp - previewwidget.cpp - itemdelegate.cpp - thememodel.cpp - warninglabel.cpp -) - -set(lxqt-config-cursor_UIS - selectwnd.ui - warninglabel.ui -) - -find_package(ZLIB REQUIRED) - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${lxqt-config-cursor_HDRS} - ${lxqt-config-cursor_SRCS} - ${lxqt-config-cursor_UIS} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/liblxqt-config-cursor" -) - -lxqt_app_translation_loader(lxqt-config-cursor_QM_LOADER ${PROJECT_NAME}) - -#************************************************ - -add_library(lxqt-config-cursor - SHARED - ${lxqt-config-cursor_SRCS} - ${DESKTOP_FILES} - ${QM_FILES} - ${lxqt-config-cursor_QM_LOADER} -) - -target_link_libraries(lxqt-config-cursor - Qt5::X11Extras - Qt5::DBus - Qt5::Xml - ${X11_X11_LIB} - ${X11_Xcursor_LIB} - lxqt - ${ZLIB_LIBRARY} - ${X11_Xfixes_LIB} -) -# not needed probably ${X11_Xfixes_LIB}) - -install(TARGETS - lxqt-config-cursor - DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LXQT_CONFIG_PROJECT}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDOR}/applications" - COMPONENT Runtime -) diff --git a/liblxqt-config-cursor/cfgfile.cpp b/liblxqt-config-cursor/cfgfile.cpp deleted file mode 100644 index 6d790a1..0000000 --- a/liblxqt-config-cursor/cfgfile.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#include "cfgfile.h" - -#include -#include -#include -#include - -QMultiMap loadCfgFile(const QString &fname, bool forceLoCase) -{ - QMultiMap res; - QFile fl(fname); - if (fl.open(QIODevice::ReadOnly)) - { - QTextStream stream; - stream.setDevice(&fl); - stream.setCodec("UTF-8"); - QString curPath = "/"; - while (1) - { - QString s = stream.readLine(); - if (s.isNull()) break; - s = s.trimmed(); - if (s.isEmpty() || s[0] == '#' || s[0] == ';') continue; - if (s[0] == '[') - { - // new path - int len = s.length()-1; - if (s[len] == ']') len--; - s = s.mid(1, len).simplified(); - s += '/'; - curPath = s; - continue; - } - int eqp = s.indexOf('='); - if (eqp < 0) continue; // invalid entry - QString name = s.left(eqp).simplified(); - QString value = s.mid(eqp+1).simplified(); - if (name.isEmpty()) continue; // invalid entry - name.prepend(curPath); - if (forceLoCase) name = name.toLower(); - res.insert(name, value); - } - fl.close(); - } - return res; -} - -void fixXDefaults(const QString &themeName) -{ - QStringList lst; - { - QFile fl(QDir::home().path()+"/.Xdefaults"); - if (fl.open(QIODevice::ReadOnly)) - { - QTextStream stream; - stream.setDevice(&fl); - while (1) - { - QString s = stream.readLine(); - if (s.isNull()) - break; - // if the line does not contain Xcursor?theme, save it to a list - if (!(s.startsWith(QLatin1String("Xcursor")) && s.midRef(8).startsWith(QLatin1String("theme")))) - lst << s; - } - fl.close(); - } - } - while (lst.size() > 0) - { - QString s(lst[lst.size()-1]); - if (!s.trimmed().isEmpty()) break; - lst.removeAt(lst.size()-1); - } - { - //QByteArray ba(themeName.toUtf8()); - QFile fl(QDir::home().path()+"/.Xdefaults"); - if (fl.open(QIODevice::WriteOnly)) - { - QTextStream stream; - stream.setDevice(&fl); - foreach (const QString &s, lst) - { - stream << s << "\n"; - } - stream << "\nXcursor.theme: " << themeName << "\n"; - fl.close(); - } - } -} - -const QString findDefaultTheme() -{ - QString res = "default"; - QFile fl(QDir::home().path()+"/.Xdefaults"); - if (fl.open(QIODevice::ReadOnly)) - { - QTextStream stream; - stream.setDevice(&fl); - while (1) - { - QString s = stream.readLine(); - if (s.isNull()) break; - if (!s.startsWith("Xcursor.theme:")) continue; - s.remove(0, 14); - s = s.trimmed(); - if (s.isEmpty()) s = "default"; - res = s; - } - fl.close(); - } - return res; -} diff --git a/liblxqt-config-cursor/cfgfile.h b/liblxqt-config-cursor/cfgfile.h deleted file mode 100644 index a6d7528..0000000 --- a/liblxqt-config-cursor/cfgfile.h +++ /dev/null @@ -1,20 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#ifndef CFGFILE_H -#define CFGFILE_H - -#include -#include - -QMultiMap loadCfgFile(const QString &fname, bool forceLoCase=false); -void fixXDefaults(const QString &themeName); -const QString findDefaultTheme(); - -#endif diff --git a/liblxqt-config-cursor/crtheme.cpp b/liblxqt-config-cursor/crtheme.cpp deleted file mode 100644 index 1b6d565..0000000 --- a/liblxqt-config-cursor/crtheme.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* Copyright © 2006-2007 Fredrik Höglund - * (c)GPL2 (c)GPL3 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 or at your option version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#include - -#include "crtheme.h" - -#include -#include - -#include "cfgfile.h" - -#include -#include -#include - -// Static variable holding alternative names for some cursors -static QHash alternatives; - -/////////////////////////////////////////////////////////////////////////////// -XCursorThemeData::XCursorThemeData(const QDir &aDir) -{ - mHidden = false; - // parse configs, etc - mPath = aDir.path(); - setName(aDir.dirName()); - if (aDir.exists("index.theme")) parseIndexFile(); - if (mDescription.isEmpty()) mDescription = "no description"; - if (mTitle.isEmpty()) mTitle = mName; -} - -void XCursorThemeData::parseIndexFile() -{ - QMultiMap cfg = loadCfgFile(mPath+"/index.theme", true); - if (cfg.contains("icon theme/name")) mTitle = cfg.values("icon theme/name").at(0).trimmed(); - if (cfg.contains("icon theme/comment")) mDescription = cfg.values("icon theme/comment").at(0).trimmed(); - if (cfg.contains("icon theme/example")) mSample = cfg.values("icon theme/example").at(0).trimmed(); - if (cfg.contains("icon theme/hidden")) - { - QString hiddenValue = cfg.values("icon theme/hidden").at(0).toLower(); - mHidden = hiddenValue=="false" ? false : true; - } - if (cfg.contains("icon theme/inherits")) - { - QStringList i = cfg.values("icon theme/inherits"), res; - for (int f = i.size()-1; f >= 0; f--) res << i.at(f).trimmed(); - } - if (mDescription.startsWith("- Converted by")) mDescription.remove(0, 2); -} - -QString XCursorThemeData::findAlternative(const QString &name) const -{ - if (alternatives.isEmpty()) - { - alternatives.reserve(18); - - // Qt uses non-standard names for some core cursors. - // If Xcursor fails to load the cursor, Qt creates it with the correct name using the - // core protcol instead (which in turn calls Xcursor). We emulate that process here. - // Note that there's a core cursor called cross, but it's not the one Qt expects. - alternatives.insert("cross", "crosshair"); - alternatives.insert("up_arrow", "center_ptr"); - alternatives.insert("wait", "watch"); - alternatives.insert("ibeam", "xterm"); - alternatives.insert("size_all", "fleur"); - alternatives.insert("pointing_hand", "hand2"); - - // Precomputed MD5 hashes for the hardcoded bitmap cursors in Qt and KDE. - // Note that the MD5 hash for left_ptr_watch is for the KDE version of that cursor. - alternatives.insert("size_ver", "00008160000006810000408080010102"); - alternatives.insert("size_hor", "028006030e0e7ebffc7f7070c0600140"); - alternatives.insert("size_bdiag", "c7088f0f3e6c8088236ef8e1e3e70000"); - alternatives.insert("size_fdiag", "fcf1c3c7cd4491d801f1e1c78f100000"); - alternatives.insert("whats_this", "d9ce0ab605698f320427677b458ad60b"); - alternatives.insert("split_h", "14fef782d02440884392942c11205230"); - alternatives.insert("split_v", "2870a09082c103050810ffdffffe0204"); - alternatives.insert("forbidden", "03b6e0fcb3499374a867c041f52298f0"); - alternatives.insert("left_ptr_watch", "3ecb610c1bf2410f44200f48c40d3599"); - alternatives.insert("hand2", "e29285e634086352946a0e7090d73106"); - alternatives.insert("openhand", "9141b49c8149039304290b508d208c40"); - alternatives.insert("closedhand", "05e88622050804100c20044008402080"); - } - - return alternatives.value(name, QString()); -} - -QPixmap XCursorThemeData::icon() const -{ - if (mIcon.isNull()) mIcon = createIcon(); - return mIcon; -} - -QImage XCursorThemeData::autoCropImage(const QImage &image) const -{ - // Compute an autocrop rectangle for the image - QRect r(image.rect().bottomRight(), image.rect().topLeft()); - const quint32 *pixels = reinterpret_cast(image.bits()); - for (int y = 0; y < image.height(); ++y) - { - for (int x = 0; x < image.width(); ++x) - { - if (*(pixels++)) - { - if (x < r.left()) r.setLeft(x); - if (x > r.right()) r.setRight(x); - if (y < r.top()) r.setTop(y); - if (y > r.bottom()) r.setBottom(y); - } - } - } - // Normalize the rectangle - return image.copy(r.normalized()); -} - -static int nominalCursorSize(int iconSize) -{ - for (int i = 512; i > 8; i /= 2) - { - if (i < iconSize) return i; - if ((i*0.75) < iconSize) return int(i*0.75); - } - return 8; -} - -QPixmap XCursorThemeData::createIcon() const -{ - int iconSize = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize); - int cursorSize = nominalCursorSize(iconSize); - QSize size = QSize(iconSize, iconSize); - - QPixmap pixmap; - QImage image = loadImage(sample(), cursorSize); - if (image.isNull() && sample() != "left_ptr") image = loadImage("left_ptr", cursorSize); - if (!image.isNull()) - { - // Scale the image if it's larger than the preferred icon size - if (image.width() > size.width() || image.height() > size.height()) - { - image = image.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation); - pixmap = QPixmap::fromImage(image); - } - } - return pixmap; -} - -XcursorImage *XCursorThemeData::xcLoadImage(const QString &image, int size) const -{ - QByteArray cursorName = QFile::encodeName(image); - QByteArray themeName = QFile::encodeName(name()); - return XcursorLibraryLoadImage(cursorName, themeName, size); -} - -XcursorImages *XCursorThemeData::xcLoadImages(const QString &image, int size) const -{ - QByteArray cursorName = QFile::encodeName(image); - QByteArray themeName = QFile::encodeName(name()); - return XcursorLibraryLoadImages(cursorName, themeName, size); -} - -unsigned long XCursorThemeData::loadCursorHandle(const QString &name, int size) const -{ - if (size == -1) size = XcursorGetDefaultSize(QX11Info::display()); - // Load the cursor images - XcursorImages *images = xcLoadImages(name, size); - if (!images) images = xcLoadImages(findAlternative(name), size); - // Fall back to a legacy cursor - //if (!images) return LegacyTheme::loadCursor(name); - if (!images) return 0; - // Create the cursor - unsigned long handle = (unsigned long)XcursorImagesLoadCursor(QX11Info::display(), images); - XcursorImagesDestroy(images); - //setCursorName(cursor, name); - return handle; -} - -QImage XCursorThemeData::loadImage(const QString &name, int size) const -{ - if (size == -1) size = XcursorGetDefaultSize(QX11Info::display()); - // Load the image - XcursorImage *xcimage = xcLoadImage(name, size); - if (!xcimage) xcimage = xcLoadImage(findAlternative(name), size); - // Fall back to a legacy cursor - //if (!xcimage) return LegacyTheme::loadImage(name); - if (!xcimage) return QImage(); - // Convert the XcursorImage to a QImage, and auto-crop it - QImage image((uchar *)xcimage->pixels, xcimage->width, xcimage->height, QImage::Format_ARGB32_Premultiplied); - image = autoCropImage(image); - XcursorImageDestroy(xcimage); - return image; -} - -bool XCursorThemeData::isWritable() const -{ - QFileInfo fi(path()); - return fi.isWritable(); -} - -/////////////////////////////////////////////////////////////////////////////// -bool haveXfixes() -{ - bool result = false; - int event_base, error_base; - if (XFixesQueryExtension(QX11Info::display(), &event_base, &error_base)) - { - int major, minor; - XFixesQueryVersion(QX11Info::display(), &major, &minor); - result = (major >= 2); - } - return result; -} - -bool applyTheme(const XCursorThemeData &theme) -{ - // Require the Xcursor version that shipped with X11R6.9 or greater, since - // in previous versions the Xfixes code wasn't enabled due to a bug in the - // build system (freedesktop bug #975). - if (!haveXfixes()) return false; - - QByteArray themeName = QFile::encodeName(theme.name()); - - // Set up the proper launch environment for newly started apps - //k8:!!!:KToolInvocation::klauncher()->setLaunchEnv("XCURSOR_THEME", themeName); - - // Update the Xcursor X resources - //k8:!!!:runRdb(0); - - // Reload the standard cursors - QStringList names; - // Qt cursors - names << "left_ptr" << "up_arrow" << "cross" << "wait" - << "left_ptr_watch" << "ibeam" << "size_ver" << "size_hor" - << "size_bdiag" << "size_fdiag" << "size_all" << "split_v" - << "split_h" << "pointing_hand" << "openhand" - << "closedhand" << "forbidden" << "whats_this"; - // X core cursors - names << "X_cursor" << "right_ptr" << "hand1" - << "hand2" << "watch" << "xterm" - << "crosshair" << "left_ptr_watch" << "center_ptr" - << "sb_h_double_arrow" << "sb_v_double_arrow" << "fleur" - << "top_left_corner" << "top_side" << "top_right_corner" - << "right_side" << "bottom_right_corner" << "bottom_side" - << "bottom_left_corner" << "left_side" << "question_arrow" - << "pirate"; - - //QX11Info x11Info; - foreach (const QString &name, names) - { - Cursor cursor = (Cursor)theme.loadCursorHandle(name); - XFixesChangeCursorByName(QX11Info::display(), cursor, QFile::encodeName(name)); - // FIXME: do we need to free the cursor? - } - return true; -} - -QString getCurrentTheme() -{ - return XcursorGetTheme(QX11Info::display()); -} diff --git a/liblxqt-config-cursor/crtheme.h b/liblxqt-config-cursor/crtheme.h deleted file mode 100644 index 83cd541..0000000 --- a/liblxqt-config-cursor/crtheme.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright © 2006-2007 Fredrik Höglund - * (c)GPL2 (c)GPL3 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 or at your option version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#ifndef CRTHEME_H -#define CRTHEME_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/////////////////////////////////////////////////////////////////////////////// -// X11 is SHIT! -struct _XcursorImage; -struct _XcursorImages; - -typedef _XcursorImage XcursorImage; -typedef _XcursorImages XcursorImages; - - -/////////////////////////////////////////////////////////////////////////////// -class XCursorThemeData -{ -public: - enum ItemDataRole { - // Note: use printf "0x%08X\n" $(($RANDOM*$RANDOM)) - // to define additional roles. - DisplayDetailRole = 0x24A3DAF8 - }; - - XCursorThemeData(const QDir &aDir); - - const QString &name() const { return mName; } - const QString &title() const { return mTitle; } - const QString &description() const { return mDescription; } - const QString &sample() const { return mSample; } - const QString &path() const { return mPath; } - bool isHidden() const { return mHidden; } - QPixmap icon() const; - const QStringList &inherits() const { return mInherits; } - - inline void setName(const QString &name) - { - mName = name; - mHash = qHash(name); - } - - bool isWritable() const; - - /// Hash value for the internal name - uint hash() const { return mHash; } - - /// Loads the cursor @p name, with the nominal size @p size. - /// If the theme doesn't have the cursor @p name, it should return - /// the default cursor from the active theme instead. - unsigned long loadCursorHandle(const QString &name, int size=-1) const; - - /// Loads the cursor image @p name, with the nominal size @p size. - /// The image should be autocropped to the smallest possible size. - /// If the theme doesn't have the cursor @p name, it should return a null image. - QImage loadImage(const QString &name, int size=-1) const; - - XcursorImage *xcLoadImage(const QString &image, int size=-1) const; - XcursorImages *xcLoadImages(const QString &image, int size=-1) const; - - QString findAlternative(const QString &name) const; - -protected: - void parseIndexFile(); - - /// Creates the icon returned by @ref icon(). - QPixmap createIcon() const; - - /// Convenience function for cropping an image. - QImage autoCropImage(const QImage &image) const; - -protected: - QString mName; - QString mTitle; - QString mDescription; - QString mPath; - QString mSample; - mutable QPixmap mIcon; - bool mHidden; - uint mHash; - QStringList mInherits; -}; - -bool haveXfixes(); -bool applyTheme(const XCursorThemeData &theme); - -QString getCurrentTheme(); - -#endif diff --git a/liblxqt-config-cursor/itemdelegate.cpp b/liblxqt-config-cursor/itemdelegate.cpp deleted file mode 100644 index 9f9df14..0000000 --- a/liblxqt-config-cursor/itemdelegate.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright © 2006-2007 Fredrik Höglund - * (c)GPL2 (c)GPL3 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 or at your option version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#include "itemdelegate.h" -#include "crtheme.h" - -#include -#include -#include - - -namespace { - const int decorationMargin = 8; -} - - -/////////////////////////////////////////////////////////////////////////////// -ItemDelegate::ItemDelegate(QObject *parent) : QAbstractItemDelegate(parent) -{ -} - - -ItemDelegate::~ItemDelegate() -{ -} - -QString ItemDelegate::firstLine(const QModelIndex &index) const -{ - if (index.isValid()) return index.model()->data(index, Qt::DisplayRole).toString(); - return QString(); -} - -QString ItemDelegate::secondLine(const QModelIndex &index) const -{ - if (index.isValid()) return index.model()->data(index, XCursorThemeData::DisplayDetailRole).toString(); - return QString(); -} - -QPixmap ItemDelegate::decoration(const QModelIndex &index) const -{ - if (index.isValid()) return qvariant_cast(index.model()->data(index, Qt::DecorationRole)); - return QPixmap(); -} - -QSize ItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - if (!index.isValid()) return QSize(); - - QFont normalfont = option.font; - QFont boldfont = normalfont; - boldfont.setBold(true); - // Extract the items we want to measure - QString firstRow = firstLine(index); - QString secondRow = secondLine(index); - // Compute the height - QFontMetrics fm1(boldfont); - QFontMetrics fm2(normalfont); - int height = fm1.lineSpacing() + fm2.lineSpacing(); - height = qMax(height, option.decorationSize.height()); - // Compute the text width - int width = fm1.width(firstRow); - width = qMax(width, fm2.width(secondRow)); - // Add decoration width + margin - width += option.decorationSize.width()+decorationMargin; - return QSize(width, height+16); -} - -QPalette::ColorRole ItemDelegate::foregroundRole(const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - Q_UNUSED(index) - if (option.state & QStyle::State_Selected) return QPalette::HighlightedText; - return QPalette::Text; -} - -void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - if (!index.isValid()) return; - painter->save(); - - QFont normalfont = option.font; - QFont boldfont = normalfont; - boldfont.setBold(true); - - QString firstRow = firstLine(index); - QString secondRow = secondLine(index); - QPixmap pixmap = decoration(index); - - QColor textcol = option.palette.color(foregroundRole(option, index)); - - // Draw the background - QStyleOptionViewItem opt = option; - QStyle *style = opt.widget ? opt.widget->style() : QApplication::style(); - style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget); - - // Draw the icon - int x = option.rect.left()+(option.decorationSize.width()-pixmap.width()+decorationMargin)/2; - int y = option.rect.top()+(option.rect.height()-pixmap.height())/2; - QRect pixmapRect = QStyle::visualRect(option.direction, option.rect, QRect(x, y, pixmap.width(), pixmap.height())); - painter->drawPixmap(pixmapRect.x(), pixmapRect.y(), pixmap); - - // Draw the text - QFontMetrics fm1(boldfont); - QFontMetrics fm2(normalfont); - - int textAreaHeight = fm1.lineSpacing()+fm2.lineSpacing(); - - x = option.rect.left()+option.decorationSize.width()+decorationMargin; - int y1 = option.rect.top()+(option.rect.height()-textAreaHeight)/2; - int y2 = y1+fm1.lineSpacing(); - QRect firstRowRect = QStyle::visualRect(option.direction, option.rect, QRect(x, y1, fm1.width(firstRow), fm1.lineSpacing())); - QRect secondRowRect = QStyle::visualRect(option.direction, option.rect, QRect(x, y2, fm2.width(secondRow), fm2.lineSpacing())); - painter->setPen(textcol); - - // First line - painter->setFont(boldfont); - painter->drawText(firstRowRect, Qt::AlignCenter, firstRow); - - // Second line - painter->setFont(normalfont); - painter->drawText(secondRowRect, Qt::AlignCenter, secondRow); - - painter->restore(); -} diff --git a/liblxqt-config-cursor/itemdelegate.h b/liblxqt-config-cursor/itemdelegate.h deleted file mode 100644 index ff14467..0000000 --- a/liblxqt-config-cursor/itemdelegate.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright © 2006-2007 Fredrik Höglund - * (c)GPL2 (c)GPL3 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 or at your option version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#ifndef ITEMDELEGATE_H -#define ITEMDELEGATE_H - -#include - -class QPainter; - - -class ItemDelegate : public QAbstractItemDelegate -{ - Q_OBJECT - -public: - ItemDelegate(QObject *parent = 0); - ~ItemDelegate(); - - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - -private: - QString firstLine(const QModelIndex &index) const; - QString secondLine(const QModelIndex &index) const; - QPixmap decoration(const QModelIndex &index) const; - QPalette::ColorRole foregroundRole(const QStyleOptionViewItem &option, const QModelIndex &index) const; -}; - -#endif diff --git a/liblxqt-config-cursor/main.cpp b/liblxqt-config-cursor/main.cpp deleted file mode 100644 index 2a5cb92..0000000 --- a/liblxqt-config-cursor/main.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -//#include -#include - -#include -#include -#include "main.h" -#include "lxqttranslate.h" - -#include -#include -#include -#include -#include -#include -#include - - -/////////////////////////////////////////////////////////////////////////////// -int main (int argc, char *argv[]) -{ - //QTextCodec::setCodecForCStrings(QTextCodec::codecForName("koi8-r")); - //QTextCodec::setCodecForLocale(QTextCodec::codecForName("koi8-r")); - - LXQt::Application app(argc, argv); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - TRANSLATE_APP; - - //qDebug() << findDefaultTheme() << getCurrentTheme(); - - SelectWnd *sw = new SelectWnd; - sw->show(); - sw->setCurrent(); - return app.exec(); -} diff --git a/liblxqt-config-cursor/main.h b/liblxqt-config-cursor/main.h deleted file mode 100644 index 09b9673..0000000 --- a/liblxqt-config-cursor/main.h +++ /dev/null @@ -1,19 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#ifndef MAIN_H -#define MAIN_H - - -#include "cfgfile.h" -#include "crtheme.h" -#include "selectwnd.h" - - -#endif diff --git a/liblxqt-config-cursor/man/lxqt-config-mouse.1 b/liblxqt-config-cursor/man/lxqt-config-mouse.1 deleted file mode 100644 index b69b08e..0000000 --- a/liblxqt-config-cursor/man/lxqt-config-mouse.1 +++ /dev/null @@ -1,39 +0,0 @@ -.TH lxqt-config-cursor "1" "September 2012" "LXQt\ 0.7.0" "LXQt\ Cursor settings" -.SH NAME -lxqt-config-cursor \- Application of \fBLXQt\fR: the faster and lighter Qt Desktop Environment -.SH SYNOPSIS -.B lxqt-config-cursor -.br -.SH DESCRIPTION -This is a simple GUI cursor theme configuration (at the moment) for the LXQt desktop environment. -Also can manage theme installation for it (locally for/per user only). -.P -\fBLXQt\fR is an advanced, easy-to-use, and fast desktop environment based on Qt -technologies, ships several core desktop components, all of which are optional: -.P - * Panel - * Desktop - * Application launcher - * Settings center \fI(related to this)\fR - * Session handler - * Polkit handler - * SSH password access - * Display manager handler -.P -These components perform similar actions to those available in other desktop -environments, and their name is self-descriptive. They are usually not launched -by hand but automatically, when choosing a \fBLXQt\-qt\fR session in the Display -Manager. -.P -.SH "REPORTING BUGS" -Report bugs to https://github.com/lxde/lxqt/issues -.SH "SEE ALSO" -\fBLXQt\fR has been tailored for users who value simplicity, speed, and -an intuitive interface, also intended for less powerful machines. See also: -.\" any module must refers to session app, for more info on start it -.P -\fBlxqt-config(1)\fR LXQt application for performing settings on many applications -.P -.SH AUTHOR -This manual page was created by \fBPICCORO Lenz McKAY\fR \fI\fR -for \fBLXQt\fR project and VENENUX GNU/Linux but can be used by others. diff --git a/liblxqt-config-cursor/previewwidget.cpp b/liblxqt-config-cursor/previewwidget.cpp deleted file mode 100644 index 7fe319e..0000000 --- a/liblxqt-config-cursor/previewwidget.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* Copyright © 2003-2007 Fredrik Höglund - * (c)GPL2 (c)GPL3 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#include - -#include -#include - -#include "previewwidget.h" - -#include "crtheme.h" - -#include -#include - -#include -#include - -namespace { - // Preview cursors - const char *const cursorNames[] = { - "left_ptr", - "left_ptr_watch", - "wait", - "pointing_hand", - "whats_this", - "ibeam", - "size_all", - "size_fdiag", - "cross", - "split_h", - "size_ver", - "size_hor", - "size_bdiag", - "split_v", - }; - - const int numCursors = 9; // The number of cursors from the above list to be previewed - const int previewSize = 24; // The nominal cursor size to be used in the preview widget - const int cursorSpacing = 20; // Spacing between preview cursors - const int widgetMinWidth = 10; // The minimum width of the preview widget - const int widgetMinHeight = 48; // The minimum height of the preview widget -} - - -/////////////////////////////////////////////////////////////////////////////// -class PreviewCursor -{ - public: - PreviewCursor (const XCursorThemeData &theme, const QString &name); - ~PreviewCursor () {} - - const QPixmap &pixmap () const { return mPixmap; } - int width () const { return mPixmap.width(); } - int height () const { return mPixmap.height(); } - inline QRect rect () const; - void setPosition (const QPoint &p) { mPos = p; } - void setPosition (int x, int y) { mPos = QPoint(x, y); } - QPoint position () const { return mPos; } - operator const xcb_cursor_t& () const { return mCursorHandle; } - operator const QPixmap& () const { return pixmap(); } - - private: - QPixmap mPixmap; - xcb_cursor_t mCursorHandle; - QPoint mPos; -}; - - -/////////////////////////////////////////////////////////////////////////////// -PreviewCursor::PreviewCursor(const XCursorThemeData &theme, const QString &name) -{ - // Create the preview pixmap - QImage image = theme.loadImage(name, previewSize); - if (image.isNull()) return; - int maxSize = previewSize*2; - if (image.height() > maxSize || image.width() > maxSize) - image = image.scaled(maxSize, maxSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); - mPixmap = QPixmap::fromImage(image); - // load the cursor - mCursorHandle = theme.loadCursorHandle(name, previewSize); -} - -QRect PreviewCursor::rect() const -{ - return QRect(mPos, mPixmap.size()).adjusted(-(cursorSpacing/2), -(cursorSpacing/2), cursorSpacing/2, cursorSpacing/2); -} - - -/////////////////////////////////////////////////////////////////////////////// -PreviewWidget::PreviewWidget(QWidget *parent) : QWidget(parent) -{ - setMouseTracking(true); - mCurrent = NULL; -} - -PreviewWidget::~PreviewWidget() -{ - qDeleteAll(mList); - mList.clear(); -} - - -// Since Qt5, wrapping a Cursor handle with QCursor is no longer supported. -// So we have to do it ourselves. I really hate Qt 5! -void PreviewWidget::setCursorHandle(xcb_cursor_t cursorHandle) -{ - WId wid = nativeParentWidget()->windowHandle()->winId(); - xcb_change_window_attributes(QX11Info::connection(), wid, XCB_CW_CURSOR, &cursorHandle); - xcb_flush(QX11Info::connection()); -} - - -QSize PreviewWidget::sizeHint() const -{ - int totalWidth = 0, maxHeight = 0; - foreach (const PreviewCursor *c, mList) - { - totalWidth += c->width(); - maxHeight = qMax(c->height(), maxHeight); - } - totalWidth += (mList.count()-1)*cursorSpacing; - maxHeight = qMax(maxHeight, widgetMinHeight); - return QSize(qMax(totalWidth, widgetMinWidth), qMax(height(), maxHeight)); -} - -void PreviewWidget::layoutItems() -{ - if (!mList.isEmpty()) - { - QSize size = sizeHint(); - int cursorWidth = size.width()/mList.count(); - int nextX = (width()-size.width())/2; - foreach (PreviewCursor *c, mList) - { - c->setPosition(nextX+(cursorWidth-c->width())/2, (height()-c->height())/2); - nextX += cursorWidth; - } - } - mNeedLayout = false; -} - -void PreviewWidget::setTheme(const XCursorThemeData &theme) -{ - qDeleteAll(mList); - mList.clear(); - for (int i = 0; i < numCursors; ++i) mList << new PreviewCursor(theme, cursorNames[i]); - mNeedLayout = true; - updateGeometry(); - mCurrent = NULL; - update(); -} - - -void PreviewWidget::clearTheme() -{ - qDeleteAll(mList); - mList.clear(); - mCurrent = NULL; - update(); -} - -void PreviewWidget::paintEvent(QPaintEvent *) -{ - QPainter p(this); - if (mNeedLayout) layoutItems(); - foreach (const PreviewCursor *c, mList) - { - if (c->pixmap().isNull()) continue; - p.drawPixmap(c->position(), *c); - } -} - -void PreviewWidget::mouseMoveEvent(QMouseEvent *e) -{ - if (mNeedLayout) layoutItems(); - foreach (const PreviewCursor *c, mList) - { - if (c->rect().contains(e->pos())) - { - if (c != mCurrent) - { - // NOTE: we have to set the Qt cursor value to something other than Qt::ArrowCursor - // Otherwise, though we set the xcursor handle to the underlying window, Qt still - // thinks that the current cursor is Qt::ArrowCursor and will not restore the cursor - // later when we call setCursor(Qt::ArrowCursor). So, we set it to BlankCursor to - // cheat Qt so it knows that the current cursor is not Qt::ArrowCursor. - // This is a dirty hack, but without this, Qt cannot restore Qt::ArrowCursor later. - setCursor(Qt::BlankCursor); - setCursorHandle(*c); - mCurrent = c; - } - return; - } - } - setCursor(Qt::ArrowCursor); - mCurrent = NULL; -} - - -void PreviewWidget::resizeEvent(QResizeEvent *) -{ - if (!mList.isEmpty()) mNeedLayout = true; -} diff --git a/liblxqt-config-cursor/previewwidget.h b/liblxqt-config-cursor/previewwidget.h deleted file mode 100644 index 3d035ea..0000000 --- a/liblxqt-config-cursor/previewwidget.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright © 2003-2007 Fredrik Höglund - * (c)GPL2 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#ifndef PREVIEWWIDGET_H -#define PREVIEWWIDGET_H - -#include - -#include -#include - -class XCursorThemeData; -class PreviewCursor; - -class PreviewWidget : public QWidget -{ - Q_OBJECT - -public: - PreviewWidget (QWidget *parent=0); - ~PreviewWidget (); - - void setTheme (const XCursorThemeData &theme); - void clearTheme (); - - QSize sizeHint () const; - - void setCursorHandle(xcb_cursor_t cursorHandle); - -protected: - void paintEvent (QPaintEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void resizeEvent (QResizeEvent *e); - -private: - void layoutItems (); - - QList mList; - const PreviewCursor *mCurrent; - bool mNeedLayout; -}; - -#endif diff --git a/liblxqt-config-cursor/selectwnd.cpp b/liblxqt-config-cursor/selectwnd.cpp deleted file mode 100644 index 8a1fa18..0000000 --- a/liblxqt-config-cursor/selectwnd.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -// 2014-04-10 modified by Hong Jen Yee (PCMan) for integration with lxqt-config-input - -#include - -#include "selectwnd.h" -#include "ui_selectwnd.h" - -#include -#include -#include -#include -#include -#include - -#include "cfgfile.h" -#include "crtheme.h" -#include "thememodel.h" -#include "itemdelegate.h" - -#include "xcrimg.h" -#include "xcrxcur.h" -#include "xcrtheme.h" - -#include -#include -#include -#include - -#define HOME_ICON_DIR QDir::homePath() + "/.icons" - -SelectWnd::SelectWnd(LXQt::Settings* settings, QWidget *parent) - : QWidget(parent), - mSettings(settings), - ui(new Ui::SelectWnd) -{ - ui->setupUi(this); - ui->warningLabel->hide(); - - mModel = new XCursorThemeModel(this); - - int size = style()->pixelMetric(QStyle::PM_LargeIconSize); - ui->lbThemes->setModel(mModel); - ui->lbThemes->setItemDelegate(new ItemDelegate(this)); - ui->lbThemes->setIconSize(QSize(size, size)); - ui->lbThemes->setSelectionMode(QAbstractItemView::SingleSelection); - - // Make sure we find out about selection changes - connect(ui->lbThemes->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), - SLOT(currentChanged(const QModelIndex &, const QModelIndex &))); - // display/hide warning label - connect(mModel, SIGNAL(modelReset()), - this, SLOT(handleWarning())); - connect(mModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(handleWarning())); - connect(mModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), - this, SLOT(handleWarning())); - - connect(ui->warningLabel, SIGNAL(showDirInfo()), - this, SLOT(showDirInfo())); - - // Disable the install button if we can't install new themes to ~/.icons, - // or Xcursor isn't set up to look for cursor themes there - ui->btInstall->setEnabled(mModel->searchPaths().contains(HOME_ICON_DIR) && iconsIsWritable()); - // TODO/FIXME: btInstall functionality - ui->btInstall->hide(); - ui->btRemove->hide(); - - //QTimer::singleShot(0, this, SLOT(setCurrent())); - - handleWarning(); -} - - -SelectWnd::~SelectWnd() -{ - delete ui; -} - -void SelectWnd::setCurrent() -{ - ui->lbThemes->selectionModel()->clear(); - - QString ct = getCurrentTheme(); - mAppliedIndex = mModel->defaultIndex(); - - if (!ct.isEmpty()) mAppliedIndex = mModel->findIndex(ct); - else mAppliedIndex = mModel->defaultIndex(); - - if (mAppliedIndex.isValid()) - { - const XCursorThemeData *theme = mModel->theme(mAppliedIndex); - // Select the current theme - selectRow(mAppliedIndex); - ui->lbThemes->scrollTo(mAppliedIndex, QListView::PositionAtCenter); - // Update the preview widget as well - if (theme) ui->preview->setTheme(*theme);// else ui->preview->clearTheme(); - } -} - -bool SelectWnd::iconsIsWritable() const -{ - const QFileInfo icons = QFileInfo(HOME_ICON_DIR); - const QFileInfo home = QFileInfo(QDir::homePath()); - return ((icons.exists() && icons.isDir() && icons.isWritable()) || (!icons.exists() && home.isWritable())); -} - -/* -void SelectWnd::keyPressEvent(QKeyEvent *e) -{ - if (e->key() == Qt::Key_Escape) close(); -} -*/ - -void SelectWnd::selectRow(int row) const -{ - // Create a selection that stretches across all columns - QModelIndex from = mModel->index(row, 0); - QModelIndex to = mModel->index(row, mModel->columnCount()-1); - QItemSelection selection(from, to); - ui->lbThemes->selectionModel()->select(selection, QItemSelectionModel::Select); - ui->lbThemes->selectionModel()->setCurrentIndex(mAppliedIndex, QItemSelectionModel::NoUpdate); -} - -void SelectWnd::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) -{ - Q_UNUSED(previous) - if (current.isValid()) { - const XCursorThemeData *theme = mModel->theme(current); - if (theme) { - ui->preview->setTheme(*theme); - ui->btRemove->setEnabled(theme->isWritable()); - } else { - ui->preview->clearTheme(); - } - - // directly apply the current settings - applyCurrent(); - } else { - ui->preview->clearTheme(); - } - //emit changed(mAppliedIndex != current); -} - -void SelectWnd::on_btInstall_clicked() -{ - qDebug() << "'install' clicked"; -} - -void SelectWnd::applyCurrent() -{ - //qDebug() << "'set' clicked"; - const XCursorThemeData *theme = mModel->theme(ui->lbThemes->currentIndex()); - if (!theme) return; - applyTheme(*theme); - fixXDefaults(theme->name()); - - // call xrdb to merge the new settings in ~/.Xdefaults - // FIXME: need to check if we're running in X? - QProcess xrdb; - xrdb.start("xrdb -merge " + QDir::home().path() + "/.Xdefaults"); - xrdb.waitForFinished(); - - // old razor-qt and lxqt versions use $XCURSOR_THEME environment variable - // for this, but it's less flexible and more problematic. Let's deprecate its use. - mSettings->beginGroup("Environment"); - mSettings->remove("XCURSOR_THEME"); // ensure that we're not using XCURSOR_THEME - mSettings->endGroup(); - // save to Mouse/cursor_theme instead - mSettings->beginGroup("Mouse"); - mSettings->setValue("cursor_theme", theme->name()); - mSettings->endGroup(); - - // The XCURSOR_THEME environment varialbe does not work sometimes. - // Besides, XDefaults values are not used by Qt. - // So, let's write the new theme name to ~/.icons/default/index.theme. - // This is the most reliable way. - // QSettings will encode the group name "Icon Theme" to "Icon%20Theme" and there is no way to turn it off. - // So let's not use it here. :-( - QString dirPath = HOME_ICON_DIR + "/default"; - QDir().mkpath(dirPath); // ensure the existence of the ~/.icons/default dir - QFile indexTheme(dirPath + "/index.theme"); - if(indexTheme.open(QIODevice::WriteOnly|QIODevice::Truncate)) - { - QTextStream(&indexTheme) << - "# Written by lxqt-config-appearance\n" << - "[Icon Theme]\n" << - "Name=Default\n" << - "Comment=Default cursor theme\n" << - "Inherits=" << theme->name() << "\n"; - indexTheme.close(); - } -} - -void SelectWnd::on_btRemove_clicked() -{ - qDebug() << "'remove' clicked"; - const XCursorThemeData *theme = mModel->theme(ui->lbThemes->currentIndex()); - if (!theme) return; - QString ct = getCurrentTheme(); - if (ct == theme->name()) - { - QMessageBox::warning(this, tr("XCurTheme error"), - tr("You can't remove active theme!"), QMessageBox::Ok, QMessageBox::Ok); - return; - } - QDir d(theme->path()); - ui->preview->clearTheme(); - mModel->removeTheme(ui->lbThemes->currentIndex()); - removeXCursorTheme(d); -} - -void SelectWnd::handleWarning() -{ - bool empty = mModel->rowCount(); - ui->warningLabel->setVisible(!empty); - ui->preview->setVisible(empty); - ui->infoLabel->setVisible(empty); -} - -void SelectWnd::showDirInfo() -{ - QToolTip::showText(mapToGlobal(ui->warningLabel->buttonPos()), mModel->searchPaths().join("\n")); -} diff --git a/liblxqt-config-cursor/selectwnd.h b/liblxqt-config-cursor/selectwnd.h deleted file mode 100644 index 200cfa0..0000000 --- a/liblxqt-config-cursor/selectwnd.h +++ /dev/null @@ -1,65 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -// 2014-04-10 modified by Hong Jen Yee (PCMan) for integration with lxqt-config-input - -#ifndef SELECTWND_H -#define SELECTWND_H - -#include -#include -#include -#include - -namespace LXQt { - class Settings; -} - -namespace Ui { -class SelectWnd; -} - -class XCursorThemeModel; - -class LXQT_API SelectWnd : public QWidget -{ - Q_OBJECT - -public: - SelectWnd (LXQt::Settings* settings, QWidget *parent=0); - ~SelectWnd (); - -public slots: - void setCurrent (); - -protected: - // void keyPressEvent (QKeyEvent *e); - -private: - bool iconsIsWritable () const; - void selectRow (int) const; - void selectRow (const QModelIndex &index) const { selectRow(index.row()); } - void applyCurrent (); - -private slots: - void currentChanged (const QModelIndex ¤t, const QModelIndex &previous); - void on_btInstall_clicked (); - void on_btRemove_clicked (); - void handleWarning(); - void showDirInfo(); - -private: - XCursorThemeModel *mModel; - QPersistentModelIndex mAppliedIndex; - LXQt::Settings* mSettings; - Ui::SelectWnd *ui; -}; - -#endif diff --git a/liblxqt-config-cursor/selectwnd.ui b/liblxqt-config-cursor/selectwnd.ui deleted file mode 100644 index f6cd6b9..0000000 --- a/liblxqt-config-cursor/selectwnd.ui +++ /dev/null @@ -1,114 +0,0 @@ - - - SelectWnd - - - - 0 - 0 - 384 - 353 - - - - LXQt Mouse Theme Configuration - - - - - - Select the cursor theme you want to use (hover preview to test cursor). <b>LXQt session needs restart after this change</b>: - - - true - - - - - - - - - - - 0 - 0 - - - - - 0 - 48 - - - - - - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - QAbstractItemView::ScrollPerPixel - - - - - - - Qt::Horizontal - - - - 174 - 20 - - - - - - - - false - - - &Install New Theme... - - - - - - - &Remove Theme - - - - - - - - PreviewWidget - QWidget -
previewwidget.h
-
- - WarningLabel - QWidget -
warninglabel.h
- 1 -
-
- - lbThemes - btInstall - btRemove - - - -
diff --git a/liblxqt-config-cursor/thememodel.cpp b/liblxqt-config-cursor/thememodel.cpp deleted file mode 100644 index 66d87ba..0000000 --- a/liblxqt-config-cursor/thememodel.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* Copyright © 2005-2007 Fredrik Höglund - * (c)GPL2 (c)GPL3 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 or at your option version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#include - -#include "thememodel.h" - -#include - -#include "crtheme.h" -#include "cfgfile.h" - -#include -#include - - -//#define DUMP_FOUND_THEMES - - -/////////////////////////////////////////////////////////////////////////////// -XCursorThemeModel::XCursorThemeModel (QObject *parent) : QAbstractTableModel(parent) -{ - insertThemes(); -} - - -XCursorThemeModel::~XCursorThemeModel() -{ - qDeleteAll(mList); - mList.clear(); -} - - -QVariant XCursorThemeModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - // Only provide text for the headers - if (role != Qt::DisplayRole) return QVariant(); - // Horizontal header labels - if (orientation == Qt::Horizontal) - { - switch (section) - { - case NameColumn: return tr("Name"); - case DescColumn: return tr("Description"); - default: return QVariant(); - } - } - // Numbered vertical header lables - return QString(section); -} - -QVariant XCursorThemeModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() < 0 || index.row() >= mList.count()) return QVariant(); - const XCursorThemeData *theme = mList.at(index.row()); - // Text label - if (role == Qt::DisplayRole) - { - switch (index.column()) - { - case NameColumn: return theme->title(); - case DescColumn: return theme->description(); - default: return QVariant(); - } - } - // Description for the first name column - if (role == XCursorThemeData::DisplayDetailRole && index.column() == NameColumn) return theme->description(); - // Icon for the name column - if (role == Qt::DecorationRole && index.column() == NameColumn) return theme->icon(); - // - return QVariant(); -} - -void XCursorThemeModel::sort(int column, Qt::SortOrder order) -{ - Q_UNUSED(column); - Q_UNUSED(order); - // Sorting of the model isn't implemented, as the KCM currently uses - // a sorting proxy model. -} - -const XCursorThemeData *XCursorThemeModel::theme(const QModelIndex &index) -{ - if (!index.isValid()) return NULL; - if (index.row() < 0 || index.row() >= mList.count()) return NULL; - return mList.at(index.row()); -} - -QModelIndex XCursorThemeModel::findIndex(const QString &name) -{ - uint hash = qHash(name); - for (int i = 0; i < mList.count(); ++i) - { - const XCursorThemeData *theme = mList.at(i); - if (theme->hash() == hash) return index(i, 0); - } - return QModelIndex(); -} - -QModelIndex XCursorThemeModel::defaultIndex() -{ - return findIndex(mDefaultName); -} - -const QStringList XCursorThemeModel::searchPaths() -{ - if (!mBaseDirs.isEmpty()) return mBaseDirs; - // Get the search path from Xcursor - QString path = XcursorLibraryPath(); - // Separate the paths - mBaseDirs = path.split(':', QString::SkipEmptyParts); - // Remove duplicates - QMutableStringListIterator i(mBaseDirs); - while (i.hasNext()) - { - const QString path = i.next(); - QMutableStringListIterator j(i); - while (j.hasNext()) if (j.next() == path) j.remove(); - } - // Expand all occurrences of ~/ to the home dir - mBaseDirs.replaceInStrings(QRegExp("^~\\/"), QDir::home().path() + '/'); - return mBaseDirs; -} - -bool XCursorThemeModel::hasTheme(const QString &name) const -{ - const uint hash = qHash(name); - foreach (const XCursorThemeData *theme, mList) if (theme->hash() == hash) return true; - return false; -} - -bool XCursorThemeModel::isCursorTheme(const QString &theme, const int depth) -{ - // Prevent infinite recursion - if (depth > 10) return false; - // Search each icon theme directory for 'theme' - foreach (const QString &baseDir, searchPaths()) - { - QDir dir(baseDir); - if (!dir.exists() || !dir.cd(theme)) continue; - // If there's a cursors subdir, we'll assume this is a cursor theme - if (dir.exists("cursors")) return true; - // If the theme doesn't have an index.theme file, it can't inherit any themes - if (!dir.exists("index.theme")) continue; - // Open the index.theme file, so we can get the list of inherited themes - QMultiMap cfg = loadCfgFile(dir.path()+"/index.theme", true); - QStringList inherits = cfg.values("icon theme/inherits"); - // Recurse through the list of inherited themes, to check if one of them is a cursor theme - // note that items are reversed - for (int f = inherits.size()-1; f >= 0; --f) - { - QString inh = inherits.at(f); - // Avoid possible DoS - if (inh == theme) continue; - if (isCursorTheme(inh, depth+1)) return true; - } - } - return false; -} - -bool XCursorThemeModel::handleDefault(const QDir &themeDir) -{ - QFileInfo info(themeDir.path()); - // If "default" is a symlink - if (info.isSymLink()) - { - QFileInfo target(info.symLinkTarget()); - if (target.exists() && (target.isDir() || target.isSymLink())) mDefaultName = target.fileName(); - return true; - } - // If there's no cursors subdir, or if it's empty - if (!themeDir.exists("cursors") || - QDir(themeDir.path() + "/cursors").entryList(QDir::Files | - QDir::NoDotAndDotDot).isEmpty()) - { - if (themeDir.exists("index.theme")) - { - XCursorThemeData theme(themeDir); - if (!theme.inherits().isEmpty()) mDefaultName = theme.inherits().at(0); - } - return true; - } - mDefaultName = QLatin1String("default"); - return false; -} - -//#define DUMP_FOUND_THEMES -void XCursorThemeModel::processThemeDir(const QDir &themeDir) -{ -#ifdef DUMP_FOUND_THEMES - qDebug() << "looking at:" << themeDir.path(); -#endif - bool haveCursors = themeDir.exists("cursors"); - // Special case handling of "default", since it's usually either a - // symlink to another theme, or an empty theme that inherits another theme - if (mDefaultName.isNull() && themeDir.dirName() == "default") - { - if (handleDefault(themeDir)) return; - } - // If the directory doesn't have a cursors subdir and lacks an - // index.theme file it can't be a cursor theme. - if (!themeDir.exists("index.theme") && !haveCursors) - { - //qDebug() << "IS NOT THEME" << themeDir; - return; - } - // Create a cursor theme object for the theme dir - XCursorThemeData *theme = new XCursorThemeData(themeDir); - // Skip this theme if it's hidden -#ifdef DUMP_FOUND_THEMES - qDebug() << - " theme name:" << theme->name() << - "\n theme title:" << theme->title() << - "\n theme desc:" << theme->description() << - "\n theme sample:" << theme->sample() << - "\n theme inherits:" << theme->inherits(); -#endif - if (theme->isHidden()) - { - //qDebug() << "HIDDEN THEME" << theme->name() << themeDir; - delete theme; - return; - } - // If there's no cursors subdirectory we'll do a recursive scan - // to check if the theme inherits a theme with one - if (!haveCursors) - { - bool foundCursorTheme = false; - foreach (const QString &name, theme->inherits()) - { - if ((foundCursorTheme = isCursorTheme(name))) break; - } - if (!foundCursorTheme) - { - delete theme; - return; - } - } - // Append the theme to the list - mList.append(theme); -} - -void XCursorThemeModel::insertThemes() -{ - // Scan each base dir for Xcursor themes and add them to the list - foreach (const QString &baseDir, searchPaths()) - { - QDir dir(baseDir); - //qDebug() << "TOPLEVEL" << baseDir; - if (!dir.exists()) continue; - //qDebug() << " continue passed"; - // Process each subdir in the directory - foreach (const QString &name, dir.entryList(QDir::AllDirs | - QDir::NoDotAndDotDot | QDir::Readable | QDir::Executable)) - { - //qDebug() << " SUBDIR" << name; - // Don't process the theme if a theme with the same name already exists - // in the list. Xcursor will pick the first one it finds in that case, - // and since we use the same search order, the one Xcursor picks should - // be the one already in the list - if (hasTheme(name)) - { - qDebug() << "duplicate theme:" << dir.path()+name; - } - if (!dir.cd(name)) - { - qDebug() << "can't cd:" << dir.path()+name; - continue; - } - processThemeDir(dir); - dir.cdUp(); // Return to the base dir - } - } - // The theme Xcursor will end up using if no theme is configured - //if (mDefaultName.isNull() || !hasTheme(mDefaultName)) mDefaultName = legacy->name(); -} - -bool XCursorThemeModel::addTheme(const QDir &dir) -{ - XCursorThemeData *theme = new XCursorThemeData(dir); - // Don't add the theme to the list if it's hidden - if (theme->isHidden()) - { - delete theme; - return false; - } - // If an item with the same name already exists in the list, - // we'll remove it before inserting the new one. - for (int i = 0; i < mList.count(); ++i) - { - if (mList.at(i)->hash() == theme->hash()) - { - removeTheme(index(i, 0)); - break; - } - } - // Append the theme to the list - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - mList.append(theme); - endInsertRows(); - return true; -} - -void XCursorThemeModel::removeTheme(const QModelIndex &index) -{ - if (!index.isValid()) return; - beginRemoveRows(QModelIndex(), index.row(), index.row()); - delete mList.takeAt(index.row()); - endRemoveRows(); -} diff --git a/liblxqt-config-cursor/thememodel.h b/liblxqt-config-cursor/thememodel.h deleted file mode 100644 index 771c5a2..0000000 --- a/liblxqt-config-cursor/thememodel.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright © 2005-2007 Fredrik Höglund - * (c)GPL2 (c)GPL3 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License version 2 or at your option version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -/* - * additional code: Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - */ -#ifndef THEMEMODEL_H -#define THEMEMODEL_H - -#include -#include - -class QDir; -class XCursorThemeData; - - -// The two TableView/TreeView columns provided by the model -enum Columns { NameColumn = 0, DescColumn }; - - -/** - * The XCursorThemeModel class provides a model for all locally installed - * Xcursor themes, and the KDE/Qt legacy bitmap theme. - * - * This class automatically scans the locations in the file system from - * which Xcursor loads cursors, and creates an internal list of all - * available cursor themes. - * - * The model provides this theme list to item views in the form of a list - * of rows with two columns; the first column has the theme's descriptive - * name and its sample cursor as its icon, and the second column contains - * the theme's description. - * - * Additional Xcursor themes can be added to a model after it's been - * created, by calling addTheme(), which takes QDir as a parameter, - * with the themes location. The intention is for this function to be - * called when a new Xcursor theme has been installed, after the model - * was instantiated. - * - * The KDE legacy theme is a read-only entry, with the descriptive name - * "KDE Classic", and the internal name "#kde_legacy#". - * - * Calling defaultIndex() will return the index of the theme Xcursor - * will use if the user hasn't explicitly configured a cursor theme. - */ -class XCursorThemeModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - XCursorThemeModel (QObject *parent = 0); - ~XCursorThemeModel (); - - inline int columnCount (const QModelIndex &parent = QModelIndex()) const; - inline int rowCount (const QModelIndex &parent = QModelIndex()) const; - QVariant headerData (int section, Qt::Orientation orientation, int role) const; - QVariant data (const QModelIndex &index, int role) const; - void sort (int column, Qt::SortOrder order = Qt::AscendingOrder); - - /// Returns the CursorTheme at @p index. - const XCursorThemeData *theme (const QModelIndex &index); - - /// Returns the index for the CursorTheme with the internal name @p name, - /// or an invalid index if no matching theme can be found. - QModelIndex findIndex (const QString &name); - - /// Returns the index for the default theme. - QModelIndex defaultIndex (); - - /// Adds the theme in @p dir, and returns @a true if successful or @a false otherwise. - bool addTheme (const QDir &dir); - void removeTheme (const QModelIndex &index); - - /// Returns the list of base dirs Xcursor looks for themes in. - const QStringList searchPaths (); - -private: - bool handleDefault (const QDir &dir); - void processThemeDir (const QDir &dir); - void insertThemes (); - bool hasTheme (const QString &theme) const; - bool isCursorTheme (const QString &theme, const int depth = 0); - -private: - QListmList; - QStringList mBaseDirs; - QString mDefaultName; -}; - -int XCursorThemeModel::rowCount (const QModelIndex &) const -{ - return mList.count(); -} - - -int XCursorThemeModel::columnCount (const QModelIndex &) const -{ - return 2; -} - -#endif diff --git a/liblxqt-config-cursor/warninglabel.cpp b/liblxqt-config-cursor/warninglabel.cpp deleted file mode 100644 index ea37b7e..0000000 --- a/liblxqt-config-cursor/warninglabel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2012 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include - -#include "warninglabel.h" - - - -WarningLabel::WarningLabel(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); - - iconLabel->setPixmap(XdgIcon::fromTheme("dialog-warning").pixmap(64, 64)); - - connect(showDirButton, SIGNAL(pressed()), - this, SIGNAL(showDirInfo())); -} diff --git a/liblxqt-config-cursor/warninglabel.h b/liblxqt-config-cursor/warninglabel.h deleted file mode 100644 index 30805c9..0000000 --- a/liblxqt-config-cursor/warninglabel.h +++ /dev/null @@ -1,47 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2012 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef WARNINGLABEL_H -#define WARNINGLABEL_H - -#include "ui_warninglabel.h" - - -class WarningLabel : public QWidget, public Ui::WarningLabel -{ - Q_OBJECT - -public: - WarningLabel (QWidget *parent=0); - - QPoint buttonPos() { return showDirButton->pos(); } - -signals: - void showDirInfo(); -}; - -#endif diff --git a/liblxqt-config-cursor/warninglabel.ui b/liblxqt-config-cursor/warninglabel.ui deleted file mode 100644 index b58b367..0000000 --- a/liblxqt-config-cursor/warninglabel.ui +++ /dev/null @@ -1,64 +0,0 @@ - - - WarningLabel - - - - 0 - 0 - 334 - 72 - - - - Form - - - - - - - - - 0 - 0 - - - - - 64 - 64 - - - - - - - - - 0 - 0 - - - - LXQt could not find any cursor theme. The default X11 cursor theme will be used instead. LXQt looked in the following directories: - - - true - - - - - - - Show... - - - - - - - - - - diff --git a/liblxqt-config-cursor/xcr/xcrimg.cpp b/liblxqt-config-cursor/xcr/xcrimg.cpp deleted file mode 100644 index 4d2ad28..0000000 --- a/liblxqt-config-cursor/xcr/xcrimg.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#include - -#include "xcrimg.h" - -#include -#include -#include -#include -#include -#include - -#include - - -#include -#include -#include - - -inline static quint8 alphaPreMul (quint8 clr, quint8 alpha) { - quint32 c32 = clr, a32 = alpha; - c32 = c32*a32/255; - if (c32 > a32) c32 = a32; - return c32&0xff; -} - - -static int nominalCursorSize (int iconSize) { - for (int i = 512; i > 8; i /= 2) { - if (i < iconSize) return i; - if (int(i*0.75) < iconSize) return int(i*0.75); - } - return 8; -} - - -static void baPutDW (QByteArray &ba, quint32 v) { - ba.append('\0'); ba.append('\0'); - ba.append('\0'); ba.append('\0'); - uchar *d = (uchar *)ba.data(); - d += ba.size()-4; - for (int f = 4; f > 0; f--, d++) { - *d = (v&0xff); - v >>= 8; - } -} - - -void XCursorImage::convertARGB2PreMul (QImage &img) { - switch (img.format()) { - case QImage::Format_ARGB32_Premultiplied: return; - case QImage::Format_ARGB32: break; - default: (void) img.convertToFormat(QImage::Format_ARGB32/*_Premultiplied*/); - } - (void) img.convertToFormat(QImage::Format_ARGB32_Premultiplied); // this shouldn't convert anything - // so convert it! - for (int y = img.height()-1; y >= 0; y--) { - quint8 *line = (quint8 *)img.scanLine(y); - for (int x = 0; x < img.width(); x++, line += 4) { - // convert to 'premultiplied' - line[0] = alphaPreMul(line[0], line[3]); - line[1] = alphaPreMul(line[1], line[3]); - line[2] = alphaPreMul(line[2], line[3]); - } - } -} - - -/////////////////////////////////////////////////////////////////////////////// -XCursorImage::XCursorImage (const QString &aName, const QImage &aImg, int aXHot, int aYHot, quint32 aDelay, quint32 aCSize) : - mIsValid(true), mName(aName), mImage(0), mDelay(aDelay), mXHot(aXHot), mYHot(aYHot), mCSize(aCSize) -{ - mImage = new QImage(aImg.copy()); - convertARGB2PreMul(*mImage); -} - - -XCursorImage::XCursorImage (const QString &aName) : - mIsValid(false), mName(aName), mImage(0), mDelay(50), mXHot(0), mYHot(0) -{ -} - - -XCursorImage::~XCursorImage () { - delete mImage; // or memory will leak! -} - - -QPixmap XCursorImage::icon () const { - if (mIcon.isNull()) mIcon = createIcon(); - return mIcon; -} - - -QCursor XCursorImage::cursor () const { - return QCursor(icon(), mXHot, mYHot); -} - - -QImage XCursorImage::image (int size) const { - if (size == -1) size = XcursorGetDefaultSize(QX11Info::display()); - if (!mImage) return QImage(); - return mImage->copy(); -} - - -QPixmap XCursorImage::createIcon () const { - QPixmap pixmap; - int iconSize = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize); - int cursorSize = nominalCursorSize(iconSize); - QSize size = QSize(iconSize, iconSize); - QImage img = image(cursorSize); - if (!img.isNull()) { - // Scale the image if it's larger than the preferred icon size - if (img.width() > size.width() || img.height() > size.height()) - img = img.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation); - pixmap = QPixmap::fromImage(img); - } - return pixmap; -} - - -quint32 XCursorImage::xcurSize () const { - if (!mImage || !mIsValid) return 0; - quint32 res = 9*4; // header - res += mImage->width()*mImage->height()*4; - return res; -} - - -void XCursorImage::genXCursorImg (QByteArray &res) const { - if (!mImage || !mIsValid) return; - baPutDW(res, 36); // header size - baPutDW(res, 0xfffd0002); // chunk type - baPutDW(res, mCSize); // subtype - baPutDW(res, 1); // version - baPutDW(res, (quint32)mImage->width()); - baPutDW(res, (quint32)mImage->height()); - baPutDW(res, (quint32)mXHot); - baPutDW(res, (quint32)mYHot); - baPutDW(res, (quint32)mDelay); - // now put the pixels - QImage i = mImage->copy(); - (void) i.convertToFormat(QImage::Format_ARGB32_Premultiplied); - //i.convertToFormat(QImage::Format_ARGB32); - for (int y = 0; y < i.height(); y++) { - const uchar *sl = i.scanLine(y); - const quint32 *d = (const quint32 *)sl; - for (int x = 0; x < i.width(); x++, d++) baPutDW(res, *d); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -XCursorImages::XCursorImages (const QString &aName, const QString &aPath) : - mName(aName), mPath(aPath), mTitle(""), mAuthor(""), mLicense(""), - mEMail(""), mSite(""), mDescr(""), mIM("") -{ -} - - -XCursorImages::~XCursorImages () { - qDeleteAll(mList); - mList.clear(); -} - - -QByteArray XCursorImages::genXCursor () const { - QByteArray res; - // build 'credits' block - QByteArray crdBA[7]; - { - QStringList crb; - crb << mAuthor << mLicense << mDescr << mTitle << mEMail << mSite << mIM; - for (int f = 0; f < crb.size(); f++) { - QString s(crb[f]); - if (s.isEmpty()) crdBA[f].clear(); else crdBA[f] = s.toUtf8(); - } - } - // - res.append("Xcur"); // signature - baPutDW(res, 16); // header size - baPutDW(res, 65536); // version number - // TOC - quint32 cnt = 0; - foreach (const XCursorImage *i, mList) if (i->xcurSize() > 0) cnt++; - // 'credits' - for (int f = 0; f < 7; f++) if (!crdBA[f].isEmpty()) cnt++; - // - baPutDW(res, cnt); // # of chunks - if (!cnt) return res; - quint32 dataOfs = cnt*(3*4)+16; - // add 'credits' chunks - for (int f = 0; f < 7; f++) { - if (crdBA[f].isEmpty()) continue; - baPutDW(res, 0xfffd0001); // entry type - baPutDW(res, f+1); // subtype - baPutDW(res, dataOfs); // offset - dataOfs += crdBA[f].size()+20; - } - // add image chunks - foreach (const XCursorImage *i, mList) { - quint32 isz = i->xcurSize(); - if (!isz) continue; - baPutDW(res, 0xfffd0002); // entry type - baPutDW(res, i->csize()); // subtype - baPutDW(res, dataOfs); // offset - dataOfs += isz; - } - // credits - for (int f = 0; f < 7; f++) { - if (crdBA[f].isEmpty()) continue; - baPutDW(res, 20); // header size - baPutDW(res, 0xfffd0001); // entry type - baPutDW(res, f+1); // subtype - baPutDW(res, 1); // version - baPutDW(res, crdBA[f].size()); // length - res.append(crdBA[f]); - } - // images - foreach (const XCursorImage *i, mList) { - quint32 isz = i->xcurSize(); - if (!isz) continue; - i->genXCursorImg(res); - } - return res; -} - - -QImage XCursorImages::buildImage () const { - int width = 0, height = 0, cnt = 0; - foreach (const XCursorImage *i, mList) { - if (i->xcurSize() > 0) { - QImage img = i->image(); - width = qMax(width, img.width()); - height = qMax(height, img.height()); - ++cnt; - } - } - //qDebug() << cnt << "images; size" << width << "by" << height; - - QImage res(width*cnt, height, QImage::Format_ARGB32); - QPainter p(&res); - int x = 0; - foreach (const XCursorImage *i, mList) { - if (i->xcurSize() > 0) { - QImage img = i->image(); - p.drawImage(QPoint(x, 0), img); - x += img.width(); - } - } - return res; -} diff --git a/liblxqt-config-cursor/xcr/xcrimg.h b/liblxqt-config-cursor/xcr/xcrimg.h deleted file mode 100644 index efcfdbe..0000000 --- a/liblxqt-config-cursor/xcr/xcrimg.h +++ /dev/null @@ -1,116 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#ifndef XCRIMG_H -#define XCRIMG_H - -#include -#include -#include - - -class XCursorImage { -public: - XCursorImage (const QString &aName, const QImage &aImg, int aXHot=0, int aYHot=0, quint32 aDelay=50, quint32 aCSize=1); - XCursorImage (const QString &aName); - virtual ~XCursorImage (); - - inline bool isValid () const { return mIsValid; } - inline const QString &name () const { return mName; } - inline quint32 delay () const { return mDelay; } - inline int xhot () const { return mXHot; } - inline int yhot () const { return mYHot; } - inline quint32 csize () const { return mCSize; } - - inline void setXHot (int v) { mXHot = v; } - inline void setYHot (int v) { mYHot = v; } - inline void setDelay (quint32 v) { mDelay = v; } - inline void setName (const QString &n) { mName = n; } - inline void setCSize (quint32 v) { mCSize = v; } - - virtual QPixmap icon () const; - virtual QCursor cursor () const; - virtual QImage image (int size=-1) const; - - quint32 xcurSize () const; // size in bytes - - virtual void genXCursorImg (QByteArray &res) const; // generate Xcursor image - - static void convertARGB2PreMul (QImage &img); - -protected: - virtual QPixmap createIcon () const; - -protected: - bool mIsValid; - QString mName; - QImage *mImage; - quint32 mDelay; // milliseconds - int mXHot; - int mYHot; - quint32 mCSize; - mutable QPixmap mIcon; -}; - - -class XCursorImages { -public: - XCursorImages (const QString &aName, const QString &aPath=""); - virtual ~XCursorImages (); - - inline const QString &name () const { return mName; } - inline const QString &path () const { return mPath; } - inline const QString &title () const { return mTitle; } - inline const QString &author () const { return mAuthor; } - inline const QString &license () const { return mLicense; } - inline const QString &mail () const { return mEMail; } - inline const QString &site () const { return mSite; } - inline const QString &descr () const { return mDescr; } - inline const QString &im () const { return mIM; } - inline const QString &script () const { return mScript; } - - inline void setName (const QString &v) { mName = v; } - inline void setPath (const QString &v) { mPath = v; } - inline void setTitle (const QString &v) { mTitle = v; } - inline void setAuthor (const QString &v) { mAuthor = v; } - inline void setLicense (const QString &v) { mLicense = v; } - inline void setMail (const QString &v) { mEMail = v; } - inline void setSite (const QString &v) { mSite = v; } - inline void setDescr (const QString &v) { mDescr = v; } - inline void setIM (const QString &v) { mIM = v; } - inline void setScript (const QString &v) { mScript = v; } - - inline const QList &list () const { return mList; } - inline XCursorImage *item (int idx) { return mList.at(idx); } - inline const XCursorImage *at (int idx) const { return mList.at(idx); } - inline int count () const { return mList.size(); } - inline int size () const { return mList.size(); } - - inline void append (XCursorImage *img) { mList << img; } - - QByteArray genXCursor () const; // generate Xcursor file - - QImage buildImage () const; - -protected: - QString mName; - QString mPath; - QString mTitle; - QString mAuthor; - QString mLicense; - QString mEMail; - QString mSite; - QString mDescr; - QString mIM; - QString mScript; // just for writing it back - QList mList; -}; - - -#endif diff --git a/liblxqt-config-cursor/xcr/xcrtheme.cpp b/liblxqt-config-cursor/xcr/xcrtheme.cpp deleted file mode 100644 index 454371d..0000000 --- a/liblxqt-config-cursor/xcr/xcrtheme.cpp +++ /dev/null @@ -1,742 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#include -//#include - -#include "xcrtheme.h" - -#include - -#include -#include - -#include "xcrimg.h" -#include "xcrxcur.h" - -/* - 0 standard arrow - 1 help arrow (the one with '?') - 2 working arrow - 3 busy cursor - 4 precision select - 5 text select - 6 handwriting - 7 unavailable -8 north (vert) resize -9 south resize - 10 west (vert-means horiz???) resize -11 east resize - 12 north-west resize -13 south-east resize - 14 north-east resize -15 south-west resize - 16 move - 17 alternate select - 18 hand -19 button -*/ - - -static const char *nameTransTbl[] = { - // curFX idx, curXP name, [...altnames], finalname, 0 - // end with 0 - "", // standard arrow (it's \x00) - "Arrow", - "left_ptr", "X_cursor", "right_ptr", "top_left_arrow", "move", - "4498f0e0c1937ffe01fd06f973665830", - 0, - // - "\x04", // precision select - "Cross", - "tcross", "cross", "crosshair", "cross_reverse", - "draped_box", - 0, - // - "\x12", // hand - "Hand", - "hand", "hand1", "hand2", "9d800788f1b08800ae810202380a0822", - "e29285e634086352946a0e7090d73106", - 0, - // - "\x05", // text select - "IBeam", - "xterm", - 0, - // - "\x11", // alternate select - "UpArrow", - "center_ptr", - 0, - // - "\x0c", - "SizeNWSE", // north-west resize - "bottom_right_corner", "top_left_corner", "bd_double_arrow", "lr_angle", - "c7088f0f3e6c8088236ef8e1e3e70000", - 0, - // - "\x0e", // north-east resize - "SizeNESW", - "bottom_left_corner", "top_right_corner", "fd_double_arrow", "ll_angle", - "fcf1c3c7cd4491d801f1e1c78f100000", - 0, - // - "\x0a", // west resize - "SizeWE", - "sb_h_double_arrow", "left_side", "right_side", "h_double_arrow", "028006030e0e7ebffc7f7070c0600140", - "14fef782d02440884392942c11205230", - 0, - // - "\x08", // north resize - "SizeNS", - "double_arrow", "bottom_side", "top_side", "v_double_arrow", "sb_v_double_arrow", "00008160000006810000408080010102", - "2870a09082c103050810ffdffffe0204", - 0, - // - "\x01", // help arrow - "Help", - "question_arrow", - "d9ce0ab605698f320427677b458ad60b", - 0, - // - "\x06", // handwriting - "Handwriting", - "pencil", - 0, - // - "\x02", // working arrow - "AppStarting", - "left_ptr_watch", "08e8e1c95fe2fc01f976f1e063a24ccd", - "3ecb610c1bf2410f44200f48c40d3599", - 0, - // - "\x10", // move (???) - "SizeAll", - "fleur", - 0, - // - "\x03", // busy cursor - "Wait", - "watch", - 0, - // - "\x07", // unavailable - "NO", - "crossed_circle", - "03b6e0fcb3499374a867c041f52298f0", - 0, - 0 -}; - - -/* -static QString convertFXIndexToXPName (qint32 idx) { - int f = 0; - do { - if (nameTransTbl[f][0] == idx) return QString(nameTransTbl[f+1]); - f += 2; - while (nameTransTbl[f]) ++f; - ++f; - } while (nameTransTbl[f]); - return QString(); -} -*/ - - -static void removeFilesAndDirs (QDir &dir) { - //qDebug() << "dir:" << dir.path(); - // files - QFileInfoList lst = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden); - foreach (const QFileInfo &fi, lst) { - //qDebug() << "removing" << fi.fileName() << fi.absoluteFilePath(); - dir.remove(fi.fileName()); - } - // dirs - lst = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Hidden); - foreach (const QFileInfo &fi, lst) { - dir.cd(fi.fileName()); - removeFilesAndDirs(dir); - dir.cd(".."); - //qDebug() << "removing dir" << fi.fileName(); - dir.rmdir(fi.fileName()); - } -} - - -static void removeFiles (QDir &dir) { - // - QFileInfoList lst = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden); - foreach (const QFileInfo &fi, lst) { - qDebug() << "removing" << fi.fileName() << fi.absoluteFilePath(); - QFile fl(fi.absoluteFilePath()); - fl.remove(); - } - // -} - - -static void removeCursorFiles (QDir &dir) { - QString pt = dir.path(); - if (!pt.isEmpty() && pt != "/") pt += "/"; - const char **nlst = nameTransTbl; - while (*nlst) { - nlst += 2; // skip non-files - while (*nlst) { - QString n(*nlst); - QFile fl(pt+n); - qDebug() << "removing" << fl.fileName(); - fl.remove(); - nlst++; - } - nlst++; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -const char **XCursorTheme::findCursorByFXId (int id) { - if (id < 0 || id > 19) return 0; // invalid id - const char **nlst = nameTransTbl; - while (*nlst) { - int lid = (**nlst)&0xff; - nlst += 2; // skip unnecessary - if (lid == id) return nlst; - while (nlst[-1]) nlst++ ; // skip - } - return 0; // none found -} - - -/* - * type: - * 0: by CursorXP name - * 1: by Xcursor name - * return: - * pointer to Xcursor name list - */ -const char **XCursorTheme::findCursorRecord (const QString &cname, int type) { - QByteArray ba(cname.toUtf8()); - const char *name = ba.constData(); - const char **nlst = nameTransTbl; - while (*nlst) { - nlst += 2; // skip unnecessary - if (!type) { - // by CursorXP name - if (!strcmp(name, nlst[-1])) return nlst; - } else { - // by Xcursor name - // find name - const char **nx = nlst; - while (*nx && strcmp(*nx, name)) nx++; - if (*nx) return nlst; // we got it! - } - while (nlst[-1]) nlst++ ; // skip - } - return 0; // none found -} - - -QString XCursorTheme::findCursorFile (const QDir &dir, const char *name) { - QString d(dir.path()); - if (d != "/") d += "/"; - d += "cursors/"; - const char **nlst = nameTransTbl; - while (*nlst) { - nlst += 2; // skip unnecessary - // find name - const char **nx = nlst; - while (*nx && strcmp(*nx, name)) nx++; - if (*nx) { - // we got it! - //qDebug() << "found" << *nx << "(" << *nlst << ")"; - nx = nlst; - while (*nx) { - QString s(*nx); - //qDebug() << "checking" << s; - QFileInfo fl(d+s); - if (fl.exists() && fl.isReadable()) { - //qDebug() << " ok" << s; - return s; - } - nx++; - } - } - while (nlst[-1]) nlst++ ; // skip - } - return QString(); // none found -} - - -/////////////////////////////////////////////////////////////////////////////// -XCursorTheme::XCursorTheme () : - mName(""), mPath(""), mTitle(""), mAuthor(""), mLicense(""), - mEMail(""), mSite(""), mDescr(""), mIM(""), mSample("left_ptr") -{ -} - - -XCursorTheme::XCursorTheme (const QDir &aDir, const QString &aName) : - mName(aName), mPath(aDir.path()), mTitle(""), mAuthor(""), mLicense(""), - mEMail(""), mSite(""), mDescr(""), mIM(""), mSample("left_ptr") -{ - parseXCursorTheme(aDir); -} - - -XCursorTheme::~XCursorTheme () { - qDeleteAll(mList); - mList.clear(); -} - - -bool XCursorTheme::writeToDir (const QDir &destDir) { - bool res = true; - QDir dir (destDir); - dir.mkdir("cursors"); - if (!dir.exists("cursors")) return false; - dir.cd("cursors"); - removeCursorFiles(dir); - // - foreach (const XCursorImages *ci, mList) { - const char **nlst = findCursorRecord(ci->name()); - if (!nlst) continue; // unknown cursor, skip it - qDebug() << "writing" << *nlst; - { - QByteArray ba(ci->genXCursor()); - QFile fo(dir.path()+"/"+ci->name()); - if (fo.open(QIODevice::WriteOnly)) { - fo.write(ba); - fo.close(); - } else { - res = false; - break; - } - } - // make symlinks - const char *orig = *nlst; - nlst++; - while (*nlst) { - qDebug() << "symlinking to" << orig << "as" << *nlst; - QByteArray newName(QFile::encodeName(dir.path()+"/"+(*nlst))); - qDebug() << "old" << orig << "new" << newName.constData(); - if (symlink(orig, newName.constData())) { - res = false; - break; - } - nlst++; - } - if (!res) break; - nlst++; - } - if (res) res = writeIndexTheme(destDir); - if (!res) removeCursorFiles(dir); - return res; -} - - -void XCursorTheme::parseThemeIndex (const QDir &dir) { - QString ifn = dir.path(); - if (!ifn.isEmpty() && ifn != "/") ifn += "/"; - ifn += "index.theme"; - qDebug() << "reading theme index:" << ifn; - QFile fl(ifn); - // - QString cmt; - mInherits.clear(); - // read config file, drop out 'icon theme' section (IT'S BAD!) - if (fl.open(QIODevice::ReadOnly)) { - QTextStream stream; - stream.setDevice(&fl); - stream.setCodec("UTF-8"); - bool inIconTheme = false; - QString curPath; - while (1) { - QString s = stream.readLine(); - if (s.isNull()) break; - QString orig(s); - s = s.trimmed(); - if (s.isEmpty() || s[0] == '#' || s[0] == ';') continue; - if (s[0] == '[') { - // new path - int len = s.length()-1; - if (s[len] == ']') len--; - s = s.mid(1, len).simplified(); - curPath = s.toLower(); - inIconTheme = (curPath == "icon theme"); - continue; - } - if (!inIconTheme) continue; - int eqp = s.indexOf('='); - if (eqp < 0) continue; // invalid entry - QString name = s.left(eqp).simplified().toLower(); - QString value = s.mid(eqp+1).simplified(); - qDebug() << name << value; - if (name == "name" && !value.isEmpty()) mTitle = value; - else if (name == "comment" && !value.isEmpty()) cmt = value; - else if (name == "author" && !value.isEmpty()) mAuthor = value; - else if (name == "url" && !value.isEmpty()) mSite = value; - else if (name == "description" && !value.isEmpty()) mDescr = value; - else if (name == "example" && !value.isEmpty()) mSample = value; - else if (name == "inherits" && !value.isEmpty()) mInherits << value; - } - fl.close(); - } - if (mDescr.isEmpty() && !cmt.isEmpty()) mDescr = cmt; - if (mSample.isEmpty()) mSample = "left_ptr"; - mInherits.removeDuplicates(); -} - - -void XCursorTheme::dumpInfo () { -/* - qDebug() << - "INFO:" << - "\n name:" << mName << - "\n path:" << mPath << - "\n title:" << mTitle << - "\n author:" << mAuthor << - "\n license:" << mLicense << - "\n mail:" << mEMail << - "\n site:" << mSite << - "\n dscr:" << mDescr << - "\n im:" << mIM << - "\n sample:" << mSample << - "\n inherits:" << mInherits - ; -*/ -} - - -void XCursorTheme::parseXCursorTheme (const QDir &dir) { - parseThemeIndex(dir); - dumpInfo(); - const char **nlst = nameTransTbl; - QDir dr(dir); dr.cd("cursors"); - while (*nlst) { - //qDebug() << "CurFX: (" << nlst[1] << ")"; - nlst += 2; // skip unnecessary - //qDebug() << "searching" << *nlst; - QString fn = findCursorFile(dir, *nlst); - if (fn.isEmpty()) continue; // no such file - //qDebug() << " Xcrusor: (" << nlst[0] << ")"; - while (nlst[-1]) nlst++ ; // skip - //qDebug() << " skiped: (" << nlst[1] << ")"; - qDebug() << "loading" << fn; - XCursorImages *ci = new XCursorImagesXCur(dr, fn); - if (ci->count()) { - qDebug() << " OK:" << fn << "name:" << ci->name(); - if (mTitle.isEmpty() && !ci->title().isEmpty()) mTitle = ci->title(); - if (mAuthor.isEmpty() && !ci->author().isEmpty()) mAuthor = ci->author(); - if (mLicense.isEmpty() && !ci->license().isEmpty()) mLicense = ci->license(); - if (mEMail.isEmpty() && !ci->mail().isEmpty()) mEMail = ci->mail(); - if (mSite.isEmpty() && !ci->site().isEmpty()) mSite = ci->site(); - if (mDescr.isEmpty() && !ci->descr().isEmpty()) mDescr = ci->descr(); - if (mIM.isEmpty() && !ci->im().isEmpty()) mIM = ci->im(); - mList << ci; - dumpInfo(); - } else { - qWarning() << "can't load" << fn << nlst[-2]; - delete ci; - } - } - dumpInfo(); - fixInfoFields(); - dumpInfo(); -} - - -void XCursorTheme::fixInfoFields () { - foreach (XCursorImages *ci, mList) { - if (!mTitle.isEmpty() && ci->title().isEmpty()) ci->setTitle(title()); - if (!mAuthor.isEmpty() && ci->author().isEmpty()) ci->setAuthor(author()); - if (!mLicense.isEmpty() && ci->license().isEmpty()) ci->setLicense(license()); - if (!mEMail.isEmpty() && ci->mail().isEmpty()) ci->setMail(mail()); - if (!mSite.isEmpty() && ci->site().isEmpty()) ci->setSite(site()); - if (!mDescr.isEmpty() && ci->descr().isEmpty()) ci->setDescr(descr()); - if (!mIM.isEmpty() && ci->im().isEmpty()) ci->setIM(im()); - } -} - - -bool XCursorTheme::writeIndexTheme (const QDir &destDir) { - QString ifn = destDir.path(); - if (!ifn.isEmpty() && ifn != "/") ifn += "/"; - ifn += "index.theme"; - qDebug() << "writing theme index:" << ifn; - QFile fl(ifn); - // - QStringList cfg, inhs, iconOther; - QString name, cmt, author, url, dscr, sample; - inhs.append(mInherits); - // read config file, drop out 'icon theme' section (IT'S BAD!) - if (fl.open(QIODevice::ReadOnly)) { - QTextStream stream; - stream.setDevice(&fl); - stream.setCodec("UTF-8"); - QString curPath; - while (1) { - QString s = stream.readLine(); - if (s.isNull()) break; - QString orig(s); - s = s.trimmed(); - if (s.isEmpty() || s[0] == '#' || s[0] == ';') { - if (curPath != "icon theme") cfg << orig; - continue; - } - if (s[0] == '[') { - // new path - int len = s.length()-1; - if (s[len] == ']') len--; - s = s.mid(1, len).simplified(); - curPath = s.toLower(); - if (curPath != "icon theme") cfg << orig; - continue; - } - if (curPath != "icon theme") cfg << orig; - else { - int eqp = s.indexOf('='); - if (eqp < 0) { - // invalid entry - iconOther << orig; - continue; - } - QString name = s.left(eqp).simplified(); - QString value = s.mid(eqp+1).simplified(); - if (name.isEmpty()) { - // invalid entry - iconOther << orig; - continue; - } - QString nn(name.toLower()); - if (nn == "name") name = value; - else if (nn == "comment") cmt = value; - else if (nn == "author") author = value; - else if (nn == "url") url = value; - else if (nn == "description") dscr = value; - else if (nn == "example") sample = value; - else if (nn == "inherits") { if (!value.isEmpty()) inhs << value; } - else iconOther << orig; -/* -Name=Fire Dragon -Comment=Fire Dragon Cursor Theme -- part of the 'Four Dragons' suite; (c) Sleeping Dragon, http://sleeping-dragon.deviantart.com/art/Fire-Dragon-30419542 -Author=Sleeping Dragon -Url=http://sleeping-dragon.deviantart.com/art/Fire-Dragon-30419542 -Description=Fire Dragon Cursor Theme -- part of the 'Four Dragons' suite -Example=left_ptr -Inherits=core -*/ - } - } - fl.close(); - } - // theme file parsed; rewrite it! - if (cfg.size() > 0 && !cfg.at(cfg.size()-1).isEmpty()) cfg << ""; - if (!fl.open(QIODevice::WriteOnly)) return false; - if (name.isEmpty()) name = mTitle; - if (author.isEmpty()) author = mAuthor; - if (url.isEmpty()) url = mSite; - if (dscr.isEmpty()) dscr = mDescr; - if (cmt.isEmpty()) cmt = dscr; - /*if (sample.isEmpty())*/ sample = "left_ptr"; - if (inhs.size() == 0) inhs << "core"; - inhs.removeDuplicates(); - dumpInfo(); -/* - qDebug() << - "***INFO:" << - "\n name:" << name << - "\n cmt:" << cmt << - "\n author:" << author << - "\n site:" << url << - "\n dscr:" << dscr << - "\n sample:" << mSample << - "\n inherits:" << inhs - ; -*/ - { - QTextStream stream; - stream.setDevice(&fl); - stream.setCodec("UTF-8"); - foreach (const QString &s, cfg) stream << s << "\n"; - stream << "[Icon Theme]\n"; - stream << "Name=" << name << "\n"; - stream << "Comment=" << cmt << "\n"; - stream << "Author=" << author << "\n"; - stream << "Url=" << url << "\n"; - stream << "Description=" << dscr << "\n"; - stream << "Example=" << mSample << "\n"; - foreach (const QString &s, inhs) stream << "Inherits=" << s << "\n"; - } - fl.close(); - return true; -} - - -/////////////////////////////////////////////////////////////////////////////// -static bool removeXCTheme (const QDir &thDir) { - if (thDir.exists("cursors")) { - QDir d(thDir); - d.cd("cursors"); - //removeCursorFiles(d); - removeFiles(d); - } - thDir.rmdir("cursors"); - // check if there are some other files - QFileInfoList lst = thDir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden); - bool cantKill = false; - foreach (const QFileInfo &fi, lst) { - QString s(fi.fileName()); - if (s != "icon-theme.cache" && s != "index.theme") { - cantKill = true; - break; - } - } - // can kill this? - if (!cantKill) { - QDir d(thDir); - d.remove("icon-theme.cache"); - d.remove("index.theme"); - } - return true; -} - - -bool removeXCursorTheme (const QDir &thDir, const QString &name) { - qDebug() << "to kill:" << thDir.path() << name; - QDir d(thDir); - if (!d.exists(name)) return false; - qDebug() << "removing" << d.path() << name; - d.cd(name); - removeXCTheme(d); - d.cd(".."); - d.rmdir(name); - return true; -} - - -bool removeXCursorTheme (const QString &name) { - QDir d(QDir::homePath()); - return removeXCursorTheme(d, name); -} - - -bool removeXCursorTheme (const QDir &thDir) { - QString name(thDir.path()); - while (!name.isEmpty() && name.endsWith('/')) name.chop(1); - int i = name.lastIndexOf('/'); - if (i < 1) return false; - name = name.mid(i+1); - QDir d(thDir); - d.cd(".."); - return removeXCursorTheme(d, name); -} - - -/////////////////////////////////////////////////////////////////////////////// -/* - * returns temporary dir or empty string - */ -static bool tarDir (const QString &destFName, const QDir &pth, const QString &dir) { - QStringList args; - - QFile fl(destFName); - fl.remove(); - - args << "-c"; // create archive... - args << "-z"; // and gzip it - QString ps(pth.path()); - if (!ps.isEmpty() && ps != ".") { - args << "-C"; // dir to go - args << ps; - } - args << "-f"; // to file - args << destFName; - QString s(dir); - if (!s.endsWith('/')) s += '/'; - args << s; - - QProcess pr; - pr.setStandardInputFile("/dev/null"); - pr.setStandardOutputFile("/dev/null"); - pr.setStandardErrorFile("/dev/null"); - - pr.start("tar", args); - - if (pr.waitForStarted()) { - if (pr.waitForFinished()) return true; - } - - // cleanup - fl.remove(); - return false; -} -//tar -c -C /home/ketmar/k8prj/xcurtheme/src -f z.tar xcr/ - - -bool packXCursorTheme (const QString &destFName, const QDir &thDir, const QString &thName, bool removeTheme) { - if (destFName.isEmpty() || thName.isEmpty()) return false; - QDir d(thDir); - if (!d.cd(thName)) return false; - - bool res = tarDir(destFName, thDir, thName); - if (res && removeTheme) { - removeFilesAndDirs(d); - d.cd(".."); - d.rmdir(thName); - } - return res; -} - - -bool XCursorTheme::writeXPTheme (const QDir &destDir) { - QString ifn = destDir.path(); - if (!ifn.isEmpty() && ifn != "/") ifn += '/'; - - QFile fl(ifn+"Scheme.ini"); - if (fl.open(QIODevice::WriteOnly)) { - QTextStream stream; - stream.setDevice(&fl); - stream.setCodec("UTF-8"); - stream << "[General]\r\n"; - stream << "Version=130\r\n"; - qDebug() << "writing images..."; - foreach (XCursorImages *ci, mList) { - const char **nlst = findCursorRecord(ci->name()); - if (!nlst) continue; // unknown cursor, skip it - qDebug() << "image:" << *(nlst-1); - QImage img(ci->buildImage()); - if (!img.save(ifn+(*(nlst-1))+".png")) return false; - stream << "["+QString(*(nlst-1))+"]\r\n"; - stream << "StdCursor=0\r\n"; - stream << "Frames=" << ci->count() << "\r\n"; - stream << "Hot spot x=" << ci->at(0)->xhot() << "\r\n"; - stream << "Hot spot y=" << ci->at(0)->yhot() << "\r\n"; - stream << "Interval=" << (ci->at(0)->delay() == 2147483647 ? 100 : ci->at(0)->delay()) << "\r\n"; - // x2, y2? wtf? - if (ci->count() > 1) { - stream << "Frames=" << ci->count() << "\r\n"; - stream << "Animation style=0\r\n"; - } else { - stream << "Frames=1\r\n"; - stream << "Animation style=0\r\n"; - } - } - stream << "[[Description]\r\n"; - if (!mName.isEmpty()) stream << mName << "\r\n"; - if (!mTitle.isEmpty()) stream << mTitle << "\r\n"; - if (!mAuthor.isEmpty()) stream << mAuthor << "\r\n"; - if (!mLicense.isEmpty()) stream << mLicense << "\r\n"; - if (!mEMail.isEmpty()) stream << mEMail << "\r\n"; - if (!mSite.isEmpty()) stream << mSite << "\r\n"; - if (!mDescr.isEmpty()) stream << mDescr << "\r\n"; - if (!mIM.isEmpty()) stream << mIM << "\r\n"; - } - fl.close(); - return true; -} diff --git a/liblxqt-config-cursor/xcr/xcrtheme.h b/liblxqt-config-cursor/xcr/xcrtheme.h deleted file mode 100644 index e8dca8c..0000000 --- a/liblxqt-config-cursor/xcr/xcrtheme.h +++ /dev/null @@ -1,97 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#ifndef XCRTHEME_H -#define XCRTHEME_H - -#include -#include -#include - -#include "xcrimg.h" - - -class XCursorTheme { -public: - XCursorTheme (const QDir &aDir, const QString &aName); - XCursorTheme (); - virtual ~XCursorTheme (); - - inline const QString &name () const { return mName; } - inline const QString &path () const { return mPath; } - inline const QString &title () const { return mTitle; } - inline const QString &author () const { return mAuthor; } - inline const QString &license () const { return mLicense; } - inline const QString &mail () const { return mEMail; } - inline const QString &site () const { return mSite; } - inline const QString &descr () const { return mDescr; } - inline const QString &im () const { return mIM; } - inline const QString &sample () const { return mSample; } - inline const QStringList &inherits () const { return mInherits; } - - inline void setName (const QString &v) { mName = v; } - inline void setPath (const QString &v) { mPath = v; } - inline void setTitle (const QString &v) { mTitle = v; } - inline void setAuthor (const QString &v) { mAuthor = v; } - inline void setLicense (const QString &v) { mLicense = v; } - inline void setMail (const QString &v) { mEMail = v; } - inline void setSite (const QString &v) { mSite = v; } - inline void setDescr (const QString &v) { mDescr = v; } - inline void setIM (const QString &v) { mIM = v; } - inline void setSample (const QString &v) { mSample = v; } - inline void setInherits (const QStringList &v) { mInherits.clear(); mInherits.append(v); } - - inline const QList &list () const { return mList; } - inline const XCursorImages *at (int idx) const { return mList.at(idx); } - inline int count () const { return mList.size(); } - inline int size () const { return mList.size(); } - - inline void append (XCursorImages *img) { mList << img; } - - bool writeToDir (const QDir &destDir); - - void fixInfoFields (); - - bool writeXPTheme (const QDir &destDir); - -protected: - static const char **findCursorByFXId (int id); - static QString findCursorFile (const QDir &dir, const char *name); - static const char **findCursorRecord (const QString &cname, int type=1); - - bool writeIndexTheme (const QDir &destDir); - void parseXCursorTheme (const QDir &dir); - void parseThemeIndex (const QDir &dir); - - void dumpInfo (); - -protected: - QString mName; - QString mPath; - QString mTitle; - QString mAuthor; - QString mLicense; - QString mEMail; - QString mSite; - QString mDescr; - QString mIM; - QString mSample; - QStringList mInherits; - QList mList; -}; - - -bool removeXCursorTheme (const QDir &thDir, const QString &name); -bool removeXCursorTheme (const QString &name); -bool removeXCursorTheme (const QDir &thDir); - -bool packXCursorTheme (const QString &destFName, const QDir &thDir, const QString &thName, bool removeTheme=false); - - -#endif diff --git a/liblxqt-config-cursor/xcr/xcrthemefx.cpp b/liblxqt-config-cursor/xcr/xcrthemefx.cpp deleted file mode 100644 index 4ffcc49..0000000 --- a/liblxqt-config-cursor/xcr/xcrthemefx.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#include -//#include - -#include "xcrthemefx.h" - -#include -#include - -#include -#include -#include - -#include "xcrimg.h" -#include "xcrxcur.h" -#include "xcrtheme.h" - - -static const char *curShapeName[] = { - "standard arrow", - "help arrow (the one with '?')", - "working arrow", - "busy cursor", - "precision select", - "text select", - "handwriting", - "unavailable", - "north (vert) resize", - "south resize", - "west (vert-means horiz?) resize", - "east resize", - "north-west resize", - "south-east resize", - "north-east resize", - "south-west resize", - "move", - "alternate select", - "hand", - "button" -}; - - -bool XCursorThemeFX::str2num (const QString &s, quint32 &res) { - quint64 n = 0; - if (s.isEmpty()) return false; - for (int f = 0; f < s.length(); f++) { - QChar ch = s.at(f); - if (!ch.isDigit()) return false; - n = n*10+ch.unicode()-'0'; - } - //if (n >= (quint64)0x100000000LL) n = 0xffffffffLL; - if (n >= (quint64)0x80000000LL) n = 0x7fffffffLL; - res = n; - return true; -} - - -QList XCursorThemeFX::parseScript (const QString &script, quint32 maxFrame) { - QList res; - QString scp = script; scp.replace("\r", "\n"); - QStringList scpL = scp.split('\n', QString::SkipEmptyParts); - foreach (QString s, scpL) { - s = s.simplified(); - //qDebug() << s; - QStringList fld = s.split(',', QString::SkipEmptyParts); //BUG!BUG!BUG! - if (fld.size() != 2) { - qDebug() << "script error:" << s; - qWarning() << "script error:" << s; - continue; - } - // frame[s] - int hyph = fld[0].indexOf('-'); - tAnimSeq a; - if (hyph == -1) { - // just a number - if (!str2num(fld[0], a.from)) { - qDebug() << "script error (frame):" << s; - qWarning() << "script error (frame):" << s; - continue; - } - a.from = qMax(qMin(maxFrame, a.from), (quint32)1)-1; - a.to = a.from; - } else { - // a..b - if (!str2num(fld[0].left(hyph), a.from)) { - qDebug() << "script error (frame from):" << s; - qWarning() << "script error (frame from):" << s; - continue; - } - a.from = qMax(qMin(maxFrame, a.from), (quint32)1)-1; - if (!str2num(fld[0].mid(hyph+1), a.to)) { - qDebug() << "script error (frame to):" << s; - qWarning() << "script error (frame to):" << s; - continue; - } - a.to = qMax(qMin(maxFrame, a.to), (quint32)1)-1; - } - // delay - if (!str2num(fld[1], a.delay)) { - qDebug() << "script error (delay):" << s; - qWarning() << "script error (delay):" << s; - continue; - } - if (a.delay < 10) a.delay = 10; - qDebug() << "from" << a.from << "to" << a.to << "delay" << a.delay; - res << a; - } - return res; -} - - -/////////////////////////////////////////////////////////////////////////////// -static QByteArray zlibInflate (const void *buf, int bufSz, int destSz) { - QByteArray res; - z_stream stream; - int err; - - res.resize(destSz+1); - stream.next_in = (Bytef *)buf; - stream.avail_in = bufSz; - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.next_out = (Bytef *)res.data(); - stream.avail_out = destSz; - - err = inflateInit(&stream); - if (err != Z_OK) return QByteArray(); - err = inflate(&stream, Z_SYNC_FLUSH); - fprintf(stderr, "inflate result: %i\n", err); - switch (err) { - case Z_STREAM_END: - err = inflateEnd(&stream); - fprintf(stderr, "Z_STREAM_END: inflate result: %i\n", err); - if (err != Z_OK) return QByteArray(); - break; - case Z_OK: - err = inflateEnd(&stream); - fprintf(stderr, "Z_OK: inflate result: %i\n", err); - if (err != Z_OK) return QByteArray(); - break; - default: return QByteArray(); - } - return res; -} - - -static quint32 baGetDW (QByteArray &ba, int &pos) { - const uchar *d = (const uchar *)ba.constData(); - d += pos+3; - pos += 4; - quint32 res = 0; - for (int f = 4; f > 0; f--, d--) { - res <<= 8; - res |= *d; - } - return res; -} - - -/////////////////////////////////////////////////////////////////////////////// -XCursorThemeFX::XCursorThemeFX (const QString &aFileName) : XCursorTheme() { - if (!parseCursorFXTheme(aFileName)) { - qDeleteAll(mList); - mList.clear(); - } -} - - -bool XCursorThemeFX::parseCursorFXTheme (const QString &aFileName) { - qDebug() << "loading" << aFileName; - QFile fl(aFileName); - if (!fl.open(QIODevice::ReadOnly)) return false; // shit! - QByteArray ba(fl.readAll()); - fl.close(); - if (ba.size() < 0xb8) return false; // shit! - int pos = 0; - if (baGetDW(ba, pos) != 1) return false; // invalid version - quint32 mainHdrSize = baGetDW(ba, pos); - if (mainHdrSize < 0xb8) return false; // invalid header size - quint32 unDataSize = baGetDW(ba, pos); - if (unDataSize < 0x4c) return false; // no cursors anyway - struct { - quint32 ofs; - quint32 len; - } infoFields[6]; - pos = 0x84; - for (int f = 0; f < 6; f++) { - infoFields[f].ofs = baGetDW(ba, pos); - infoFields[f].len = baGetDW(ba, pos); - } - pos = 0xb4; - quint32 ihdrSize = baGetDW(ba, pos); - // now read data - pos = mainHdrSize; - qDebug() << "reading data from" << pos; - QByteArray unp(zlibInflate(ba.constData()+pos, ba.size()-pos, unDataSize)); - if (unp.isEmpty()) { - qDebug() << "CursorFX: can't depack data"; - qWarning() << "CursorFX: can't depack data"; - return false; - } - // process info section - for (int f = 0; f < 6; f++) { - int len = infoFields[f].len; - if (!len) continue; - pos = infoFields[f].ofs; - if ((quint32)pos >= ihdrSize || (quint32)pos+len >= ihdrSize) continue; // skip invalid one - QByteArray sBA(unp.mid(pos, len)); - sBA.append('\0'); sBA.append('\0'); - QString s = QString::fromUtf16((const ushort *)sBA.constData()).simplified(); - switch (f) { - case 0: setTitle(s); break; - case 1: setAuthor(s); break; - //case 2: setVersion(s); break; - case 3: setSite(s); break; - case 4: setMail(s); break; - case 5: setDescr(s); break; - default: ; - } - } - // process resources - QSet shapesSeen; - pos = ihdrSize; - qDebug() << "resources started at hex" << QString::number(pos, 16); - while (pos <= unp.size()-12) { - quint32 ipos = pos; // will be fixed later - quint32 rtype = baGetDW(unp, pos); - quint32 basicHdrSize = baGetDW(unp, pos); - quint32 itemSize = baGetDW(unp, pos); - qDebug() << "pos hex:" << QString::number(pos, 16) << "rtype:" << rtype << "bhdrsz hex:" << QString::number(basicHdrSize, 16) << "itemsz hex:" << QString::number(itemSize, 16); - if (itemSize < 12) { - // invalid data - qDebug() << "CursorFX: invalid data chunk size"; - qWarning() << "CursorFX: invalid data chunk size"; - return false; - } - pos = ipos+itemSize; // skip it - if (rtype != 2) continue; // not cursor resource - if (itemSize < 0x4c) { - qDebug() << "CursorFX: invalid cursor chunk size:" << itemSize; - qWarning() << "CursorFX: invalid cursor chunk size:" << itemSize; - return false; - } - // cursor - int cps = ipos+3*4; - rtype = baGetDW(unp, cps); - if (rtype != 2) { - qDebug() << "CursorFX: invalid cursor chunk type:" << rtype; - qWarning() << "CursorFX: invalid cursor chunk type:" << rtype; - return false; - } - quint32 curShape = baGetDW(unp, cps); - quint32 curType = baGetDW(unp, cps); - if (curShape > 19) { - qDebug() << "CursorFX: unknown cursor shape:" << curShape; - qWarning() << "CursorFX: unknown cursor shape:" << curShape; - return false; - } - if (curType != 1) { - qDebug() << "skipping 'press' cursor; shape no" << curShape << "named" << curShapeName[curShape]; - continue; - // we need only 'normal' cursors - } - qDebug() << "cursor shape:" << curShape; - const char **nlst = findCursorByFXId((int)curShape); - if (!nlst) { - // unknown cursor type, skip it - qDebug() << "CursorFX: skipping cursor shape:" << curShapeName[curShape]; - qWarning() << "CursorFX: skipping cursor shape:" << curShapeName[curShape]; - continue; - } - if (shapesSeen.contains(curShape&0xff)) { - // unknown cursor type, skip it - qDebug() << "CursorFX: skipping duplicate cursor shape:" << curShapeName[curShape]; - qWarning() << "CursorFX: skipping duplicate cursor shape:" << curShapeName[curShape]; - continue; - } - shapesSeen << (curShape&0xff); - qDebug() << "importing cursor" << *nlst; - quint32 unk0 = baGetDW(unp, cps); // unknown field - quint32 frameCnt = baGetDW(unp, cps); - if (frameCnt < 1) frameCnt = 1; // just in case - quint32 imgWdt = baGetDW(unp, cps); - quint32 imgHgt = baGetDW(unp, cps); - quint32 imgDelay = baGetDW(unp, cps); - quint32 aniFlags = baGetDW(unp, cps); - quint32 unk1 = baGetDW(unp, cps); // unknown field - quint32 imgXHot = baGetDW(unp, cps); - quint32 imgYHot = baGetDW(unp, cps); - quint32 realHdrSize = baGetDW(unp, cps); - quint32 imgDataSize = baGetDW(unp, cps); - quint32 addonOfs = baGetDW(unp, cps); - quint32 addonLen = baGetDW(unp, cps); - if (imgDelay < 10) imgDelay = 10; - if (imgDelay >= (quint32)0x80000000LL) imgDelay = 0x7fffffffLL; - qDebug() << - "cursor data:" << - "\n frames:" << frameCnt << - "\n width:" << imgWdt << - "\n height:" << imgHgt << - "\n delay:" << imgDelay << - "\n flags:" << QString::number(aniFlags, 2) << - "\n xhot:" << imgXHot << - "\n yhot:" << imgYHot << - "\n unk0:" << unk0 << - "\n unk1:" << unk1 << - "\n rhdata:" << QString::number(realHdrSize, 16) << - "\n dataOfs:" << QString::number(ipos+realHdrSize, 16) << - "\n cdataOfs:" << QString::number(ipos+basicHdrSize+addonLen, 16) - ; - // now check if we have enought data - if (ipos+realHdrSize+imgDataSize > (quint32)pos) { - qDebug() << "CursorFX: cursor data too big"; - qWarning() << "CursorFX: cursor data too big"; - return false; - } - // addon is the script; parse it later - QList aseq; - QString script; - if (addonLen) { - // script - if (addonOfs < 0x4c || addonOfs > realHdrSize) { - qDebug() << "CursorFX: invalid addon data offset"; - qWarning() << "CursorFX: invalid addon data offset"; - return false; - } - QByteArray bs(unp.mid(ipos+addonOfs, addonLen)); - bs.append('\0'); bs.append('\0'); - script = QString::fromUtf16((const ushort *)bs.constData()); - qDebug() << "script:\n" << script; - // create animseq - aseq = parseScript(script, frameCnt); - } else { - // create 'standard' animseq - tAnimSeq a; - a.from = 0; a.to = frameCnt-1; a.delay = imgDelay; - aseq << a; - // and back if 'alternate' flag set - if (aniFlags&0x01) { - a.from = frameCnt-1; a.to = 0; - aseq << a; - } - } - if (imgWdt*imgHgt*4 != imgDataSize) { - qDebug() << "data size:" << imgDataSize << "but should be" << imgWdt*imgHgt*4; - continue; - } - // decode image - QImage img((const uchar *)unp.constData()+ipos+realHdrSize, imgWdt, imgHgt, QImage::Format_ARGB32); - img = img.mirrored(false, true); - // - XCursorImages *cim = new XCursorImages(*nlst); - cim->setScript(script); - //!!! - //!!!img.save(QString("_png/%1.png").arg(cim->name())); - //!!! - quint32 frameWdt = img.width()/frameCnt; - qDebug() << "frameWdt:" << frameWdt << "left:" << img.width()%(frameWdt*frameCnt); - // now build animation sequence - int fCnt = 0; - foreach (const tAnimSeq &a, aseq) { - bool back = a.from > a.to; // going backwards - quint32 fNo = a.from; - for (;; fCnt++) { - //k8:qDebug() << " frame:" << fNo << "delay:" << a.delay; - // copy frame - QImage frame(img.copy(fNo*frameWdt, 0, frameWdt, img.height())); - //frame.save(QString("_png/%1_%2.png").arg(cim->name()).arg(QString::number(f))); - XCursorImage *i = new XCursorImage(QString("%1%2").arg(cim->name()).arg(QString::number(fCnt)), - frame, imgXHot, imgYHot, a.delay, 1 - ); - cim->append(i); - // - if (fNo == a.to) break; - if (back) fNo--; else fNo++; - } - } - // append if not empty - if (cim->count()) { - // now check if it is looped and cancel looping if necessary - if ((aniFlags & 0x02) == 0) { - // not looped - qDebug() << " anti-loop fix"; - XCursorImage *i = cim->item(cim->count()-1); - i->setDelay(0x7fffffffL); - //i->setCSize(2); // ??? - } - mList << cim; - } - } - return true; -} diff --git a/liblxqt-config-cursor/xcr/xcrthemefx.h b/liblxqt-config-cursor/xcr/xcrthemefx.h deleted file mode 100644 index c474ccd..0000000 --- a/liblxqt-config-cursor/xcr/xcrthemefx.h +++ /dev/null @@ -1,40 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#ifndef XCRTHEMEFX_H -#define XCRTHEMEFX_H - -#include -#include -#include - -#include "xcrimg.h" -#include "xcrtheme.h" - - -class XCursorThemeFX : public XCursorTheme { -public: - XCursorThemeFX (const QString &aFileName); - -public: - class tAnimSeq { - public: - quint32 from, to; - quint32 delay; - }; - - static QList parseScript (const QString &script, quint32 maxFrame); - static bool str2num (const QString &s, quint32 &res); - -protected: - bool parseCursorFXTheme (const QString &aFileName); -}; - - -#endif diff --git a/liblxqt-config-cursor/xcr/xcrthemexp.cpp b/liblxqt-config-cursor/xcr/xcrthemexp.cpp deleted file mode 100644 index 9aec632..0000000 --- a/liblxqt-config-cursor/xcr/xcrthemexp.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#include -//#include - -#include "xcrthemexp.h" - -#include -#include - -#include -#include -#include - -#include "xcrimg.h" -#include "xcrxcur.h" -#include "xcrtheme.h" -#include "xcrthemefx.h" - - -static const char *curShapeName[] = { - "Arrow", - "Cross", - "Hand", - "IBeam", - "UpArrow", - "SizeNWSE", - "SizeNESW", - "SizeWE", - "SizeNS", - "Help", - "Handwriting", - "AppStarting", - "SizeAll", - "Wait", - "NO", - 0 -}; - - -static const char *findCurShapeName (const QString &s) { - QByteArray ba(s.toUtf8()); - const char *name = ba.constData(); - const char **nlst = curShapeName; - while (*nlst) { - if (!strcasecmp(name, *nlst)) return *nlst; - nlst++; - } - return 0; -} - - -static QString findFile (const QDir &dir, const QString &name, bool fullName=false) { - QFileInfoList lst = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden); - foreach (const QFileInfo &fi, lst) { - if (!name.compare(fi.fileName(), Qt::CaseInsensitive)) { - if (fullName) return fi.absoluteFilePath(); - return fi.fileName(); - } - } - return QString(); -} - - -class CursorInfo { -public: - CursorInfo () { clear(); curSection.clear(); } - - void clear () { - frameCnt = 1; delay = 50; xhot = yhot = 0; - script.clear(); - wasFrameCnt = wasXHot = wasYHot = wasDelay = wasScript = wasAStyle = wasStdCur = false; - isStdCursor = false; - isLooped = true; is2way = false; - } - -public: - quint32 frameCnt, delay, xhot, yhot; - QString script; - bool wasFrameCnt, wasXHot, wasYHot, wasDelay, wasScript, wasAStyle, wasStdCur; - bool isStdCursor; - bool isLooped, is2way; - QString curSection; - QString nextSection; -}; - - -/* true: EOF */ -static bool readNextSection (QTextStream &stream, CursorInfo &info) { - info.clear(); - if (info.nextSection.isEmpty()) { - // find next section - //qDebug() << "searching section..."; - for (;;) { - QString s; - info.curSection.clear(); - info.nextSection.clear(); - for (;;) { - s = stream.readLine(); - if (s.isNull()) return true; - s = s.trimmed(); - //qDebug() << "*" << s; - if (s.isEmpty() || s[0] == '#' || s[0] == ';') continue; - if (s[0] == '[') break; - } - int len = s.length()-1; - if (s[len] == ']') len--; - s = s.mid(1, len); - const char *csn = findCurShapeName(s); - if (!csn) continue; - // section found - info.curSection = csn; - break; - } - } else { - info.curSection = info.nextSection; - info.nextSection.clear(); - } - // section found; read it - for (;;) { - QString s = stream.readLine(); - if (s.isNull()) return true; - s = s.trimmed(); - //qDebug() << "+" << s; - if (s.isEmpty() || s[0] == '#' || s[0] == ';') continue; - if (s[0] == '[') { - int len = s.length()-1; - if (s[len] == ']') len--; - s = s.mid(1, len); - const char *csn = findCurShapeName(s); - if (csn) info.nextSection = csn; else info.nextSection.clear(); - break; - } - QStringList nv(s.split('=')); - if (nv.size() != 2) continue; // invalid - QString name = nv[0].simplified().toLower(); - quint32 num = 0; - bool numOk = XCursorThemeFX::str2num(nv[1].trimmed(), num); - if (!numOk) num = 0; - if (name == "frames") { - info.frameCnt = qMax(num, (quint32)1); - info.wasFrameCnt = true; - } else if (name == "interval") { - info.delay = qMax(qMin(num, (quint32)0x7fffffffL), (quint32)10); - info.wasDelay = true; - } else if (name == "animation style") { - info.isLooped = true; - info.is2way = (num != 0); - info.wasAStyle = true; - } else if (name == "hot spot x") { - info.xhot = num; - info.wasXHot = true; - } else if (name == "hot spot y") { - info.yhot = num; - info.wasYHot = true; - } else if (name == "framescript") { - // 1 or 0 - } else if (name == "stdcursor") { - info.isStdCursor = (num!=0); - info.wasStdCur = true; - } else if (name == "hot spot x2" || name == "hot spot y2") { - } else if (name == "stdcursor" || name == "hot spot x2" || name == "hot spot y2") { - // nothing - } else { - qDebug() << "unknown param:" << name << nv[1]; - qWarning() << "unknown param:" << name << nv[1]; - } - } - return false; -} - - -static void removeFilesAndDirs (QDir &dir) { - //qDebug() << "dir:" << dir.path(); - // files - QFileInfoList lst = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden); - foreach (const QFileInfo &fi, lst) { - //qDebug() << "removing" << fi.fileName() << fi.absoluteFilePath(); - dir.remove(fi.fileName()); - } - // dirs - lst = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Hidden); - foreach (const QFileInfo &fi, lst) { - dir.cd(fi.fileName()); - removeFilesAndDirs(dir); - dir.cd(".."); - //qDebug() << "removing dir" << fi.fileName(); - dir.rmdir(fi.fileName()); - } -} - - -/* - * returns temporary dir or empty string - */ -static QString unzipFile (const QString &zipFile) { - QStringList args; - - char tmpDirName[18]; - strcpy(tmpDirName, "/tmp/unzXXXXXX"); - char *td = mkdtemp(tmpDirName); - if (!td) return QString(); - - QDir dir(td); - - args << "-b"; // all files are binary - args << "-D"; // skip timestamps - args << "-n"; // never overwrite (just in case) - args << "-qq"; // be very quiet - args << zipFile; - args << "-d" << dir.absolutePath(); // dest dir - - QProcess pr; - pr.setStandardInputFile("/dev/null"); - pr.setStandardOutputFile("/dev/null"); - pr.setStandardErrorFile("/dev/null"); - - pr.start("unzip", args); - - if (pr.waitForStarted()) { - if (pr.waitForFinished()) return QLatin1String(td); - } - - // cleanup - removeFilesAndDirs(dir); - dir.cd(".."); - QString s = QLatin1String(strchr(td+1, '/')+1); - //qDebug() << s; - dir.rmdir(s); - - return QString(); -} - - -/////////////////////////////////////////////////////////////////////////////// -XCursorThemeXP::XCursorThemeXP (const QString &aFileName) : XCursorTheme() { - QFileInfo fi(aFileName); - if (fi.exists() && fi.isReadable()) { - QString dst = unzipFile(aFileName); - if (!dst.isEmpty()) { - QDir d(dst); - if (!parseCursorXPTheme(d)) { - qDeleteAll(mList); - mList.clear(); - } - qDebug() << "doing cleanup..."; - dst.remove(0, dst.indexOf('/', 1)+1); - removeFilesAndDirs(d); - d.cd(".."); - qDebug() << dst; - d.rmdir(dst); - } - } -} - - -bool XCursorThemeXP::parseCursorXPTheme (const QDir &thDir) { - qDebug() << "loading" << thDir.path(); - QString ifn = findFile(thDir, "scheme.ini", true); - if (ifn.isEmpty()) return false; - qDebug() << "reading scheme:" << ifn; - // - QFile fl(ifn); - if (!fl.open(QIODevice::ReadOnly)) return false; // no scheme --> no fun! - QTextStream stream; - stream.setDevice(&fl); - stream.setCodec("UTF-8"); - CursorInfo info; - QSet sectionsSeen; - bool eof = false; - do { - eof = readNextSection(stream, info); - if (info.curSection.isEmpty()) break; -/* - qDebug() << "section:" << info.curSection << - "\n stdcr was:" << info.wasStdCur << "value:" << info.isStdCursor << - "\n frame was:" << info.wasFrameCnt << "value:" << info.frameCnt << - "\n delay was:" << info.wasDelay << "value:" << info.delay << - "\n xhot was:" << info.wasXHot << "value:" << info.xhot << - "\n yhot was:" << info.wasYHot << "value:" << info.yhot << - "\n style was:" << info.wasAStyle << "loop:" << info.isLooped << "2way:" << info.is2way << - "\n scrpt was:" << info.wasScript << "value:" << info.script << - "\n next section:" << info.nextSection - ; -*/ - const char ** nlst = XCursorTheme::findCursorRecord(info.curSection, 0); - QString imgFile = findFile(thDir, info.curSection+".png", true); - if (!sectionsSeen.contains(info.curSection) && nlst && !imgFile.isEmpty()) { - qDebug() << "section" << info.curSection << "file:" << imgFile; - sectionsSeen << info.curSection; - //TODO: script - QList aseq; - { - // create 'standard' animseq - XCursorThemeFX::tAnimSeq a; - a.from = 0; a.to = info.frameCnt-1; a.delay = info.delay; - aseq << a; - // and back if 'alternate' flag set - if (info.is2way) { - a.from = info.frameCnt-1; a.to = 0; - aseq << a; - } - } - // load image - QImage img(imgFile); - if (!img.isNull()) { - XCursorImages *cim = new XCursorImages(*nlst); - quint32 frameWdt = img.width()/info.frameCnt; - qDebug() << "frameWdt:" << frameWdt << "left:" << img.width()%(frameWdt*info.frameCnt); - // now build animation sequence - int fCnt = 0; - foreach (const XCursorThemeFX::tAnimSeq &a, aseq) { - bool back = a.from > a.to; // going backwards - quint32 fNo = a.from; - for (;; fCnt++) { - //k8:qDebug() << " frame:" << fNo << "delay:" << a.delay; - // copy frame - QImage frame(img.copy(fNo*frameWdt, 0, frameWdt, img.height())); - //frame.save(QString("_png/%1_%2.png").arg(cim->name()).arg(QString::number(f))); - XCursorImage *i = new XCursorImage(QString("%1%2").arg(cim->name()).arg(QString::number(fCnt)), - frame, info.xhot, info.yhot, a.delay, 1 - ); - cim->append(i); - // - if (fNo == a.to) break; - if (back) fNo--; else fNo++; - } - } - // append if not empty - if (cim->count()) { - // now check if it is looped and cancel looping if necessary - if (!info.isLooped) { - // not looped - qDebug() << " anti-loop fix"; - XCursorImage *i = cim->item(cim->count()-1); - i->setDelay(0x7fffffffL); - //i->setCSize(2); // ??? - } - mList << cim; - } - } - } - } while (!eof); - return true; -} diff --git a/liblxqt-config-cursor/xcr/xcrthemexp.h b/liblxqt-config-cursor/xcr/xcrthemexp.h deleted file mode 100644 index fb97be3..0000000 --- a/liblxqt-config-cursor/xcr/xcrthemexp.h +++ /dev/null @@ -1,31 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#ifndef XCRTHEMEXP_H -#define XCRTHEMEXP_H - -#include -#include -#include - -#include "xcrimg.h" -#include "xcrtheme.h" -#include "xcrthemefx.h" - - -class XCursorThemeXP : public XCursorTheme { -public: - XCursorThemeXP (const QString &aFileName); - -protected: - bool parseCursorXPTheme (const QDir &thDir); -}; - - -#endif diff --git a/liblxqt-config-cursor/xcr/xcrxcur.cpp b/liblxqt-config-cursor/xcr/xcrxcur.cpp deleted file mode 100644 index 219b978..0000000 --- a/liblxqt-config-cursor/xcr/xcrxcur.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#include -//#include - -#include "xcrxcur.h" - -#include -#include -#include -#include -#include - -#include - - -#include -#include -#include - - -/* -static QImage autoCropImage (const QImage &image) { - // Compute an autocrop rectangle for the image - QRect r(image.rect().bottomRight(), image.rect().topLeft()); - const quint32 *pixels = reinterpret_cast(image.bits()); - for (int y = 0; y < image.height(); y++) { - for (int x = 0; x < image.width(); x++) { - if (*(pixels++)) { - if (x < r.left()) r.setLeft(x); - if (x > r.right()) r.setRight(x); - if (y < r.top()) r.setTop(y); - if (y > r.bottom()) r.setBottom(y); - } - } - } - // Normalize the rectangle - return image.copy(r.normalized()); -} -*/ - - -inline static quint32 getDW (const void *data) { - const quint8 *d = (const quint8 *)data; - d += 3; - quint32 res = 0; - for (int f = 4; f > 0; f--, d--) { - res <<= 8; - res |= *d; - } - return res; -} - - -static quint32 baGetDW (QByteArray &ba, int &pos) { - const uchar *d = (const uchar *)ba.constData(); - d += pos+3; - pos += 4; - quint32 res = 0; - for (int f = 4; f > 0; f--, d--) { - res <<= 8; - res |= *d; - } - return res; -} - - -/////////////////////////////////////////////////////////////////////////////// -XCursorImageXCur::XCursorImageXCur (const QString &aName, const void *aImgData) : XCursorImage(aName) { - parseImgData(aImgData); -} - - -XCursorImageXCur::~XCursorImageXCur () { -} - - -void XCursorImageXCur::parseImgData (const void *aImgData) { - mIsValid = false; - delete mImage; // It's fine to delete a null pointer - mImage = 0; - const quint32 *data = (const quint32 *)aImgData; - if (getDW(data) != 36) return; // header size - if (getDW(data+1) != 0xfffd0002L) return; // magic - //if (getDW(data+2) != 1) return; // image subtype - if (getDW(data+3) != 1) return; // version - mCSize = getDW(data+2); - data += 4; - quint32 wdt = getDW(data++); // width - quint32 hgt = getDW(data++); // height - if (wdt > 0x7fff) return; - if (hgt > 0x7fff) return; -/* - quint32 xhot = getDW(data++); - quint32 yhot = getDW(data++); - assert(xhot <= wdt); - assert(yhot <= hgt); -*/ - mXHot = *((const qint32 *)data); data++; - mYHot = *((const qint32 *)data); data++; - mDelay = getDW(data++); // milliseconds - // got to pixels (ARGB) - QImage img((const uchar *)data, wdt, hgt, QImage::Format_ARGB32_Premultiplied); - mImage = new QImage(img.copy()); - mIsValid = true; -} - - -/////////////////////////////////////////////////////////////////////////////// -XCursorImagesXCur::XCursorImagesXCur (const QDir &aDir, const QString &aName) : XCursorImages(aName, aDir.path()) { - parseCursorFile(aDir.path()+"/"+aName); -} - - -XCursorImagesXCur::XCursorImagesXCur (const QString &aFileName) : XCursorImages("", "") { - QString name(aFileName); - if (name.isEmpty() || name.endsWith('/')) return; - int i = name.lastIndexOf('/'); - QString dir; - if (i < 0) dir = "./"; else dir = name.left(i); - name = name.mid(i+1); - setName(name); setPath(dir); - parseCursorFile(aFileName); -} - - -bool XCursorImagesXCur::parseCursorFile (const QString &fname) { - //qDebug() << fname; - qDeleteAll(mList); - mList.clear(); - QFile fl(fname); - if (!fl.open(QIODevice::ReadOnly)) return false; // shit! - QByteArray ba(fl.readAll()); - fl.close(); - if (ba.size() < 4*4) return false; // shit! - if (ba[0] != 'X' || ba[1] != 'c' || ba[2] != 'u' || ba[3] != 'r') return false; // shit! - //FIXME: add more checks! - int pos = 4; - quint32 hdrSize = baGetDW(ba, pos); - if (hdrSize < 16) return false; // invalid header size - quint32 version = baGetDW(ba, pos); - if (version != 65536) return false; // invalid version - quint32 ntoc = baGetDW(ba, pos); - if (!ntoc) return true; // nothing to parse - if (ntoc >= 65536) return false; // idiot or what? - quint32 tocEndOfs = hdrSize+(ntoc*(3*4)); - if (tocEndOfs > (quint32)ba.size()) return false; // out of data - pos = hdrSize; - // parse TOC - int cnt = -1; - bool wasTitle = false, wasAuthor = false, wasLic = false; - bool wasMail = false, wasSite = false, wasDescr = false, wasIM = false; - while (ntoc-- > 0) { - cnt++; - quint32 type = baGetDW(ba, pos); - pos += 4; // skip the shit - quint32 dataOfs = baGetDW(ba, pos); - if (type == 0xfffd0001) { - // text - if (dataOfs < tocEndOfs || dataOfs > (quint32)ba.size()-20) continue; // invalid text - // parse text - int ipos = dataOfs; - if (baGetDW(ba, ipos) != 20) continue; // invalid header size - if (baGetDW(ba, ipos) != 0xfffd0001) continue; // invalid type - quint32 subT = baGetDW(ba, ipos); - if (baGetDW(ba, ipos) != 1) continue; // invalid version - quint32 len = baGetDW(ba, ipos); - // check for data presence - if (ipos+len > (quint32)ba.size()) continue; // out of data - QByteArray stBA(ba.mid(ipos, len)); - QString s(QString::fromUtf8(stBA)); - switch (subT) { - case 1: // copyright (author) - if (!wasAuthor) { - wasAuthor = true; - mAuthor = s; - } - break; - case 2: // license - if (!wasLic) { - wasLic = true; - mLicense = s; - } - break; - case 3: // other (description) - if (!wasDescr) { - wasDescr = true; - mDescr = s; - } - break; - // my extensions - case 4: // title - if (!wasTitle) { - wasTitle = true; - mTitle = s; - } - break; - case 5: // e-mail - if (!wasMail) { - wasMail = true; - mEMail = s; - } - break; - case 6: // site - if (!wasSite) { - wasSite = true; - mSite = s; - } - break; - case 7: // IM - if (!wasIM) { - wasIM = true; - mIM = s; - } - break; - } - continue; - } - if (type != 0xfffd0002) continue; // not an image, skip this one - // image - // check - if (dataOfs < tocEndOfs || dataOfs > (quint32)ba.size()-36) continue; // invalid image - // parse image - int ipos = dataOfs; - if (baGetDW(ba, ipos) != 36) continue; // invalid image (header size) - if (baGetDW(ba, ipos) != 0xfffd0002) continue; // invalid type - ipos += 4; // skip the shit - if (baGetDW(ba, ipos) != 1) continue; // invalid image (version) - quint32 wdt = baGetDW(ba, ipos); - quint32 hgt = baGetDW(ba, ipos); - if (wdt > 0x7fff || hgt > 0x7fff) continue; // invalid sizes - // check for data presence - if ((ipos+3*4)+(wdt*hgt*4) > (quint32)ba.size()) continue; // out of data - // load image - const uchar *dta = (const uchar *)ba.constData(); - dta += dataOfs; - XCursorImage *img = new XCursorImageXCur(mName+"_"+QString::number(cnt), dta); - if (img->isValid()) mList << img; else delete img; - } - return true; -} diff --git a/liblxqt-config-cursor/xcr/xcrxcur.h b/liblxqt-config-cursor/xcr/xcrxcur.h deleted file mode 100644 index 96e862d..0000000 --- a/liblxqt-config-cursor/xcr/xcrxcur.h +++ /dev/null @@ -1,40 +0,0 @@ -/* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar) - * (c)DWTFYW - * - * This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ -#ifndef XCRXCUR_H -#define XCRXCUR_H - -#include -#include -#include - -#include "xcrimg.h" - - -class XCursorImageXCur : public XCursorImage { -public: - XCursorImageXCur (const QString &aName, const void *aImgData); // create from Xcursor file contents (ptr to image) - virtual ~XCursorImageXCur (); - -protected: - void parseImgData (const void *aImgData); -}; - - -class XCursorImagesXCur : public XCursorImages { -public: - XCursorImagesXCur (const QDir &aDir, const QString &aName); - XCursorImagesXCur (const QString &aFileName); - -protected: - bool parseCursorFile (const QString &fname); -}; - - -#endif diff --git a/lxqt-config-appearance.png b/lxqt-config-appearance.png deleted file mode 100644 index 6d77584..0000000 Binary files a/lxqt-config-appearance.png and /dev/null differ diff --git a/lxqt-config-appearance/CMakeLists.txt b/lxqt-config-appearance/CMakeLists.txt deleted file mode 100644 index b65bb09..0000000 --- a/lxqt-config-appearance/CMakeLists.txt +++ /dev/null @@ -1,101 +0,0 @@ -project(lxqt-config-appearance) - -include_directories( - ${Qt5Gui_PRIVATE_INCLUDE_DIRS} - "${CMAKE_CURRENT_SOURCE_DIR}/../liblxqt-config-cursor" -) - -set(H_FILES - iconthemeinfo.h -) - -set(MOC_FILES - iconthemeconfig.h - lxqtthemeconfig.h - fontsconfig.h - styleconfig.h - fontconfigfile.h -) - -set(CPP_FILES - main.cpp - iconthemeconfig.cpp - iconthemeinfo.cpp - lxqtthemeconfig.cpp - fontsconfig.cpp - styleconfig.cpp - fontconfigfile.cpp -) - -set(UI_FILES - iconthemeconfig.ui - lxqtthemeconfig.ui - fontsconfig.ui - styleconfig.ui -) - -set(QRC_FILES "") - -set(LIBRARIES - lxqt -) - - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS} - SOURCES - ${H_FILES} - ${CPP_FILES} - ${UI_FILES} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES ${PROJECT_NAME}.desktop.in) - -#************************************************ - -add_executable(${PROJECT_NAME} - ${CPP_FILES} - ${RESOURCES} - ${QRC_FILES} - ${QM_FILES} - ${QM_LOADER} - ${DESKTOP_FILES} -) - -target_link_libraries(${PROJECT_NAME} - Qt5::Widgets - Qt5::X11Extras - Qt5::Xml - ${LIBRARIES} - lxqt-config-cursor -) - -set_target_properties("${PROJECT_NAME}" - PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}/${LXQT_CONFIG_PROJECT}" -) - -install(TARGETS - ${PROJECT_NAME} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" - COMPONENT Runtime -) diff --git a/lxqt-config-appearance/fontconfigfile.cpp b/lxqt-config-appearance/fontconfigfile.cpp deleted file mode 100644 index 9f3e6ef..0000000 --- a/lxqt-config-appearance/fontconfigfile.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2014 Hong Jen Yee (PCMan) - * LXQt project: http://lxde.org/ - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "fontconfigfile.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -FontConfigFile::FontConfigFile(QObject* parent): - QObject(parent), - mAntialias(true), - mHinting(true), - mSubpixel("rgb"), - mHintStyle("hintslight"), - mDpi(96), - mAutohint(false), - mSaveTimer(NULL) -{ - mDirPath = QString::fromLocal8Bit(qgetenv("XDG_CONFIG_HOME")); - QString homeDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); - if(mDirPath.isEmpty()) - mDirPath = homeDir % "/.config"; - mDirPath += "/fontconfig"; - mFilePath = mDirPath + "/fonts.conf"; - - load(); -} - -FontConfigFile::~FontConfigFile() -{ - if(mSaveTimer) // has pending save request - { - delete mSaveTimer; - mSaveTimer = NULL; - save(); - } -} - -void FontConfigFile::setAntialias(bool value) -{ - mAntialias = value; - queueSave(); -} - -void FontConfigFile::setSubpixel(QByteArray value) -{ - mSubpixel = value; - queueSave(); -} - -void FontConfigFile::setHinting(bool value) -{ - mHinting = value; - queueSave(); -} - -void FontConfigFile::setHintStyle(QByteArray value) -{ - mHintStyle = value; - queueSave(); -} - -void FontConfigFile::setDpi(int value) -{ - mDpi = value; - queueSave(); -} - -void FontConfigFile::setAutohint(bool value) -{ - mAutohint = value; - queueSave(); -} - -void FontConfigFile::load() -{ - QFile file(mFilePath); - if(file.open(QIODevice::ReadOnly)) - { - QByteArray buffer = file.readAll(); - file.close(); - if(buffer.contains("lxqt-config-appearance")) // the config file is created by us - { - // doing full xml parsing is over-kill. let's use some simpler brute-force methods. - QDomDocument doc; - doc.setContent(&file); - file.close(); - QDomElement docElem = doc.documentElement(); - QDomNodeList editNodes = docElem.elementsByTagName("edit"); - for(int i = 0; i < editNodes.count(); ++i) - { - QDomElement editElem = editNodes.at(i).toElement(); - QByteArray name = editElem.attribute("name").toLatin1(); - if(name == "antialias") - { - QString value = editElem.firstChildElement("bool").text(); - mAntialias = value[0] == 't' ? true : false; - } - else if(name == "rgba") - { - QString value = editElem.firstChildElement("const").text(); - mSubpixel = value.toLatin1(); - } - else if(name == "hinting") - { - QString value = editElem.firstChildElement("bool").text(); - mHinting = value[0] == 't' ? true : false; - } - else if(name == "hintstyle") - { - QString value = editElem.firstChildElement("const").text(); - mHintStyle = value.toLatin1(); - } - else if(name == "dpi") - { - QString value = editElem.firstChildElement("double").text(); - mDpi = value.toInt(); - } - else if(name == "autohint") - { - QString value = editElem.firstChildElement("bool").text(); - mAutohint = value[0] == 't' ? true : false; - } - } - } - else // the config file is created by others => make a backup and write our config - { - QFile backup(mFilePath + ".bak"); - if(backup.open(QIODevice::WriteOnly)) - { - backup.write(buffer); - backup.close(); - } - queueSave(); // overwrite with our file - } - } -} - -void FontConfigFile::save() -{ - if(mSaveTimer) - { - mSaveTimer->deleteLater(); - mSaveTimer = NULL; - } - - QFile file(mFilePath); - QDir().mkdir(mDirPath); - // References: https://wiki.archlinux.org/index.php/Font_Configuration - if(file.open(QIODevice::WriteOnly)) - { - QTextStream s(&file); - s << - "\n" - "\n" - "\n" - "\n" - " conf.d\n" - " \n" - " \n" - " " << (mAntialias ? "true" : "false") << "\n" - " \n" - " \n" - " \n" - " \n" - " " << mSubpixel << "\n" - " \n" - " \n" - " \n" - " \n" - " lcddefault\n" - " \n" - " \n" - " \n" - " \n" - " " << (mHinting ? "true" : "false") << "\n" - " \n" - " \n" - " \n" - " \n" - " " << mHintStyle << "\n" - " \n" - " \n" - " \n" - " \n" - " " << (mAutohint ? "true" : "false") << "\n" - " \n" - " \n" - " \n" - " \n" - " " << mDpi << "\n" - " \n" - " \n" - ""; - s.flush(); - file.close(); - } -} - -void FontConfigFile::queueSave() -{ - if(mSaveTimer) - mSaveTimer->start(1500); - else - { - mSaveTimer = new QTimer(); - mSaveTimer->setSingleShot(true); - connect(mSaveTimer, SIGNAL(timeout()), this, SLOT(save())); - mSaveTimer->start(1500); - } -} - diff --git a/lxqt-config-appearance/fontconfigfile.h b/lxqt-config-appearance/fontconfigfile.h deleted file mode 100644 index 61620c3..0000000 --- a/lxqt-config-appearance/fontconfigfile.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2014 Hong Jen Yee (PCMan) - * LXQt project: http://lxde.org/ - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef FONTCONFIGFILE_H -#define FONTCONFIGFILE_H - -#include -#include -#include - -class QTimer; - -class FontConfigFile: public QObject -{ - Q_OBJECT -public: - explicit FontConfigFile(QObject* parent = 0); - virtual ~FontConfigFile(); - - bool antialias() const { - return mAntialias; - } - void setAntialias(bool value); - - bool hinting() const { - return mHinting; - } - void setHinting(bool value); - - QByteArray subpixel() const { - return mSubpixel; - } - void setSubpixel(QByteArray value); - - QByteArray hintStyle() const { - return mHintStyle; - } - void setHintStyle(QByteArray value); - - int dpi() const { - return mDpi; - } - void setDpi(int value); - - bool autohint() const { - return mAutohint; - } - void setAutohint(bool value); - -private Q_SLOTS: - void save(); - -private: - void load(); - void queueSave(); - -private: - bool mAntialias; - bool mHinting; - QByteArray mSubpixel; - QByteArray mHintStyle; - int mDpi; - bool mAutohint; - QString mDirPath; - QString mFilePath; - QTimer* mSaveTimer; -}; - -#endif // FONTCONFIGFILE_H diff --git a/lxqt-config-appearance/fontsconfig.cpp b/lxqt-config-appearance/fontsconfig.cpp deleted file mode 100644 index 687fe83..0000000 --- a/lxqt-config-appearance/fontsconfig.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxde.org/ - * - * Copyright: 2014 LXQt team - * Authors: - * Hong Jen Yee (PCMan) - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "fontsconfig.h" -#include "ui_fontsconfig.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef Q_WS_X11 -extern void qt_x11_apply_settings_in_all_apps(); -#endif - -static const char* subpixelNames[] = {"none", "rgb", "bgr", "vrgb", "vbgr"}; -static const char* hintStyleNames[] = {"hintnone", "hintslight", "hintmedium", "hintfull"}; - -FontsConfig::FontsConfig(LXQt::Settings* settings, QSettings* qtSettings, QWidget* parent) : - QWidget(parent), - ui(new Ui::FontsConfig), - mQtSettings(qtSettings), - mSettings(settings), - mFontConfigFile() -{ - ui->setupUi(this); - - initControls(); - - connect(ui->fontName, SIGNAL(currentFontChanged(QFont)), SLOT(updateQtFont())); - connect(ui->fontStyle, SIGNAL(currentIndexChanged(int)), SLOT(updateQtFont())); - connect(ui->fontSize, SIGNAL(valueChanged(int)), SLOT(updateQtFont())); - - connect(ui->antialias, SIGNAL(toggled(bool)), SLOT(antialiasToggled(bool))); - connect(ui->subpixel, SIGNAL(currentIndexChanged(int)), SLOT(subpixelChanged(int))); - connect(ui->hinting, SIGNAL(toggled(bool)), SLOT(hintingToggled(bool))); - connect(ui->hintStyle, SIGNAL(currentIndexChanged(int)), SLOT(hintStyleChanged(int))); - connect(ui->dpi, SIGNAL(valueChanged(int)), SLOT(dpiChanged(int))); - connect(ui->autohint, SIGNAL(toggled(bool)), SLOT(autohintToggled(bool))); -} - - -FontsConfig::~FontsConfig() -{ - delete ui; -} - - -void FontsConfig::initControls() -{ - // read Qt style settings from Qt Trolltech.conf config - mQtSettings->beginGroup(QLatin1String("Qt")); - - QString fontName = mQtSettings->value("font").toString(); - QFont font; - font.fromString(fontName); - ui->fontName->setCurrentFont(font); - ui->fontSize->setValue(font.pointSize()); - int fontStyle = 0; - if(font.bold()) - fontStyle = font.italic() ? 3 : 1; - else if(font.italic()) - fontStyle = 2; - ui->fontStyle->setCurrentIndex(fontStyle); - - mQtSettings->endGroup(); - - // load fontconfig config - ui->antialias->setChecked(mFontConfigFile.antialias()); - ui->autohint->setChecked(mFontConfigFile.autohint()); - - QByteArray subpixelStr = mFontConfigFile.subpixel(); - int subpixel; - for(subpixel = 0; subpixel < 5; ++subpixel) - { - if(subpixelStr == subpixelNames[subpixel]) - break; - } - if(subpixel < 5) - ui->subpixel->setCurrentIndex(subpixel); - - ui->hinting->setChecked(mFontConfigFile.hinting()); - - QByteArray hintStyleStr = mFontConfigFile.hintStyle(); - int hintStyle; - for(hintStyle = 0; hintStyle < 4; ++hintStyle) - { - if(hintStyleStr == hintStyleNames[hintStyle]) - break; - } - if(hintStyle < 4) - ui->hintStyle->setCurrentIndex(hintStyle); - - int dpi = mFontConfigFile.dpi(); - ui->dpi->setValue(dpi); - - update(); -} - -void FontsConfig::antialiasToggled(bool toggled) -{ - mFontConfigFile.setAntialias(toggled); -} - -void FontsConfig::dpiChanged(int value) -{ - mFontConfigFile.setDpi(value); -} - -void FontsConfig::hintingToggled(bool toggled) -{ - mFontConfigFile.setHinting(toggled); -} - -void FontsConfig::subpixelChanged(int index) -{ - mFontConfigFile.setSubpixel(subpixelNames[index]); -} - -void FontsConfig::hintStyleChanged(int index) -{ - mFontConfigFile.setHintStyle(hintStyleNames[index]); -} - -void FontsConfig::autohintToggled(bool toggled) -{ - mFontConfigFile.setAutohint(toggled); -} - -void FontsConfig::updateQtFont() -{ - // FIXME: the change does not apply to some currently running Qt programs. - // FIXME: does not work with KDE apps - // TODO: also write the config values to GTK+ config files (gtk-2.0.rc and gtk3/settings.ini) - // FIXME: the selected font does not apply to our own application. Why? - - QFont font = ui->fontName->currentFont(); - int size = ui->fontSize->value(); - bool bold = false; - bool italic = false; - switch(ui->fontStyle->currentIndex()) - { - case 1: - bold = true; - break; - case 2: - italic = true; - break; - case 3: - bold = italic = true; - } - - font.setPointSize(size); - font.setBold(bold); - font.setItalic(italic); - - mQtSettings->beginGroup(QLatin1String("Qt")); - mQtSettings->setValue("font", font.toString()); - mQtSettings->endGroup(); - mQtSettings->sync(); - -#ifdef Q_WS_X11 - qt_x11_apply_settings_in_all_apps(); -#endif - - update(); -} diff --git a/lxqt-config-appearance/fontsconfig.h b/lxqt-config-appearance/fontsconfig.h deleted file mode 100644 index 807fd45..0000000 --- a/lxqt-config-appearance/fontsconfig.h +++ /dev/null @@ -1,70 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Alexander Sokoloff - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef FONTSCONFIG_H -#define FONTSCONFIG_H - -#include -#include -#include -#include "fontconfigfile.h" - -class QTreeWidgetItem; -class QSettings; - -namespace Ui { - class FontsConfig; -} - -class FontsConfig : public QWidget -{ - Q_OBJECT - -public: - explicit FontsConfig(LXQt::Settings *settings, QSettings *qtSettings, QWidget *parent = 0); - ~FontsConfig(); - -public Q_SLOTS: - void initControls(); - -private Q_SLOTS: - void updateQtFont(); - void antialiasToggled(bool toggled); - void hintingToggled(bool toggled); - void subpixelChanged(int index); - void hintStyleChanged(int index); - void dpiChanged(int value); - void autohintToggled(bool toggled); - -private: - Ui::FontsConfig *ui; - QSettings *mQtSettings; - LXQt::Settings *mSettings; - FontConfigFile mFontConfigFile; -}; - -#endif // FONTSCONFIG_H diff --git a/lxqt-config-appearance/fontsconfig.ui b/lxqt-config-appearance/fontsconfig.ui deleted file mode 100644 index 64e3c6e..0000000 --- a/lxqt-config-appearance/fontsconfig.ui +++ /dev/null @@ -1,261 +0,0 @@ - - - FontsConfig - - - - 0 - 0 - 421 - 379 - - - - - - - - 75 - true - - - - Font - - - - - - - Default font for user interface - - - - - - Font name: - - - - - - - - - - Style: - - - - - - - Point size: - - - - - - - 4 - - - - - - - - Normal - - - - - Bold - - - - - Italic - - - - - Bold Italic - - - - - - - - - - - The following settings only affect newly started applications - - - - - - Use antialias fonts - - - - - - - Font hinting style: - - - - - - - false - - - - None - - - - - Slight - - - - - Medium - - - - - Full - - - - - - - - Font hinting - - - - - - - Resolution (DPI): - - - - - - - Autohint - - - - - - - -1 - - - 1048576 - - - - - - - Subpixel antialiasing: - - - - - - - false - - - - None - - - - - RGB - - - - - BGR - - - - - VRGB - - - - - VBGR - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - antialias - toggled(bool) - subpixel - setEnabled(bool) - - - 225 - 109 - - - 298 - 140 - - - - - hinting - toggled(bool) - hintStyle - setEnabled(bool) - - - 225 - 171 - - - 298 - 202 - - - - - diff --git a/lxqt-config-appearance/iconthemeconfig.cpp b/lxqt-config-appearance/iconthemeconfig.cpp deleted file mode 100644 index fb15e9e..0000000 --- a/lxqt-config-appearance/iconthemeconfig.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "iconthemeconfig.h" - -#include -#include -#include -#include - -IconThemeConfig::IconThemeConfig(LXQt::Settings* settings, QWidget* parent): - QWidget(parent), - m_settings(settings) -{ - setupUi(this); - - initIconsThemes(); - initControls(); - connect(iconThemeList, SIGNAL(itemClicked(QTreeWidgetItem*,int)), - this, SLOT(iconThemeSelected(QTreeWidgetItem*,int))); - connect(iconFollowColorSchemeCB, &QAbstractButton::toggled, this, [this] (bool checked) { - m_settings->setValue("icon_follow_color_scheme", checked); - }); -} - - -void IconThemeConfig::initIconsThemes() -{ - QStringList processed; - const QStringList baseDirs = QIcon::themeSearchPaths(); - static const QStringList iconNames = QStringList() - << QStringLiteral("document-open") - << QStringLiteral("document-new") - << QStringLiteral("edit-undo") - << QStringLiteral("media-playback-start"); - - const int iconNamesN = iconNames.size(); - iconThemeList->setColumnCount(iconNamesN + 2); - - QList items; - foreach (const QString &baseDirName, baseDirs) - { - QDir baseDir(baseDirName); - if (!baseDir.exists()) - continue; - - const QFileInfoList dirs = baseDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); - foreach (const QFileInfo &dir, dirs) - { - if (!processed.contains(dir.canonicalFilePath())) - { - processed << dir.canonicalFilePath(); - - IconThemeInfo theme(QDir(dir.canonicalFilePath())); - if (theme.isValid() && (!theme.isHidden())) - { - QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - item->setSizeHint(0, QSize(42,42)); // make icons non-cropped - item->setData(0, Qt::UserRole, theme.name()); - - const QVector icons = theme.icons(iconNames); - - const int K = icons.size(); - for (int i = 0; i < K; ++i) - { - item->setIcon(i, icons.at(i)); - } - - QString themeDescription; - if (theme.comment().isEmpty()) - { - themeDescription = theme.text(); - } - else - { - themeDescription = theme.text() % QStringLiteral(" (") % theme.comment() % QStringLiteral(")"); - } - - item->setText(iconNamesN + 1, themeDescription); - - items.append(item); - } - } - } - } - - iconThemeList->insertTopLevelItems(0, items); - for (int i=0; iheader()->count()-1; ++i) - { - iconThemeList->resizeColumnToContents(i); - } -} - - -void IconThemeConfig::initControls() -{ - QString currentTheme = QIcon::themeName(); - QTreeWidgetItemIterator it(iconThemeList); - while (*it) { - if ((*it)->data(0, Qt::UserRole).toString() == currentTheme) - { - iconThemeList->setCurrentItem((*it)); - break; - } - ++it; - } - - iconFollowColorSchemeCB->setChecked(m_settings->value("icon_follow_color_scheme", true).toBool()); - - update(); -} - - -IconThemeConfig::~IconThemeConfig() -{ -} - - -void IconThemeConfig::iconThemeSelected(QTreeWidgetItem *item, int column) -{ - Q_UNUSED(column); - const QString theme = item->data(0, Qt::UserRole).toString(); - if (!theme.isEmpty()) - { - // Ensure that this widget also updates it's own icons - QIcon::setThemeName(theme); - - m_settings->setValue("icon_theme", theme); - m_settings->sync(); - } -} diff --git a/lxqt-config-appearance/iconthemeconfig.h b/lxqt-config-appearance/iconthemeconfig.h deleted file mode 100644 index 7ab2e08..0000000 --- a/lxqt-config-appearance/iconthemeconfig.h +++ /dev/null @@ -1,58 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include "ui_iconthemeconfig.h" -#include "iconthemeinfo.h" - -namespace LXQt { -class Settings; -} - - -class IconThemeConfig : public QWidget, public Ui::IconThemeConfig -{ - Q_OBJECT - -public: - IconThemeConfig(LXQt::Settings *settings, QWidget *parent = 0); - ~IconThemeConfig(); - -private: - LXQt::Settings *m_settings; - void initIconsThemes(); - -public slots: - void initControls(); - -private slots: - void iconThemeSelected(QTreeWidgetItem *item, int column); -}; - -#endif diff --git a/lxqt-config-appearance/iconthemeconfig.ui b/lxqt-config-appearance/iconthemeconfig.ui deleted file mode 100644 index 8777a3c..0000000 --- a/lxqt-config-appearance/iconthemeconfig.ui +++ /dev/null @@ -1,98 +0,0 @@ - - - IconThemeConfig - - - - 0 - 0 - 450 - 327 - - - - LXQt Appearance Configuration - - - - - - - 75 - true - - - - Icons Theme - - - - - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOff - - - true - - - - 22 - 22 - - - - false - - - true - - - 4 - - - false - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - - - - The KDE extension of XDG icon themes -> FollowsColorScheme - - - Colorize icons based on widget style (palette) - - - - - - - - diff --git a/lxqt-config-appearance/iconthemeinfo.cpp b/lxqt-config-appearance/iconthemeinfo.cpp deleted file mode 100644 index b7042c9..0000000 --- a/lxqt-config-appearance/iconthemeinfo.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * https://sourceforge.net/projects/lxde-qt/ - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * Luis Pereira - * - * The directoryMatchesSize() and thedirectorySizeDistance() functions were - * taken from Qt5 qtbase/src/gui/image/qiconloader.cpp - * Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "iconthemeinfo.h" - -#define PREVIEW_ICON_SIZE 22 - -IconThemeInfo::IconThemeInfo(const QDir &dir): - mValid(false), - mHidden(false) -{ - mName = dir.dirName(); - if (dir.exists(QStringLiteral("index.theme"))) - load(dir.absoluteFilePath(QStringLiteral("index.theme"))); -} - - -void IconThemeInfo::load(const QString &fileName) -{ - mFileName = fileName; - mValid = false; - QSettings file(mFileName, QSettings::IniFormat); - if (file.status() != QSettings::NoError) - return; - - if (file.value(QStringLiteral("Icon Theme/Directories")).toStringList().join(QLatin1Char(' ')).isEmpty()) - return; - - mHidden = file.value(QStringLiteral("Icon Theme/Hidden"), false).toBool(); - mText = file.value(QStringLiteral("Icon Theme/Name")).toString(); - mComment = file.value(QStringLiteral("Icon Theme/Comment")).toString(); - - mValid = true; -} - - -QVector IconThemeInfo::icons(const QStringList &iconNames) const -{ - QVector icons; - QString current_theme = QIcon::themeName(); - - QIcon::setThemeName(mName); - for (const auto & i : iconNames) - { - icons.push_back({QIcon::fromTheme(i).pixmap({PREVIEW_ICON_SIZE, PREVIEW_ICON_SIZE})}); - } - - QIcon::setThemeName(current_theme); - - return icons; -} diff --git a/lxqt-config-appearance/iconthemeinfo.h b/lxqt-config-appearance/iconthemeinfo.h deleted file mode 100644 index fe1d82c..0000000 --- a/lxqt-config-appearance/iconthemeinfo.h +++ /dev/null @@ -1,65 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * https://sourceforge.net/projects/lxde-qt/ - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef ICONTHEMEINFO_H -#define ICONTHEMEINFO_H - -#include - -#include -#include -#include -#include - -class IconThemeInfo -{ -public: - IconThemeInfo(const QDir &dir); - - QString fileName() const { return mFileName; } - QString name() const { return mName; } - QString text() const { return mText; } - QString comment() const { return mComment; } - - bool isValid() const { return mValid; } - bool isHidden() const { return mHidden; } - QVector icons(const QStringList &iconNames) const; - -private: - QString mFileName; - QString mName; - QString mText; - QString mComment; - - bool mValid; - bool mHidden; - - void load(const QString &fileName); -}; - - -#endif // ICONTHEMEINFO_H diff --git a/lxqt-config-appearance/lxqt-config-appearance.desktop.in b/lxqt-config-appearance/lxqt-config-appearance.desktop.in deleted file mode 100644 index 8565232..0000000 --- a/lxqt-config-appearance/lxqt-config-appearance.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Appearance -GenericName=Appearance settings -Comment=Appearance settings for LXQt -Exec=lxqt-config-appearance -Icon=preferences-desktop-theme -Categories=Settings;DesktopSettings;Qt;LXQt; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/lxqt-config-appearance/lxqtthemeconfig.cpp b/lxqt-config-appearance/lxqtthemeconfig.cpp deleted file mode 100644 index 45bcbfe..0000000 --- a/lxqt-config-appearance/lxqtthemeconfig.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Alexander Sokoloff - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "lxqtthemeconfig.h" -#include "ui_lxqtthemeconfig.h" -#include -#include -#include -#include -#include - -/*! - * \brief Simple delegate to draw system background color below decoration/icon - * (needed by System theme, which uses widget background and therefore provides semi-transparent preview) - */ -class ThemeDecorator : public QItemDelegate -{ -public: - using QItemDelegate::QItemDelegate; -protected: - virtual void drawDecoration(QPainter * painter, const QStyleOptionViewItem & option, const QRect & rect, const QPixmap & pixmap) const override - { - //Note: can't use QItemDelegate::drawDecoration, because it is ignoring pixmap, - //if the icon is valid (and that is set in paint()) - if (pixmap.isNull() || !rect.isValid()) - return; - - QPoint p = QStyle::alignedRect(option.direction, option.decorationAlignment, pixmap.size(), rect).topLeft(); - painter->fillRect(QRect{p, pixmap.size()}, QApplication::palette().color(QPalette::Window)); - painter->drawPixmap(p, pixmap); - } -}; - -/*! - * \brief Check if currently configured wallpaper (read from pcmanfm-qt's - * settings) is the same as \param themeWallpaper - */ -static bool isWallpaperChanged(const QString & themeWallpaper) -{ - static const QString config_path = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) - + QStringLiteral("/pcmanfm-qt/lxqt/settings.conf"); - static const QString wallpaper_key = QStringLiteral("Desktop/Wallpaper"); - const QString current_wallpaper = QSettings{config_path, QSettings::IniFormat}.value(wallpaper_key).toString(); - return themeWallpaper != current_wallpaper; -} - -LXQtThemeConfig::LXQtThemeConfig(LXQt::Settings *settings, QWidget *parent) : - QWidget(parent), - ui(new Ui::LXQtThemeConfig), - mSettings(settings) -{ - ui->setupUi(this); - { - QScopedPointer p{ui->lxqtThemeList->itemDelegate()}; - ui->lxqtThemeList->setItemDelegate(new ThemeDecorator{this}); - } - - connect(ui->lxqtThemeList, SIGNAL(itemClicked(QTreeWidgetItem*,int)), - this, SLOT(lxqtThemeSelected(QTreeWidgetItem*,int))); - connect(ui->wallpaperOverride, &QAbstractButton::toggled, [this] (bool checked) { - if (checked) - lxqtThemeSelected(ui->lxqtThemeList->currentItem(), 0/*not used*/); - }); - - - const QList themes = LXQt::LXQtTheme::allThemes(); - foreach(const LXQt::LXQtTheme &theme, themes) - { - QString themeName = theme.name(); - themeName[0] = themeName[0].toTitleCase(); - QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(themeName)); - if (!theme.previewImage().isEmpty()) - { - item->setIcon(0, QIcon(theme.previewImage())); - } - item->setSizeHint(0, QSize(42,42)); // make icons non-cropped - item->setData(0, Qt::UserRole, theme.name()); - ui->lxqtThemeList->addTopLevelItem(item); - } - - initControls(); -} - - -LXQtThemeConfig::~LXQtThemeConfig() -{ - delete ui; -} - - -void LXQtThemeConfig::initControls() -{ - QString currentTheme = mSettings->value("theme").toString(); - - QTreeWidgetItemIterator it(ui->lxqtThemeList); - while (*it) { - if ((*it)->data(0, Qt::UserRole).toString() == currentTheme) - { - ui->lxqtThemeList->setCurrentItem((*it)); - break; - } - ++it; - } - - update(); -} - - -void LXQtThemeConfig::lxqtThemeSelected(QTreeWidgetItem* item, int column) -{ - Q_UNUSED(column); - if (!item) - return; - - LXQt::LXQtTheme currentTheme{mSettings->value("theme").toString()}; - QVariant themeName = item->data(0, Qt::UserRole); - mSettings->setValue("theme", themeName); - LXQt::LXQtTheme theme(themeName.toString()); - if(theme.isValid()) { - QString wallpaper = theme.desktopBackground(); - if(!wallpaper.isEmpty() && (ui->wallpaperOverride->isChecked() || !isWallpaperChanged(currentTheme.desktopBackground()))) { - // call pcmanfm-qt to update wallpaper - QStringList args; - args << "--set-wallpaper" << wallpaper; - QProcess::startDetached("pcmanfm-qt", args); - } - } -} diff --git a/lxqt-config-appearance/lxqtthemeconfig.h b/lxqt-config-appearance/lxqtthemeconfig.h deleted file mode 100644 index fcdff5c..0000000 --- a/lxqt-config-appearance/lxqtthemeconfig.h +++ /dev/null @@ -1,59 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Alexander Sokoloff - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef LXQTTHEMECONFIG_H -#define LXQTTHEMECONFIG_H - -#include -#include - -class QTreeWidgetItem; - -namespace Ui { - class LXQtThemeConfig; -} - -class LXQtThemeConfig : public QWidget -{ - Q_OBJECT - -public: - explicit LXQtThemeConfig(LXQt::Settings *settings, QWidget *parent = 0); - ~LXQtThemeConfig(); - -public slots: - void initControls(); - -private slots: - void lxqtThemeSelected(QTreeWidgetItem* item, int column); - -private: - Ui::LXQtThemeConfig *ui; - LXQt::Settings *mSettings; -}; - -#endif // LXQTTHEMECONFIG_H diff --git a/lxqt-config-appearance/lxqtthemeconfig.ui b/lxqt-config-appearance/lxqtthemeconfig.ui deleted file mode 100644 index d3c63a3..0000000 --- a/lxqt-config-appearance/lxqtthemeconfig.ui +++ /dev/null @@ -1,65 +0,0 @@ - - - LXQtThemeConfig - - - - 0 - 0 - 400 - 300 - - - - - - - - 75 - true - - - - LXQt Theme - - - - - - - true - - - - 100 - 32 - - - - false - - - true - - - false - - - - 1 - - - - - - - - Override user-defined wallpaper - - - - - - - - diff --git a/lxqt-config-appearance/main.cpp b/lxqt-config-appearance/main.cpp deleted file mode 100644 index 8319f91..0000000 --- a/lxqt-config-appearance/main.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include - -#include -#include -#include -#include "iconthemeconfig.h" -#include "lxqtthemeconfig.h" -#include "styleconfig.h" -#include "fontsconfig.h" - -#include "../liblxqt-config-cursor/selectwnd.h" - -int main (int argc, char **argv) -{ - LXQt::SingleApplication app(argc, argv); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Config Appearance")); - const QString VERINFO = QStringLiteral(LXQT_CONFIG_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - app.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(app); - - LXQt::Settings* settings = new LXQt::Settings("lxqt"); - LXQt::Settings* sessionSettings = new LXQt::Settings("session"); - LXQt::ConfigDialog* dialog = new LXQt::ConfigDialog(QObject::tr("LXQt Appearance Configuration"), settings); - - app.setActivationWindow(dialog); - - QSettings& qtSettings = *settings; // use lxqt config file for Qt settings in Qt5. - StyleConfig* stylePage = new StyleConfig(settings, &qtSettings, dialog); - dialog->addPage(stylePage, QObject::tr("Widget Style"), QStringList() << "preferences-desktop-theme" << "preferences-desktop"); - QObject::connect(dialog, SIGNAL(reset()), stylePage, SLOT(initControls())); - - IconThemeConfig* iconPage = new IconThemeConfig(settings, dialog); - dialog->addPage(iconPage, QObject::tr("Icons Theme"), QStringList() << "preferences-desktop-icons" << "preferences-desktop"); - QObject::connect(dialog, SIGNAL(reset()), iconPage, SLOT(initControls())); - - LXQtThemeConfig* themePage = new LXQtThemeConfig(settings, dialog); - dialog->addPage(themePage, QObject::tr("LXQt Theme"), QStringList() << "preferences-desktop-color" << "preferences-desktop"); - QObject::connect(dialog, SIGNAL(reset()), themePage, SLOT(initControls())); - - FontsConfig* fontsPage = new FontsConfig(settings, &qtSettings, dialog); - dialog->addPage(fontsPage, QObject::tr("Font"), QStringList() << "preferences-desktop-font" << "preferences-desktop"); - QObject::connect(dialog, SIGNAL(reset()), fontsPage, SLOT(initControls())); - - SelectWnd* cursorPage = new SelectWnd(sessionSettings, dialog); - cursorPage->setCurrent(); - dialog->addPage(cursorPage, QObject::tr("Cursor"), QStringList() << "input-mouse" << "preferences-desktop"); - - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setWindowIcon(QIcon::fromTheme("preferences-desktop-theme")); - dialog->show(); - - return app.exec(); -} - diff --git a/lxqt-config-appearance/man/lxqt-config-appearance.1 b/lxqt-config-appearance/man/lxqt-config-appearance.1 deleted file mode 100644 index f5c04a1..0000000 --- a/lxqt-config-appearance/man/lxqt-config-appearance.1 +++ /dev/null @@ -1,50 +0,0 @@ -.TH lxqt-config-appearance "1" "September 2012" "LXQt\ 0.7.0" "LXQt\ GUI settings" -.SH NAME -lxqt-config-appearance \- GUI appearance application of \fBLXQt\fR: the faster and lighter QT Desktop Environment -.SH SYNOPSIS -.B lxqt-config-appearance -.br -.SH DESCRIPTION -With this application you can setting and configuring qt/lxqt gui appearance of programs. -.P -The GUI applications in linux depends of their respective subsystem, in lxqt the overal aspect of -many apps relies on QT4 framework gui. The \fBlxqt-config-appearance\fR application its the configuration center -to provide all aspects of setting \fBLXQt\fR desktop in session settings related programs. -.P -All remaining mayor aspect for lxqt appearance relies over qt4 config application (\fBqtconfig\-qt4\fR), due -the \fBLXQt\fR DE are based on Qt framework. -.P -\fBLXQt\fR is an advanced, easy-to-use, and fast desktop environment based on Qt -technologies, ships several core desktop components, all of which are optional: -.P - * Panel - * Desktop - * Application launcher - * Settings center \fI(related to this)\fR - * Session handler - * Polkit handler - * SSH pasword manager - * Display manager handler - * Power manager -.P -These components perform similar actions to those available in other desktop -environments, and their name is self-descriptive. They are usually not launched -by hand but automatically, when choosing a \fBLXQt\-qt\fR session in the Display -Manager. -.P -.SH "REPORTING BUGS" -Report bugs to https://github.com/lxde/lxqt/issues -.SH "SEE ALSO" -\fBLXQt\fR it has been tailored for users who value simplicity, speed, and -an intuitive interface, also intended for less powerful machines. See also: -.\" any module must refers to session app, for more info on start it -.P -\fBlxqt-session.1\fR LXQt module for manage LXQt complete environment. -.P -\fBlxqt-config.1\fR LXQt application for general config and settings. -.P -\fBqtconfig-qt4.1\fR Qt4 application for gui and appereance settings over all qt4 based software. -.P -.SH AUTHOR -This manual page was created by \fBPICCORO Lenz McKAY\fR \fI\fR -for \fBLXQt\fR project and VENENUX GNU/Linux but can be used by others. diff --git a/lxqt-config-appearance/styleconfig.cpp b/lxqt-config-appearance/styleconfig.cpp deleted file mode 100644 index 1a99596..0000000 --- a/lxqt-config-appearance/styleconfig.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxde.org/ - * - * Copyright: 2014 LXQt team - * Authors: - * Hong Jen Yee (PCMan) - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "styleconfig.h" -#include "ui_styleconfig.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef Q_WS_X11 -extern void qt_x11_apply_settings_in_all_apps(); -#endif - -StyleConfig::StyleConfig(LXQt::Settings* settings, QSettings* qtSettings, QWidget* parent) : - QWidget(parent), - ui(new Ui::StyleConfig), - mQtSettings(qtSettings), - mSettings(settings) -{ - ui->setupUi(this); - - connect(ui->styleList, SIGNAL(itemClicked(QTreeWidgetItem*,int)), - this, SLOT(styleSelected(QTreeWidgetItem*,int))); - - Q_FOREACH(const QString& name, QStyleFactory::keys()) - { - QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(name)); - ui->styleList->addTopLevelItem(item); - } - - initControls(); - - connect(ui->toolButtonStyle, SIGNAL(currentIndexChanged(int)), SLOT(toolButtonStyleSelected(int))); - connect(ui->singleClickActivate, SIGNAL(toggled(bool)), SLOT(singleClickActivateToggled(bool))); -} - - -StyleConfig::~StyleConfig() -{ - delete ui; -} - - -void StyleConfig::initControls() -{ - // read Qt style settings from Qt Trolltech.conf config - mQtSettings->beginGroup(QLatin1String("Qt")); - QString currentTheme = mQtSettings->value("style").toString(); - mQtSettings->endGroup(); - - QTreeWidgetItemIterator it(ui->styleList); - while (*it) { - if ((*it)->data(0, Qt::DisplayRole).toString() == currentTheme) - { - ui->styleList->setCurrentItem((*it)); - break; - } - ++it; - } - - // read other widget related settings form LXQt settings. - QByteArray tb_style = mSettings->value("tool_button_style").toByteArray(); - // convert toolbar style name to value - QMetaEnum me = QToolBar::staticMetaObject.property(QToolBar::staticMetaObject.indexOfProperty("toolButtonStyle")).enumerator(); - int val = me.keyToValue(tb_style.constData()); - if(val == -1) - val = Qt::ToolButtonTextBesideIcon; - ui->toolButtonStyle->setCurrentIndex(val); - - // activate item views with single click - ui->singleClickActivate->setChecked( mSettings->value("single_click_activate", false).toBool()); - - update(); -} - - -void StyleConfig::styleSelected(QTreeWidgetItem* item, int column) -{ - Q_UNUSED(column); - if (!item) - return; - QVariant themeName = item->data(0, Qt::DisplayRole); - mQtSettings->beginGroup(QLatin1String("Qt")); - mQtSettings->setValue("style", themeName); - mQtSettings->endGroup(); - mQtSettings->sync(); - -#ifdef Q_WS_X11 - qt_x11_apply_settings_in_all_apps(); -#endif -} - -void StyleConfig::toolButtonStyleSelected(int index) -{ - // convert style value to string - QMetaEnum me = QToolBar::staticMetaObject.property(QToolBar::staticMetaObject.indexOfProperty("toolButtonStyle")).enumerator(); - if(index == -1) - index = Qt::ToolButtonTextBesideIcon; - const char* str = me.valueToKey(index); - if(str) - { - mSettings->setValue("tool_button_style", str); - mSettings->sync(); - } -} - -void StyleConfig::singleClickActivateToggled(bool toggled) -{ - mSettings->setValue("single_click_activate", toggled); - mSettings->sync(); -} - diff --git a/lxqt-config-appearance/styleconfig.h b/lxqt-config-appearance/styleconfig.h deleted file mode 100644 index a680ca8..0000000 --- a/lxqt-config-appearance/styleconfig.h +++ /dev/null @@ -1,63 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2012 Razor team - * Authors: - * Alexander Sokoloff - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef STYLECONFIG_H -#define STYLECONFIG_H - -#include -#include - -class QTreeWidgetItem; -class QSettings; - -namespace Ui { - class StyleConfig; -} - -class StyleConfig : public QWidget -{ - Q_OBJECT - -public: - explicit StyleConfig(LXQt::Settings *settings, QSettings *qtSettings, QWidget *parent = 0); - ~StyleConfig(); - -public slots: - void initControls(); - -private slots: - void styleSelected(QTreeWidgetItem* item, int column); - void toolButtonStyleSelected(int index); - void singleClickActivateToggled(bool toggled); - -private: - Ui::StyleConfig *ui; - QSettings *mQtSettings; - LXQt::Settings *mSettings; -}; - -#endif // STYLECONFIG_H diff --git a/lxqt-config-appearance/styleconfig.ui b/lxqt-config-appearance/styleconfig.ui deleted file mode 100644 index 9a086aa..0000000 --- a/lxqt-config-appearance/styleconfig.ui +++ /dev/null @@ -1,98 +0,0 @@ - - - StyleConfig - - - - 0 - 0 - 490 - 363 - - - - - - - - 75 - true - - - - Widget Style - - - - - - - - 0 - 1 - - - - true - - - false - - - false - - - - 1 - - - - - - - - Toolbar button style: - - - - - - - - Only display the icon - - - - - Only display the text - - - - - The text appears beside the icon - - - - - The text appears under the icon - - - - - Default - - - - - - - - Activate item on single click - - - - - - - - diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_ar.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_ar.desktop deleted file mode 100644 index cf108d8..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_ar.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ar]=إعدادات مظهر لكسكيوت -GenericName[ar]=إعدادات المظهر -Name[ar]=المظهر diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_ca.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_ca.desktop deleted file mode 100644 index 506793c..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_ca.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ca]=Aparença -GenericName[ca]=Ajusts de l'aparença -Comment[ca]=Ajusts de l'aparença per a LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_cs.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_cs.desktop deleted file mode 100644 index ca0140a..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_cs.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[cs]=Nastavit vzhled pracovní plochy LXQt -GenericName[cs]=Nastavení vzhledu -Name[cs]=Nastavení vzhledu diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_cs_CZ.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_cs_CZ.desktop deleted file mode 100644 index 45646d0..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_cs_CZ.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[cs_CZ]=Nastavit vzhled pracovní plochy LXQt -GenericName[cs_CZ]=Nastavení vzhledu -Name[cs_CZ]=Nastavení vzhledu diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_da.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_da.desktop deleted file mode 100644 index 768abf6..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_da.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[da]=Udseende -GenericName[da]=Udseendeindstillinger -Comment[da]=Udseendeindstillinger for LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_de.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_de.desktop deleted file mode 100644 index ebabc1e..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_de.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[de]=Erscheinungsbild -GenericName[de]=Erscheinungsbild Einstellungen -Comment[de]=Einstellungen zum Aussehen der LXQt Arbeitsfläche diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_el.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_el.desktop deleted file mode 100644 index c9e42fe..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_el.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[el]=Διαμόρφωση εμφάνισης της επιφάνειας εργασίας LXQt -GenericName[el]=Διαμόρφωση εμφάνισης LXQt -Name[el]=Διαμόρφωση εμφάνισης LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_eo.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_eo.desktop deleted file mode 100644 index 9e90feb..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_eo.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[eo]=Agordi aperon de LXQt-labortablo -GenericName[eo]=Agordoj de apero de LXQt -Name[eo]=Agordoj de apero de LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_es.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_es.desktop deleted file mode 100644 index a45f295..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_es.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[es]=Configura el aspecto del escritorio LXQt -GenericName[es]=Configuración de Aspecto LXQt -Name[es]=Configuración de Aspecto LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_es_VE.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_es_VE.desktop deleted file mode 100644 index bfb3e11..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_es_VE.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[es_VE]=Configurar apariencia del escritorio LXQt -GenericName[es_VE]=Configuración de apariencia de LXQt -Name[es_VE]=Configuración de apariencia de LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_eu.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_eu.desktop deleted file mode 100644 index d630fb7..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_eu.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[eu]=Konfiguratu LXQt mahaigainaren itxura -GenericName[eu]=LXQt itxuraren konfigurazioa -Name[eu]=LXQt itxuraren konfigurazioa diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_fi.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_fi.desktop deleted file mode 100644 index f332a5b..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_fi.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[fi]=Hallitse LXQt-työpöydän ulkoasua -GenericName[fi]=LXQtin ulkoasun hallinta -Name[fi]=LXQtin ulkoasun hallinta diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_fr.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_fr.desktop deleted file mode 100644 index 2caea96..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_fr.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[fr]=Apparence -GenericName[fr]=Configurer l'apparence -Comment[fr]=Configurer l'apparence de LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_hu.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_hu.desktop deleted file mode 100644 index c3f22db..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_hu.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[hu]=A LXQt asztal megjelenésének beállítása -GenericName[hu]=LXQt megjelenésbeállító -Name[hu]=LXQt megjelenésbeállító diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_ia.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_ia.desktop deleted file mode 100644 index 26b0d99..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_ia.desktop +++ /dev/null @@ -1 +0,0 @@ -# Translations diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_id_ID.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_id_ID.desktop deleted file mode 100644 index 26b0d99..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_id_ID.desktop +++ /dev/null @@ -1 +0,0 @@ -# Translations diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_it.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_it.desktop deleted file mode 100644 index 7adb9f6..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_it.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -GenericName[it]=Aspetto -Name[it]=Aspetto -Comment[it]=Configura l'aspetto di LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_ja.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_ja.desktop deleted file mode 100644 index 1209541..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_ja.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ja]=LXQtデスクトップの外観を設定 -GenericName[ja]=LXQt外観の設定 -Name[ja]=LXQt外観の設定 diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_ko.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_ko.desktop deleted file mode 100644 index 26b0d99..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_ko.desktop +++ /dev/null @@ -1 +0,0 @@ -# Translations diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_lt.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_lt.desktop deleted file mode 100644 index 451fa64..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_lt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[lt]=LXQt išvaizdos nustatymai -GenericName[lt]=Išvaizdos nustatymai -Name[lt]=Išvaizda diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_nl.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_nl.desktop deleted file mode 100644 index 0c56d11..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_nl.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[nl]=Configureer het uiterlijk van het LXQt bureaublad -GenericName[nl]=LXQt Uiterlijk Configuratie -Name[nl]=LXQt Uiterlijk Configuratie diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_pl_PL.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_pl_PL.desktop deleted file mode 100644 index 45b7f9b..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_pl_PL.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[pl_PL]=Konfiguruj wygląd pulpitu LXQt -GenericName[pl_PL]=Konfiguracja wyglądu LXQt -Name[pl_PL]=Konfiguracja wyglądu LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_pt.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_pt.desktop deleted file mode 100644 index f114950..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_pt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[pt]=Configurar o aspeto do LXQt -GenericName[pt]=Configuração da aparência do LXQt -Name[pt]=Configuração da aparência do LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_pt_BR.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_pt_BR.desktop deleted file mode 100644 index b26cf8c..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_pt_BR.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[pt_BR]=Configure a aparência da área de trabalho LXQt -GenericName[pt_BR]=Configuração da aparência do LXQt -Name[pt_BR]=Configuração da aparência do LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_ro_RO.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_ro_RO.desktop deleted file mode 100644 index 20da510..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_ro_RO.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ro_RO]=Configurează aspectul desktopului LXQt -GenericName[ro_RO]=Configurare aspect LXQt -Name[ro_RO]=Configurare aspect LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_ru.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_ru.desktop deleted file mode 100644 index 2453235..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ru]=Настройки внешнего вида LXQt -GenericName[ru]=Настройка внешнего вида -Name[ru]=Внешний вид \ No newline at end of file diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_sk.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_sk.desktop deleted file mode 100644 index cace414..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_sk.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sk]=Nastavenie vzhľadu prostredia LXQt -GenericName[sk]=Nastavenie vzhľadu -Name[sk]=Nastavenie vzhľadu diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_sl.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_sl.desktop deleted file mode 100644 index 3fd428c..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_sl.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sl]=Nastavite videz namizja LXQt -GenericName[sl]=Nastavitev videza -Name[sl]=Nastavitev videza namizja LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_sr.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_sr.desktop deleted file mode 100644 index 8a8351f..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_sr.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sr]=Подесите изглед Рејзорове радне површи -GenericName[sr]=Подешавање изгледа -Name[sr]=Подешавање изгледа Рејзора diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_sr@ijekavian.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_sr@ijekavian.desktop deleted file mode 100644 index 8943815..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_sr@ijekavian.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[sr@ijekavian]=Подешавање изгледа Рејзора -Comment[sr@ijekavian]=Подесите изглед Рејзорове радне површи -GenericName[sr@ijekavian]=Подешавање изгледа diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_sr@ijekavianlatin.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_sr@ijekavianlatin.desktop deleted file mode 100644 index 69661a6..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[sr@ijekavianlatin]=Podešavanje izgleda Rejzora -Comment[sr@ijekavianlatin]=Podesite izgled Rejzorove radne površi -GenericName[sr@ijekavianlatin]=Podešavanje izgleda diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_sr@latin.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_sr@latin.desktop deleted file mode 100644 index 3aebf95..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_sr@latin.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sr@latin]=Podesite izgled Rejzorove radne površi -GenericName[sr@latin]=Podešavanje izgleda -Name[sr@latin]=Podešavanje izgleda Rejzora diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_th_TH.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_th_TH.desktop deleted file mode 100644 index f4b0fa1..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_th_TH.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[th_TH]=ตั้งค่ารูปลักษณ์ของเดสก์ท็อป LXQt -GenericName[th_TH]=การตั้งค่ารูปลักษณ์ LXQt -Name[th_TH]=การตั้งค่ารูปลักษณ์ LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_tr.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_tr.desktop deleted file mode 100644 index 9d01a71..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_tr.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[tr]=LXQt masaüstünün görünümünü yapılandırın -GenericName[tr]=LXQt Görünüm Yapılandırıcı -Name[tr]=LXQt Görünüm Yapılandırıcı diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_uk.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_uk.desktop deleted file mode 100644 index 3398c37..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_uk.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[uk]=Налаштувати вигляд стільниці LXQt -GenericName[uk]=Налаштування вигляду LXQt -Name[uk]=Налаштування вигляду LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_zh_CN.GB2312.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_zh_CN.GB2312.desktop deleted file mode 100644 index 26b0d99..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_zh_CN.GB2312.desktop +++ /dev/null @@ -1 +0,0 @@ -# Translations diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_zh_CN.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_zh_CN.desktop deleted file mode 100644 index cc576f7..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_zh_CN.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[zh_CN]=配置 LXQt 桌面的外观 -GenericName[zh_CN]=LXQt 外观配置 -Name[zh_CN]=LXQt 外观配置 diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_zh_TW.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_zh_TW.desktop deleted file mode 100644 index 038f4b2..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_zh_TW.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[zh_TW]=自定LXQt桌面的外觀 -GenericName[zh_TW]=LXQt外觀設定 -Name[zh_TW]=LXQt外觀設定 diff --git a/lxqt-config-brightness/CMakeLists.txt b/lxqt-config-brightness/CMakeLists.txt deleted file mode 100644 index c21ab45..0000000 --- a/lxqt-config-brightness/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -project(lxqt-config-brightness) - -find_package(Qt5Widgets REQUIRED QUIET) -find_package(Qt5X11Extras REQUIRED QUIET) - -find_package(XCB REQUIRED xcb xcb-randr) - -set(QTX_LIBRARIES Qt5::Widgets Qt5::X11Extras) - - -include_directories ( - ${XCB_INCLUDE_DIRS} -) - -set(H_FILES - brightnesssettings.h - xrandrbrightness.h - monitorinfo.h - outputwidget.h -) - -set(CPP_FILES - main.cpp - brightnesssettings.cpp - xrandrbrightness.cpp - monitorinfo.cpp - outputwidget.cpp -) - -set(UI_FILES - brightnesssettings.ui - outputwidget.ui -) - -qt5_wrap_ui(UI_HEADERS ${UI_FILES}) - - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${H_FILES} - ${CPP_FILES} - ${UI_FILES} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES "resources/${PROJECT_NAME}.desktop.in") - - -add_executable(${PROJECT_NAME} ${CPP_FILES} ${UI_FILES} ${QM_FILES} ${DESKTOP_FILES} ${QM_LOADER}) - -target_link_libraries( - ${PROJECT_NAME} - ${QTX_LIBRARIES} - ${XCB_LIBRARIES} - lxqt -) - -add_definitions( - -DICON_DIR="${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps" -) - - -install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) -install(FILES ${DESKTOP_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) -install( - FILES icons/brightnesssettings.svg - DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps" -) - diff --git a/lxqt-config-brightness/README.md b/lxqt-config-brightness/README.md deleted file mode 100644 index 99c1da9..0000000 --- a/lxqt-config-brightness/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# brightness-settings - -This tool changes brightness and gamma of your screen. It is a X11 tool. LibKScreen can not change brightness or gamma yet. - diff --git a/lxqt-config-brightness/brightnesssettings.cpp b/lxqt-config-brightness/brightnesssettings.cpp deleted file mode 100644 index bd66f48..0000000 --- a/lxqt-config-brightness/brightnesssettings.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "brightnesssettings.h" -#include "outputwidget.h" -#include -#include - -BrightnessSettings::BrightnessSettings(QWidget *parent):QDialog(parent) -{ - ui = new Ui::BrightnessSettings(); - ui->setupUi(this); - - mBrightness = new XRandrBrightness(); - mMonitors = mBrightness->getMonitorsInfo(); - - for(const MonitorInfo &monitor: mMonitors) - { - OutputWidget *output = new OutputWidget(monitor, this); - ui->layout->addWidget(output); - output->show(); - connect(output, SIGNAL(changed(MonitorInfo)), this, SLOT(monitorSettingsChanged(MonitorInfo))); - connect(this, &BrightnessSettings::monitorReverted, output, &OutputWidget::setRevertedValues); - } - - mConfirmRequestTimer.setSingleShot(true); - mConfirmRequestTimer.setInterval(1000); - connect(&mConfirmRequestTimer, &QTimer::timeout, this, &BrightnessSettings::requestConfirmation); - -} - -void BrightnessSettings::monitorSettingsChanged(MonitorInfo monitor) -{ - mBrightness->setMonitorsSettings(QList{} << monitor); - if (ui->confirmCB->isChecked()) - { - mConfirmRequestTimer.start(); - } else - { - for (auto & m : mMonitors) - { - if (m.id() == monitor.id() && m.name() == monitor.name()) - { - m.setBacklight(monitor.backlight()); - m.setBrightness(monitor.brightness()); - } - } - } -} - -void BrightnessSettings::requestConfirmation() -{ - QMessageBox msg{QMessageBox::Question, tr("Brightness settings changed") - , tr("Confirmation required. Are the settings correct?") - , QMessageBox::Yes | QMessageBox::No}; - int timeout = 5; // seconds - QString no_text = msg.button(QMessageBox::No)->text(); - no_text += QStringLiteral("(%1)"); - msg.setButtonText(QMessageBox::No, no_text.arg(timeout)); - msg.setDefaultButton(QMessageBox::No); - - QTimer timeoutTimer; - timeoutTimer.setSingleShot(false); - timeoutTimer.setInterval(1000); - connect(&timeoutTimer, &QTimer::timeout, [&] { - msg.setButtonText(QMessageBox::No, no_text.arg(--timeout)); - if (timeout == 0) - { - timeoutTimer.stop(); - msg.reject(); - } - }); - timeoutTimer.start(); - - if (QMessageBox::Yes == msg.exec()) - { - // re-read current values - mMonitors = mBrightness->getMonitorsInfo(); - } else - { - // revert the changes - mBrightness->setMonitorsSettings(mMonitors); - for (const auto & monitor : mMonitors) - emit monitorReverted(monitor); - } -} diff --git a/lxqt-config-brightness/brightnesssettings.h b/lxqt-config-brightness/brightnesssettings.h deleted file mode 100644 index 6d5bd36..0000000 --- a/lxqt-config-brightness/brightnesssettings.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef __BRIGHTNESS_SETTINGS_H__ -#define __BRIGHTNESS_SETTINGS_H__ - -#include -#include -#include "xrandrbrightness.h" -#include "ui_brightnesssettings.h" - - -class BrightnessSettings: public QDialog -{ -Q_OBJECT - -public: - BrightnessSettings(QWidget *parent =0); - -signals: - void monitorReverted(const MonitorInfo & monitor); - -public slots: - void monitorSettingsChanged(MonitorInfo monitor); - void requestConfirmation(); - -private: - XRandrBrightness *mBrightness; - QList mMonitors; - QTimer mConfirmRequestTimer; - Ui::BrightnessSettings *ui; - - -}; - - -#endif - diff --git a/lxqt-config-brightness/brightnesssettings.ui b/lxqt-config-brightness/brightnesssettings.ui deleted file mode 100644 index 0832376..0000000 --- a/lxqt-config-brightness/brightnesssettings.ui +++ /dev/null @@ -1,89 +0,0 @@ - - - BrightnessSettings - - - - 0 - 0 - 406 - 110 - - - - Brightness Settings - - - - - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Backlight and brightness settings:</span></p><p>Use arrow keys to change settings.</p></body></html> - - - - - - - - - - Require confirmation after settings change - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - buttonBox - accepted() - BrightnessSettings - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - BrightnessSettings - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/lxqt-config-brightness/icons/brightnesssettings.svg b/lxqt-config-brightness/icons/brightnesssettings.svg deleted file mode 100644 index 40a0c7c..0000000 --- a/lxqt-config-brightness/icons/brightnesssettings.svg +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/lxqt-config-brightness/main.cpp b/lxqt-config-brightness/main.cpp deleted file mode 100644 index ccb6908..0000000 --- a/lxqt-config-brightness/main.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "xrandrbrightness.h" -#include -#include -#include -#include "brightnesssettings.h" - -int main(int argn, char* argv[]) -{ - LXQt::SingleApplication app(argn, argv); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - // Command line options - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Config Brightness")); - const QString VERINFO = QStringLiteral(LXQT_CONFIG_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - app.setApplicationVersion(VERINFO); - QCommandLineOption increaseOption(QStringList() << "i" << "icrease", - app.tr("Increase brightness.")); - parser.addOption(increaseOption); - QCommandLineOption decreaseOption(QStringList() << "d" << "decrease", - app.tr("Decrease brightness.")); - parser.addOption(decreaseOption); - QCommandLineOption setOption(QStringList() << "s" << "set", - app.tr("Set brightness from 1 to 100."), "brightness"); - parser.addOption(setOption); - QCommandLineOption helpOption = parser.addHelpOption(); - parser.addOption(increaseOption); - parser.addOption(decreaseOption); - parser.addOption(setOption); - parser.addOption(helpOption); - parser.addVersionOption(); - - parser.process(app); - if( parser.isSet(increaseOption) || parser.isSet(decreaseOption) || parser.isSet(setOption) ) - { - XRandrBrightness *brightness = new XRandrBrightness(); - QList monitors = brightness->getMonitorsInfo(); - QList monitorsChanged; - float sign = parser.isSet(decreaseOption)?-1.0:1.0; - double brightness_value = parser.value(setOption).toFloat(); - brightness_value = qMin( qMax(brightness_value, 0.0), 100.0 ) / 100.0; - if(!parser.value(setOption).isEmpty()) - sign = 0.0; - foreach(MonitorInfo monitor, monitors) - { - if( monitor.isBacklightSupported() ) - { - long backlight = ( monitor.backlight() + sign*(monitor.backlightMax()/50 + 1) )*qAbs(sign) + brightness_value*monitor.backlightMax(); - if(backlight0) - { - monitor.setBacklight(backlight); - monitorsChanged.append(monitor); - } - } - else - { - float brightness = (monitor.brightness() + 0.1*sign)*qAbs(sign) + brightness_value*2.0; - if(brightness<2.0 && brightness>0.0) - { - monitor.setBrightness(brightness); - monitorsChanged.append(monitor); - } - } - } - brightness->setMonitorsSettings(monitorsChanged); - return 0; - } - - BrightnessSettings *brightnessSettings = new BrightnessSettings(); - brightnessSettings->setWindowIcon(QIcon(ICON_DIR "/brightnesssettings.svg")); - brightnessSettings->show(); - - return app.exec(); -} - diff --git a/lxqt-config-brightness/monitorinfo.cpp b/lxqt-config-brightness/monitorinfo.cpp deleted file mode 100644 index 992dd81..0000000 --- a/lxqt-config-brightness/monitorinfo.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "monitorinfo.h" - -MonitorInfo::MonitorInfo(int id, QString name, long backlightMax) -{ - mId = id; - mName = name; - mBacklightMax = backlightMax; -} - -MonitorInfo::MonitorInfo(const MonitorInfo &monitor) -{ - mId = monitor.mId; - mName = monitor.mName; - mBacklightMax = monitor.mBacklightMax; - mBacklight = monitor.mBacklight; - mBrightness = monitor.mBrightness; -} - -bool MonitorInfo::isBacklightSupported() const -{ - return mBacklightMax > 0; -} - -long MonitorInfo::backlightMax() const -{ - return mBacklightMax; -} - -long MonitorInfo::backlight() const -{ - return mBacklight; -} - -void MonitorInfo::setBacklight(const long value) -{ - mBacklight = value; -} - -float MonitorInfo::brightness() const -{ - return mBrightness; -} - -void MonitorInfo::setBrightness(const float percent) -{ - mBrightness = qMax(qMin((float)2.0, percent), (float)0.0); -} - -int MonitorInfo::id() const -{ - return mId; -} - -QString MonitorInfo::name() const -{ - return mName; -} - diff --git a/lxqt-config-brightness/monitorinfo.h b/lxqt-config-brightness/monitorinfo.h deleted file mode 100644 index 9d5b123..0000000 --- a/lxqt-config-brightness/monitorinfo.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef __MONITOR_INFO_H__ -#define __MONITOR_INFO_H__ - -#include - - -/** This class represents backlight and brightness values of screen. - * If backlight is supported, backlight power of screen can be changed. - * Brightness represents color saturation. - */ -class MonitorInfo -{ -public: - MonitorInfo(int id, QString name, long backlightMax); - MonitorInfo(const MonitorInfo &monitor); - - bool isBacklightSupported() const; - long backlight() const; - long backlightMax() const; - void setBacklight(const long value); - - float brightness() const; - /**Brightness is a number between 0 and 2.*/ - void setBrightness(const float percent); - - int id() const; - QString name() const; - -private: - long mBacklightMax; - long mBacklight; - - float mBrightness; - - QString mName; - int mId; -}; - -#endif - diff --git a/lxqt-config-brightness/outputwidget.cpp b/lxqt-config-brightness/outputwidget.cpp deleted file mode 100644 index 4aac9a5..0000000 --- a/lxqt-config-brightness/outputwidget.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "outputwidget.h" - -OutputWidget::OutputWidget(MonitorInfo monitor, QWidget *parent):QWidget(parent), mMonitor(monitor) -{ - ui = new Ui::OutputWidget(); - ui->setupUi(this); - - ui->label->setText(""+monitor.name()+":"); - if ( monitor.isBacklightSupported() ) - { - ui->backlightSlider->setMinimum(0); - ui->backlightSlider->setMaximum(monitor.backlightMax()); - ui->backlightSlider->setValue(monitor.backlight()); - ui->backlightSlider->setFocus(Qt::OtherFocusReason); - } - else - ui->backlightSlider->hide(); - ui->brightnessSlider->setMinimum(0); - ui->brightnessSlider->setMaximum(200); - ui->brightnessSlider->setValue(monitor.brightness()*100); - - connect(ui->backlightSlider, SIGNAL(valueChanged(int)), this, SLOT(backlightChanged(int))); - connect(ui->brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(brightnessChanged(int))); -} - -void OutputWidget::backlightChanged(int value) -{ - mMonitor.setBacklight(value); - emit changed(mMonitor); -} - - -void OutputWidget::brightnessChanged(int value) -{ - mMonitor.setBrightness((float)value/100.0); - emit changed(mMonitor); -} - -void OutputWidget::setRevertedValues(const MonitorInfo & monitor) -{ - if (mMonitor.id() == monitor.id() && mMonitor.name() == monitor.name()) - { - ui->backlightSlider->blockSignals(true); - ui->backlightSlider->setValue(monitor.backlight()); - ui->backlightSlider->blockSignals(false); - ui->brightnessSlider->blockSignals(true); - ui->brightnessSlider->setValue(monitor.brightness()*100); - ui->brightnessSlider->blockSignals(false); - } -} diff --git a/lxqt-config-brightness/outputwidget.h b/lxqt-config-brightness/outputwidget.h deleted file mode 100644 index e464147..0000000 --- a/lxqt-config-brightness/outputwidget.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef __OUTPUT_WIDGET_H__ -#define __OUTPUT_WIDGET_H__ - -#include -#include "monitorinfo.h" -#include "ui_outputwidget.h" - -class OutputWidget: public QWidget -{ -Q_OBJECT -public: - OutputWidget(MonitorInfo monitor, QWidget *parent); - -signals: - void changed(MonitorInfo info); - -public slots: - void backlightChanged(int value); - void brightnessChanged(int value); - void setRevertedValues(const MonitorInfo & monitor); -private: - MonitorInfo mMonitor; - Ui::OutputWidget *ui; -}; - -#endif - diff --git a/lxqt-config-brightness/outputwidget.ui b/lxqt-config-brightness/outputwidget.ui deleted file mode 100644 index bd6427f..0000000 --- a/lxqt-config-brightness/outputwidget.ui +++ /dev/null @@ -1,84 +0,0 @@ - - - OutputWidget - - - - 0 - 0 - 478 - 86 - - - - - 0 - 0 - - - - Form - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - 5 - - - - - - <b>Output:</b> - - - Qt::RichText - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - - 48 - 48 - - - - false - - - 10.000000000000000 - - - true - - - - - - - - - - - diff --git a/lxqt-config-brightness/resources/lxqt-config-brightness.desktop.in b/lxqt-config-brightness/resources/lxqt-config-brightness.desktop.in deleted file mode 100644 index 0bb2459..0000000 --- a/lxqt-config-brightness/resources/lxqt-config-brightness.desktop.in +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Name=Brightness -GenericName=Brightness Settings -Comment=Configure brightness -Exec=lxqt-config-brightness -Terminal=false -Type=Application -Icon=brightnesssettings -Categories=Settings;DesktopSettings;Qt;LXQt;HardwareSettings; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_ar.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_ar.desktop deleted file mode 100644 index 73e7d25..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ar]=إعدادات السّطوع diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_ca.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_ca.desktop deleted file mode 100644 index b575944..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_ca.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ca]=Ajusts de la brillantor diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_da.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_da.desktop deleted file mode 100644 index 94c7345..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_da.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[da]=Lysstyrke -GenericName[da]=Lysstyrkeindstillinger -Comment[da]=Konfigurér lysstyrke diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_es.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_es.desktop deleted file mode 100644 index 069729b..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_es.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[es]=Permite cambiar el brillo y el contraste del monitor -GenericName[es]=Configuración de Brillo y contraste LXQt -Name[es]=Configuración de Brillo y contraste LXQt diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_fr.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_fr.desktop deleted file mode 100644 index 461e526..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[fr]=Paramètres de luminosité -GenericName[fr]=Paramètres de luminosité de l'écran -Comment[fr]=Régler la luminosité et le contraste de l'écran diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_it.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_it.desktop deleted file mode 100644 index 3d589f3..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Luminosità -Comment[it]=Permette di cambiare la luminosità e il contrasto dello schermo diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_lt.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_lt.desktop deleted file mode 100644 index 17fe957..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_lt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[lt]=Konfigūruoti ryškumą -GenericName[lt]=Ryškumo nustatymai -Name[lt]=Ryškumas diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_pl.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_pl.desktop deleted file mode 100644 index b8420d2..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_pl.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[pl]=Ustawienia jasności -GenericName[pl]=Ustawienia jasności wyświetlacza -Comment[pl]=Dostosuj jasność i kontrast wyświetlacza diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_ru.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_ru.desktop deleted file mode 100644 index 1e22633..0000000 --- a/lxqt-config-brightness/translations/lxqt-config-brightness_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ru]=Позволяет менять яркость и контраст монитора -GenericName[ru]=Настройка яркости и контраста LXQt -Name[ru]=Настройка яркости и контраста LXQt diff --git a/lxqt-config-brightness/xrandrbrightness.cpp b/lxqt-config-brightness/xrandrbrightness.cpp deleted file mode 100644 index 20d1310..0000000 --- a/lxqt-config-brightness/xrandrbrightness.cpp +++ /dev/null @@ -1,411 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2010 Lukas Tinkl - * Copyright (C) 2015 Kai Uwe Broulik - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - - -#include -#include - -#include "xrandrbrightness.h" - -XRandrBrightness::XRandrBrightness() -{ - if (!QX11Info::isPlatformX11()) { - return; - } - ScopedCPointer versionReply(xcb_randr_query_version_reply(QX11Info::connection(), - xcb_randr_query_version(QX11Info::connection(), 1, 2), - nullptr)); - - if (!versionReply) { - qDebug() << "RandR Query version returned null"; - return; - } - - if (versionReply->major_version < 1 || (versionReply->major_version == 1 && versionReply->minor_version < 2)) { - qDebug() << "RandR version" << versionReply->major_version << "." << versionReply->minor_version << " too old"; - return; - } - ScopedCPointer backlightReply(xcb_intern_atom_reply(QX11Info::connection(), - xcb_intern_atom (QX11Info::connection(), 1, strlen("Backlight"), "Backlight"), - nullptr)); - - if (!backlightReply) { - qDebug() << "Intern Atom for Backlight returned null"; - return; - } - - m_backlight = backlightReply->atom; - - if (m_backlight == XCB_NONE) { - qDebug() << "No outputs have backlight property"; - //return; - } - xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(QX11Info::connection())); - if (!iter.rem) { - qDebug() << "XCB Screen Roots Iterator rem was null"; - return; - } - - xcb_screen_t *screen = iter.data; - xcb_window_t root = screen->root; - - m_resources.reset(xcb_randr_get_screen_resources_current_reply(QX11Info::connection(), - xcb_randr_get_screen_resources_current(QX11Info::connection(), root) - , nullptr)); - - if (!m_resources) { - qDebug() << "RANDR Get Screen Resources returned null"; - return; - } -} - - - -bool XRandrBrightness::backlight_get_with_range(xcb_randr_output_t output, long &value, long &min, long &max) const { - long cur = backlight_get(output); - if (cur == -1) { - return false; - } - - ScopedCPointer propertyReply(xcb_randr_query_output_property_reply(QX11Info::connection(), - xcb_randr_query_output_property(QX11Info::connection(), output, m_backlight) - , nullptr)); - - if (!propertyReply) { - return -1; - } - - if (propertyReply->range && xcb_randr_query_output_property_valid_values_length(propertyReply.data()) == 2) { - int32_t *values = xcb_randr_query_output_property_valid_values(propertyReply.data()); - value = cur; - min = values[0]; - max = values[1]; - return true; - } - - return false; -} - -long XRandrBrightness::backlight_get(xcb_randr_output_t output) const -{ - ScopedCPointer propertyReply; - long value; - - if (m_backlight != XCB_ATOM_NONE) { - propertyReply.reset(xcb_randr_get_output_property_reply(QX11Info::connection(), - xcb_randr_get_output_property(QX11Info::connection(), output, m_backlight, XCB_ATOM_NONE, 0, 4, 0, 0) - , nullptr)); - - if (!propertyReply) { - return -1; - } - } - - if (!propertyReply || propertyReply->type != XCB_ATOM_INTEGER || propertyReply->num_items != 1 || propertyReply->format != 32) { - value = -1; - } else { - value = *(reinterpret_cast(xcb_randr_get_output_property_data(propertyReply.data()))); - } - return value; -} - -void XRandrBrightness::backlight_set(xcb_randr_output_t output, long value) -{ - xcb_randr_change_output_property(QX11Info::connection(), output, m_backlight, XCB_ATOM_INTEGER, - 32, XCB_PROP_MODE_REPLACE, - 1, reinterpret_cast(&value)); -} - - -float XRandrBrightness::gamma_brightness_get(xcb_randr_output_t output) -{ - xcb_generic_error_t *error; - - xcb_randr_get_output_info_cookie_t output_info_cookie = xcb_randr_get_output_info (QX11Info::connection(), output, 0); - xcb_randr_get_output_info_reply_t * output_info = xcb_randr_get_output_info_reply (QX11Info::connection(), output_info_cookie, &error); - if(error != NULL) - { - qDebug() << "Error getting output_info"; - return -1; - } - if(output_info == NULL) - { - qDebug() << "Error: output_info is null"; - return -1; - } - // xcb_randr_get_output_info_reply_t tiene como elemento crtc - xcb_randr_get_crtc_gamma_cookie_t gamma_cookie = xcb_randr_get_crtc_gamma_unchecked (QX11Info::connection(), output_info->crtc); - xcb_randr_get_crtc_gamma_reply_t *gamma_reply = xcb_randr_get_crtc_gamma_reply (QX11Info::connection(), gamma_cookie, &error); - if(error != NULL) - { - qDebug() << "Error getting gamma_reply"; - return -1; - } - if(gamma_reply == NULL) - { - qDebug() << "Error: gamma_reply is null"; - return -1; - } - uint16_t *red = xcb_randr_get_crtc_gamma_red (gamma_reply); - if(red == NULL) - { - qDebug() << "Error: red is null"; - return -1; - } - int red_length = xcb_randr_get_crtc_gamma_red_length(gamma_reply); - - // uint16_t *green = xcb_randr_get_crtc_gamma_green (gamma_reply); - // if(green == NULL) - // { - // qDebug() << "Error: green is null"; - // return -1; - // } - // uint16_t *blue = xcb_randr_get_crtc_gamma_blue (gamma_reply); - // if(blue == NULL) - // { - // qDebug() << "Error: blue is null"; - // return -1; - // } - - float brightness = (float)red[red_length-1]/65535.0; - return brightness; -} - -void XRandrBrightness::gamma_brightness_set(xcb_randr_output_t output, float percent) -{ - xcb_generic_error_t *error; - - xcb_randr_get_output_info_cookie_t output_info_cookie = xcb_randr_get_output_info (QX11Info::connection(), output, 0); - xcb_randr_get_output_info_reply_t * output_info = xcb_randr_get_output_info_reply (QX11Info::connection(), output_info_cookie, &error); - if(error != NULL) - { - qDebug() << "Error getting output_info"; - return; - } - if(output_info == NULL) - { - qDebug() << "Error: output_info is null"; - return; - } - // xcb_randr_get_output_info_reply_t tiene como elemento crtc - xcb_randr_get_crtc_gamma_cookie_t gamma_cookie = xcb_randr_get_crtc_gamma_unchecked (QX11Info::connection(), output_info->crtc); - xcb_randr_get_crtc_gamma_reply_t *gamma_reply = xcb_randr_get_crtc_gamma_reply (QX11Info::connection(), gamma_cookie, &error); - if(error != NULL) - { - qDebug() << "Error getting gamma_reply"; - return; - } - if(gamma_reply == NULL) - { - qDebug() << "Error: gamma_reply is null"; - return; - } - uint16_t *red = xcb_randr_get_crtc_gamma_red (gamma_reply); - if(red == NULL) - { - qDebug() << "Error: red is null"; - return; - } - int red_length = xcb_randr_get_crtc_gamma_red_length(gamma_reply); - uint16_t *green = xcb_randr_get_crtc_gamma_green (gamma_reply); - if(green == NULL) - { - qDebug() << "Error: green is null"; - return; - } - uint16_t *blue = xcb_randr_get_crtc_gamma_blue (gamma_reply); - if(blue == NULL) - { - qDebug() << "Error: blue is null"; - return; - } - - float max_gamma = 65535*percent; - for(int i=0;icrtc, red_length, red, green, blue); -} - - -QList XRandrBrightness::getMonitorsInfo() -{ - QList monitors; - - if (!m_resources) { - return monitors; - } - - auto *outputs = xcb_randr_get_screen_resources_current_outputs(m_resources.data()); - for (int i = 0; i < m_resources->num_outputs; ++i) { - xcb_randr_output_t output = outputs[i]; - - xcb_generic_error_t *error; - - xcb_randr_get_output_info_cookie_t output_info_cookie = xcb_randr_get_output_info (QX11Info::connection(), output, 0); - xcb_randr_get_output_info_reply_t * output_info = xcb_randr_get_output_info_reply (QX11Info::connection(), output_info_cookie, &error); - if(error != NULL) - { - qDebug() << "Error getting output_info"; - continue; - } - if(output_info == NULL) - { - qDebug() << "Error: output_info is null"; - continue; - } - - QString name = QString::fromUtf8((const char *) xcb_randr_get_output_info_name(output_info), output_info->name_len); - - - qDebug() << "Found output:" << name; - - - // Is connected? - if ( (xcb_randr_connection_t)(output_info->connection) != XCB_RANDR_CONNECTION_CONNECTED ) - { - qDebug() << "Output is not connected"; - continue; // This output is not connected. Check other - } - - // Is enabled? - if( output_info->crtc == 0) - { - qDebug() << "Crtc is not null. Output not enabled."; - continue; - } - xcb_randr_get_crtc_info_cookie_t crtc_info_cookie = xcb_randr_get_crtc_info_unchecked (QX11Info::connection(), output_info->crtc, 0); - xcb_randr_get_crtc_info_reply_t *crtc_info =xcb_randr_get_crtc_info_reply (QX11Info::connection(), crtc_info_cookie, &error); - if(error != NULL) - { - qDebug() << "Error getting output_info"; - continue; - } - if(crtc_info == NULL) - { - qDebug() << "Error: output_info is null"; - continue; - } - if( crtc_info->mode == XCB_NONE ) - { - qDebug() << "No modes. Output not enabled."; - continue; - } - - // Output is connected and enabled. Get data: - bool backlightIsSuported = false; - long cur, min, max, backlight_max = -1; - if (backlight_get(output) != -1) - { - if (backlight_get_with_range(output, cur, min, max)) - { - backlightIsSuported = true; - backlight_max = max - min; - } - } - - MonitorInfo monitor((int)output, name, backlight_max); - - if(backlightIsSuported) - monitor.setBacklight(cur-min); - - monitor.setBrightness(gamma_brightness_get(output)); - - qDebug() << "Output:" << name << "added"; - monitors.append(monitor); - - } - - return monitors; -} - -void XRandrBrightness::setMonitorsSettings(QList monitors) -{ - if (!m_resources) { - return; - } - - auto *outputs = xcb_randr_get_screen_resources_current_outputs(m_resources.data()); - for (int i = 0; i < m_resources->num_outputs; ++i) { - xcb_randr_output_t output = outputs[i]; - - xcb_generic_error_t *error; - - xcb_randr_get_output_info_cookie_t output_info_cookie = xcb_randr_get_output_info (QX11Info::connection(), output, 0); - xcb_randr_get_output_info_reply_t * output_info = xcb_randr_get_output_info_reply (QX11Info::connection(), output_info_cookie, &error); - if(error != NULL) - { - qDebug() << "Error getting output_info"; - continue; - } - if(output_info == NULL) - { - qDebug() << "Error: output_info is null"; - continue; - } - - // Is connected? - if ( (xcb_randr_connection_t)(output_info->connection) != XCB_RANDR_CONNECTION_CONNECTED ) - continue; // This output is not connected. Check other - - // Is enabled? - if( output_info->crtc == 0) - continue; - xcb_randr_get_crtc_info_cookie_t crtc_info_cookie = xcb_randr_get_crtc_info_unchecked (QX11Info::connection(), output_info->crtc, 0); - xcb_randr_get_crtc_info_reply_t *crtc_info =xcb_randr_get_crtc_info_reply (QX11Info::connection(), crtc_info_cookie, &error); - if(error != NULL) - continue; - if(crtc_info == NULL && crtc_info->mode == XCB_NONE ) - continue; - - QString name = QString::fromUtf8((const char *) xcb_randr_get_output_info_name(output_info), output_info->name_len); - - // Output is connected and enabled. Get data: - bool backlightIsSuported = false; - long cur, min, max, backlight_max = -1, backlight_value = 0; - if (backlight_get(output) != -1) - { - if (backlight_get_with_range(output, cur, min, max)) - { - backlightIsSuported = true; - backlight_max = max - min; - backlight_value = cur - min; - } - } - float brightness_value = gamma_brightness_get(output); - - // Compare output info with settings and set it. - for(const MonitorInfo &monitor: monitors) - { - if(monitor.id() == (int)output && monitor.name() == name) - { - // Set settings - if(backlightIsSuported && monitor.backlight() != backlight_value) - backlight_set(output, min+monitor.backlight()); - if(monitor.brightness() != brightness_value) - gamma_brightness_set(output, monitor.brightness()); - break; - } - } - } -} - diff --git a/lxqt-config-brightness/xrandrbrightness.h b/lxqt-config-brightness/xrandrbrightness.h deleted file mode 100644 index d3a7917..0000000 --- a/lxqt-config-brightness/xrandrbrightness.h +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2010 Lukas Tinkl - * Copyright (C) 2015 Kai Uwe Broulik - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef XRANDRBRIGHTNESS_H -#define XRANDRBRIGHTNESS_H - -#include -#include - -#include -#include - -#include "monitorinfo.h" - -template using ScopedCPointer = QScopedPointer; - -class XRandrBrightness -{ -public: - XRandrBrightness(); - ~XRandrBrightness() = default; - - QList getMonitorsInfo(); - void setMonitorsSettings(QList monitors); - -private: - bool backlight_get_with_range(xcb_randr_output_t output, long &value, long &min, long &max) const; - long backlight_get(xcb_randr_output_t output) const; - void backlight_set(xcb_randr_output_t output, long value); - float gamma_brightness_get(xcb_randr_output_t output); - void gamma_brightness_set(xcb_randr_output_t output, float percent); - - xcb_atom_t m_backlight = XCB_ATOM_NONE; - ScopedCPointer m_resources; - -}; - -#endif // XRANDRBRIGHTNESS_H - diff --git a/lxqt-config-file-associations/CMakeLists.txt b/lxqt-config-file-associations/CMakeLists.txt deleted file mode 100644 index ca27020..0000000 --- a/lxqt-config-file-associations/CMakeLists.txt +++ /dev/null @@ -1,87 +0,0 @@ -project(lxqt-config-file-associations) - -set(H_FILES - mimetypedata.h - mimetypeviewer.h - applicationchooser.h -) - -set(MOC_FILES - mimetypedata.h - mimetypeviewer.h - applicationchooser.h -) - -set(CPP_FILES - mimetypedata.cpp - mimetypeviewer.cpp - applicationchooser.cpp - main.cpp -) - -set(UI_FILES - mimetypeviewer.ui - applicationchooser.ui -) - -set(QRC_FILES "") - -set(LIBRARIES - lxqt -) - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${H_FILES} - ${CPP_FILES} - ${UI_FILES} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES ${PROJECT_NAME}.desktop.in) - -#************************************************ - -add_executable(${PROJECT_NAME} - ${CPP_FILES} - ${RESOURCES} - ${QRC_FILES} - ${QM_FILES} - ${QM_LOADER} - ${DESKTOP_FILES} -) - -target_link_libraries(${PROJECT_NAME} - KF5::WindowSystem - Qt5::Xml - Qt5::DBus - Qt5::Widgets - Qt5::Concurrent - ${LIBRARIES} -) - -install(TARGETS - ${PROJECT_NAME} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" - COMPONENT Runtime -) diff --git a/lxqt-config-file-associations/applicationchooser.cpp b/lxqt-config-file-associations/applicationchooser.cpp deleted file mode 100644 index 71fd612..0000000 --- a/lxqt-config-file-associations/applicationchooser.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include "applicationchooser.h" - -Q_DECLARE_METATYPE(XdgDesktopFile*) - -ApplicationChooser::ApplicationChooser(const XdgMimeType& mimeInfo, bool showUseAlwaysCheckBox) -{ - m_MimeInfo = mimeInfo; - m_CurrentDefaultApplication = XdgDesktopFileCache::getDefaultApp(m_MimeInfo.name()); - widget.setupUi(this); - - widget.mimetypeIconLabel->setPixmap(m_MimeInfo.icon().pixmap(widget.mimetypeIconLabel->size())); - widget.mimetypeLabel->setText(m_MimeInfo.comment()); - widget.alwaysUseCheckBox->setVisible(showUseAlwaysCheckBox); - widget.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); -} - -ApplicationChooser::~ApplicationChooser() -{ -} - -int ApplicationChooser::exec() -{ - show(); - fillApplicationListWidget(); - - return QDialog::exec(); -} - - - -bool lessThan(XdgDesktopFile* a, XdgDesktopFile* b) -{ - return a && b && a->name().toLower() < b->name().toLower(); -} - -void ApplicationChooser::updateAllIcons() { - // loading all icons is very time-consuming... - QCoreApplication::processEvents(); - QTreeWidget* tree = widget.applicationTreeWidget; - int updated = 0; - int top_n = tree->topLevelItemCount(); - for(int top_i = 0; top_i < top_n; ++top_i) { - QTreeWidgetItem* parent = tree->topLevelItem(top_i); - int n = parent->childCount(); - for(int i = 0; i < n; ++i) { - QTreeWidgetItem* item = parent->child(i); - XdgDesktopFile* desktopFile = item->data(0, 32).value(); - if(Q_LIKELY(desktopFile != NULL && !desktopFile->icon().isNull())) { - item->setIcon(0, desktopFile->icon()); - ++updated; - if(updated % 8 == 0) // update the UI in batch is more efficient - QCoreApplication::processEvents(); - } - } - } - QCoreApplication::processEvents(); - QApplication::restoreOverrideCursor(); -} - -void ApplicationChooser::fillApplicationListWidget() -{ - widget.applicationTreeWidget->clear(); - - QSet addedApps; - QList applicationsThatHandleThisMimetype = XdgDesktopFileCache::getApps(m_MimeInfo.name()); - QList otherApplications; - - QStringList mimetypes; - mimetypes << m_MimeInfo.name() << m_MimeInfo.allAncestors(); - - // Adding all apps takes some time. Make the user aware by setting the - // cursor to Wait. - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - QMimeDatabase db; - foreach(const QString& mts, mimetypes) { - QMimeType mt = db.mimeTypeForName(mts); - QString heading; - heading = mt.name() == QLatin1String("application/octet-stream") ? - tr("Other applications") : - tr("Applications that handle %1").arg(mt.comment()); - - QList applications; - applications = mt.name() == QLatin1String("application/octet-stream") ? - XdgDesktopFileCache::getAllFiles() : - XdgDesktopFileCache::getApps(mt.name()); - - qSort(applications.begin(), applications.end(), lessThan); - - QTreeWidgetItem* headingItem = new QTreeWidgetItem(widget.applicationTreeWidget); - headingItem->setExpanded(true); - headingItem->setFlags(Qt::ItemIsEnabled); - headingItem->setText(0, heading); - headingItem->setSizeHint(0, QSize(0, 25)); - - addApplicationsToApplicationListWidget(headingItem, applications, addedApps); - } - connect(widget.applicationTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(selectionChanged())); - widget.applicationTreeWidget->setFocus(); - - if (!applicationsThatHandleThisMimetype.isEmpty()) { - widget.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); - } - - // delay icon update for faster loading - QTimer::singleShot(0, this, SLOT(updateAllIcons())); -} - -void ApplicationChooser::addApplicationsToApplicationListWidget(QTreeWidgetItem* parent, - QList applications, - QSet& alreadyAdded) -{ - QIcon placeHolderIcon = QIcon::fromTheme("application-x-executable"); - - if (applications.isEmpty()) - { - QTreeWidgetItem* noAppsFoundItem = new QTreeWidgetItem(parent); - noAppsFoundItem->setText(0, tr("No applications found")); - noAppsFoundItem->setFlags(0); - QFont font = noAppsFoundItem->font(0); - font.setStyle(QFont::StyleItalic); - noAppsFoundItem->setFont(0, font); - } - else - { - // Insert applications in the listwidget, skipping already added applications - foreach (XdgDesktopFile* desktopFile, applications) - { - if (alreadyAdded.contains(desktopFile)) - continue; - - // Only applications - if (desktopFile->type() != XdgDesktopFile::ApplicationType) - continue; - - QTreeWidgetItem *item = new QTreeWidgetItem(parent); - item->setIcon(0, placeHolderIcon); - item->setText(0, desktopFile->name()); - item->setData(0, 32, QVariant::fromValue(desktopFile)); - - if (desktopFile == m_CurrentDefaultApplication) - { - widget.applicationTreeWidget->setCurrentItem(item); - } - - alreadyAdded.insert(desktopFile); - } - } -} - -void ApplicationChooser::selectionChanged() -{ - widget.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - - QTreeWidgetItem* newItem = widget.applicationTreeWidget->currentItem(); - if (newItem && newItem->data(0, 32).value()) - { - widget.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); - m_CurrentDefaultApplication = newItem->data(0, 32).value(); - } -} diff --git a/lxqt-config-file-associations/applicationchooser.h b/lxqt-config-file-associations/applicationchooser.h deleted file mode 100644 index 3191163..0000000 --- a/lxqt-config-file-associations/applicationchooser.h +++ /dev/null @@ -1,61 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef _APPLICATIONCHOOSER_H -#define _APPLICATIONCHOOSER_H - -#include "ui_applicationchooser.h" -#include -#include - -class QSettings; - -class ApplicationChooser : public QDialog -{ - Q_OBJECT -public: - ApplicationChooser(const XdgMimeType& mimeInfo, bool showUseAlwaysCheckBox = false); - - virtual ~ApplicationChooser(); - XdgDesktopFile* DefaultApplication() const { return m_CurrentDefaultApplication; } - - virtual int exec(); - -private slots: - void selectionChanged(); - void updateAllIcons(); - -private: - void fillApplicationListWidget(); - - void addApplicationsToApplicationListWidget(QTreeWidgetItem* parent, - QList applications, - QSet & alreadyAdded); - XdgMimeType m_MimeInfo; - Ui::ApplicationChooser widget; - XdgDesktopFile* m_CurrentDefaultApplication; -}; - -#endif /* _APPLICATIONCHOOSER_H */ diff --git a/lxqt-config-file-associations/applicationchooser.ui b/lxqt-config-file-associations/applicationchooser.ui deleted file mode 100644 index 3015234..0000000 --- a/lxqt-config-file-associations/applicationchooser.ui +++ /dev/null @@ -1,207 +0,0 @@ - - - ApplicationChooser - - - - 0 - 0 - 385 - 417 - - - - ApplicationChooser - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - 0 - 0 - - - - - 0 - 30 - - - - - 12 - - - - Pick an application for: - - - - - - - - 0 - 0 - - - - - 30 - 30 - - - - Icon - - - - - - - Mimetype - - - - - - - - - - - 240 - 200 - - - - QAbstractItemView::NoEditTriggers - - - false - - - QAbstractItemView::SelectRows - - - false - - - false - - - true - - - false - - - - 1 - - - - - Applications that handle JPEG - - - - - - - - - New Subitem - - - - - New Subitem - - - - - - Other applications - - - - New Subitem - - - - - New Subitem - - - - - - - - - - - - - - - - Qt::LeftToRight - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - ApplicationChooser - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - ApplicationChooser - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/lxqt-config-file-associations/lxqt-config-file-associations.desktop.in b/lxqt-config-file-associations/lxqt-config-file-associations.desktop.in deleted file mode 100644 index f686f7a..0000000 --- a/lxqt-config-file-associations/lxqt-config-file-associations.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Name=File Associations -GenericName=File Association Settings -Comment=Configure applications associated with known file types -Exec=lxqt-config-file-associations -Icon=preferences-desktop-filetype-association -Categories=Settings;DesktopSettings;Qt;LXQt; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/lxqt-config-file-associations/main.cpp b/lxqt-config-file-associations/main.cpp deleted file mode 100644 index a2b04bb..0000000 --- a/lxqt-config-file-associations/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Christian Surlykke - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "mimetypeviewer.h" -#include - -int main (int argc, char **argv) -{ - LXQt::SingleApplication app(argc, argv); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Config File Associations")); - const QString VERINFO = QStringLiteral(LXQT_CONFIG_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - app.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(app); - - MimetypeViewer mimetypeViewer; - app.setActivationWindow(&mimetypeViewer); - mimetypeViewer.setWindowIcon(QIcon::fromTheme("preferences-desktop-filetype-association")); - mimetypeViewer.show(); - - return app.exec(); - qDebug() << "Efter exec"; -} - diff --git a/lxqt-config-file-associations/mimetypedata.cpp b/lxqt-config-file-associations/mimetypedata.cpp deleted file mode 100644 index 8967796..0000000 --- a/lxqt-config-file-associations/mimetypedata.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2014 LXQt team - * Authors: - * Luís Pereira - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - - -#include "mimetypedata.h" - -MimeTypeData::MimeTypeData() -{ -} - - -MimeTypeData::MimeTypeData(const XdgMimeType& mime) -{ - mName = mime.name(); - mPatterns = mime.globPatterns().join(" "); - mComment = mime.comment(); -} - - -bool MimeTypeData::matches(const QString &filter) const -{ - if (mName.contains(filter) || mPatterns.contains(filter) || - mComment.contains(filter)) { - return true; - } else { - return false; - } -} diff --git a/lxqt-config-file-associations/mimetypedata.h b/lxqt-config-file-associations/mimetypedata.h deleted file mode 100644 index 47f33bc..0000000 --- a/lxqt-config-file-associations/mimetypedata.h +++ /dev/null @@ -1,54 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2014 LXQt team - * Authors: - * Luís Pereira - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - - -#ifndef MIMETYPEDATA_H -#define MIMETYPEDATA_H - -#include -#include - - -class MimeTypeData { -public: - MimeTypeData(); - MimeTypeData(const XdgMimeType& mime); - - QString inline name() const { return mName; }; - QString inline patterns() const { return mPatterns; }; - QString inline comment() const { return mComment; }; - - bool matches(const QString& filter) const; - -private: - QString mName; - QString mPatterns; - QString mComment; -}; - -Q_DECLARE_METATYPE(MimeTypeData) -#endif // MIMETYPEDATA_H diff --git a/lxqt-config-file-associations/mimetypeitemmodel.cpp b/lxqt-config-file-associations/mimetypeitemmodel.cpp deleted file mode 100644 index 0e1fd44..0000000 --- a/lxqt-config-file-associations/mimetypeitemmodel.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* -* Copyright (c) Christian Surlykke -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license, and -* the AUTHORS file for copyright and authorship information. -*/ - -#include -#include - -#include "mimetypeitemmodel.h" -#include - -/* - * Implementation note: - * - * MimetypeItemModel is an implementation of QAbstractItemModel with XdgMimeInfoCache as backing store. - * - * There are 2 levels of items in this model: mediatype ('application', 'audio', 'image' etc.) and - * subtype ('application/pdf' which is a child of 'application' or 'image/jpeg' which is a child of 'image'. - * - * A QModelIndex for a mediatype has a zero internal pointer. - * - * A QModelIndex for a subtype has an internal pointer to the XdgMimeInfo for that subtype - so the QModelIndex for - * 'image/jpeg' has an internal pointer that points to the XdgMineInfo for 'image/jpeg' which is held in XdgMimeInfoCache. - * - * QModelIndexes for mediatypes have no parents, and QModelIndexes for subtypes have no children. - */ - - -MimetypeItemModel::MimetypeItemModel(QObject *parent) : -QAbstractItemModel(parent) -{ -} - -MimetypeItemModel::~MimetypeItemModel() -{ -} - -QVariant MimetypeItemModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) - { - return QVariant(); - } - - XdgMimeInfo *mimeInfo = 0; - QString text; - - if (index.parent().isValid()) - { - mimeInfo = static_cast(index.internalPointer()); - text = mimeInfo->subType(); - } - else - { - text = XdgMimeInfoCache::mediatypes().value(index.row()); - } - - switch (role) - { - case Qt::DisplayRole : return QVariant(text); - case MimeInfoRole : return QVariant::fromValue(mimeInfo); - default : return QVariant(); - } -} - -QModelIndex MimetypeItemModel::index(int row, int column, const QModelIndex& parent) const -{ - if (column != 0) - { - return QModelIndex(); - } - - if (parent.isValid()) - { - if (parent.row() >= XdgMimeInfoCache::mediatypes().size()) - { - return QModelIndex(); - } - - QString mediatype = XdgMimeInfoCache::mediatypes().value(parent.row()); - - if (row >= XdgMimeInfoCache::subtypes(mediatype).size()) - { - return QModelIndex(); - } - - QString subtype = XdgMimeInfoCache::subtypes(mediatype).value(row); - - XdgMimeInfo* mimeInfo = XdgMimeInfoCache::xdgMimeInfo(mediatype, subtype); - return createIndex(row, 0, mimeInfo); - } - else - { - if (row >= XdgMimeInfoCache::mediatypes().size()) - { - return QModelIndex(); - } - - return createIndex(row, 0); - } -} - -QModelIndex MimetypeItemModel::parent(const QModelIndex& index) const -{ - if (index.isValid() && index.internalPointer()) - { - XdgMimeInfo* mimeInfo = static_cast(index.internalPointer()); - - int row = XdgMimeInfoCache::mediatypes().indexOf(mimeInfo->mediaType()); - return createIndex(row, 0); - } - else - { - return QModelIndex(); - } -} - - -int MimetypeItemModel::rowCount(const QModelIndex& parent) const -{ - if (parent.column() > 0) - { - return 0; - } - - if (parent.parent().isValid()) - { - return 0; - } - else if (parent.isValid()) - { - QString media = XdgMimeInfoCache::mediatypes().value(parent.row()); - return XdgMimeInfoCache::subtypes(media).size(); - } - else - { - return XdgMimeInfoCache::mediatypes().size(); - } -} - - -MimetypeFilterItemModel::MimetypeFilterItemModel(QObject* parent) : - QSortFilterProxyModel(parent) -{ -} - -bool MimetypeFilterItemModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const -{ - QModelIndex index = sourceModel()->index(source_row, 0, source_parent); - - if (source_parent.isValid()) - { - return filterHelper(index); - } - else - { - for (int i = 0; i < sourceModel()->rowCount(index); i++) - { - if (filterAcceptsRow(i, index)) - { - return true; - } - } - } - - return false; -} - -bool MimetypeFilterItemModel::filterHelper(QModelIndex& source_index) const -{ - XdgMimeInfo* mimeInfo = source_index.data(MimeInfoRole).value(); - if (!mimeInfo) - { - return false; - } - - if (mimeInfo->mimeType().contains(filterRegExp())) - { - return true; - } - - if (mimeInfo->comment().contains(filterRegExp())) - { - return true; - } - - foreach (const QString &pattern, mimeInfo->patterns()) - { - if (pattern.contains(filterRegExp())) - { - return true; - } - } - - return false; -} diff --git a/lxqt-config-file-associations/mimetypeitemmodel.h b/lxqt-config-file-associations/mimetypeitemmodel.h deleted file mode 100644 index 5155aa7..0000000 --- a/lxqt-config-file-associations/mimetypeitemmodel.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* Copyright (c) Christian Surlykke -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license, and -* the AUTHORS file for copyright and authorship information. -*/ - -#ifndef MIMETYPEITEMMODEL_H -#define MIMETYPEITEMMODEL_H - -#include -#include - -#include - -// Used for MimetypeItemModel::data to return a QVariant wrapping an XdgMimeInfo* -#define MimeInfoRole 32 - -Q_DECLARE_METATYPE(XdgMimeInfo*) - -/*! - * - */ -class MimetypeItemModel : public QAbstractItemModel -{ -public: - MimetypeItemModel(QObject *parent = 0); - virtual ~MimetypeItemModel(); - - QVariant data(const QModelIndex &index, int role) const; - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const {return 1;} -}; - -class MimetypeFilterItemModel : public QSortFilterProxyModel -{ -public: - MimetypeFilterItemModel(QObject *parent = 0); - - bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const; - - bool filterHelper(QModelIndex& source_index) const; -}; - - -#endif /* MIMETYPEITEMMODEL_H */ - diff --git a/lxqt-config-file-associations/mimetypeviewer.cpp b/lxqt-config-file-associations/mimetypeviewer.cpp deleted file mode 100644 index 6277517..0000000 --- a/lxqt-config-file-associations/mimetypeviewer.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Christian Surlykke - * 2014 Luís Pereira - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -#include "mimetypeviewer.h" -#include "ui_mimetypeviewer.h" - -#include "applicationchooser.h" - - -enum ItemTypeEntries { - GroupType = 1001, - EntrieType = 1002 -}; - -static bool mimeTypeLessThan(const QMimeType& m1, const QMimeType& m2) -{ - return m1.name() < m2.name(); -} - -void MimetypeViewer::loadAllMimeTypes() -{ - mediaTypes.clear(); - mGroupItems.clear(); - mItemList.clear(); - QStringList selectedMimeTypes; - - QMimeDatabase db; - QList mimetypes = db.allMimeTypes(); - - qSort(mimetypes.begin(), mimetypes.end(), mimeTypeLessThan); - foreach (const QMimeType &mt, mimetypes) { - const QString mimetype = mt.name(); - const int i = mimetype.indexOf(QLatin1Char('/')); - const QString mediaType = mimetype.left(i); - const QString subType = mimetype.mid(i + 1); - - MimeTypeData* data = new MimeTypeData(mt); - - if (!mediaTypes.contains(mediaType)) { // A new type of media - mediaTypes.append(mediaType); - QTreeWidgetItem *item = new QTreeWidgetItem(widget.mimetypeTreeWidget, GroupType); - item->setText(0, mediaType); - widget.mimetypeTreeWidget->insertTopLevelItem(0, item); - mGroupItems.insert(mediaType, item); - } - QTreeWidgetItem *item = new QTreeWidgetItem(mGroupItems.value(mediaType), EntrieType); - QVariant v; - v.setValue(*data); - item->setData(0, Qt::UserRole, v); - item->setText(0, subType); - mItemList.append(item); - } - - widget.mimetypeTreeWidget->resizeColumnToContents(1); - widget.mimetypeTreeWidget->show(); -} - - -MimetypeViewer::MimetypeViewer(QWidget *parent) - : QDialog(parent) -{ - widget.setupUi(this); - addSearchIcon(); - widget.searchTermLineEdit->setEnabled(false); - - connect(widget.searchTermLineEdit, SIGNAL(textChanged(const QString&)), - this, SLOT(filter(const QString&))); - - connect(widget.chooseApplicationsButton, SIGNAL(clicked()), this, SLOT(chooseApplication())); - connect(widget.dialogButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonBoxClicked(QAbstractButton*))); - - QString mimeappsListPath(XdgDirs::configHome(true) + "/mimeapps.list"); - mDefaultsList = new QSettings(mimeappsListPath, XdgDesktopFileCache::desktopFileSettingsFormat(), this); - mSettingsCache = new LXQt::SettingsCache(mDefaultsList); - mSettingsCache->loadFromSettings(); - initializeMimetypeTreeView(); - loadAllMimeTypes(); - widget.searchTermLineEdit->setFocus(); - - connect(widget.mimetypeTreeWidget, SIGNAL(itemSelectionChanged()), - this, SLOT(currentMimetypeChanged())); -} - -MimetypeViewer::~MimetypeViewer() -{ -} - -void MimetypeViewer::addSearchIcon() -{ - QIcon searchIcon = QIcon::fromTheme("system-search"); - if (searchIcon.isNull()) - return; - - widget.searchTermLineEdit->setTextMargins(0, 0, 30, 0); - QHBoxLayout *hBoxLayout = new QHBoxLayout(widget.searchTermLineEdit); - hBoxLayout->setContentsMargins(0,0,0,0); - widget.searchTermLineEdit->setLayout(hBoxLayout); - QLabel *searchIconLabel = new QLabel(widget.searchTermLineEdit); - searchIconLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - searchIconLabel->setMinimumHeight(30); - searchIconLabel->setMinimumWidth(30); - - searchIconLabel->setPixmap(searchIcon.pixmap(QSize(20,20))); - hBoxLayout->addWidget(searchIconLabel, 0, Qt::AlignRight | Qt::AlignVCenter); -} - - -void MimetypeViewer::initializeMimetypeTreeView() -{ - currentMimetypeChanged(); - widget.mimetypeTreeWidget->setColumnCount(2); - widget.searchTermLineEdit->setEnabled(true); -} - -void MimetypeViewer::currentMimetypeChanged() -{ - widget.iconLabel->hide(); - widget.descriptionLabel->setText(tr("None")); - widget.mimetypeGroupBox->setEnabled(false); - - widget.patternsLabel->clear(); - widget.patternsGroupBox->setEnabled(false); - - widget.appIcon->hide(); - widget.applicationLabel->clear(); - widget.applicationsGroupBox->setEnabled(false); - - QTreeWidgetItem *sel = widget.mimetypeTreeWidget->currentItem(); - - if (!sel || sel->type() == GroupType) { - return; - } - - MimeTypeData mimeData = sel->data(0, Qt::UserRole).value(); - - QMimeDatabase db; - XdgMimeType mt = db.mimeTypeForName(mimeData.name()); - if (mt.name().isEmpty()) - return; - - m_CurrentMime = mt; - - widget.descriptionLabel->setText(mimeData.comment()); - - QIcon icon = m_CurrentMime.icon(); - if (! icon.isNull()) - { - widget.iconLabel->setPixmap(icon.pixmap(widget.iconLabel->size())); - widget.iconLabel->show(); - } - - widget.mimetypeGroupBox->setEnabled(true); - widget.patternsLabel->setText(mimeData.patterns()); - widget.patternsGroupBox->setEnabled(true); - - XdgDesktopFile* defaultApp = XdgDesktopFileCache::getDefaultApp(m_CurrentMime.name()); - if (defaultApp && defaultApp->isValid()) - { - QString nonLocalizedName = defaultApp->value("Name").toString(); - QString localizedName = defaultApp->localizedValue("Name", nonLocalizedName).toString(); - QIcon appIcon = defaultApp->icon(); - widget.appIcon->setPixmap(appIcon.pixmap(widget.iconLabel->size())); - widget.appIcon->show(); - widget.applicationLabel->setText(localizedName); - widget.chooseApplicationsButton->setText(tr("&Change...")); - } - else - { - widget.applicationLabel->setText(tr("None")); - widget.chooseApplicationsButton->setText(tr("&Choose...")); - } - - widget.applicationsGroupBox->setEnabled(true); - -} - -void MimetypeViewer::filter(const QString& pattern) -{ - QMimeDatabase db; - MimeTypeData mimeData; - - for (int i = 0; i < widget.mimetypeTreeWidget->topLevelItemCount(); ++i) { - widget.mimetypeTreeWidget->topLevelItem(i)->setHidden(true); - } - - foreach(QTreeWidgetItem* it, mItemList) { - mimeData = it->data(0, Qt::UserRole).value(); - if (pattern.isEmpty() || mimeData.matches(pattern)) { - const int i = mimeData.name().indexOf(QLatin1Char('/')); - const QString mediaType = mimeData.name().left(i); - QTreeWidgetItem* groupItem = mGroupItems.value(mediaType); - Q_ASSERT(groupItem); - if (groupItem) { - groupItem->setHidden(false); - it->setHidden(false); - } - } else { - it->setHidden(true); - } - } -} - - -void MimetypeViewer::chooseApplication() -{ - ApplicationChooser applicationChooser(m_CurrentMime); - if (applicationChooser.exec() == QDialog::Accepted && applicationChooser.DefaultApplication()) - { - QString fileNameNoPath = QFileInfo(applicationChooser.DefaultApplication()->fileName()).fileName(); - mDefaultsList->beginGroup("Default Applications"); - mDefaultsList->setValue(m_CurrentMime.name(), fileNameNoPath); - mDefaultsList->endGroup(); - currentMimetypeChanged(); - } - widget.mimetypeTreeWidget->setFocus(); -} - -void MimetypeViewer::dialogButtonBoxClicked(QAbstractButton* button) -{ - QDialogButtonBox::ButtonRole role = widget.dialogButtonBox->buttonRole(button); - if (role == QDialogButtonBox::ResetRole) - { - mSettingsCache->loadToSettings(); - currentMimetypeChanged(); - } - else - { - close(); - } -} - diff --git a/lxqt-config-file-associations/mimetypeviewer.h b/lxqt-config-file-associations/mimetypeviewer.h deleted file mode 100644 index eb7aab4..0000000 --- a/lxqt-config-file-associations/mimetypeviewer.h +++ /dev/null @@ -1,69 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Christian Surlykke - * 2014 Luís Pereira - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef _MIMETYPEVIEWER_H -#define _MIMETYPEVIEWER_H - -#include -#include - -#include - -#include "mimetypedata.h" -#include "ui_mimetypeviewer.h" - -class QSettings; - -namespace LXQt { -class SettingsCache; -} - -class MimetypeViewer : public QDialog { - Q_OBJECT -public: - MimetypeViewer(QWidget *parent = 0); - virtual ~MimetypeViewer(); - -private slots: - void initializeMimetypeTreeView(); - void currentMimetypeChanged(); - void filter(const QString&); - void chooseApplication(); - void dialogButtonBoxClicked(QAbstractButton *button); - -private: - void addSearchIcon(); - void loadAllMimeTypes(); - XdgMimeType m_CurrentMime; - QSettings* mDefaultsList; - LXQt::SettingsCache *mSettingsCache; - Ui::mimetypeviewer widget; - QStringList mediaTypes; - QList mItemList; - QMap mGroupItems; -}; - -#endif /* _MIMETYPEVIEWER_H */ diff --git a/lxqt-config-file-associations/mimetypeviewer.ui b/lxqt-config-file-associations/mimetypeviewer.ui deleted file mode 100644 index 2d1daa0..0000000 --- a/lxqt-config-file-associations/mimetypeviewer.ui +++ /dev/null @@ -1,275 +0,0 @@ - - - mimetypeviewer - - - - 0 - 0 - 565 - 370 - - - - - 530 - 370 - - - - File Associations - - - - - - true - - - - 0 - 0 - - - - - 280 - 260 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - 10 - 170 - 260 - 140 - - - - Default application - - - - - 140 - 90 - 110 - 30 - - - - &Choose... - - - - - - 10 - 20 - 241 - 51 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 50 - 50 - - - - TextLabel - - - - - - - None - - - 10 - - - - - - - - - - 10 - 100 - 260 - 60 - - - - Patterns - - - - - 10 - 20 - 230 - 30 - - - - *.txt *.xml - - - true - - - - - - - 10 - 0 - 260 - 90 - - - - MIME type - - - - - - - 0 - 0 - - - - - 50 - 50 - - - - Icon - - - - - - - Description - - - true - - - - - - - - - - - - 0 - 30 - - - - - - - - - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - 0 - 0 - - - - - 180 - 275 - - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - false - - - 0 - - - false - - - 500 - - - - - - - searchTermLineEdit - mimetypeTreeWidget - chooseApplicationsButton - - - - diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ar.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_ar.desktop deleted file mode 100644 index 538a087..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ar.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ar]=ارتباطات الملفّات -GenericName[ar]=إعدادات ارتباطات الملفّات -Comment[ar]=اضبط التّطبيقات المرتبطة بأنواع الملفّات المعروفة diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ca.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_ca.desktop deleted file mode 100644 index 9920c27..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ca.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ca]=Associacions dels fitxers -GenericName[ca]=Ajusts de les associacions dels fitxers -Comment[ca]=Configureu les aplicacions associades amb els tipus de fitxers coneguts diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_da.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_da.desktop deleted file mode 100644 index 41dc557..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_da.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[da]=Filtilknytninger -GenericName[da]=Filtilknytningsindstillinger -Comment[da]=Konfigurér programmer tilknyttet kendte filtyper diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_de.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_de.desktop deleted file mode 100644 index 8c8ae89..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_de.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[de]=Dateizuordnungen -GenericName[de]=Setzen von Dateizuordnungen -Comment[de]=Zuordnen von Dateitypen zu Anwendungsprogrammen diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_el.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_el.desktop deleted file mode 100644 index 4953479..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_el.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[el]=Συσχετίσεις αρχείων -GenericName[el]=Ρυθμίσεις των συσχετίσεων αρχείων -Comment[el]=Διαμόρφωση της συσχέτισης των εφαρμογών με γνωστούς τύπους αρχείων diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_fr.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_fr.desktop deleted file mode 100644 index 3d68e6c..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[fr]=Association des fichiers -GenericName[fr]=Paramètres d'association des fichiers -Comment[fr]=Configurer les applications associées avec les types de fichier diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_hu.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_hu.desktop deleted file mode 100644 index 8dfdf40..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_hu.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[hu]=Fájlhozzárendelések -GenericName[hu]=Fájltípusok hozzárendelése -Comment[hu]=Fájltípusok hozzárandelése programokhoz diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_it.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_it.desktop deleted file mode 100644 index 70fac81..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_it.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[it]=Associazioni file -GenericName[it]=Imposta le associazioni file -Comment[it]=Imposta le associazioni file per le applicazioni installate diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ja.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_ja.desktop deleted file mode 100644 index 8213df7..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ja.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ja]=既知のファイル種類に対するアプリケーション関連付けの設定 -GenericName[ja]=ファイル関連付けの設定 -Name[ja]=ファイル関連付け diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_lt.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_lt.desktop deleted file mode 100644 index 2d9638f..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_lt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[lt]=Failų susiejimai -GenericName[lt]=Failų susiejimų nustatymai -Comment[lt]=Konfigūruoti su žinomais failų tipais susietas programas diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_pl_PL.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_pl_PL.desktop deleted file mode 100644 index 1dc89d0..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_pl_PL.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[pl]=Skojarzenia plików -GenericName[pl]=Ustawienia skojarzeń plików -Comment[pl]=Ustawienia domyślnych programów dla danego typu pliku diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_pt.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_pt.desktop deleted file mode 100644 index 49ffd2a..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_pt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[pt]=Associação de ficheiros -GenericName[pt]=Definições de associação de ficheiros -Comment[pt]=Configurar associação de ficheiros para os tipos de ficheiro conhecidos diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ru.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_ru.desktop deleted file mode 100644 index 3a1697e..0000000 --- a/lxqt-config-file-associations/translations/lxqt-config-file-associations_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ru]=Настроить приложения, ассоциированные с известными типами файлов -GenericName[ru]=Настройки ассоциации файлов -Name[ru]=Ассоциация файлов \ No newline at end of file diff --git a/lxqt-config-input/CMakeLists.txt b/lxqt-config-input/CMakeLists.txt deleted file mode 100644 index cad1b83..0000000 --- a/lxqt-config-input/CMakeLists.txt +++ /dev/null @@ -1,92 +0,0 @@ -project(lxqt-config-input) -find_package(X11 REQUIRED) - -include_directories( - ${X11_INCLUDE_DIR} - "${CMAKE_CURRENT_SOURCE_DIR}/../liblxqt-config-cursor" -) - -set(lxqt-config-input_HDRS - keyboardconfig.h - mouseconfig.h - mouseconfig.h - keyboardlayoutconfig.h - selectkeyboardlayoutdialog.h -) - -set(lxqt-config-input_SRCS - lxqt-config-input.cpp - keyboardconfig.cpp - mouseconfig.cpp - keyboardlayoutconfig.cpp - selectkeyboardlayoutdialog.cpp -) - -set(lxqt-config-input_UIS - mouseconfig.ui - keyboardconfig.ui - keyboardlayoutconfig.ui - selectkeyboardlayoutdialog.ui -) - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${lxqt-config-input_HDRS} - ${lxqt-config-input_SRCS} - ${lxqt-config-input_UIS} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES ${PROJECT_NAME}.desktop.in) - -#************************************************ - -add_definitions( - -DPACKAGE_DATA_DIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt-config-input" -) - -add_executable(lxqt-config-input - ${lxqt-config-input_SRCS} - ${DESKTOP_FILES} - ${QM_FILES} - ${QM_LOADER} -) - -target_link_libraries(lxqt-config-input - Qt5::Widgets - Qt5::X11Extras - ${X11_LIBRARIES} - lxqt - lxqt-config-cursor -) - -set_target_properties(lxqt-config-input - PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}/${LXQT_CONFIG_PROJECT}" -) - -install(TARGETS - lxqt-config-input - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" - COMPONENT Runtime -) diff --git a/lxqt-config-input/data/input-keyboard.png b/lxqt-config-input/data/input-keyboard.png deleted file mode 100644 index 80d8774..0000000 Binary files a/lxqt-config-input/data/input-keyboard.png and /dev/null differ diff --git a/lxqt-config-input/data/input-mouse.png b/lxqt-config-input/data/input-mouse.png deleted file mode 100644 index 50c4cf6..0000000 Binary files a/lxqt-config-input/data/input-mouse.png and /dev/null differ diff --git a/lxqt-config-input/keyboardconfig.cpp b/lxqt-config-input/keyboardconfig.cpp deleted file mode 100644 index 996d24d..0000000 --- a/lxqt-config-input/keyboardconfig.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - Copyright (C) 2013-2014 Hong Jen Yee (PCMan) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#include "keyboardconfig.h" -#include -#include -#include -#include -#include -#include -#include - -// FIXME: how to support XCB or Wayland? -#include -#include -#include - -#ifdef Q_WS_X11 -extern void qt_x11_apply_settings_in_all_apps(); -#endif - -KeyboardConfig::KeyboardConfig(LXQt::Settings* _settings, QSettings* _qtSettings, QWidget* parent): - QWidget(parent), - settings(_settings), - qtSettings(_qtSettings), - delay(500), - oldDelay(500), - interval(30), - oldInterval(30), - beep(true), - oldBeep(true), - numlock(false) { - - ui.setupUi(this); - - /* read the config flie */ - loadSettings(); - initControls(); - - // set_range_stops(ui.keyboardDelay, 10); - connect(ui.keyboardDelay, SIGNAL(valueChanged(int)), SLOT(onKeyboardSliderChanged(int))); - // set_range_stops(ui.keyboardInterval, 10); - connect(ui.keyboardInterval, SIGNAL(valueChanged(int)), SLOT(onKeyboardSliderChanged(int))); - connect(ui.keyboardBeep, SIGNAL(toggled(bool)), SLOT(onKeyboardBeepToggled(bool))); - connect(ui.cursorFlashTime, SIGNAL(valueChanged(int)), SLOT(onCorsorFlashTimeChanged(int))); - connect(ui.keyboardNumLock, SIGNAL(toggled(bool)), SLOT(onKeyboardNumLockToggled(bool))); -} - -KeyboardConfig::~KeyboardConfig() { - -} - -void KeyboardConfig::initControls() { - ui.keyboardDelay->setValue(delay); - ui.keyboardInterval->setValue(interval); - ui.keyboardBeep->setChecked(beep); - ui.keyboardNumLock->setChecked(numlock); - - qtSettings->beginGroup(QLatin1String("Qt")); - int value = qtSettings->value(QLatin1String("cursorFlashTime"), 1000).toInt(); - ui.cursorFlashTime->setValue(value); - qtSettings->endGroup(); -} - -void KeyboardConfig::onKeyboardSliderChanged(int value) { - QSlider* slider = static_cast(sender()); - - if(slider == ui.keyboardDelay) - delay = value; - else if(slider == ui.keyboardInterval) - interval = value; - - /* apply keyboard values */ - XkbSetAutoRepeatRate(QX11Info::display(), XkbUseCoreKbd, delay, interval); - - accept(); -} - -void KeyboardConfig::onKeyboardBeepToggled(bool checked) { - XKeyboardControl values; - beep = checked; - values.bell_percent = beep ? -1 : 0; - XChangeKeyboardControl(QX11Info::display(), KBBellPercent, &values); - - accept(); -} - -void KeyboardConfig::onKeyboardNumLockToggled(bool checked) { - numlock = checked; - accept(); -} - -void KeyboardConfig::onCorsorFlashTimeChanged(int value) -{ - qtSettings->beginGroup(QLatin1String("Qt")); - qtSettings->setValue(QLatin1String("cursorFlashTime"), value); - qtSettings->endGroup(); - qtSettings->sync(); -#ifdef Q_WS_X11 - qt_x11_apply_settings_in_all_apps(); -#endif -} - - -void KeyboardConfig::loadSettings() { - settings->beginGroup("Keyboard"); - oldDelay = delay = settings->value("delay", 500).toInt(); - oldInterval = interval = settings->value("interval", 30).toInt(); - oldBeep = beep = settings->value("beep", true).toBool(); - numlock = settings->value("numlock", false).toBool(); - settings->endGroup(); -} - -void KeyboardConfig::accept() { - settings->beginGroup("Keyboard"); - settings->setValue("delay", delay); - settings->setValue("interval", interval); - settings->setValue("beep", beep); - settings->setValue("numlock", numlock); - settings->endGroup(); -} - -void KeyboardConfig::reset() { - /* restore to original settings */ - /* keyboard */ - delay = oldDelay; - interval = oldInterval; - beep = oldBeep; - XkbSetAutoRepeatRate(QX11Info::display(), XkbUseCoreKbd, delay, interval); - /* FIXME: beep? */ - - initControls(); - accept(); -} diff --git a/lxqt-config-input/keyboardconfig.h b/lxqt-config-input/keyboardconfig.h deleted file mode 100644 index 505edc3..0000000 --- a/lxqt-config-input/keyboardconfig.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2013-2014 Hong Jen Yee (PCMan) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#ifndef KEYBOARDCONFIG_H -#define KEYBOARDCONFIG_H - -#include -#include "ui_keyboardconfig.h" - -namespace LXQt { - class Settings; -} -class QSettings; - -class KeyboardConfig : public QWidget { - Q_OBJECT - -public: - KeyboardConfig(LXQt::Settings* _settings, QSettings* _qtSettings, QWidget* parent = 0); - virtual ~KeyboardConfig(); - - void accept(); - -public Q_SLOTS: - void reset(); - -private: - void setLeftHandedMouse(); - void loadSettings(); - void initControls(); - -private Q_SLOTS: - void onKeyboardSliderChanged(int value); - void onKeyboardBeepToggled(bool checked); - void onCorsorFlashTimeChanged(int value); - void onKeyboardNumLockToggled(bool checked); - -private: - Ui::KeyboardConfig ui; - LXQt::Settings* settings; - QSettings* qtSettings; - int delay; - int oldDelay; - int interval; - int oldInterval; - bool beep; - bool oldBeep; - bool numlock; -}; - -#endif // KEYBOARDCONFIG_H diff --git a/lxqt-config-input/keyboardconfig.ui b/lxqt-config-input/keyboardconfig.ui deleted file mode 100644 index 99647f9..0000000 --- a/lxqt-config-input/keyboardconfig.ui +++ /dev/null @@ -1,208 +0,0 @@ - - - KeyboardConfig - - - - 0 - 0 - 375 - 276 - - - - Form - - - - - - Cursor flash time: - - - - - - - <b>Keyboard</b> - - - - - - - Beep when there is an error of keyboard input - - - - - - - ms - - - 10000 - - - - - - - Character Repeat - - - - - - - - - 10 - - - 210 - - - 10 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - Long - - - - - - - 100 - - - 1100 - - - 100 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - Repeat delay: - - - - - - - Short - - - - - - - Repeat interval: - - - - - - - Type in the following box to test your keyboard settings - - - - - - - Short - - - - - - - Long - - - - - - - 0 - - - - - - - 0 - - - - - - - - - - Turn on NumLock after login - - - - - - - - - keyboardDelay - valueChanged(int) - label_16 - setNum(int) - - - 245 - 65 - - - 405 - 70 - - - - - keyboardInterval - valueChanged(int) - label_17 - setNum(int) - - - 198 - 93 - - - 403 - 97 - - - - - diff --git a/lxqt-config-input/keyboardlayoutconfig.cpp b/lxqt-config-input/keyboardlayoutconfig.cpp deleted file mode 100644 index 7bbe6a0..0000000 --- a/lxqt-config-input/keyboardlayoutconfig.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* - * - * Copyright (C) 2014 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "keyboardlayoutconfig.h" -#include -#include -#include -#include -#include "selectkeyboardlayoutdialog.h" -#include - -KeyboardLayoutConfig::KeyboardLayoutConfig(LXQt::Settings* _settings, QWidget* parent): - QWidget(parent), - settings(_settings) { - ui.setupUi(this); - - loadLists(); - loadSettings(); - initControls(); - - connect(ui.addLayout, SIGNAL(clicked(bool)), SLOT(onAddLayout())); - connect(ui.removeLayout, SIGNAL(clicked(bool)), SLOT(onRemoveLayout())); - connect(ui.moveUp, SIGNAL(clicked(bool)), SLOT(onMoveUp())); - connect(ui.moveDown, SIGNAL(clicked(bool)), SLOT(onMoveDown())); - connect(ui.keyboardModel, SIGNAL(currentIndexChanged(int)), SLOT(accept())); - connect(ui.switchKey, SIGNAL(currentIndexChanged(int)), SLOT(accept())); -} - -KeyboardLayoutConfig::~KeyboardLayoutConfig() { -} - -void KeyboardLayoutConfig::loadSettings() { - // load current settings from the output of setxkbmap command - QProcess setxkbmap; - setxkbmap.start(QLatin1String("setxkbmap -query -verbose 5")); - setxkbmap.waitForFinished(); - if(setxkbmap.exitStatus() == QProcess::NormalExit) { - QList layouts, variants; - while(!setxkbmap.atEnd()) { - QByteArray line = setxkbmap.readLine(); - if(line.startsWith("model:")) { - keyboardModel_ = QString::fromLatin1(line.mid(6).trimmed()); - } - else if(line.startsWith("layout:")) { - layouts = line.mid(7).trimmed().split(','); - } - else if(line.startsWith("variant:")) { - variants = line.mid(8).trimmed().split(','); - } - else if(line.startsWith("options:")) { - const QList options = line.mid(9).trimmed().split(','); - Q_FOREACH(const QByteArray &option, options) { - if(option.startsWith("grp:")) - switchKey_ = QString::fromLatin1(option); - else - currentOptions_ << QString::fromLatin1(option); - } - } - } - - const int size = layouts.size(), variantsSize = variants.size(); - for(int i = 0; i < size; ++i) { - currentLayouts_.append(QPair(layouts.at(i), variantsSize > 0 ? variants.at(i) : QString())); - } - - setxkbmap.close(); - } -} - -enum ListSection{ - NoSection, - ModelSection, - LayoutSection, - VariantSection, - OptionSection -}; - -void KeyboardLayoutConfig::loadLists() { - // load known lists from xkb data files - // XKBD_BASELIST_PATH is os dependent see keyboardlayoutconfig.h - QFile file(QLatin1String(XKBD_BASELIST_PATH)); - if(file.open(QIODevice::ReadOnly)) { - ListSection section = NoSection; - while(!file.atEnd()) { - QByteArray line = file.readLine().trimmed(); - if(section == NoSection) { - if(line.startsWith("! model")) - section = ModelSection; - else if(line.startsWith("! layout")) - section = LayoutSection; - else if(line.startsWith("! variant")) - section = VariantSection; - else if(line.startsWith("! option")) - section = OptionSection; - } - else { - if(line.isEmpty()) { - section = NoSection; - continue; - } - int sep = line.indexOf(' '); - QString name = QString::fromLatin1(line, sep); - while(line[sep] == ' ') // skip spaces - ++sep; - QString description = QString::fromUtf8(line.constData() + sep); - - switch(section) { - case ModelSection: { - ui.keyboardModel->addItem(description, name); - break; - } - case LayoutSection: - knownLayouts_[name] = KeyboardLayoutInfo(description); - break; - case VariantSection: { - // the descriptions of variants are prefixed by their language ids - sep = description.indexOf(": "); - if(sep >= 0) { - QString lang = description.left(sep); - QMap::iterator it = knownLayouts_.find(lang); - if(it != knownLayouts_.end()) { - KeyboardLayoutInfo& info = *it; - info.variants.append(LayoutVariantInfo(name, description.mid(sep + 2))); - } - } - break; - } - case OptionSection: - if(line.startsWith("grp:")) { // key used to switch to another layout - ui.switchKey->addItem(description, name); - } - break; - default:; - } - } - } - file.close(); - } -} - -void KeyboardLayoutConfig::initControls() { - QList >::iterator it; - for(it = currentLayouts_.begin(); it != currentLayouts_.end(); ++it) { - QString name = it->first; - QString variant = it->second; - addLayout(name, variant); - } - - int n = ui.keyboardModel->count(); - int row; - for(row = 0; row < n; ++row) { - if(ui.keyboardModel->itemData(row, Qt::UserRole).toString() == keyboardModel_) { - ui.keyboardModel->setCurrentIndex(row); - break; - } - } - - n = ui.switchKey->count(); - for(row = 0; row < n; ++row) { - if(ui.switchKey->itemData(row, Qt::UserRole).toString() == switchKey_) { - ui.switchKey->setCurrentIndex(row); - break; - } - } - -} - -void KeyboardLayoutConfig::addLayout(QString name, QString variant) { - qDebug() << "add" << name << variant; - const KeyboardLayoutInfo& info = knownLayouts_.value(name); - QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setData(0, Qt::DisplayRole, info.description); - item->setData(0, Qt::UserRole, name); - const LayoutVariantInfo* vinfo = info.findVariant(variant); - if(vinfo) { - item->setData(1, Qt::DisplayRole, vinfo->description); - item->setData(1, Qt::UserRole, variant); - } - ui.layouts->addTopLevelItem(item); -} - -void KeyboardLayoutConfig::reset() { - ui.layouts->clear(); - initControls(); - accept(); -} - -void KeyboardLayoutConfig::accept() { - // call setxkbmap to apply the changes - QProcess setxkbmap; - // clear existing options - setxkbmap.start("setxkbmap -option"); - setxkbmap.waitForFinished(); - setxkbmap.close(); - - QString command = "setxkbmap"; - // set keyboard model - QString model; - int cur_model = ui.keyboardModel->currentIndex(); - if(cur_model >= 0) { - model = ui.keyboardModel->itemData(cur_model, Qt::UserRole).toString(); - command += " -model "; - command += model; - } - - // set keyboard layout - int n = ui.layouts->topLevelItemCount(); - QString layouts, variants; - if(n > 0) { - for(int row = 0; row < n; ++row) { - QTreeWidgetItem* item = ui.layouts->topLevelItem(row); - layouts += item->data(0, Qt::UserRole).toString(); - variants += item->data(1, Qt::UserRole).toString(); - if(row < n - 1) { // not the last row - layouts += ','; - variants += ','; - } - } - command += " -layout "; - command += layouts; - - if (variants.indexOf(',') > -1 || !variants.isEmpty()) { - command += " -variant "; - command += variants; - } - } - - Q_FOREACH(QString option, currentOptions_) { - if (!option.startsWith("grp:")) { - command += " -option "; - command += option; - } - } - - QString switchKey; - int cur_switch_key = ui.switchKey->currentIndex(); - if(cur_switch_key > 0) { // index 0 is "None" - switchKey = ui.switchKey->itemData(cur_switch_key, Qt::UserRole).toString(); - command += " -option "; - command += switchKey; - } - - qDebug() << command; - - // execute the command line - setxkbmap.start(command); - setxkbmap.waitForFinished(); - - // save to lxqt-session config file. - settings->beginGroup("Keyboard"); - settings->setValue("layout", layouts); - settings->setValue("variant", variants); - settings->setValue("model", model); - if(switchKey.isEmpty() && currentOptions_ .isEmpty()) - settings->remove("options"); - else - settings->setValue("options", switchKey.isEmpty() ? currentOptions_ : (currentOptions_ << switchKey)); - settings->endGroup(); -} - -void KeyboardLayoutConfig::onAddLayout() { - SelectKeyboardLayoutDialog dlg(knownLayouts_, this); - if(dlg.exec() == QDialog::Accepted) { - addLayout(dlg.selectedLayout(), dlg.selectedVariant()); - accept(); - } -} - -void KeyboardLayoutConfig::onRemoveLayout() { - if(ui.layouts->topLevelItemCount() > 1) { - QTreeWidgetItem* item = ui.layouts->currentItem(); - if(item) { - delete item; - accept(); - } - } -} - -void KeyboardLayoutConfig::onMoveDown() { - QTreeWidgetItem* item = ui.layouts->currentItem(); - if(!item) - return; - int pos = ui.layouts->indexOfTopLevelItem(item); - if(pos < ui.layouts->topLevelItemCount() - 1) { // not the last item - ui.layouts->takeTopLevelItem(pos); - ui.layouts->insertTopLevelItem(pos + 1, item); - ui.layouts->setCurrentItem(item); - accept(); - } -} - -void KeyboardLayoutConfig::onMoveUp() { - QTreeWidgetItem* item = ui.layouts->currentItem(); - if(!item) - return; - int pos = ui.layouts->indexOfTopLevelItem(item); - if(pos > 0) { // not the first item - ui.layouts->takeTopLevelItem(pos); - ui.layouts->insertTopLevelItem(pos - 1, item); - ui.layouts->setCurrentItem(item); - accept(); - } -} - diff --git a/lxqt-config-input/keyboardlayoutconfig.h b/lxqt-config-input/keyboardlayoutconfig.h deleted file mode 100644 index 383335f..0000000 --- a/lxqt-config-input/keyboardlayoutconfig.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Copyright (C) 2014 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef KEYBOARDLAYOUTCONFIG_H -#define KEYBOARDLAYOUTCONFIG_H - -#include -#ifdef Q_OS_LINUX -#define XKBD_BASELIST_PATH "/usr/share/X11/xkb/rules/base.lst" -#elif defined(Q_OS_FREEBSD) -#define XKBD_BASELIST_PATH "/usr/local/share/X11/xkb/rules/base.lst" -#elif defined(Q_OS_OPENBSD) -#define XKBD_BASELIST_PATH "/usr/X11R6/share/X11/xkb/rules/base.lst" -#else -#define XKBD_BASELIST_PATH "/usr/local/share/X11/xkb/rules/base.lst" -#endif - -#include -#include "keyboardlayoutinfo.h" -#include -#include "ui_keyboardlayoutconfig.h" - -namespace LXQt { - class Settings; -} - -class KeyboardLayoutConfig : public QWidget { - Q_OBJECT -public: - KeyboardLayoutConfig(LXQt::Settings* _settings, QWidget* parent = 0); - virtual ~KeyboardLayoutConfig(); - -public Q_SLOTS: - void accept(); - void reset(); - void onAddLayout(); - void onRemoveLayout(); - void onMoveUp(); - void onMoveDown(); - -private: - void loadSettings(); - void loadLists(); - void initControls(); - void addLayout(QString name, QString variant); - -private: - Ui::KeyboardLayoutConfig ui; - QString keyboardModel_; - QString switchKey_; - QStringList currentOptions_; - QList > currentLayouts_; - QMap knownLayouts_; - LXQt::Settings* settings; -}; - -#endif // KEYBOARDLAYOUTCONFIG_H diff --git a/lxqt-config-input/keyboardlayoutconfig.ui b/lxqt-config-input/keyboardlayoutconfig.ui deleted file mode 100644 index d2235aa..0000000 --- a/lxqt-config-input/keyboardlayoutconfig.ui +++ /dev/null @@ -1,152 +0,0 @@ - - - KeyboardLayoutConfig - - - - 0 - 0 - 428 - 322 - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - <b>Keyboard Layout</b> - - - - - - - - - - 1 - 1 - - - - true - - - QAbstractItemView::InternalMove - - - false - - - false - - - - Layout - - - - - Variant - - - - - - - - - - &Add - - - - - - - &Remove - - - - - - - up - - - - - - - down - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Keyboard model: - - - - - - - QComboBox::AdjustToMinimumContentsLengthWithIcon - - - - - - - Keys to change layout: - - - - - - - QComboBox::AdjustToMinimumContentsLengthWithIcon - - - - None - - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Note</span>: If you are using an <span style=" font-weight:600;">input method</span>, such as IBus, uim, fcitx, or gcin, the settings here <span style=" font-weight:600;">might not work</span> because they are overridden by the input methods.</p></body></html> - - - true - - - - - - - - diff --git a/lxqt-config-input/keyboardlayoutinfo.h b/lxqt-config-input/keyboardlayoutinfo.h deleted file mode 100644 index da31996..0000000 --- a/lxqt-config-input/keyboardlayoutinfo.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Copyright (C) 2014 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef _KEYBOARD_LAYOUT_INFO_H_ -#define _KEYBOARD_LAYOUT_INFO_H_ - -#include -#include - -struct LayoutVariantInfo { - QString name; - QString description; - LayoutVariantInfo(QString _name, QString desc): name(_name), description(desc) { - } -}; - -struct KeyboardLayoutInfo { - QString description; - QList variants; - - KeyboardLayoutInfo(QString desc = QString()): description(desc) { - } - - const LayoutVariantInfo* findVariant(QString name) const { - if(!name.isEmpty()) { - Q_FOREACH(const LayoutVariantInfo& vinfo, variants) { - if(vinfo.name == name) - return &vinfo; - } - } - return NULL; - } -}; - -#endif diff --git a/lxqt-config-input/lxqt-config-input.cpp b/lxqt-config-input/lxqt-config-input.cpp deleted file mode 100644 index 379ceac..0000000 --- a/lxqt-config-input/lxqt-config-input.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2013-2014 Hong Jen Yee (PCMan) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include -#include -#include -#include -#include "mouseconfig.h" -#include "keyboardconfig.h" -#include "../liblxqt-config-cursor/selectwnd.h" -#include "keyboardlayoutconfig.h" - -int main(int argc, char** argv) { - LXQt::SingleApplication app(argc, argv); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Config Input")); - const QString VERINFO = QStringLiteral(LXQT_CONFIG_VERSION - "\n\nliblxqt: " LXQT_VERSION - "\nQt: " QT_VERSION_STR); - app.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(app); - - QByteArray configName = qgetenv("LXQT_SESSION_CONFIG"); - if(configName.isEmpty()) - configName = "session"; - LXQt::Settings settings(configName); - LXQt::ConfigDialog dlg(QObject::tr("Keyboard and Mouse Settings"), &settings); - app.setActivationWindow(&dlg); - - LXQt::Settings qtSettings("lxqt"); - MouseConfig* mouseConfig = new MouseConfig(&settings, &qtSettings, &dlg); - dlg.addPage(mouseConfig, QObject::tr("Mouse"), "input-mouse"); - QObject::connect(&dlg, SIGNAL(reset()), mouseConfig, SLOT(reset())); - - SelectWnd* cursorConfig = new SelectWnd(&settings, &dlg); - cursorConfig->setCurrent(); - dlg.addPage(cursorConfig, QObject::tr("Cursor"), "preferences-desktop-theme"); - - KeyboardConfig* keyboardConfig = new KeyboardConfig(&settings, &qtSettings, &dlg); - dlg.addPage(keyboardConfig, QObject::tr("Keyboard"), "input-keyboard"); - QObject::connect(&dlg, SIGNAL(reset()), keyboardConfig, SLOT(reset())); - - KeyboardLayoutConfig* keyboardLayoutConfig = new KeyboardLayoutConfig(&settings, &dlg); - dlg.addPage(keyboardLayoutConfig, QObject::tr("Keyboard Layout"), "input-keyboard"); - QObject::connect(&dlg, SIGNAL(reset()), keyboardLayoutConfig, SLOT(reset())); - - dlg.setWindowIcon(QIcon::fromTheme("input-keyboard")); - - dlg.exec(); - return 0; -} diff --git a/lxqt-config-input/lxqt-config-input.desktop.in b/lxqt-config-input/lxqt-config-input.desktop.in deleted file mode 100644 index b1088b9..0000000 --- a/lxqt-config-input/lxqt-config-input.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Keyboard and Mouse -GenericName=Input settings -Comment=Configure keyboard, mouse, and other input devices -Exec=lxqt-config-input -Icon=input-keyboard -Categories=Qt;Settings;HardwareSettings;DesktopSettings;LXQt; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/lxqt-config-input/lxqt-config-input.h b/lxqt-config-input/lxqt-config-input.h deleted file mode 100644 index 1f9e0e3..0000000 --- a/lxqt-config-input/lxqt-config-input.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -* Copyright (c) LXQt contributors. -* -* This file is part of the LXQt project. -* It is distributed under the LGPL 2.1 or later license. -* Please refer to the LICENSE file for a copy of the license, and -* the AUTHORS file for copyright and authorship information. -*/ - -#ifndef LXQT_CONFIG_INPUT_H -#define LXQT_CONFIG_INPUT_H - - - -#endif // LXQT_CONFIG_INPUT_H diff --git a/lxqt-config-input/mouseconfig.cpp b/lxqt-config-input/mouseconfig.cpp deleted file mode 100644 index 0f25283..0000000 --- a/lxqt-config-input/mouseconfig.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright (C) 2013-2014 Hong Jen Yee (PCMan) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#include "mouseconfig.h" -#include -#include -#include -#include -#include -#include -#include -#include - -// FIXME: how to support XCB or Wayland? -#include -#include -#include - -#ifdef Q_WS_X11 -extern void qt_x11_apply_settings_in_all_apps(); -#endif - -MouseConfig::MouseConfig(LXQt::Settings* _settings, QSettings* _qtSettings, QWidget* parent): - QWidget(parent), - settings(_settings), - qtSettings(_qtSettings), - accel(20), - oldAccel(20), - threshold(10), - oldThreshold(10), - leftHanded(false), - oldLeftHanded(false), - singleClick(false), - oldSingleClick(false) { - - ui.setupUi(this); - - /* read the config flie */ - loadSettings(); - initControls(); - - // set_range_stops(ui.mouseAccel, 10); - connect(ui.mouseAccel, SIGNAL(valueChanged(int)), SLOT(onMouseAccelChanged(int))); - // set_range_stops(ui.mouseThreshold, 10); - connect(ui.mouseThreshold, SIGNAL(valueChanged(int)), SLOT(onMouseThresholdChanged(int))); - connect(ui.mouseLeftHanded, SIGNAL(toggled(bool)), SLOT(onMouseLeftHandedToggled(bool))); - - connect(ui.doubleClickInterval, SIGNAL(valueChanged(int)), SLOT(onDoubleClickIntervalChanged(int))); - connect(ui.wheelScrollLines, SIGNAL(valueChanged(int)), SLOT(onWheelScrollLinesChanged(int))); - connect(ui.singleClick, SIGNAL(toggled(bool)), SLOT(onSingleClickChanged(bool))); -} - -MouseConfig::~MouseConfig() { -} - -void MouseConfig::initControls() { - ui.mouseAccel->setValue(accel); - ui.mouseThreshold->setValue(110 - threshold); - ui.mouseLeftHanded->setChecked(leftHanded); - - ui.singleClick->setChecked(qtSettings->value(QLatin1String("single_click_activate"), false).toBool()); - - qtSettings->beginGroup(QLatin1String("Qt")); - int value = qtSettings->value(QLatin1String("doubleClickInterval"), 400).toInt(); - ui.doubleClickInterval->setValue(value); - - value = qtSettings->value(QLatin1String("wheelScrollLines"), 3).toInt(); - ui.wheelScrollLines->setValue(value); - qtSettings->endGroup(); -} - - -void MouseConfig::onMouseAccelChanged(int value) { - accel = value; - XChangePointerControl(QX11Info::display(), True, False, - accel, 10, 0); - accept(); -} - -void MouseConfig::onMouseThresholdChanged(int value) { - /* threshold = 110 - sensitivity. The lower the threshold, the higher the sensitivity */ - threshold = 110 - value; - XChangePointerControl(QX11Info::display(), False, True, - 0, 10, threshold); - accept(); -} - -/* This function is taken from Gnome's control-center 2.6.0.3 (gnome-settings-mouse.c) and was modified*/ -#define DEFAULT_PTR_MAP_SIZE 128 -void MouseConfig::setLeftHandedMouse() { - unsigned char* buttons; - unsigned char* more_buttons; - int n_buttons, i; - int idx_1 = 0, idx_3 = 1; - - buttons = (unsigned char*)malloc(DEFAULT_PTR_MAP_SIZE); - if(!buttons) { - return; - } - n_buttons = XGetPointerMapping(QX11Info::display(), buttons, DEFAULT_PTR_MAP_SIZE); - - if(n_buttons > DEFAULT_PTR_MAP_SIZE) { - more_buttons = (unsigned char*)realloc(buttons, n_buttons); - if(!more_buttons) { - free(buttons); - return; - } - buttons = more_buttons; - n_buttons = XGetPointerMapping(QX11Info::display(), buttons, n_buttons); - } - - for(i = 0; i < n_buttons; i++) { - if(buttons[i] == 1) - idx_1 = i; - else if(buttons[i] == ((n_buttons < 3) ? 2 : 3)) - idx_3 = i; - } - - if((leftHanded && idx_1 < idx_3) || - (!leftHanded && idx_1 > idx_3)) { - buttons[idx_1] = ((n_buttons < 3) ? 2 : 3); - buttons[idx_3] = 1; - XSetPointerMapping(QX11Info::display(), buttons, n_buttons); - } - free(buttons); -} - -void MouseConfig::onMouseLeftHandedToggled(bool checked) { - leftHanded = checked; - setLeftHandedMouse(); - accept(); -} - -void MouseConfig::onDoubleClickIntervalChanged(int value) -{ - qtSettings->beginGroup(QLatin1String("Qt")); - qtSettings->setValue(QLatin1String("doubleClickInterval"), value); - qtSettings->endGroup(); - qtSettings->sync(); -#ifdef Q_WS_X11 - qt_x11_apply_settings_in_all_apps(); -#endif -} - -void MouseConfig::onWheelScrollLinesChanged(int value) -{ - qtSettings->beginGroup(QLatin1String("Qt")); - qtSettings->setValue(QLatin1String("wheelScrollLines"), value); - qtSettings->endGroup(); - qtSettings->sync(); -#ifdef Q_WS_X11 - qt_x11_apply_settings_in_all_apps(); -#endif -} - -void MouseConfig::onSingleClickChanged(bool checked) -{ - qtSettings->setValue(QLatin1String("single_click_activate"), checked); - qtSettings->sync(); -#ifdef Q_WS_X11 - qt_x11_apply_settings_in_all_apps(); -#endif -} - -void MouseConfig::loadSettings() { - oldSingleClick = singleClick = qtSettings->value("single_click_activate", false).toBool(); - - settings->beginGroup("Mouse"); - oldAccel = accel = settings->value("accel_factor", 20).toInt(); - oldThreshold = threshold = settings->value("accel_threshold", 10).toInt(); - oldLeftHanded = leftHanded = settings->value("left_handed", false).toBool(); - settings->endGroup(); -} - -void MouseConfig::accept() { - qtSettings->setValue("single_click_activate", singleClick); - - settings->beginGroup("Mouse"); - settings->setValue("accel_factor", accel); - settings->setValue("accel_threshold", threshold); - settings->setValue("left_handed", leftHanded); - settings->endGroup(); -} - -void MouseConfig::reset() { - /* restore to original settings */ - /* mouse */ - accel = oldAccel; - threshold = oldThreshold; - leftHanded = oldLeftHanded; - singleClick = oldSingleClick; - XChangePointerControl(QX11Info::display(), True, True, - accel, 10, threshold); - setLeftHandedMouse(); - - initControls(); - accept(); -} diff --git a/lxqt-config-input/mouseconfig.h b/lxqt-config-input/mouseconfig.h deleted file mode 100644 index d11ec9d..0000000 --- a/lxqt-config-input/mouseconfig.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2013-2014 Hong Jen Yee (PCMan) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#ifndef MOUSECONFIG_H -#define MOUSECONFIG_H - -#include -#include "ui_mouseconfig.h" - -namespace LXQt { - class Settings; -} -class QSettings; - -class MouseConfig : public QWidget { - Q_OBJECT - -public: - MouseConfig(LXQt::Settings* _settings, QSettings* _qtSettings, QWidget* parent); - virtual ~MouseConfig(); - - void accept(); -public Q_SLOTS: - void reset(); - -private: - void setLeftHandedMouse(); - void loadSettings(); - void initControls(); - -private Q_SLOTS: - void onMouseAccelChanged(int value); - void onMouseThresholdChanged(int value); - void onMouseLeftHandedToggled(bool checked); - void onDoubleClickIntervalChanged(int value); - void onWheelScrollLinesChanged(int value); - void onSingleClickChanged(bool checked); - -private: - Ui::MouseConfig ui; - LXQt::Settings* settings; - QSettings* qtSettings; - int accel; - int oldAccel; - int threshold; - int oldThreshold; - bool leftHanded; - bool oldLeftHanded; - bool singleClick; - bool oldSingleClick; -}; - -#endif // MOUSECONFIG_H diff --git a/lxqt-config-input/mouseconfig.ui b/lxqt-config-input/mouseconfig.ui deleted file mode 100644 index 775c99d..0000000 --- a/lxqt-config-input/mouseconfig.ui +++ /dev/null @@ -1,208 +0,0 @@ - - - MouseConfig - - - - 0 - 0 - 324 - 223 - - - - Form - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - <b>Mouse</b> - - - - - - - Motion - - - - - - High - - - - - - - Fast - - - - - - - Sensitivity: - - - - - - - Low - - - - - - - 10 - - - 110 - - - 10 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - Acceleration: - - - - - - - 10 - - - 110 - - - 10 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - Slow - - - - - - - 0 - - - - - - - 0 - - - - - - - - - - Double click interval: - - - - - - - ms - - - 10000 - - - - - - - Wheel scroll lines: - - - - - - - - - - Left handed (Swap left and right mouse buttons) - - - - - - - Single click to activate items - - - - - - - - - mouseAccel - valueChanged(int) - label_41 - setNum(int) - - - 175 - 74 - - - 342 - 73 - - - - - mouseThreshold - valueChanged(int) - label_42 - setNum(int) - - - 191 - 95 - - - 347 - 95 - - - - - diff --git a/lxqt-config-input/selectkeyboardlayoutdialog.cpp b/lxqt-config-input/selectkeyboardlayoutdialog.cpp deleted file mode 100644 index edcd6a5..0000000 --- a/lxqt-config-input/selectkeyboardlayoutdialog.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * - * Copyright (C) 2014 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "selectkeyboardlayoutdialog.h" -#include - -SelectKeyboardLayoutDialog::SelectKeyboardLayoutDialog(QMap< QString, KeyboardLayoutInfo>& knownLayouts, QWidget* parent): - QDialog(parent), - knownLayouts_(knownLayouts) { - ui.setupUi(this); - connect(ui.layouts, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(onLayoutChanged())); - - QMap::const_iterator it; - for(it = knownLayouts_.constBegin(); it != knownLayouts_.constEnd(); ++it) { - const QString& name = it.key(); - const KeyboardLayoutInfo& info = *it; - QListWidgetItem * item = new QListWidgetItem(info.description); - item->setData(Qt::UserRole, name); - ui.layouts->addItem(item); - } - ui.layouts->setCurrentItem(ui.layouts->item(0)); -} - -SelectKeyboardLayoutDialog::~SelectKeyboardLayoutDialog() { - -} - -void SelectKeyboardLayoutDialog::onLayoutChanged() { - QListWidgetItem* item = ui.layouts->currentItem(); - ui.variants->clear(); - - ui.variants->addItem("None"); - ui.variants->setCurrentItem(ui.variants->item(0)); - if(item) { // add variants of this layout to the list view - QString name = item->data(Qt::UserRole).toString(); - const KeyboardLayoutInfo& info = knownLayouts_[name]; - Q_FOREACH(const LayoutVariantInfo& vinfo, info.variants) { - QListWidgetItem * vitem = new QListWidgetItem(vinfo.description); - // qDebug() << "vitem" << vinfo.name << vinfo.description; - vitem->setData(Qt::UserRole, vinfo.name); - ui.variants->addItem(vitem); - } - } -} - -QString SelectKeyboardLayoutDialog::selectedLayout() { - QListWidgetItem* layoutItem = ui.layouts->currentItem(); - if(layoutItem) { - return layoutItem->data(Qt::UserRole).toString(); - } - return QString(); -} - -QString SelectKeyboardLayoutDialog::selectedVariant() { - QListWidgetItem* variantItem = ui.variants->currentItem(); - if(variantItem) - return variantItem->data(Qt::UserRole).toString(); - return QString(); -} diff --git a/lxqt-config-input/selectkeyboardlayoutdialog.h b/lxqt-config-input/selectkeyboardlayoutdialog.h deleted file mode 100644 index 838d032..0000000 --- a/lxqt-config-input/selectkeyboardlayoutdialog.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Copyright (C) 2014 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef SELECTKEYBOARDLAYOUTDIALOG_H -#define SELECTKEYBOARDLAYOUTDIALOG_H - -#include -#include "ui_selectkeyboardlayoutdialog.h" -#include "keyboardlayoutinfo.h" - -class SelectKeyboardLayoutDialog : public QDialog { - Q_OBJECT -public: - SelectKeyboardLayoutDialog(QMap< QString, KeyboardLayoutInfo >& knownLayouts, QWidget* parent = 0); - virtual ~SelectKeyboardLayoutDialog(); - - QString selectedLayout(); - QString selectedVariant(); - -private Q_SLOTS: - void onLayoutChanged(); - -private: - Ui::SelectKeyboardLayoutDialog ui; - QMap& knownLayouts_; -}; - -#endif // SELECTKEYBOARDLAYOUTDIALOG_H diff --git a/lxqt-config-input/selectkeyboardlayoutdialog.ui b/lxqt-config-input/selectkeyboardlayoutdialog.ui deleted file mode 100644 index 36bb688..0000000 --- a/lxqt-config-input/selectkeyboardlayoutdialog.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - SelectKeyboardLayoutDialog - - - - 0 - 0 - 480 - 384 - - - - Select a keyboard layout - - - - - - Keyboard layout - - - - - - - Variant - - - - - - - true - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - SelectKeyboardLayoutDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - SelectKeyboardLayoutDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/lxqt-config-input/translations/lxqt-config-input_ar.desktop b/lxqt-config-input/translations/lxqt-config-input_ar.desktop deleted file mode 100644 index d1d9769..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_ar.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ar]=لوحة المفاتيح والفأرة -GenericName[ar]=إعدادات الدّخل -Comment[ar]=اضبط لوحة المفاتيح، والفأرة وأجهزة الدّخل الأخرى diff --git a/lxqt-config-input/translations/lxqt-config-input_ca.desktop b/lxqt-config-input/translations/lxqt-config-input_ca.desktop deleted file mode 100644 index 7f62fd0..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_ca.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ca]=Teclat i ratolí -GenericName[ca]=Ajusts de l'entrada -Comment[ca]=Configureu el teclat, el ratolí i altres dispositius d'entrada diff --git a/lxqt-config-input/translations/lxqt-config-input_da.desktop b/lxqt-config-input/translations/lxqt-config-input_da.desktop deleted file mode 100644 index 681a16d..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_da.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[da]=Tastatur og mus -GenericName[da]=Input-indstillinger -Comment[da]=Konfigurér tastatur, mus og andre input-enheder diff --git a/lxqt-config-input/translations/lxqt-config-input_de.desktop b/lxqt-config-input/translations/lxqt-config-input_de.desktop deleted file mode 100644 index da426fc..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_de.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[de]=Tastatur und Maus -GenericName[de]=Eingabegerätekonfiguration -Comment[de]=Tastatur, Maus und andere Eingabegeräte konfigurieren diff --git a/lxqt-config-input/translations/lxqt-config-input_el.desktop b/lxqt-config-input/translations/lxqt-config-input_el.desktop deleted file mode 100644 index addfbad..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_el.desktop +++ /dev/null @@ -1,4 +0,0 @@ -#Translations -Name[el]=Πληκτρολόγιο και ποντίκι -GenericName[el]=Ρυθμίσεις εισαγωγής -Comment[el]=Διαμόρφωση του πληκτρολογίου, του ποντικιού, και άλλων συσκευών εισαγωγής diff --git a/lxqt-config-input/translations/lxqt-config-input_fr.desktop b/lxqt-config-input/translations/lxqt-config-input_fr.desktop deleted file mode 100644 index 84f9355..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[fr]=Clavier et Souris -GenericName[fr]=Paramètres des périphériques d'entrée -Comment[fr]=Configurer les claviers, souris et les autres périphériques d'entrée diff --git a/lxqt-config-input/translations/lxqt-config-input_hu.desktop b/lxqt-config-input/translations/lxqt-config-input_hu.desktop deleted file mode 100644 index 42db5bd..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_hu.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[hu]=Billentyű és egérbeállítás -GenericName[hu]=Beviteli eszközbeállítás -Comment[hu]=TA billentyűzet és egér beállítása diff --git a/lxqt-config-input/translations/lxqt-config-input_it.desktop b/lxqt-config-input/translations/lxqt-config-input_it.desktop deleted file mode 100644 index db4e585..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_it.desktop +++ /dev/null @@ -1,6 +0,0 @@ -# Translations -Name[it]=Tastiera e mouse -GenericName[it]=Configura i dispositivi di immissione -Comment[it]=Configura tastiera, mouse e altri dispositivi di immissione - - diff --git a/lxqt-config-input/translations/lxqt-config-input_ja.desktop b/lxqt-config-input/translations/lxqt-config-input_ja.desktop deleted file mode 100644 index 201a9b7..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_ja.desktop +++ /dev/null @@ -1,5 +0,0 @@ -# Translations -Name[ja]=キーボードとマウス -GenericName[ja]=入力の設定 -Comment[ja]=キーボードやマウス、その他の入力デバイスの設定 - diff --git a/lxqt-config-input/translations/lxqt-config-input_lt.desktop b/lxqt-config-input/translations/lxqt-config-input_lt.desktop deleted file mode 100644 index 706d6dd..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_lt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[lt]=Klaviatūra ir pelė -GenericName[lt]=Įvedimo nustatymai -Comment[lt]=Konfigūruoti klaviatūrą, pelę ir kitus įvedimo įrenginius diff --git a/lxqt-config-input/translations/lxqt-config-input_pl.desktop b/lxqt-config-input/translations/lxqt-config-input_pl.desktop deleted file mode 100644 index 7a64193..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_pl.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[pl]=Mysz i Klawiatura -GenericName[pl]=Urządzenia wejścia -Comment[pl]=Konfiguracja klawiatury i myszy diff --git a/lxqt-config-input/translations/lxqt-config-input_pt.desktop b/lxqt-config-input/translations/lxqt-config-input_pt.desktop deleted file mode 100644 index 565b74f..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_pt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[pt]=Teclado e rato -GenericName[pt]=Definições de introdução -Comment[pt]=Configuração do rato, teclado e outros dispositivos de introdução diff --git a/lxqt-config-input/translations/lxqt-config-input_ru.desktop b/lxqt-config-input/translations/lxqt-config-input_ru.desktop deleted file mode 100644 index 6d441bb..0000000 --- a/lxqt-config-input/translations/lxqt-config-input_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ru]=Настроить клавиатуру, мышь и другие устройства ввода -Name[ru]=Клавиатура и мышь -GenericName[ru]=Настройки ввода \ No newline at end of file diff --git a/lxqt-config-locale/CMakeLists.txt b/lxqt-config-locale/CMakeLists.txt deleted file mode 100644 index efa8702..0000000 --- a/lxqt-config-locale/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -project(lxqt-config-locale) - -set(H_FILES - localeconfig.h -) - - -set(CPP_FILES - main.cpp - localeconfig.cpp -) - -set(UI_FILES - localeconfig.ui -) - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${H_FILES} - ${CPP_FILES} - ${UI_FILES} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES ${PROJECT_NAME}.desktop.in) - -#************************************************ - -add_executable(${PROJECT_NAME} - ${CPP_FILES} - ${RESOURCES} - ${QRC_SOURCES} - ${QM_FILES} - ${DESKTOP_FILES} - ${QM_LOADER} -) - -target_link_libraries(${PROJECT_NAME} - Qt5::Widgets - Qt5::Xml - lxqt -) - -install(TARGETS - ${PROJECT_NAME} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" - COMPONENT Runtime -) diff --git a/lxqt-config-locale/localeconfig.cpp b/lxqt-config-locale/localeconfig.cpp deleted file mode 100644 index 76ca2a7..0000000 --- a/lxqt-config-locale/localeconfig.cpp +++ /dev/null @@ -1,452 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)GPL2+ - * - * - * Copyright: 2014 LXQt team - * 2014 Sebastian Kügler - * Authors: - * Julien Lavergne - * Sebastian Kügler - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * - * END_COMMON_COPYRIGHT_HEADER - * - * Based on plasma-desktop/kcms/formats module - */ - -#include "localeconfig.h" -#include "ui_localeconfig.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -const static QString lcLang = QStringLiteral("LANG"); - -const static QString lcNumeric = QStringLiteral("LC_NUMERIC"); -const static QString lcTime = QStringLiteral("LC_TIME"); -const static QString lcMonetary = QStringLiteral("LC_MONETARY"); -const static QString lcMeasurement = QStringLiteral("LC_MEASUREMENT"); -const static QString lcCollate = QStringLiteral("LC_COLLATE"); -const static QString lcCtype = QStringLiteral("LC_CTYPE"); - -const static QString lcLanguage = QStringLiteral("LANGUAGE"); - -LocaleConfig::LocaleConfig(LXQt::Settings* settings, LXQt::Settings* session_settings, QWidget* parent) : - QWidget(parent), - m_ui(new Ui::LocaleConfig), - hasChanged(new bool), - mSettings(settings), - sSettings(session_settings) - - -{ - m_ui->setupUi(this); - m_combos << m_ui->comboGlobal - << m_ui->comboNumbers - << m_ui->comboTime - << m_ui->comboCurrency - << m_ui->comboMeasurement - << m_ui->comboCollate; - - hasChanged = false; - - initControls(); -} - - -LocaleConfig::~LocaleConfig() -{ - delete m_ui; -} - -bool countryLessThan(const QLocale & c1, const QLocale & c2) -{ - return QString::localeAwareCompare(c1.nativeCountryName(), c2.nativeCountryName()) < 0; -} - -void LocaleConfig::load() -{ - QList allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); - qSort(allLocales.begin(), allLocales.end(), countryLessThan); - foreach(QComboBox * combo, m_combos) - { - initCombo(combo, allLocales); - } - - readConfig(); - - foreach(QComboBox * combo, m_combos) - { - connectCombo(combo); - } - - connect(m_ui->checkDetailed, &QAbstractButton::toggled, [ = ]() - { - updateExample(); - updateEnabled(); - hasChanged = true; - }); - - updateEnabled(); - updateExample(); - hasChanged = false; -} - -void LocaleConfig::initCombo(QComboBox *combo, const QList & allLocales) -{ - combo->clear(); - const QString clabel = tr("No change"); - combo->setInsertPolicy(QComboBox::InsertAlphabetically); - combo->addItem(clabel, QString()); - foreach(const QLocale & l, allLocales) - { - addLocaleToCombo(combo, l); - } -} - -void LocaleConfig::connectCombo(QComboBox *combo) -{ - connect(combo, &QComboBox::currentTextChanged, [ = ]() - { - hasChanged = true; - updateExample(); - }); -} - -void LocaleConfig::addLocaleToCombo(QComboBox *combo, const QLocale &locale) -{ - const QString clabel = !locale.nativeCountryName().isEmpty() ? locale.nativeCountryName() : locale.countryToString(locale.country()); - // This needs to use name() rather than bcp47name() or later on the export will generate a non-sense locale (e.g. "it" instead of - // "it_IT") - // TODO: Properly handle scripts (@foo) - QString cvalue = locale.name(); - if (!cvalue.contains('.')) - { // explicitely add the encoding, otherwise Qt doesn't accept dead keys and garbles the output as well - cvalue.append(QLatin1Char('.') + QTextCodec::codecForLocale()->name()); - } - - QString flagcode; - const QStringList split = locale.name().split('_'); - if (split.count() > 1) - { - flagcode = split[1].toLower(); - } - /* TODO Find a better place for flags ... */ - QString flag(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kf5/locale/countries/%1/flag.png").arg(flagcode))); - QIcon flagIcon; - if (!flag.isEmpty()) - { - flagIcon = QIcon(flag); - } - - QString itemResult; - itemResult = QString("%1 - %2 (%3)") - .arg(clabel) - .arg(locale.nativeLanguageName()) - .arg(locale.name()); - - combo->addItem(flagIcon, itemResult, cvalue); -} - -void setCombo(QComboBox *combo, const QString &key) -{ - const int ix = combo->findData(key); - if (ix > -1) - { - combo->setCurrentIndex(ix); - } -} - -void LocaleConfig::readConfig() -{ - mSettings->beginGroup("Formats"); - - bool useDetailed = mSettings->value("useDetailed", false).toBool(); - m_ui->checkDetailed->setChecked(useDetailed); - - setCombo(m_ui->comboGlobal, mSettings->value(lcLang, qgetenv(lcLang.toLatin1())).toString()); - - setCombo(m_ui->comboNumbers, mSettings->value(lcNumeric, qgetenv(lcNumeric.toLatin1())).toString()); - setCombo(m_ui->comboTime, mSettings->value(lcTime, qgetenv(lcTime.toLatin1())).toString()); - setCombo(m_ui->comboCollate, mSettings->value(lcCollate, qgetenv(lcCollate.toLatin1())).toString()); - setCombo(m_ui->comboCurrency, mSettings->value(lcMonetary, qgetenv(lcMonetary.toLatin1())).toString()); - setCombo(m_ui->comboMeasurement, mSettings->value(lcMeasurement, qgetenv(lcMeasurement.toLatin1())).toString()); - - updateEnabled(); - - mSettings->endGroup(); -} - -void LocaleConfig::writeConfig() -{ - mSettings->beginGroup("Formats"); - - // global ends up empty here when OK button is clicked from kcmshell5, - // apparently the data in the combo is gone by the time save() is called. - // This might be a problem in KCModule, but does not directly affect us - // since within systemsettings, it works fine. - // See https://bugs.kde.org/show_bug.cgi?id=334624 - if (m_ui->comboGlobal->count() == 0) - { - qWarning() << "Couldn't read data from UI, writing configuration failed."; - return; - } - const QString global = m_ui->comboGlobal->currentData().toString(); - - if (!m_ui->checkDetailed->isChecked()) - { - // Global setting, clean up config - mSettings->remove("useDetailed"); - if (global.isEmpty()) - { - mSettings->remove(lcLang); - } - else - { - mSettings->setValue(lcLang, global); - } - mSettings->remove(lcNumeric); - mSettings->remove(lcTime); - mSettings->remove(lcMonetary); - mSettings->remove(lcMeasurement); - mSettings->remove(lcCollate); - mSettings->remove(lcCtype); - } - else - { - // Save detailed settings - mSettings->setValue("useDetailed", true); - - if (global.isEmpty()) - { - mSettings->remove(lcLang); - } - else - { - mSettings->setValue(lcLang, global); - } - - const QString numeric = m_ui->comboNumbers->currentData().toString(); - if (numeric.isEmpty()) - { - mSettings->remove(lcNumeric); - } - else - { - mSettings->setValue(lcNumeric, numeric); - } - - const QString time = m_ui->comboTime->currentData().toString(); - if (time.isEmpty()) - { - mSettings->remove(lcTime); - } - else - { - mSettings->setValue(lcTime, time); - } - - const QString monetary = m_ui->comboCurrency->currentData().toString(); - if (monetary.isEmpty()) - { - mSettings->remove(lcMonetary); - } - else - { - mSettings->setValue(lcMonetary, monetary); - } - - const QString measurement = m_ui->comboMeasurement->currentData().toString(); - if (measurement.isEmpty()) - { - mSettings->remove(lcMeasurement); - } - else - { - mSettings->setValue(lcMeasurement, measurement); - } - - const QString collate = m_ui->comboCollate->currentData().toString(); - if (collate.isEmpty()) - { - mSettings->remove(lcCollate); - } - else - { - mSettings->setValue(lcCollate, collate); - } - } - mSettings->endGroup(); -} - -void LocaleConfig::saveSettings() -{ - if (hasChanged) - { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Format Settings Changed")); - msgBox.setText(tr("Do you want to save your changes? They will take effect the next time you log in.")); - msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel); - msgBox.setDefaultButton(QMessageBox::Cancel); - - int ret = msgBox.exec(); - if( ret == QMessageBox::Save ) - { - writeConfig(); - writeExports(); - } - } - -} - -void LocaleConfig::writeExports() -{ - sSettings->beginGroup("Environment"); - mSettings->beginGroup("Formats"); - if (!mSettings->value(lcLang).toString().isNull()) - { - sSettings->setValue(lcLang, mSettings->value(lcLang).toString()); - - if (mSettings->value("useDetailed").toBool()) - { - if (!mSettings->value(lcNumeric).toString().isNull()) - { - sSettings->setValue(lcNumeric, mSettings->value(lcNumeric).toString()); - } - if (!mSettings->value(lcTime).toString().isNull()) - { - sSettings->setValue(lcTime, mSettings->value(lcTime).toString()); - } - if (!mSettings->value(lcCollate).toString().isNull()) - { - sSettings->setValue(lcCollate, mSettings->value(lcCollate).toString()); - } - if (!mSettings->value(lcMonetary).toString().isNull()) - { - sSettings->setValue(lcMonetary, mSettings->value(lcMonetary).toString()); - } - if (!mSettings->value(lcMeasurement).toString().isNull()) - { - sSettings->setValue(lcMeasurement, mSettings->value(lcMeasurement).toString()); - } - } - else - { - sSettings->setValue(lcNumeric, mSettings->value(lcLang).toString()); - sSettings->setValue(lcTime, mSettings->value(lcLang).toString()); - sSettings->setValue(lcCollate, mSettings->value(lcLang).toString()); - sSettings->setValue(lcMonetary, mSettings->value(lcLang).toString()); - sSettings->setValue(lcMeasurement, mSettings->value(lcLang).toString()); - } - } - mSettings->endGroup(); - sSettings->endGroup(); - sSettings->sync(); -} - -void LocaleConfig::defaults() -{ - m_ui->checkDetailed->setChecked(false); - - // restore user defaults from env vars - setCombo(m_ui->comboGlobal, qgetenv(lcLang.toLatin1())); - setCombo(m_ui->comboNumbers, qgetenv(lcNumeric.toLatin1())); - setCombo(m_ui->comboTime, qgetenv(lcTime.toLatin1())); - setCombo(m_ui->comboCollate, qgetenv(lcCollate.toLatin1())); - setCombo(m_ui->comboCurrency, qgetenv(lcMonetary.toLatin1())); - setCombo(m_ui->comboMeasurement, qgetenv(lcMeasurement.toLatin1())); - - updateEnabled(); -} - -void LocaleConfig::updateEnabled() -{ - const bool enabled = m_ui->checkDetailed->isChecked(); - - m_ui->labelNumbers->setEnabled(enabled); - m_ui->labelTime->setEnabled(enabled); - m_ui->labelCurrency->setEnabled(enabled); - m_ui->labelMeasurement->setEnabled(enabled); - m_ui->labelCollate->setEnabled(enabled); - m_ui->comboNumbers->setEnabled(enabled); - m_ui->comboTime->setEnabled(enabled); - m_ui->comboCurrency->setEnabled(enabled); - m_ui->comboMeasurement->setEnabled(enabled); - m_ui->comboCollate->setEnabled(enabled); -} - -void LocaleConfig::updateExample() -{ - const bool useDetailed = m_ui->checkDetailed->isChecked(); - - QLocale nloc; - QLocale tloc; - QLocale cloc; - QLocale mloc; - - if (useDetailed) - { - nloc = QLocale(m_ui->comboNumbers->currentData().toString()); - tloc = QLocale(m_ui->comboTime->currentData().toString()); - cloc = QLocale(m_ui->comboCurrency->currentData().toString()); - mloc = QLocale(m_ui->comboMeasurement->currentData().toString()); - } - else - { - nloc = QLocale(m_ui->comboGlobal->currentData().toString()); - tloc = QLocale(m_ui->comboGlobal->currentData().toString()); - cloc = QLocale(m_ui->comboGlobal->currentData().toString()); - mloc = QLocale(m_ui->comboGlobal->currentData().toString()); - } - - const QString numberExample = nloc.toString(1000.01); - const QString timeExample = tloc.toString(QDateTime::currentDateTime()); - const QString currencyExample = cloc.toCurrencyString(24); - - QString measurementSetting; - if (mloc.measurementSystem() == QLocale::ImperialUKSystem) - { - measurementSetting = tr("Imperial UK"); - } - else if (mloc.measurementSystem() == QLocale::ImperialUSSystem) - { - measurementSetting = tr("Imperial US"); - } - else - { - measurementSetting = tr("Metric"); - } - - m_ui->exampleNumbers->setText(numberExample); - m_ui->exampleTime->setText(timeExample); - m_ui->exampleCurrency->setText(currencyExample); - m_ui->exampleMeasurement->setText(measurementSetting); -} - -void LocaleConfig::initControls() -{ - defaults(); - load(); - hasChanged = false; -} diff --git a/lxqt-config-locale/localeconfig.h b/lxqt-config-locale/localeconfig.h deleted file mode 100644 index a25a513..0000000 --- a/lxqt-config-locale/localeconfig.h +++ /dev/null @@ -1,79 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)GPL2+ - * - * - * Copyright: 2014 LXQt team - * 2014 Sebastian Kügler - * Authors: - * Julien Lavergne - * Sebastian Kügler - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef LOCALECONFIG_H -#define LOCALECONFIG_H - -#include -#include - -class QTreeWidgetItem; -class QSettings; - - -namespace Ui { - class LocaleConfig; -} - -class QComboBox; -class QMessageWidget; - -class LocaleConfig : public QWidget -{ - Q_OBJECT - -public: - explicit LocaleConfig(LXQt::Settings *settings, LXQt::Settings *session_settings, QWidget *parent = 0); - ~LocaleConfig(); - - void load(); - void save(); - void defaults(); - -public slots: - void initControls(); - void saveSettings(); - -private: - void addLocaleToCombo(QComboBox *combo, const QLocale &locale); - void initCombo(QComboBox *combo, const QList &allLocales); - void connectCombo(QComboBox *combo); - QList m_combos; - - void readConfig(); - void writeConfig(); - void writeExports(); - - void updateExample(); - void updateEnabled(); - - Ui::LocaleConfig *m_ui; - bool hasChanged; - LXQt::Settings *mSettings; - LXQt::Settings *sSettings; -}; - -#endif // LOCALECONFIG_H diff --git a/lxqt-config-locale/localeconfig.ui b/lxqt-config-locale/localeconfig.ui deleted file mode 100644 index f7aecc3..0000000 --- a/lxqt-config-locale/localeconfig.ui +++ /dev/null @@ -1,385 +0,0 @@ - - - Sebastian Kuegler - LocaleConfig - - - - 0 - 0 - 600 - 450 - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 16 - - - - - - - - - - QFormLayout::ExpandingFieldsGrow - - - 6 - - - 6 - - - - - Re&gion: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - comboGlobal - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - De&tailed Settings - - - - - - - &Numbers: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - comboNumbers - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - &Time: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - comboTime - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - Currenc&y: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - comboCurrency - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - Measurement &Units: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - comboMeasurement - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - Co&llation and Sorting: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - comboCollate - - - - - - - - 0 - 0 - - - - - 300 - 0 - - - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - <b>Examples</b> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Numbers: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Time: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Currency: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Measurement Units: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 16 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 16 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 32 - - - - - - - - - - - - - - - - diff --git a/lxqt-config-locale/lxqt-config-locale.desktop.in b/lxqt-config-locale/lxqt-config-locale.desktop.in deleted file mode 100644 index 46cf666..0000000 --- a/lxqt-config-locale/lxqt-config-locale.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Locale -GenericName=Locale settings -Comment=Locale settings for LXQt -Exec=lxqt-config-locale -Icon=preferences-desktop-locale -Categories=Settings;DesktopSettings;Qt;LXQt; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/lxqt-config-locale/main.cpp b/lxqt-config-locale/main.cpp deleted file mode 100644 index 28dbc65..0000000 --- a/lxqt-config-locale/main.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)GPL2+ - * - * - * Copyright: 2014 LXQt team - * - * Authors: - * Julien Lavergne - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include - -#include -#include -#include -#include "localeconfig.h" - -int main (int argc, char **argv) -{ - LXQt::SingleApplication app(argc, argv); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Config Locale")); - const QString VERINFO = QStringLiteral(LXQT_CONFIG_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - app.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(app); - - LXQt::Settings settings("lxqt-config-locale"); - LXQt::Settings session_settings("session"); - LXQt::ConfigDialog* dialog = new LXQt::ConfigDialog(QObject::tr("LXQt Locale Configuration"), &settings); - - app.setActivationWindow(dialog); - - LocaleConfig* localePage = new LocaleConfig(&settings, &session_settings, dialog); - dialog->addPage(localePage, QObject::tr("Locale Settings"), QStringList() << "preferences-desktop-locale" << "preferences-desktop"); - QObject::connect(dialog, SIGNAL(reset()), localePage, SLOT(initControls())); - QObject::connect(dialog, SIGNAL(save()), localePage, SLOT(saveSettings())); - - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setWindowIcon(QIcon::fromTheme("preferences-desktop-locale")); - dialog->show(); - - return app.exec(); -} diff --git a/lxqt-config-locale/translations/lxqt-config-locale_ar.desktop b/lxqt-config-locale/translations/lxqt-config-locale_ar.desktop deleted file mode 100644 index 812d306..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_ar.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[ar]=المحليّة -GenericName[ar]=إعدادات المحليّة -Comment[ar]=إعدادات المحليّة للكسكيوت diff --git a/lxqt-config-locale/translations/lxqt-config-locale_ca.desktop b/lxqt-config-locale/translations/lxqt-config-locale_ca.desktop deleted file mode 100644 index 1487277..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_ca.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[ca]=Configuració regional -GenericName[ca]=Ajusts de la configuració regional -Comment[ca]=Ajusts de la configuració regional per a LXQt diff --git a/lxqt-config-locale/translations/lxqt-config-locale_da.desktop b/lxqt-config-locale/translations/lxqt-config-locale_da.desktop deleted file mode 100644 index c585032..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_da.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[da]=Sprog -GenericName[da]=Sprogindstillinger -Comment[da]=Sprogindstillinger for LXQt diff --git a/lxqt-config-locale/translations/lxqt-config-locale_de.desktop b/lxqt-config-locale/translations/lxqt-config-locale_de.desktop deleted file mode 100644 index f286c87..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_de.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[de]=Regionaleinstellungen -GenericName[de]=Regionaleinstellungen -Comment[de]=Regionaleinstellungen für LXQt diff --git a/lxqt-config-locale/translations/lxqt-config-locale_fr.desktop b/lxqt-config-locale/translations/lxqt-config-locale_fr.desktop deleted file mode 100644 index 250d44c..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[fr]=Région -GenericName[fr]=Paramètres de la région -Comment[fr]=Paramètres de la région pour LXQt diff --git a/lxqt-config-locale/translations/lxqt-config-locale_it.desktop b/lxqt-config-locale/translations/lxqt-config-locale_it.desktop deleted file mode 100644 index 28e8bb0..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_it.desktop +++ /dev/null @@ -1,2 +0,0 @@ -Name[it]=Lingua e Paese -Comment[it]=Preferenze della lingua e del paese diff --git a/lxqt-config-locale/translations/lxqt-config-locale_lt.desktop b/lxqt-config-locale/translations/lxqt-config-locale_lt.desktop deleted file mode 100644 index 799f1de..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_lt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[lt]=Lokalė -GenericName[lt]=Lokalės nustatymai -Comment[lt]=LXQt lokalės nustatymai diff --git a/lxqt-config-locale/translations/lxqt-config-locale_pl.desktop b/lxqt-config-locale/translations/lxqt-config-locale_pl.desktop deleted file mode 100644 index a9061fb..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_pl.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[pl]=Region i język -GenericName[pl]=Ustawienia regionalne -Comment[pl]=Zmień region i język LXQt diff --git a/lxqt-config-locale/translations/lxqt-config-locale_ru.desktop b/lxqt-config-locale/translations/lxqt-config-locale_ru.desktop deleted file mode 100644 index a8706bc..0000000 --- a/lxqt-config-locale/translations/lxqt-config-locale_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ru]=Локаль -GenericName[ru]=Настройки локали -Comment[ru]=Настройки локали для LXQt diff --git a/lxqt-config-monitor/CMakeLists.txt b/lxqt-config-monitor/CMakeLists.txt deleted file mode 100644 index c4e5e84..0000000 --- a/lxqt-config-monitor/CMakeLists.txt +++ /dev/null @@ -1,92 +0,0 @@ -project(lxqt-config-monitor) - -find_package(KF5Screen REQUIRED) -find_package(Qt5Svg REQUIRED) - -set(HEADERS - monitorsettingsdialog.h - monitor.h - monitorwidget.h - monitorpicture.h - loadsettings.h - settingsdialog.h - managesavedsettings.h - fastmenu.h -) - -set(SOURCES - main.cpp - monitorsettingsdialog.cpp - monitor.cpp - monitorwidget.cpp - timeoutdialog.cpp - monitorpicture.cpp - loadsettings.cpp - settingsdialog.cpp - managesavedsettings.cpp - fastmenu.cpp -) - -set(UIS - monitorsettingsdialog.ui - monitorwidget.ui - timeoutdialog.ui - monitorpicture.ui - managesavedsettings.ui - fastmenu.ui -) - -set(ICONS - icons/monitor.svg -) - -# Config file -configure_file(resources/configure.in configure.h) - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${HEADERS} - ${SOURCES} - ${UIS} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES "resources/${PROJECT_NAME}.desktop.in") - -#************************************************ - -add_executable(${PROJECT_NAME} - ${SOURCES} - ${RESOURCES} - ${QRC_SOURCES} - ${DESKTOP_FILES} - ${QM_FILES} - ${QM_LOADER} -) - -target_link_libraries(${PROJECT_NAME} - Qt5::Widgets - Qt5::X11Extras - Qt5::Svg - KF5::Screen - lxqt -) - -install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) -install(FILES ${DESKTOP_FILES} DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/applications") -install(FILES ${ICONS} DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/lxqt/icons") diff --git a/lxqt-config-monitor/LICENSE b/lxqt-config-monitor/LICENSE deleted file mode 100644 index d7f1051..0000000 --- a/lxqt-config-monitor/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {description} - Copyright (C) {year} {fullname} - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - {signature of Ty Coon}, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/lxqt-config-monitor/README.md b/lxqt-config-monitor/README.md deleted file mode 100644 index 7574bf9..0000000 --- a/lxqt-config-monitor/README.md +++ /dev/null @@ -1,4 +0,0 @@ -lxqt-config-monitor -=================== - -This tool lets you change monitor settings. It was based on lxrandr-qt but now uses libkscreen. diff --git a/lxqt-config-monitor/fakeTest.sh b/lxqt-config-monitor/fakeTest.sh deleted file mode 100644 index 6aa23c8..0000000 --- a/lxqt-config-monitor/fakeTest.sh +++ /dev/null @@ -1,6 +0,0 @@ -export KSCREEN_BACKEND=Fake -export KSCREEN_BACKEND_ARGS=TEST_DATA=/home/lucas/prog/lxqt/libkscreen/autotests/configs/multipleoutput.json -killall kscreen_backend_launcher -#`find /usr -name 'kscreen_backend_launcher'` -lxqt-config-monitor - diff --git a/lxqt-config-monitor/fastmenu.cpp b/lxqt-config-monitor/fastmenu.cpp deleted file mode 100644 index 1f124e1..0000000 --- a/lxqt-config-monitor/fastmenu.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "fastmenu.h" -#include "timeoutdialog.h" - -#include -#include -#include -#include -#include - -enum Options -{ - None=0, Extended=1, Unified=2, OnlyFirst=3, OnlySecond=4 -}; - -FastMenu::FastMenu(KScreen::ConfigPtr config, QWidget* parent) : - QGroupBox(parent) -{ - this->mConfig = config; - this->mOldConfig = mConfig->clone(); - - ui.setupUi(this); - - connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onSeleccionChanged(int))); -} - -FastMenu::~FastMenu() -{ -} - -void FastMenu::extended() -{ - int width = 0; - KScreen::OutputList outputs = mConfig->outputs(); - for (const KScreen::OutputPtr &output : outputs) - { - if( !output->isConnected() ) - continue; - QPoint pos = output->pos(); - pos.setX(width); - pos.setY(0); - output->setPos(pos); - output->setEnabled(true); - //first left one as primary - output->setPrimary(width == 0); - KScreen::ModePtr mode(output->currentMode()); - if (!mode) - { // set first mode - mode = output->modes().first(); - if (mode) - { - output->setCurrentModeId(mode->id()); - } - } - if (mode) { - width += mode->size().width(); - } - } -} - -static bool sizeBiggerThan(const QSize &sizeA, const QSize &sizeB) -{ - return sizeA.width() * sizeA.height() > sizeB.width() * sizeB.height(); -} - -void FastMenu::unified() -{ - KScreen::OutputList outputs = mConfig->outputs(); - // Look for common size - QList commonSizes; - for (const KScreen::OutputPtr &output : outputs) - { - if( !output->isConnected() ) - continue; - for(const KScreen::ModePtr &mode: output->modes()) - { - commonSizes.append(mode->size()); - } - break; - } - for (const KScreen::OutputPtr &output : outputs) - { - if( !output->isConnected() ) - continue; - QList sizes; - for(const KScreen::ModePtr &mode: output->modes()) - { - if( commonSizes.contains(mode->size()) ) - sizes.append(mode->size()); - } - commonSizes = sizes; - } - // Select the bigest common size - qSort(commonSizes.begin(), commonSizes.end(), sizeBiggerThan); - if(commonSizes.isEmpty()) - return; - QSize commonSize = commonSizes[0]; - // Put all monitors in (0,0) position and set size - for (const KScreen::OutputPtr &output : outputs) - { - if( !output->isConnected() ) - continue; - QPoint pos = output->pos(); - pos.setX(0); - pos.setY(0); - output->setPos(pos); - output->setEnabled(true); - // Select mode with the biggest refresh rate - float maxRefreshRate = 0.0; - for(const KScreen::ModePtr &mode: output->modes()) - { - if(mode->size() == commonSize && maxRefreshRate < mode->refreshRate()) - { - output->setCurrentModeId(mode->id()); - maxRefreshRate = mode->refreshRate(); - } - } - } -} - -void FastMenu::onlyFirst() -{ - bool foundOk = false; - KScreen::OutputList outputs = mConfig->outputs(); - for (const KScreen::OutputPtr &output : outputs) - { - if( !output->isConnected() ) - continue; - QPoint pos = output->pos(); - pos.setX(0); - pos.setY(0); - output->setPos(pos); - output->setEnabled(!foundOk); - foundOk = true; - } -} - -void FastMenu::onlySecond() -{ - bool foundOk = true; - KScreen::OutputList outputs = mConfig->outputs(); - for (const KScreen::OutputPtr &output : outputs) - { - if( !output->isConnected() ) - continue; - QPoint pos = output->pos(); - pos.setX(0); - pos.setY(0); - output->setPos(pos); - output->setEnabled(!foundOk); - foundOk = false; - } -} - -void FastMenu::onSeleccionChanged(int index) -{ - switch((Options) index) - { - case Extended: - extended(); - break; - case Unified: - unified(); - break; - case OnlyFirst: - onlyFirst(); - break; - case OnlySecond: - onlySecond(); - break; - case None: - return; - break; - }; - - if (mConfig && KScreen::Config::canBeApplied(mConfig)) - { - KScreen::SetConfigOperation(mConfig).exec(); - - TimeoutDialog mTimeoutDialog; - if (mTimeoutDialog.exec() == QDialog::Rejected) - KScreen::SetConfigOperation(mOldConfig).exec(); - else - mOldConfig = mConfig->clone(); - } -} diff --git a/lxqt-config-monitor/fastmenu.h b/lxqt-config-monitor/fastmenu.h deleted file mode 100644 index f83a94f..0000000 --- a/lxqt-config-monitor/fastmenu.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2016 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef _FASTMENU_H_ -#define _FASTMENU_H_ - -#include "ui_fastmenu.h" - -#include -#include -#include -#include -#include - - - -class FastMenu : public QGroupBox -{ - Q_OBJECT - - -public: - FastMenu(KScreen::ConfigPtr config, QWidget* parent = 0); - ~FastMenu(); - -private Q_SLOTS: - void onSeleccionChanged(int index); - -private: - Ui::FastMenu ui; - KScreen::ConfigPtr mConfig; - KScreen::ConfigPtr mOldConfig; - - void extended(); - void unified(); - void onlyFirst(); - void onlySecond(); -}; - -#endif // _FASTMENU_H_ diff --git a/lxqt-config-monitor/fastmenu.ui b/lxqt-config-monitor/fastmenu.ui deleted file mode 100644 index b2bcc54..0000000 --- a/lxqt-config-monitor/fastmenu.ui +++ /dev/null @@ -1,80 +0,0 @@ - - - FastMenu - - - - 0 - 0 - 298 - 164 - - - - Form - - - - - - Fast options - - - false - - - - - - - 20 - - - - - - - - - - ❶ ❷ Extended view - - - - - ❶ ❶ Unified view - - - - - ❶ Only first - - - - - ❷ Only second - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - diff --git a/lxqt-config-monitor/icons/monitor.svg b/lxqt-config-monitor/icons/monitor.svg deleted file mode 100644 index 102ec12..0000000 --- a/lxqt-config-monitor/icons/monitor.svg +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xmlOpenclipartmonitoring2011-02-16T19:15:54Iconos para monitoreo de proyectoshttps://openclipart.org/detail/119695/monitoring-by-jabernaljabernalbúsquedamonitoreomonitoringprojectproyectosearch - - image/svg+xml - - - - - - - - - - - - - diff --git a/lxqt-config-monitor/loadsettings.cpp b/lxqt-config-monitor/loadsettings.cpp deleted file mode 100644 index 19dbc7b..0000000 --- a/lxqt-config-monitor/loadsettings.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2015 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - - - -#include "loadsettings.h" -#include -#include -#include -#include -#include -#include -#include - - -LoadSettings::LoadSettings(QObject *parent):QObject(parent) -{ - KScreen::GetConfigOperation *operation = new KScreen::GetConfigOperation(); - connect(operation, &KScreen::GetConfigOperation::finished, [this, operation] (KScreen::ConfigOperation *op) { - KScreen::GetConfigOperation *configOp = qobject_cast(op); - if (configOp) - { - loadConfiguration(configOp->config()); - operation->deleteLater(); - } - }); -} - -void LoadSettings::loadConfiguration(KScreen::ConfigPtr config) -{ - LXQt::Settings settings("lxqt-config-monitor"); - QList monitors; - settings.beginGroup("currentConfig"); - loadMonitorSettings(settings, monitors); - settings.endGroup(); - - applySettings(config, monitors); -} - - -void applySettings(KScreen::ConfigPtr config, QList monitors) -{ - KScreen::OutputList outputs = config->outputs(); - for (const KScreen::OutputPtr &output : outputs) - { - qDebug() << "Output: " << output->name(); - for(int i=0;iname() ) - { - KScreen::Edid* edid = output->edid(); - if (edid && edid->isValid()) - if( monitor.hash != edid->hash() ) - { - qDebug() << "Hash: " << monitor.hash << "==" << edid->hash(); - return QCoreApplication::instance()->exit(1); // Saved settings are from other monitor - } - if( monitor.connected != output->isConnected() ) - return QCoreApplication::instance()->exit(2); // Saved settings are from other monitor - if( !output->isConnected() ) - continue; - output->setEnabled( monitor.enabled ); - output->setPrimary( monitor.primary ); - output->setPos( QPoint(monitor.xPos, monitor.yPos) ); - output->setRotation( (KScreen::Output::Rotation)(monitor.rotation) ); - // output->setCurrentModeId could fail. KScreen sometimes changes mode Id. - KScreen::ModeList modeList = output->modes(); - foreach(const KScreen::ModePtr &mode, modeList) - { - if( mode->id() == QString(monitor.currentMode) - || - ( - mode->size().width() == monitor.currentModeWidth - && - mode->size().height() == monitor.currentModeHeight - && - mode->refreshRate() == monitor.currentModeRate - ) - ) - { - output->setCurrentModeId( mode->id() ); - break; - } - } - - } - } - } - - if (KScreen::Config::canBeApplied(config)) - KScreen::SetConfigOperation(config).exec(); - - QCoreApplication::instance()->exit(0); -} - diff --git a/lxqt-config-monitor/loadsettings.h b/lxqt-config-monitor/loadsettings.h deleted file mode 100644 index 9af3c95..0000000 --- a/lxqt-config-monitor/loadsettings.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2015 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef __LOADSETTINGS_H__ -#define __LOADSETTINGS_H__ - - -#include -#include -#include "monitor.h" - -class LoadSettings : public QObject -{ - Q_OBJECT - -public: - LoadSettings(QObject *parent = 0); - -private Q_SLOTS: - void loadConfiguration(KScreen::ConfigPtr config); - -private: - - // Configutarions - KScreen::ConfigPtr mConfig; -}; - -/*! Apply settings. - */ -void applySettings(KScreen::ConfigPtr config, QList monitors); - - -#endif // __LOADSETTINGS_H__ diff --git a/lxqt-config-monitor/main.cpp b/lxqt-config-monitor/main.cpp deleted file mode 100644 index 316b1d0..0000000 --- a/lxqt-config-monitor/main.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2014 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "monitorsettingsdialog.h" -#include -#include "loadsettings.h" - -static bool loadSettingsOk(int argc, char** argv) -{ - for(int i=0; i - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#include "managesavedsettings.h" -#include "loadsettings.h" -#include "configure.h" -#include "monitor.h" -#include -#include -#include - -Q_DECLARE_METATYPE(MonitorSavedSettings) - - -ManageSavedSettings::ManageSavedSettings(LXQt::Settings * applicationSettings, KScreen::ConfigPtr config, QWidget * parent): -QDialog(parent) -{ - - this->applicationSettings = applicationSettings; - this->config = config; - - ui.setupUi(this); - - connect(ui.allConfigs, SIGNAL(itemActivated(QListWidgetItem *)), SLOT(showSelectedConfig(QListWidgetItem *))); - connect(ui.deletePushButton, SIGNAL(clicked()), SLOT(onDeleteItem())); - connect(ui.renamePushButton, SIGNAL(clicked()), SLOT(onRenameItem())); - connect(ui.applyPushButton, SIGNAL(clicked()), SLOT(onApplyItem())); - - loadSettings(); -} - - -void ManageSavedSettings::showSelectedConfig(QListWidgetItem * item) -{ - MonitorSavedSettings o = item->data(Qt::UserRole).value(); - QString text; - for(int i=0; i < o.monitors.size(); i++) - { - MonitorSettings setting = o.monitors[i]; - if(! setting.connected ) - continue; - text += QString("%1:
").arg(setting.name); - text += QString(" Mode: %1x%2
").arg(setting.currentModeWidth).arg(setting.currentModeHeight); - text += QString(" Rate: %1 Hz
").arg(setting.currentModeRate); - switch(setting.rotation) - { - case KScreen::Output::Rotation::None: - text += QString(" Rotation: %1
").arg(tr("None")); - break; - case KScreen::Output::Rotation::Left: - text += QString(" Rotation: %1
").arg(tr("Left")); - break; - case KScreen::Output::Rotation::Inverted: - text += QString(" Rotation: %1
").arg(tr("Inverted")); - break; - case KScreen::Output::Rotation::Right: - text += QString(" Rotation: %1
").arg(tr("Right")); - break; - } - text += QString(" Position: %1x%2
").arg(setting.xPos).arg(setting.yPos); - text += QString(" Primary: %1
").arg(setting.primary?tr("True"):tr("False")); - text += QString(" Enabled: %1
").arg(setting.enabled?tr("True"):tr("False")); - } - text += "
"; - ui.selectedSettingsTextEdit->setText(text); - ui.applyPushButton->setEnabled(isHardwareCompatible(o)); -} - - -bool ManageSavedSettings::isHardwareCompatible(MonitorSavedSettings &settings) -{ - KScreen::OutputList outputs = config->outputs(); - for (const KScreen::OutputPtr &output : outputs) - { - bool ok = false; - for (int i=0; i < settings.monitors.size(); i++) - { - MonitorSettings o = settings.monitors[i]; - if(o.name != output->name()) - continue; - KScreen::Edid *edid = output->edid(); - if(edid && edid->isValid()) - if(o.hash != output->edid()->hash()) - return false; - ok = true; - break; - } - if(!ok) - return false; - } - return true; -} - -void ManageSavedSettings::onDeleteItem() -{ - if (ui.allConfigs->currentItem() == NULL) - return; - MonitorSavedSettings obj = ui.allConfigs->currentItem()->data(Qt::UserRole).value(); - - LXQt::Settings settings("lxqt-config-monitor"); - QList monitors; - settings.beginGroup("SavedConfigs"); - loadMonitorSettings(settings, monitors); - for (int i = 0; i < monitors.size(); i++) { - MonitorSavedSettings o = monitors[i]; - if (o == obj) { - monitors.removeAt(i); - break; - } - } - saveMonitorSettings(settings, monitors); - - settings.endGroup(); - - loadSettings(); -} - -void ManageSavedSettings::onRenameItem() -{ - if (ui.allConfigs->currentItem() == NULL) - return; - MonitorSavedSettings obj = ui.allConfigs->currentItem()->data(Qt::UserRole).value(); - bool ok; - QString configName = QInputDialog::getText(this, tr("Name"), tr("Name:"), - QLineEdit::Normal, - obj.name, &ok); - if (!ok || configName.isEmpty()) - return; - - LXQt::Settings settings("lxqt-config-monitor"); - QList monitors; - settings.beginGroup("SavedConfigs"); - loadMonitorSettings(settings, monitors); - for (int i = 0; i < monitors.size(); i++) { - MonitorSavedSettings o = monitors[i]; - if (o == obj) { - monitors.removeAt(i); - obj.name = configName; - monitors.append(obj); - break; - } - } - saveMonitorSettings(settings, monitors); - - settings.endGroup(); - - loadSettings(); -} - -void ManageSavedSettings::onApplyItem() -{ - if (ui.allConfigs->currentItem() == NULL) - return; - MonitorSavedSettings settings = ui.allConfigs->currentItem()->data(Qt::UserRole).value(); - applySettings(config, settings.monitors); -} - - - -void ManageSavedSettings::loadSettings() -{ - ui.allConfigs->clear(); - //ui.hardwareCompatibleConfigs->clear(); - LXQt::Settings settings("lxqt-config-monitor"); - QList monitors; - settings.beginGroup("SavedConfigs"); - loadMonitorSettings(settings, monitors); - settings.endGroup(); - foreach(MonitorSavedSettings o, monitors) { - QListWidgetItem *item = new QListWidgetItem(o.name+" - "+o.date, ui.allConfigs); - QVariant var; - var.setValue(o); - item->setData(Qt::UserRole, var); - if (isHardwareCompatible(o)) { - QFont font = ui.allConfigs->font(); - font.setBold(true); - item->setData(Qt::FontRole, font); - } - } -} diff --git a/lxqt-config-monitor/managesavedsettings.h b/lxqt-config-monitor/managesavedsettings.h deleted file mode 100644 index 4cbb305..0000000 --- a/lxqt-config-monitor/managesavedsettings.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2015 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - - -#ifndef _SAVESETTINGS_H_ -#define _SAVESETTINGS_H_ - -#include "ui_managesavedsettings.h" -#include "monitor.h" -#include -#include -#include -#include - -class ManageSavedSettings : public QDialog { - Q_OBJECT - -public: - ManageSavedSettings(LXQt::Settings *applicationSettings, KScreen::ConfigPtr config, QWidget* parent = 0); - - Ui::ManageSavedSettings ui; - -public slots: - /*! Load settings to QListWidgets. - edids is hardware code to detect hardware compatible settings. - */ - void loadSettings(); - - void showSelectedConfig(QListWidgetItem * item); - - void onDeleteItem(); - - void onRenameItem(); - - void onApplyItem(); - -private: - LXQt::Settings *applicationSettings; - KScreen::ConfigPtr config; - bool isHardwareCompatible(MonitorSavedSettings &settings); - -}; - -#endif // _SAVESETTINGS_H_ diff --git a/lxqt-config-monitor/managesavedsettings.ui b/lxqt-config-monitor/managesavedsettings.ui deleted file mode 100644 index 55357e6..0000000 --- a/lxqt-config-monitor/managesavedsettings.ui +++ /dev/null @@ -1,74 +0,0 @@ - - - ManageSavedSettings - - - - 0 - 0 - 521 - 312 - - - - Monitor Settings - - - - - - - - - - - - - Saved settings - - - - - - - - - - - Rename - - - - - - - Delete - - - - - - - Apply - - - - - - - - - true - - - - - - - - - - - - - diff --git a/lxqt-config-monitor/monitor.cpp b/lxqt-config-monitor/monitor.cpp deleted file mode 100644 index 1afa4a3..0000000 --- a/lxqt-config-monitor/monitor.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2014 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "monitor.h" - -bool MonitorSavedSettings::operator==(const MonitorSavedSettings &obj) -{ - if(name != obj.name) - return false; - if(date != obj.date) - return false; - // TODO: Check QList monitors. - return true; -} - -void saveMonitorSettings(QSettings & settings, QList monitors) -{ - settings.remove("settings"); - settings.beginWriteArray("settings"); - int i = 0; - Q_FOREACH(MonitorSettings monitor, monitors) - { - settings.setArrayIndex(i++); - saveMonitorSettings(settings, monitor); - } - settings.endArray(); -} - -void saveMonitorSettings(QSettings &settings, MonitorSettings &monitor) -{ - settings.setValue("name", monitor.name); - settings.setValue("hash", monitor.hash); - settings.setValue("connected", monitor.connected); - if(monitor.connected) - { - settings.setValue("enabled", monitor.enabled); - settings.setValue("primary", monitor.primary); - settings.setValue("xPos", monitor.xPos); - settings.setValue("yPos", monitor.yPos); - settings.setValue("currentMode", monitor.currentMode); - settings.setValue("currentModeWidth", monitor.currentModeWidth); - settings.setValue("currentModeHeight", monitor.currentModeHeight); - settings.setValue("currentModeRate", monitor.currentModeRate); - settings.setValue("rotation", monitor.rotation); - } -} - -void loadMonitorSettings(QSettings & settings, QList &monitors) -{ - int size = settings.beginReadArray("settings"); - for(int i=0; i monitors) -{ - settings.remove("SavedSettings"); - settings.beginWriteArray("SavedSettings"); - int i = 0; - Q_FOREACH(MonitorSavedSettings monitor, monitors) - { - settings.setArrayIndex(i++); - saveMonitorSettings(settings, monitor); - } - settings.endArray(); -} - -void saveMonitorSettings(QSettings &settings, MonitorSavedSettings &monitor) -{ - settings.setValue("name", monitor.name); - settings.setValue("date", monitor.date); - saveMonitorSettings(settings, monitor.monitors); -} - -void loadMonitorSettings(QSettings & settings, QList &monitors) -{ - int size = settings.beginReadArray("SavedSettings"); - for(int i=0; i - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef _MONITOR_H_ -#define _MONITOR_H_ - -#include -#include -#include - -//Settings to be stored or read from settings file. -struct MonitorSettings { - QString name; - QString hash; - bool connected; - bool enabled; - bool primary; - QString currentMode; - int currentModeWidth; - int currentModeHeight; - float currentModeRate; - int xPos; - int yPos; - int rotation; -}; - -struct MonitorSavedSettings { - QString name; - QString date; - QList monitors; - - bool operator==(const MonitorSavedSettings &obj); -}; - -/**This function saves a list of MonitorSettings in QSettings file. - * Before using this function, QSettings group must be opened. - */ -void saveMonitorSettings(QSettings &settings, QList monitors); -void saveMonitorSettings(QSettings &settings, MonitorSettings &monitor); - -/**This function loads a list of MonitorSettings from QSettings file. - * Before using this function, QSettings group must be opened. - */ -void loadMonitorSettings(QSettings &settings, QList &monitors); -void loadMonitorSettings(QSettings &settings, MonitorSettings &monitor); - -/**This function saves a list of MonitorSavedSettings in QSettings file. - * Before using this function, QSettings group must be opened. - */ -void saveMonitorSettings(QSettings &settings, QList monitors); -void saveMonitorSettings(QSettings &settings, MonitorSavedSettings &monitor); - -/**This function loads a list of MonitorSavedSettings in QSettings file. - * Before using this function, QSettings group must be opened. - */ -void loadMonitorSettings(QSettings &settings, QList &monitors); -void loadMonitorSettings(QSettings &settings, MonitorSavedSettings &monitor); - -#endif // _MONITOR_H_ diff --git a/lxqt-config-monitor/monitorpicture.cpp b/lxqt-config-monitor/monitorpicture.cpp deleted file mode 100644 index 05a8efb..0000000 --- a/lxqt-config-monitor/monitorpicture.cpp +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright (C) 2014 P.L. Lucas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "monitorpicture.h" - -#include -#include -#include -#include -#include -#include - -#include "configure.h" - -// Gets size from string rate. String rate format is "widthxheight". Example: 800x600 -static QSize sizeFromString(QString str) -{ - int width = 0; - int height = 0; - int x = str.indexOf('x'); - if (x > 0) - { - width = str.leftRef(x).toInt(); - height = str.midRef(x + 1).toInt(); - } - return QSize(width, height); -} - -MonitorPictureProxy::MonitorPictureProxy(QObject *parent, MonitorPicture *monitorPicture):QObject(parent) -{ - this->monitorPicture = monitorPicture; -} - -void MonitorPictureProxy::updateSize() -{ - KScreen::OutputPtr output = monitorPicture->monitorWidget->output; - QSize size = output->currentMode()->size(); - monitorPicture->updateSize(size); -} - -void MonitorPictureProxy::updatePosition() -{ - KScreen::OutputPtr output = monitorPicture->monitorWidget->output; - QPoint pos = output->pos(); - //qDebug() << "MonitorPictureProxy:updatePosition]" << pos; - monitorPicture->setMonitorPosition(pos.x(), pos.y()); -} - -MonitorPictureDialog::MonitorPictureDialog(KScreen::ConfigPtr config, QWidget * parent, Qt::WindowFlags f) : - QDialog(parent,f) -{ - updatingOk = false; - firstShownOk = false; - maxMonitorSize = 0; - mConfig = config; - ui.setupUi(this); -} - - -void MonitorPictureDialog::setScene(QList monitors) -{ - int monitorsWidth =0; - int monitorsHeight = 0; - QGraphicsScene *scene = new QGraphicsScene(); - for (MonitorWidget *monitor : monitors) - { - MonitorPicture *monitorPicture = new MonitorPicture(nullptr, monitor, this); - pictures.append(monitorPicture); - scene->addItem(monitorPicture); - monitorsWidth += monitorPicture->rect().width(); - monitorsHeight += monitorPicture->rect().height(); - MonitorPictureProxy *proxy = new MonitorPictureProxy(this, monitorPicture); - proxy->connect(monitor->output.data(), SIGNAL(currentModeIdChanged()), SLOT(updateSize())); - proxy->connect(monitor->output.data(), SIGNAL(posChanged()), SLOT(updatePosition())); - } - // The blue rectangle is maximum size of virtual screen (framebuffer) - scene->addRect(0, 0, mConfig->screen()->maxSize().width(), mConfig->screen()->maxSize().height(), QPen(Qt::blue, 20))->setOpacity(0.5); - maxMonitorSize = qMax(monitorsWidth, monitorsHeight); - ui.graphicsView->setScene(scene); -} - -void MonitorPictureDialog::showEvent(QShowEvent * event) -{ - QWidget::showEvent(event); - if( ! firstShownOk ) - { - // Update scale and set scrollbar position. - // Real widget size is not set, until widget is shown. - firstShownOk = true; - int minWidgetLength = qMin(ui.graphicsView->size().width(), ui.graphicsView->size().width()) / 1.5; - qDebug() << "minWidgetLength" << minWidgetLength << "maxMonitorSize" << maxMonitorSize << "scale" << minWidgetLength / (float) maxMonitorSize; - ui.graphicsView->scale(minWidgetLength / (float) maxMonitorSize, minWidgetLength / (float) maxMonitorSize); - updateScene(); - ui.graphicsView->verticalScrollBar()->setValue(0); - ui.graphicsView->horizontalScrollBar()->setValue(0); - } -} - -void MonitorPictureDialog::updateScene() -{ - ui.graphicsView->scene()->update(); -} - -void MonitorPictureDialog::updateMonitorWidgets(QString primaryMonitor) -{ - // This method update spin boxes of position. - // If position is changed when this method is running, position is changed until buffer overflow. - // updatingOk control that this method can not be run twice in the same position change. - - if(updatingOk) - return; - updatingOk = true; - int x0, y0; - x0 = y0 = 0; - - for (MonitorPicture *picture : pictures) - { - if (picture->monitorWidget->output->name() == primaryMonitor - || primaryMonitor == QStringLiteral("")) - { - x0 = picture->originX + picture->pos().x(); - y0 = picture->originY + picture->pos().y(); - break; - } - } - - if( primaryMonitor == QStringLiteral("") ) - { - for(MonitorPicture *picture: pictures) - { - int x1 = picture->originX + picture->pos().x(); - int y1 = picture->originY + picture->pos().y(); - x0 = qMin(x0, x1); - y0 = qMin(y0, y1); - } - } - - for (MonitorPicture *picture : pictures) - { - int x = picture->originX + picture->pos().x() - x0; - int y = picture->originY + picture->pos().y() - y0; - if( x != picture->monitorWidget->ui.xPosSpinBox->value() ) - picture->monitorWidget->ui.xPosSpinBox->setValue(x); - //else - // qDebug() << "x Iguales"; - if( y != picture->monitorWidget->ui.yPosSpinBox->value() ) - picture->monitorWidget->ui.yPosSpinBox->setValue(y); - //else - // qDebug() << "y Iguales"; - //qDebug() << "[MonitorPictureDialog::updateMonitorWidgets]" << x << '=' << picture->monitorWidget->ui.xPosSpinBox->value() << ',' << y << '=' << picture->monitorWidget->ui.yPosSpinBox->value(); - } - updatingOk = false; -} - -MonitorPicture::MonitorPicture(QGraphicsItem * parent, - MonitorWidget *monitorWidget, - MonitorPictureDialog *monitorPictureDialog) : - QGraphicsRectItem(parent) -{ - this->monitorWidget = monitorWidget; - this->monitorPictureDialog = monitorPictureDialog; - QSize currentSize = sizeFromString(monitorWidget->ui.resolutionCombo->currentText()); - if( monitorWidget->output->rotation() == KScreen::Output::Left || monitorWidget->output->rotation() == KScreen::Output::Right ) - currentSize.transpose(); - int x = monitorWidget->ui.xPosSpinBox->value(); - int y = monitorWidget->ui.yPosSpinBox->value(); - setAcceptedMouseButtons(Qt::LeftButton); - setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemSendsGeometryChanges); - originX = x; - originY = y; - - setRect(x, y, currentSize.width(), currentSize.height()); - // setPen(QPen(Qt::black, 20)); - // textItem = new QGraphicsTextItem(monitorWidget->output->name(), this); - // textItem->setX(x); - // textItem->setY(y); - // textItem->setParentItem(this); - - QSvgRenderer *renderer = new QSvgRenderer(QLatin1String(ICON_PATH "monitor.svg")); - svgItem = new QGraphicsSvgItem(); - svgItem->setSharedRenderer(renderer); - svgItem->setX(x); - svgItem->setY(y); - svgItem->setOpacity(0.7); - svgItem->setParentItem(this); - - - textItem = new QGraphicsTextItem(monitorWidget->output->name(), this); - textItem->setDefaultTextColor(Qt::white); - textItem->setX(x); - textItem->setY(y); - textItem->setParentItem(this); - setPen(QPen(Qt::black, 20)); - - - adjustNameSize(); -} - -void MonitorPicture::adjustNameSize() -{ - prepareGeometryChange(); - qreal fontWidth = QFontMetrics(textItem->font()).width(monitorWidget->output->name() + QStringLiteral(" ")); - textItem->setScale((qreal) this->rect().width() / fontWidth); - QTransform transform; - qreal width = qAbs(this->rect().width()/svgItem->boundingRect().width()); - qreal height = qAbs(this->rect().height()/svgItem->boundingRect().height()); - qDebug() << "Width x Height" << width << "x" << height; - transform.scale(width, height); - svgItem->setTransform(transform); -} - -void MonitorPicture::updateSize(QSize currentSize) -{ - QRectF r = rect(); - r.setSize(currentSize); - setRect(r); - adjustNameSize(); -} - -QVariant MonitorPicture::itemChange(GraphicsItemChange change, const QVariant & value) -{ - //qDebug() << "[MonitorPicture::itemChange]: "; - //if ( change == ItemPositionChange && scene()) { - // value is the new position. - //QPointF newPos = value.toPointF(); - //qDebug() << "[MonitorPictureDialog::updateMonitorWidgets]: " << newPos.x() << "x" << newPos.y(); - //} - QVariant v = QGraphicsItem::itemChange(change, value); - //monitorPictureDialog->updateMonitorWidgets(QString()); - return v; -} - -void MonitorPicture::setMonitorPosition(int x, int y) -{ - setX( x - originX ); - setY( y - originY ); -} - -void MonitorPicture::mouseReleaseEvent(QGraphicsSceneMouseEvent * event) -{ - QGraphicsRectItem::mouseReleaseEvent(event); - monitorPictureDialog->moveMonitorPictureToNearest(this); - monitorPictureDialog->updateMonitorWidgets(QString()); -} - -////////////////////////////////////////////////////////////////////////////////// -// Move picture to nearest picture procedure. -// Read magnetic_attraction.html for more info about the algorithm used. -////////////////////////////////////////////////////////////////////////////////// - -struct Parameters { - float t1, t2; - QVector2D cutPoint; -}; - -static Parameters segmentsCut(QVector2D p0, QVector2D p1, QVector2D s0, QVector2D s1) -{ - Parameters result; - QVector2D v0 = p1 - p0; - QVector2D v1 = s1 - s0; - QVector2D P = s0 - p0; - - float det = v0.y() * v1.x() - v0.x() * v1.y(); - if (det == 0.0) - result.t1 = result.t2 = -1.0; - - result.t1 = 1 / det * (-v1.y() * P.x() + v1.x() * P.y()); - result.t2 = 1 / det * (-v0.y() * P.x() + v0.x() * P.y()); - result.cutPoint = v0 * result.t1 + p0; - return result; -} - -static QVector2D computeCenter(MonitorPicture* monitorPicture) -{ - float x0 = monitorPicture->x() + monitorPicture->originX; - float y0 = monitorPicture->y() + monitorPicture->originY; - float x1 = x0 + monitorPicture->rect().width(); - float y1 = y0 + monitorPicture->rect().height(); - QVector2D p0(x0, y0); - QVector2D p1(x1, y1); - QVector2D center = p0 + (p1 - p0) * 0.5; - return center; -} - -struct Result_moveMonitorPictureToNearest -{ - bool ok; - QVector2D vector; -}; - -static Result_moveMonitorPictureToNearest compareTwoMonitors(MonitorPicture* monitorPicture1, - MonitorPicture* monitorPicture2) -{ - Result_moveMonitorPictureToNearest result; - QVector2D center1 = computeCenter(monitorPicture1); - QVector2D center2 = computeCenter(monitorPicture2); - float x0 = monitorPicture2->x() + monitorPicture2->originX; - float y0 = monitorPicture2->y() + monitorPicture2->originY; - float x1 = x0 + monitorPicture2->rect().width(); - float y1 = y0 + monitorPicture2->rect().height(); - - QVector2D p0(x0, y0); - QVector2D p1(x1, y1); - QVector2D P1, P2; - float t1 = -1.0, t2 = -1.0; - - Parameters params = segmentsCut(center1, center2, QVector2D(x0, y0), QVector2D(x1, y0)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t1 < 0) - { - t1 = params.t1; - P1 = params.cutPoint; - } - - params = segmentsCut(center1, center2, QVector2D(x0, y0), QVector2D(x0, y1)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t1 < 0) - { - t1 = params.t1; - P1 = params.cutPoint; - } - - params = segmentsCut(center1, center2, QVector2D(x1, y1), QVector2D(x1, y0)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t1 < 0) - { - t1 = params.t1; - P1 = params.cutPoint; - } - - params = segmentsCut(center1, center2, QVector2D(x1, y1), QVector2D(x0, y1)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t1 < 0) - { - t1 = params.t1; - P1 = params.cutPoint; - } - - x0 = monitorPicture1->x() + monitorPicture1->originX; - y0 = monitorPicture1->y() + monitorPicture1->originY; - x1 = x0 + monitorPicture1->rect().width(); - y1 = y0 + monitorPicture1->rect().height(); - p0 = QVector2D(x0, y0); - p1 = QVector2D(x1, y1); - - params = segmentsCut(center1, center2, QVector2D(x0, y0), QVector2D(x1, y0)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t2 < 0) - { - t2 = params.t1; - P2 = params.cutPoint; - } - - params = segmentsCut(center1, center2, QVector2D(x0, y0), QVector2D(x0, y1)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t2 < 0) - { - t2 = params.t1; - P2 = params.cutPoint; - } - - params = segmentsCut(center1, center2, QVector2D(x1, y1), QVector2D(x1, y0)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t2 < 0) - { - t2 = params.t1; - P2 = params.cutPoint; - } - - params = segmentsCut(center1, center2, QVector2D(x1, y1), QVector2D(x0, y1)); - if (params.t1 >= 0.0 && params.t1 <= 1.0 && params.t2 >= 0.0 && params.t2 <= 1.0 && t2 < 0) - { - t2 = params.t1; - P2 = params.cutPoint; - } - - // Monitor outside - if (t1 > t2) - { - result.vector = P1 - P2; - result.ok = false; - } else - result.ok = true; - - return result; -} - -void MonitorPictureDialog::moveMonitorPictureToNearest(MonitorPicture* monitorPicture) -{ - if (!ui.magneticCheckBox->isChecked()) - return; - - QVector2D vector(0, 0); - for (MonitorPicture *picture : pictures) - { - if (picture == monitorPicture) - continue; - - Result_moveMonitorPictureToNearest result = compareTwoMonitors(monitorPicture, picture); - if (result.ok) - return; - else if (result.vector.length() < vector.length() || vector.length() == 0.0) - vector = result.vector; - } - - int x = monitorPicture->x(); - int y = monitorPicture->y(); - monitorPicture->setX(x + vector.x()); - monitorPicture->setY(y + vector.y()); -} diff --git a/lxqt-config-monitor/monitorpicture.h b/lxqt-config-monitor/monitorpicture.h deleted file mode 100644 index 8e85e94..0000000 --- a/lxqt-config-monitor/monitorpicture.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2014 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef _MONITORPICTURE_H_ -#define _MONITORPICTURE_H_ - -#include -#include -#include -#include -#include -#include -#include "monitor.h" -#include "ui_monitorpicture.h" -#include "monitorwidget.h" - -class MonitorPicture; - -class MonitorPictureDialog : public QDialog -{ - Q_OBJECT - -public: - MonitorPictureDialog(KScreen::ConfigPtr config, QWidget * parent = 0, Qt::WindowFlags f = 0); - void setScene(QList monitors); - void updateMonitorWidgets(QString primaryMonitor); - void moveMonitorPictureToNearest(MonitorPicture* monitorPicture); - void updateScene(); - -protected: - virtual void showEvent(QShowEvent * event); - -private: - Ui::MonitorPictureDialog ui; - QList pictures; - bool updatingOk; - KScreen::ConfigPtr mConfig; - bool firstShownOk; - int maxMonitorSize; -}; - -class MonitorPicture : public QGraphicsRectItem -{ -public: - MonitorPicture(QGraphicsItem *parent, - MonitorWidget *monitorWidget, - MonitorPictureDialog *monitorPictureDialog); - void setMonitorPosition(int x, int y); - void adjustNameSize(); - - MonitorWidget *monitorWidget; - int originX, originY; - - void updateSize(QSize size); - -private: - QGraphicsTextItem *textItem; - QGraphicsSvgItem *svgItem; - MonitorPictureDialog *monitorPictureDialog; - - -protected: - QVariant itemChange(GraphicsItemChange change, const QVariant & value); - void mouseReleaseEvent(QGraphicsSceneMouseEvent * event); -}; - -class MonitorPictureProxy: public QObject -{ - Q_OBJECT - public: - MonitorPictureProxy(QObject *parent, MonitorPicture *monitorPicture); - MonitorPicture *monitorPicture; - - public slots: - void updateSize(); - void updatePosition(); - -}; - - -#endif // _MONITORPICTURE_H_ diff --git a/lxqt-config-monitor/monitorpicture.ui b/lxqt-config-monitor/monitorpicture.ui deleted file mode 100644 index bdce68e..0000000 --- a/lxqt-config-monitor/monitorpicture.ui +++ /dev/null @@ -1,38 +0,0 @@ - - - MonitorPictureDialog - - - - 0 - 0 - 462 - 362 - - - - Dialog - - - - - - - - - - - - - Keep monitors attached - - - true - - - - - - - - diff --git a/lxqt-config-monitor/monitorsettingsdialog.cpp b/lxqt-config-monitor/monitorsettingsdialog.cpp deleted file mode 100644 index 2730413..0000000 --- a/lxqt-config-monitor/monitorsettingsdialog.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - Copyright (C) 2014 P.L. Lucas - Copyright (C) 2013 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "monitorsettingsdialog.h" - -#include "monitorwidget.h" -#include "monitor.h" -#include "timeoutdialog.h" -#include "monitorpicture.h" -#include "settingsdialog.h" -#include "fastmenu.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -MonitorSettingsDialog::MonitorSettingsDialog() : - QDialog(nullptr, 0) -{ - ui.setupUi(this); - - KScreen::GetConfigOperation *operation = new KScreen::GetConfigOperation(); - connect(operation, &KScreen::GetConfigOperation::finished, [this, operation] (KScreen::ConfigOperation *op) { - KScreen::GetConfigOperation *configOp = qobject_cast(op); - qDebug() << "Connecting to KScreen..."; - if (configOp && configOp->config() && configOp->config()->screen()) - { - mOldConfig = configOp->config()->clone(); - loadConfiguration(configOp->config()); - operation->deleteLater(); - } - else if(configOp && !configOp->config()) - { - qDebug() << "Error: Config is invalid, probably backend couldn't load"; - exit(1); - } - else if(configOp && configOp->config() && !configOp->config()->screen()) - { - qDebug() << "Error: No screen in the configuration, broken backend"; - exit(2); - } - else - { - qDebug() << "Error: Connect to KScreen is not possible"; - exit(3); - } - }); - - connect(ui.buttonBox, &QDialogButtonBox::clicked, [&] (QAbstractButton *button) { - if (ui.buttonBox->standardButton(button) == QDialogButtonBox::Apply) - applyConfiguration(false); - if (ui.buttonBox->standardButton(button) == QDialogButtonBox::Save) - { - applyConfiguration(true); - } - - }); - - connect(ui.settingsButton, SIGNAL(clicked()), this, SLOT(showSettingsDialog())); -} - -MonitorSettingsDialog::~MonitorSettingsDialog() -{ -} - -void MonitorSettingsDialog::loadConfiguration(KScreen::ConfigPtr config) -{ - if (mConfig == config) - return; - - mConfig = config; - - MonitorPictureDialog *monitorPicture = nullptr; - FastMenu *fastMenu = nullptr; - KScreen::OutputList outputs = mConfig->outputs(); - - int nMonitors = 0; - for (const KScreen::OutputPtr &output : outputs) - { - if (output->isConnected()) - nMonitors++; - - if (nMonitors > 1) - { - fastMenu = new FastMenu(config, this); - ui.monitorList->addItem(tr("Fast Menu")); - ui.stackedWidget->addWidget(fastMenu); - - monitorPicture = new MonitorPictureDialog(config, this); - ui.monitorList->addItem(tr("Set position")); - ui.stackedWidget->addWidget(monitorPicture); - break; - } - } - - QList monitors; - - for (const KScreen::OutputPtr &output : outputs) - { - if (output->isConnected()) - { - MonitorWidget *monitor = new MonitorWidget(output, mConfig, this); - ui.monitorList->addItem(output->name()); - ui.stackedWidget->addWidget(monitor); - monitors.append(monitor); - } - } - - Q_FOREACH(MonitorWidget *monitor1, monitors) - { - Q_FOREACH(MonitorWidget *monitor, monitors) - { - if(monitor != monitor1) - connect(monitor, SIGNAL(primaryOutputChanged(MonitorWidget *)), monitor1, SLOT(onPrimaryOutputChanged(MonitorWidget *))); - } - } - - if (monitorPicture) - monitorPicture->setScene(monitors); - - ui.monitorList->setCurrentRow(0); - adjustSize(); -} - -void MonitorSettingsDialog::applyConfiguration(bool saveConfigOk) -{ - if (mConfig && KScreen::Config::canBeApplied(mConfig)) - { - KScreen::SetConfigOperation(mConfig).exec(); - - TimeoutDialog mTimeoutDialog; - if (mTimeoutDialog.exec() == QDialog::Rejected) - KScreen::SetConfigOperation(mOldConfig).exec(); - else - { - mOldConfig = mConfig->clone(); - if (saveConfigOk) - saveConfiguration(mConfig); - } - } -} - -void MonitorSettingsDialog::accept() -{ - //applyConfiguration(true); - QDialog::accept(); -} - -void MonitorSettingsDialog::reject() -{ - QDialog::reject(); -} - -void MonitorSettingsDialog::saveConfiguration(KScreen::ConfigPtr config) -{ - - QList currentSettings; - KScreen::OutputList outputs = config->outputs(); - for (const KScreen::OutputPtr &output : outputs) - { - MonitorSettings monitor; - monitor.name = output->name(); - KScreen::Edid* edid = output->edid(); - if (edid && edid->isValid()) - monitor.hash = edid->hash(); - monitor.connected = output->isConnected(); - if ( output->isConnected() ) - { - monitor.enabled = output->isEnabled(); - monitor.primary = output->isPrimary(); - monitor.xPos = output->pos().x(); - monitor.yPos = output->pos().y(); - monitor.currentMode = output->currentModeId(); - monitor.currentModeWidth = output->currentMode()->size().width(); - monitor.currentModeHeight = output->currentMode()->size().height(); - monitor.currentModeRate = output->currentMode()->refreshRate(); - monitor.rotation = output->rotation(); - } - currentSettings.append(monitor); - } - - LXQt::Settings settings("lxqt-config-monitor"); - settings.beginGroup("currentConfig"); - saveMonitorSettings(settings, currentSettings); - settings.endGroup(); - - QList monitors; - settings.beginGroup("SavedConfigs"); - loadMonitorSettings(settings, monitors); - qDebug() << "[ MonitorSettingsDialog::saveConfiguration] # monitors Read:" << monitors.size(); - MonitorSavedSettings monitor; - monitor.name = QDateTime::currentDateTime().toString(); - monitor.date = QDateTime::currentDateTime().toString(Qt::ISODate); - monitor.monitors = currentSettings; - monitors.append(monitor); - saveMonitorSettings(settings, monitors); - qDebug() << "[ MonitorSettingsDialog::saveConfiguration] # monitors Write:" << monitors.size(); - settings.endGroup(); - - LXQt::AutostartEntry autoStart("lxqt-config-monitor-autostart.desktop"); - XdgDesktopFile desktopFile(XdgDesktopFile::ApplicationType, "lxqt-config-monitor-autostart", "lxqt-config-monitor -l"); - //desktopFile.setValue("OnlyShowIn", QString(qgetenv("XDG_CURRENT_DESKTOP"))); - desktopFile.setValue("OnlyShowIn", "LXQt"); - desktopFile.setValue("Comment", "Autostart monitor settings for LXQt-config-monitor"); - autoStart.setFile(desktopFile); - autoStart.commit(); -} - - -void MonitorSettingsDialog::showSettingsDialog() -{ - QByteArray configName = qgetenv("LXQT_SESSION_CONFIG"); - - if (configName.isEmpty()) - configName = "MonitorSettings"; - - LXQt::Settings settings(configName); - - SettingsDialog settingsDialog(tr("Advanced settings"), &settings, mConfig); - settingsDialog.exec(); -} diff --git a/lxqt-config-monitor/monitorsettingsdialog.h b/lxqt-config-monitor/monitorsettingsdialog.h deleted file mode 100644 index dbd8af7..0000000 --- a/lxqt-config-monitor/monitorsettingsdialog.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2014 P.L. Lucas - Copyright (C) 2013 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef MONITORSETTINGSDIALOG_H -#define MONITORSETTINGSDIALOG_H - -#include "ui_monitorsettingsdialog.h" -#include "timeoutdialog.h" - -#include -#include -#include -#include - -class MonitorSettingsDialog : public QDialog -{ - Q_OBJECT - -public: - MonitorSettingsDialog(); - virtual ~MonitorSettingsDialog(); - - virtual void accept(); - virtual void reject(); - -private: - void applyConfiguration(bool saveConfigOk); - void cancelConfiguration(); - -private Q_SLOTS: - void loadConfiguration(KScreen::ConfigPtr config); - void showSettingsDialog(); - -private: - void saveConfiguration(KScreen::ConfigPtr config); - - Ui::MonitorSettingsDialog ui; - - // Configutarions - KScreen::ConfigPtr mOldConfig; - KScreen::ConfigPtr mConfig; -}; - -#endif // MONITORSETTINGSDIALOG_H diff --git a/lxqt-config-monitor/monitorsettingsdialog.ui b/lxqt-config-monitor/monitorsettingsdialog.ui deleted file mode 100644 index b48d4f6..0000000 --- a/lxqt-config-monitor/monitorsettingsdialog.ui +++ /dev/null @@ -1,136 +0,0 @@ - - - MonitorSettingsDialog - - - - 0 - 0 - 510 - 131 - - - - Monitor Settings - - - - - - - - - - - Qt::Horizontal - - - false - - - - - 0 - 0 - - - - - 150 - 0 - - - - Qt::ScrollBarAlwaysOff - - - QListView::Adjust - - - - - - 1 - 0 - - - - - 350 - 0 - - - - - - - - - - - Settings - - - - - - Qt::ToolButtonTextBesideIcon - - - false - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Apply|QDialogButtonBox::Close|QDialogButtonBox::Save - - - false - - - - - - - - - - - monitorList - currentRowChanged(int) - stackedWidget - setCurrentIndex(int) - - - 126 - 181 - - - 20 - 20 - - - - - buttonBox - rejected() - MonitorSettingsDialog - reject() - - - 338 - 439 - - - 286 - 257 - - - - - diff --git a/lxqt-config-monitor/monitorwidget.cpp b/lxqt-config-monitor/monitorwidget.cpp deleted file mode 100644 index de0ae12..0000000 --- a/lxqt-config-monitor/monitorwidget.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - Copyright (C) 2014 P.L. Lucas - Copyright (C) 2014 Hong Jen Yee (PCMan) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "monitorwidget.h" - -#include -#include -#include -#include - - - -QString modeToString(KScreen::ModePtr mode) -{ - // mode->name() can be anything, not just widthxheight. eg if added with cvt. - return QString("%1x%2").arg(mode->size().width()).arg(mode->size().height()); -} - -KScreen::OutputPtr getOutputById(int id, KScreen::OutputList outputs) -{ - for (const KScreen::OutputPtr &output : outputs) - if (output->id() == id) - return output; - - return KScreen::OutputPtr(nullptr); -} - -KScreen::ModePtr getModeById(QString id, KScreen::ModeList modes) -{ - for (const KScreen::ModePtr &mode : modes) - if (mode->id() == id) - return mode; - - return KScreen::ModePtr(NULL); -} - -static bool sizeBiggerThan(const KScreen::ModePtr &modeA, const KScreen::ModePtr &modeB) -{ - QSize sizeA = modeA->size(); - QSize sizeB = modeB->size(); - return sizeA.width() * sizeA.height() > sizeB.width() * sizeB.height(); -} - - -MonitorWidget::MonitorWidget(KScreen::OutputPtr output, KScreen::ConfigPtr config, QWidget* parent) : - QGroupBox(parent) -{ - this->output = output; - this->config = config; - - ui.setupUi(this); - - ui.enabledCheckbox->setChecked(output->isEnabled()); - - QList modeList = output->modes().values(); - - // Remove duplicate sizes - QMap noDuplicateModes; - foreach(const KScreen::ModePtr &mode, modeList) - { - if( noDuplicateModes.keys().contains(modeToString(mode)) ) - { - KScreen::ModePtr actual = noDuplicateModes[modeToString(mode)]; - bool isActualPreferred = output->preferredModes().contains(actual->id()); - bool isModePreferred = output->preferredModes().contains(mode->id()); - if( ( mode->refreshRate() > actual->refreshRate() && !isActualPreferred ) || isModePreferred ) - noDuplicateModes[modeToString(mode)] = mode; - } - else - noDuplicateModes[modeToString(mode)] = mode; - } - - // Sort modes by size - modeList = noDuplicateModes.values(); - qSort(modeList.begin(), modeList.end(), sizeBiggerThan); - - // Add each mode to the list - foreach (const KScreen::ModePtr &mode, modeList) - { - ui.resolutionCombo->addItem(modeToString(mode), mode->id()); - if(output->preferredModes().contains(mode->id())) - { - // Make bold preferredModes - QFont font = ui.resolutionCombo->font(); - font.setBold(true); - ui.resolutionCombo->setItemData(ui.resolutionCombo->count()-1, font, Qt::FontRole); - } - } - connect(ui.resolutionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onResolutionChanged(int))); - - // Select actual mode in list - if (output->currentMode()) - { - // Set the current mode in dropdown - int idx = ui.resolutionCombo->findData(output->currentMode()->id()); - if (idx < 0) - { - // Select mode with same size - foreach (const KScreen::ModePtr &mode, modeList) - { - if( mode->size() == output->currentMode()->size() ) - idx = ui.resolutionCombo->findData(output->currentMode()->id()); - } - } - if(idx < 0) - idx = ui.resolutionCombo->findData(output->preferredMode()->id()); - if (idx >= 0) - ui.resolutionCombo->setCurrentIndex(idx); - } - updateRefreshRates(); - - - // Update EDID information - // KScreen doesn't make much public but that's ok... - KScreen::Edid* edid = output->edid(); - if (edid && edid->isValid()) - { - ui.outputInfoLabel->setText( - tr("Name: %1\n").arg(edid->name()) % - tr("Vendor: %1\n").arg(edid->vendor()) % - tr("Serial: %1\n").arg(edid->serial()) % - tr("Display size: %1cm x %2cm\n").arg(edid->width()).arg(edid->height()) % - tr("Serial number: %1\n").arg(edid->serial()) % - tr("EISA device ID: %1\n").arg(edid->eisaId()) - ); - } - - if (config->connectedOutputs().count() == 1) - { - setOnlyMonitor(true); - // There isn't always a primary output. Gross. - output->setPrimary(true); - } - - ui.xPosSpinBox->setValue(output->pos().x()); - ui.yPosSpinBox->setValue(output->pos().y()); - - // Behavior chooser - if (output->isPrimary()) - ui.behaviorCombo->setCurrentIndex(PrimaryDisplay); - else - ui.behaviorCombo->setCurrentIndex(ExtendDisplay); - - // Insert orientations - ui.orientationCombo->addItem(tr("None"), KScreen::Output::None); - ui.orientationCombo->addItem(tr("Left"), KScreen::Output::Left); - ui.orientationCombo->addItem(tr("Right"), KScreen::Output::Right); - ui.orientationCombo->addItem(tr("Inverted"), KScreen::Output::Inverted); - switch(output->rotation()) - { - case KScreen::Output::None: - ui.orientationCombo->setCurrentIndex(0); - break; - case KScreen::Output::Left: - ui.orientationCombo->setCurrentIndex(1); - break; - case KScreen::Output::Right: - ui.orientationCombo->setCurrentIndex(2); - break; - case KScreen::Output::Inverted: - ui.orientationCombo->setCurrentIndex(3); - break; - } - - connect(ui.enabledCheckbox, SIGNAL(toggled(bool)), this, SLOT(onEnabledChanged(bool))); - connect(ui.behaviorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onBehaviorChanged(int))); - connect(ui.xPosSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onPositionChanged(int))); - connect(ui.yPosSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onPositionChanged(int))); - connect(ui.orientationCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onOrientationChanged(int))); - - // Force update behavior visibility - onBehaviorChanged(ui.behaviorCombo->currentIndex()); -} - -MonitorWidget::~MonitorWidget() -{ -} - -void MonitorWidget::onEnabledChanged(bool enabled) -{ - output->setEnabled(enabled); - - // If we're enabling a disabled output for the first time - if (enabled && !output->currentMode()) - { - // order here matters - onResolutionChanged(ui.resolutionCombo->currentIndex()); - onOrientationChanged(ui.orientationCombo->currentIndex()); - onBehaviorChanged(ui.behaviorCombo->currentIndex()); - } -} - -void MonitorWidget::onOrientationChanged(int idx) -{ - output->setRotation((KScreen::Output::Rotation) ui.orientationCombo->currentData().toInt(0)); -} - -void MonitorWidget::onBehaviorChanged(int idx) -{ - // Behavior should match the index of the selected element - ui.xPosSpinBox->setVisible(idx == ExtendDisplay); - ui.yPosSpinBox->setVisible(idx == ExtendDisplay); - - output->setPrimary(idx == PrimaryDisplay); - if(idx == PrimaryDisplay) - emit primaryOutputChanged(this); -} - -void MonitorWidget::onPositionChanged(int value) -{ - output->setPos(QPoint(ui.xPosSpinBox->value(), ui.yPosSpinBox->value())); -} - -void MonitorWidget::onResolutionChanged(int index) -{ - output->setCurrentModeId(ui.resolutionCombo->currentData().toString()); - updateRefreshRates(); -} - -void MonitorWidget::onRateChanged(int index) -{ - output->setCurrentModeId(ui.rateCombo->currentData().toString()); -} - -void MonitorWidget::updateRefreshRates() -{ - disconnect(ui.rateCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onRateChanged(int))); - ui.rateCombo->clear(); - - if (output->modes().size() < 0) - return; - - KScreen::ModePtr selectedMode = output->currentMode(); - if (selectedMode) - { - for (const KScreen::ModePtr &mode : output->modes()) - if (mode->size() == selectedMode->size()) - ui.rateCombo->addItem(tr("%1 Hz").arg(mode->refreshRate()), mode->id()); - - int idx = ui.rateCombo->findData(selectedMode->id()); - if (idx >= 0) - ui.rateCombo->setCurrentIndex(idx); - } - - connect(ui.rateCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onRateChanged(int))); -} - -void MonitorWidget::setOnlyMonitor(bool isOnlyMonitor) -{ - ui.enabledCheckbox->setEnabled(!isOnlyMonitor); - ui.behaviorCombo->setEnabled(!isOnlyMonitor); - ui.xPosSpinBox->setVisible(!isOnlyMonitor); - ui.yPosSpinBox->setVisible(!isOnlyMonitor); - if(isOnlyMonitor) - { - ui.xPosSpinBox->setValue(0); - ui.yPosSpinBox->setValue(0); - } -} - -void MonitorWidget::onPrimaryOutputChanged(MonitorWidget *widget) -{ - if(widget == this) - return; - ui.behaviorCombo->setCurrentIndex(ExtendDisplay); -} diff --git a/lxqt-config-monitor/monitorwidget.h b/lxqt-config-monitor/monitorwidget.h deleted file mode 100644 index ced3caf..0000000 --- a/lxqt-config-monitor/monitorwidget.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2014 P.L. Lucas - Copyright (C) 2014 Hong Jen Yee (PCMan) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef _MONITORWIDGET_H_ -#define _MONITORWIDGET_H_ - -#include "ui_monitorwidget.h" - -#include -#include -#include -#include -#include -#include - -#define PrimaryDisplay 0 -#define ExtendDisplay 1 - -#define RightOf 0 -#define LeftOf 1 -#define Above 2 -#define Below 3 -#define Manually 4 - -class MonitorWidget : public QGroupBox -{ - Q_OBJECT - - friend class MonitorPicture; - friend class MonitorPictureDialog; - -public: - MonitorWidget(KScreen::OutputPtr output, KScreen::ConfigPtr config, QWidget* parent = 0); - ~MonitorWidget(); - - void updateRefreshRates(); - - KScreen::OutputPtr output; - KScreen::ConfigPtr config; - -signals: - void primaryOutputChanged(MonitorWidget *widget); - -public Q_SLOTS: - void setOnlyMonitor(bool isOnlyMonitor); - -private Q_SLOTS: - void onEnabledChanged(bool); - void onBehaviorChanged(int); - void onPositionChanged(int); - void onResolutionChanged(int); - void onRateChanged(int); - void onOrientationChanged(int); - void onPrimaryOutputChanged(MonitorWidget *widget); - -private: - Ui::MonitorWidget ui; -}; - -#endif // _MONITORWIDGET_H_ diff --git a/lxqt-config-monitor/monitorwidget.ui b/lxqt-config-monitor/monitorwidget.ui deleted file mode 100644 index 07488d1..0000000 --- a/lxqt-config-monitor/monitorwidget.ui +++ /dev/null @@ -1,210 +0,0 @@ - - - MonitorWidget - - - - 0 - 0 - 313 - 274 - - - - - - - 0 - - - - Setup - - - - - - - - (x) - - - - - - -10000000 - - - 10000000 - - - - - - - (y) - - - - - - -10000000 - - - 10000000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Resolution: - - - - - - - - - - - - Enable this display - - - - - - - - This is my primary display - - - - - This screen extends another display - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Advanced - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Refresh rate: - - - - - - - Rotation: - - - - - - - - - - - 0 - 0 - - - - - - - - - - - Info - - - - - - Display information - - - true - - - - - - - Qt::Vertical - - - - 20 - 1 - - - - - - - - - - - - - diff --git a/lxqt-config-monitor/resources/configure.in b/lxqt-config-monitor/resources/configure.in deleted file mode 100644 index c0cd07a..0000000 --- a/lxqt-config-monitor/resources/configure.in +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __CONFIG_H__ -#define ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/lxqt/icons/" -#define __CONFIG_H__ -#endif \ No newline at end of file diff --git a/lxqt-config-monitor/resources/lxqt-config-monitor.desktop.in b/lxqt-config-monitor/resources/lxqt-config-monitor.desktop.in deleted file mode 100644 index bb7939e..0000000 --- a/lxqt-config-monitor/resources/lxqt-config-monitor.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Monitor settings -GenericName=Monitor settings -Comment=Configure monitors -Exec=lxqt-config-monitor -Icon=preferences-desktop-display -Categories=Settings;DesktopSettings;Qt;LXQt;HardwareSettings; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/lxqt-config-monitor/resources/magnetic_attraction.html b/lxqt-config-monitor/resources/magnetic_attraction.html deleted file mode 100644 index 0fd6900..0000000 --- a/lxqt-config-monitor/resources/magnetic_attraction.html +++ /dev/null @@ -1,42 +0,0 @@ - - -Magnetic attraction algorithm - - - -

Magnetic attraction algorithm

-

The algorithm used to move monitors to the nearest one in “position dialog” is explained here.

-

Segment equation is used. Let’s explain segment equation in order to understand the proccess:

-

If you have two points, p0, p1 ∈ ℝ 2, the equation of straight line between p0 and p1 is:

- -r = v · t + p0 - -

where v = p1 - p0, and t ∈ [0,1].

-

Algorithm calculates equation of the segment between monitor centers. Then, it gets intersection points with edges of monitors:

- - - - Layer 1 - - - - c_0 - c_1 - t_2 - t_1 - - - - -

If v = c1 - c0, c0 and c1 are monitors centers, the equation between them is r = v · t + c0.

-

where t1 is the parameter of the mentioned equation to get the intersection point with the c1 monitor.

-

where t2 the parameter with the c0 monitor.

-

t1, t2 ∈ [0,1].

- -

If t2<t1, the monitors are separated, otherwise the monitors are overlapped.

-

With the previous information we get:

-

r1 = v· t1 + c0

-

r2 = v· t2 + c0

-

Iff t2<t1, c0 monitor must be moved, and its displacement is provided by r = r1-r2

- - diff --git a/lxqt-config-monitor/savesettings.cpp b/lxqt-config-monitor/savesettings.cpp deleted file mode 100644 index 331f164..0000000 --- a/lxqt-config-monitor/savesettings.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - Copyright (C) 2015 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include -#include -#include "savesettings.h" -#include "configure.h" -#include -#include -#include -#include - -SaveSettings::SaveSettings(LXQt::Settings*applicationSettings, QWidget* parent): - QDialog(parent) { - - this->applicationSettings = applicationSettings; - - ui.setupUi(this); - - QSize size(128,64); - ui.save->setIcon(QIcon::fromTheme("document-save")); - ui.save->setIconSize(size); - - connect(ui.hardwareCompatibleConfigs, SIGNAL(itemDoubleClicked(QListWidgetItem *)), SLOT(setSavedSettings(QListWidgetItem *))); - connect(ui.deletePushButton, SIGNAL(clicked()), SLOT(onDeleteItem())); - connect(ui.renamePushButton, SIGNAL(clicked()), SLOT(onRenameItem())); - - loadSettings(); -} - -void SaveSettings::setHardwareIdentifier(QString hardwareIdentifier) { - this->hardwareIdentifier = hardwareIdentifier; - loadSettings(); -} - -void SaveSettings::setSavedSettings(QListWidgetItem * item) { - QJsonObject o = item->data(Qt::UserRole).toJsonObject(); - QString cmd = o["command"].toString(); - qDebug() << "[SaveSettings::setSavedSettings]: " << cmd; - QProcess::execute(cmd); -} - -void SaveSettings::onDeleteItem() { - if( ui.allConfigs->currentItem() == NULL ) - return; - QJsonObject obj = ui.allConfigs->currentItem()->data(Qt::UserRole).toJsonObject(); - applicationSettings->beginGroup("configMonitor"); - QJsonArray savedConfigs = QJsonDocument::fromJson(applicationSettings->value("saved").toByteArray()).array(); - for(int i=0;isetValue("saved", QVariant(QJsonDocument(savedConfigs).toJson())); - applicationSettings->endGroup(); - loadSettings(); -} - -void SaveSettings::onRenameItem() { - if( ui.allConfigs->currentItem() == NULL ) - return; - QJsonObject obj = ui.allConfigs->currentItem()->data(Qt::UserRole).toJsonObject(); - bool ok; - QString configName = QInputDialog::getText(this, tr("Name"), tr("Name:"), QLineEdit::Normal, obj["name"].toString(), &ok); - if (!ok || configName.isEmpty()) - return; - applicationSettings->beginGroup("configMonitor"); - QJsonArray savedConfigs = QJsonDocument::fromJson(applicationSettings->value("saved").toByteArray()).array(); - for(int i=0;isetValue("saved", QVariant(QJsonDocument(savedConfigs).toJson())); - applicationSettings->endGroup(); - loadSettings(); -} - -void SaveSettings::loadSettings() { - ui.allConfigs->clear(); - ui.hardwareCompatibleConfigs->clear(); - applicationSettings->beginGroup("configMonitor"); - QJsonArray savedConfigs = QJsonDocument::fromJson(applicationSettings->value("saved").toByteArray()).array(); - foreach (const QJsonValue & v, savedConfigs) { - QJsonObject o = v.toObject(); - QListWidgetItem *item = new QListWidgetItem(o["name"].toString(), ui.allConfigs); - item->setData(Qt::UserRole, QVariant(o)); - if(o["hardwareIdentifier"].toString() == hardwareIdentifier) { - QListWidgetItem *item = new QListWidgetItem(o["name"].toString(), ui.hardwareCompatibleConfigs); - item->setData(Qt::UserRole, QVariant(o)); - } - } - applicationSettings->endGroup(); -} diff --git a/lxqt-config-monitor/settingsdialog.cpp b/lxqt-config-monitor/settingsdialog.cpp deleted file mode 100644 index 8ba7c9c..0000000 --- a/lxqt-config-monitor/settingsdialog.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2015 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "settingsdialog.h" -#include "managesavedsettings.h" -#include - -SettingsDialog::SettingsDialog(const QString &title, LXQt::Settings *settings, KScreen::ConfigPtr config, QWidget *parent) - : LXQt::ConfigDialog(title, settings, parent) -{ - setButtons(QDialogButtonBox::QDialogButtonBox::Apply | QDialogButtonBox::Close); - setWindowIcon(QIcon::fromTheme("preferences-desktop-display")); - - //DaemonSettings *daemon = new DaemonSettings(settings, this); - //addPage(daemon, QObject::tr("Daemon"), "system-run"); - - ManageSavedSettings * savedSettings = new ManageSavedSettings(settings, config, this); - addPage(savedSettings, QObject::tr("Manage Saved Settings"), "system-run"); -} diff --git a/lxqt-config-monitor/settingsdialog.h b/lxqt-config-monitor/settingsdialog.h deleted file mode 100644 index 3094f2f..0000000 --- a/lxqt-config-monitor/settingsdialog.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2015 P.L. Lucas - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef __SETTINGSDIALOG_H__ -#define __SETTINGSDIALOG_H__ - -#include -#include -#include -#include - - -class SettingsDialog : public LXQt::ConfigDialog -{ - Q_OBJECT - -public: - SettingsDialog(const QString &title, LXQt::Settings *settings, KScreen::ConfigPtr config, QWidget *parent = 0); - -private Q_SLOTS: - -private: - - // Configutarions -}; - -#endif // __SETTINGSDIALOG_H__ - diff --git a/lxqt-config-monitor/timeoutdialog.cpp b/lxqt-config-monitor/timeoutdialog.cpp deleted file mode 100644 index 55302a9..0000000 --- a/lxqt-config-monitor/timeoutdialog.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright (C) 2014 PCMan - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#define TIMER_DURATION 10 - -#include "timeoutdialog.h" - -TimeoutDialog::TimeoutDialog(QWidget* parent, Qt::WindowFlags f) : - QDialog(parent, f) -{ - ui.setupUi(this); - - QIcon icon = style()->standardIcon(QStyle::SP_MessageBoxQuestion); - int size = style()->pixelMetric(QStyle::PM_MessageBoxIconSize); - ui.icon->setPixmap(icon.pixmap(QSize(size, size))); - - connect(&timer, &QTimer::timeout, this, &TimeoutDialog::onTimeout); - adjustSize(); -} - -TimeoutDialog::~TimeoutDialog() -{ -} - -void TimeoutDialog::showEvent(QShowEvent* e) -{ - timer.start(1000); - QDialog::showEvent(e); -} - -void TimeoutDialog::onTimeout() -{ - int maximum = ui.progressBar->maximum(); - int time = ui.progressBar->value() + maximum / TIMER_DURATION; - - // if time is finished, settings are restored. - if (time >= maximum) - { - timer.stop(); - reject(); - } - else - { - int remaining = maximum / TIMER_DURATION - TIMER_DURATION * time / maximum; - ui.remainingTime->setText(tr("%n second(s) remaining", nullptr, remaining).arg(remaining)); - ui.progressBar->setValue(time); - } -} diff --git a/lxqt-config-monitor/timeoutdialog.h b/lxqt-config-monitor/timeoutdialog.h deleted file mode 100644 index c6c0601..0000000 --- a/lxqt-config-monitor/timeoutdialog.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * Copyright (C) 2014 PCMan - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifndef TIMEOUTDIALOG_H -#define TIMEOUTDIALOG_H - -#include "ui_timeoutdialog.h" -#include -#include - -class TimeoutDialog : public QDialog -{ - Q_OBJECT - -public: - TimeoutDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); - virtual ~TimeoutDialog(); - -protected: - virtual void showEvent(QShowEvent* e); - -private Q_SLOTS: - void onTimeout(); - -private: - Ui::TimeoutDialog ui; - QTimer timer; -}; - -#endif // TIMEOUTDIALOG_H diff --git a/lxqt-config-monitor/timeoutdialog.ui b/lxqt-config-monitor/timeoutdialog.ui deleted file mode 100644 index 0d1ec14..0000000 --- a/lxqt-config-monitor/timeoutdialog.ui +++ /dev/null @@ -1,107 +0,0 @@ - - - TimeoutDialog - - - - 0 - 0 - 255 - 152 - - - - Settings are changed - - - true - - - - - - - 0 - 0 - - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - QDialogButtonBox::No|QDialogButtonBox::Yes - - - - - - - Are the current settings OK for you? - - - 10 - - - - - - - false - - - - - - - Qt::AlignCenter - - - 5 - - - - - - - - - buttonBox - accepted() - TimeoutDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - TimeoutDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_ar.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_ar.desktop deleted file mode 100644 index 7a9960b..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_ar.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[ar]=إعدادات الشّاشة -GenericName[ar]=إعدادات الشّاشة -Comment[ar]=اضبط الشّاشات diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_ca.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_ca.desktop deleted file mode 100644 index c73ebb8..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_ca.desktop +++ /dev/null @@ -1,4 +0,0 @@ -#Translations -Name[ca]=Ajusts del monitor -GenericName[ca]=Ajusts del monitor -Comment[ca]=Configureu els monitors diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_da.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_da.desktop deleted file mode 100644 index 9f0e877..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_da.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[da]=Skærmindstillinger -GenericName[da]=Skærmindstillinger -Comment[da]=Konfigurér skærme diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_de.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_de.desktop deleted file mode 100644 index abdbf8c..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_de.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[de]=Bildschirmeinstellungen -GenericName[de]=Bildschirmeinstellungen -Comment[de]=Bildschirmauflösung und externe Monitore konfigurieren diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_el.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_el.desktop deleted file mode 100644 index b741f35..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_el.desktop +++ /dev/null @@ -1,4 +0,0 @@ -#Translations -Name[el]=Ρυθμίσεις οθόνης -GenericName[el]=Ρυθμίσεις οθόνης -Comment[el]=Διαμόρφωση οθονών diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_fr.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_fr.desktop deleted file mode 100644 index 3d9f7ca..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_fr.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[fr]=Paramètres de l'écran -GenericName[fr]=Paramètres de l'écran -Comment[fr]=Configurer les écrans diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_hu.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_hu.desktop deleted file mode 100644 index dbd544c..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_hu.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[hu]=LXQt képernyőbeállítás -GenericName[hu]=Képernyőbeállítások -Comment[hu]=Képfelbontás és külső monitorok beállítása diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_it.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_it.desktop deleted file mode 100644 index 4e34f16..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_it.desktop +++ /dev/null @@ -1,4 +0,0 @@ -Name[it]=Monitor -GenericName[it]=Impostazioni dei monitor -Comment[it]=Configura la risoluzione e i monitor esterni - diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_ja.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_ja.desktop deleted file mode 100644 index 6c6a98c..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_ja.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ja]=モニターの設定 -GenericName[ja]=モニターの設定 -Comment[ja]=モニターの設定 diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_lt.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_lt.desktop deleted file mode 100644 index ae994ec..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_lt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[lt]=Monitoriaus nustatymai -GenericName[lt]=Monitoriaus nustatymai -Comment[lt]=Konfigūruoti monitorius diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_pl_PL.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_pl_PL.desktop deleted file mode 100644 index 0bbd58d..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_pl_PL.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[pl]=Monitor -GenericName[pl]=Ustawienia monitora -Comment[pl]=Konfiguracja monitora diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_pt.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_pt.desktop deleted file mode 100644 index d86f841..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_pt.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[pt]=Definições do monitor -GenericName[pt]=Definições do monitor -Comment[pt]=Configuração de monitores diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_ru.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_ru.desktop deleted file mode 100644 index ab3984e..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ru]=Настроить мониторы -Name[ru]=Настройки монитора -GenericName[ru]=Настройки монитора \ No newline at end of file diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_zh_TW.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_zh_TW.desktop deleted file mode 100644 index 638e341..0000000 --- a/lxqt-config-monitor/translations/lxqt-config-monitor_zh_TW.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[zh_TW]=設定螢幕 -GenericName[zh_TW]=螢幕設定 -Name[zh_TW]=LXQt螢幕設定 diff --git a/lxqt-config.png b/lxqt-config.png deleted file mode 100644 index d95a959..0000000 Binary files a/lxqt-config.png and /dev/null differ diff --git a/man/lxqt-config.1 b/man/lxqt-config.1 deleted file mode 100644 index 69a9de2..0000000 --- a/man/lxqt-config.1 +++ /dev/null @@ -1,59 +0,0 @@ -.TH lxqt-config "1" "September 2012" "LXQt 0.7.0" "LXQt System Settings" -.SH NAME -lxqt-config \- \fBLXQt\fR Settings Center for all related modules and applications -.SH SYNOPSIS -.B lxqt-config -.br -.SH DESCRIPTION -This application its a settings center of all environment related applications, and all -config software instaled and registered by the \fBLXQt\fR desktop environment. -.P -\fBLXQt\fR is an advanced, easy-to-use, and fast desktop environment based on Qt -technologies, ships several core desktop components, all of which are optional: -.P - * Panel - * Desktop - * Application launcher - * Settings center \fI(this)\fR - * Session handler - * Polkit handler - * SSH password access - * Display manager handler -.P -These components perform similar actions to those available in other desktop -environments, and their names are self-descriptive. They are usually not launched -by hand but automatically, when choosing a \fBLXQt\fR session in the Display -Manager. -.P -.SH LXQt Settings Center related applications -.P -\fBLXQt\fR has various config applications: -.P - * Mouse settings: (\fBlxqt-config-mouse\fR) - * Desktop settings: (\fBlxqt-config-desktop\fR) - * Appereance settings: (\fBlxqt-config-appearance\fR) - * Session settings: (\fBlxqt-config-session\fR) - * Notification settings: (\fBlxqt-config-notificationd\fR) -.P -All of this also can be find in Settings or Preferences menu, please consult the respective manpages. -.SH "REPORTING BUGS" -Report bugs to https://github.com/lxde/lxqt/issues -.SH "SEE ALSO" -\fBLXQt\fR has been tailored for users who value simplicity, speed, and -an intuitive interface. LXQt is also intended for less powerful machines. See: - -.\" any module must refers to session app, for more info on start it -.P - * Mouse settings: \fBlxqt-config-mouse(1)\fR -.P - * Desktop settings: \fBlxqt-config-desktop(1)\fR -.P - * Appeareance settings: \fBlxqt-config-appearance(1)\fR -.P - * Session settings: \fBlxqt-config-session(1)\fR -.P - * Notification settings: \fBlxqt-config-notificationd(1)\fR -.P -.SH AUTHOR -This manual page was created by \fBPICCORO Lenz McKAY\fR \fI\fR -for \fBLXQt\fR project and VENENUX GNU/Linux but can be used by others. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 1f9c86b..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -project(lxqt-config) -add_subdirectory(qcategorizedview) - -include_directories ( - "${CMAKE_CURRENT_SOURCE_DIR}/qcategorizedview" -) - -set(lxqt-config_HDRS "") - -set(lxqt-config_SRCS - main.cpp - mainwindow.cpp -) - -set(lxqt-config_MOCS - mainwindow.h -) - -set(lxqt-config_UIS - mainwindow.ui -) - -# Translations ********************************** -lxqt_translate_ts(QM_FILES - UPDATE_TRANSLATIONS - ${UPDATE_TRANSLATIONS} - SOURCES - ${lxqt-config_HDRS} - ${lxqt-config_SRCS} - ${lxqt-config_UIS} - INSTALL_DIR - "${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}" - PULL_TRANSLATIONS - ${PULL_TRANSLATIONS} - CLEAN_TRANSLATIONS - ${CLEAN_TRANSLATIONS} - TRANSLATIONS_REPO - ${TRANSLATIONS_REPO} - TRANSLATIONS_REFSPEC - ${TRANSLATIONS_REFSPEC} - REPO_SUBDIR - "lxqt-config/${PROJECT_NAME}" -) - -lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) -lxqt_translate_desktop(DESKTOP_FILES SOURCES lxqt-config.desktop.in) - -#************************************************ - -add_executable(lxqt-config - ${lxqt-config_SRCS} - ${DESKTOP_FILES} - ${QM_FILES} - ${QM_LOADER} -) - -target_link_libraries(lxqt-config - KF5::WindowSystem - Qt5::Widgets - Qt5::Xml - lxqt -) - -# helper static lib -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/qcategorizedview) -target_link_libraries(lxqt-config qcategorizedview) - -install(TARGETS - lxqt-config - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) -install(FILES - ${DESKTOP_FILES} - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" - COMPONENT Runtime -) -install(FILES lxqt-config.menu - DESTINATION "${LXQT_ETC_XDG_DIR}/menus" - COMPONENT Runtime -) diff --git a/src/lxqt-config.desktop.in b/src/lxqt-config.desktop.in deleted file mode 100644 index e36dd86..0000000 --- a/src/lxqt-config.desktop.in +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Type=Application -Name=LXQt Configuration Center -GenericName=System Settings -Comment=Configure your system -Exec=lxqt-config -Icon=preferences-system -Categories=Settings;DesktopSettings;Qt;LXQt; -OnlyShowIn=LXQt; - -#TRANSLATIONS_DIR=translations diff --git a/src/lxqt-config.menu b/src/lxqt-config.menu deleted file mode 100644 index b2e4a7d..0000000 --- a/src/lxqt-config.menu +++ /dev/null @@ -1,71 +0,0 @@ - - - Settings - lxqt-menu-applications.directory - - - - - - - Settings - - - - LXQt settings - lxqt-settings-lxqt.directory - - - DesktopSettings - - LXQt - X-LXQt - - obconf-qt.desktop - compton-conf.desktop - pcmanfm-qt-desktop-pref.desktop - - - lxqt-config.desktop - System - - - - - - - System settings - lxqt-settings-system.directory - - - Settings - System - - - - - - Other settings - lxqt-settings-other.directory - - - - Settings - - - LXQt - LXDE - System - - - - - - - - LXQt settings - System settings - - - - diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index abe16a2..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include "mainwindow.h" -#include "QCommandLineParser" - - -int main(int argc, char **argv) -{ - LXQt::SingleApplication app(argc, argv); - app.setOrganizationName(QStringLiteral("lxqt")); - app.setApplicationName(QStringLiteral("lxqt-config")); - app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Config")); - const QString VERINFO = QStringLiteral(LXQT_CONFIG_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - app.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(app); - - // ensure that we use lxqt-config.menu file. - qputenv("XDG_MENU_PREFIX", "lxqt-"); - - LXQtConfig::MainWindow w; - app.setActivationWindow(&w); - QSize s = QSettings{}.value("size").toSize(); - if (!s.isEmpty()) - w.resize(s); - w.show(); - - int ret = app.exec(); - - QSettings{}.setValue("size", w.size()); - - return ret; -} diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp deleted file mode 100644 index 7641e79..0000000 --- a/src/mainwindow.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include -#include -#include - -#include "mainwindow.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "qcategorizedview.h" -#include "qcategorydrawer.h" -#include "qcategorizedsortfilterproxymodel.h" - -namespace LXQtConfig { - -struct ConfigPaneData: public QSharedData -{ - QString id; - QString category; - XdgDesktopFile xdg; -}; - -class ConfigPane -{ -public: - ConfigPane(): d(new ConfigPaneData) { } - ConfigPane(const ConfigPane &other): d(other.d) { } - - inline QString &id() const { return d->id; } - inline XdgDesktopFile xdg() const { return d->xdg; } - inline void setXdg(XdgDesktopFile xdg) { d->xdg = xdg; } - inline QString &category() const { return d->category; } - - bool operator==(const ConfigPane &other) - { - return d->id == other.id(); - } - -private: - QExplicitlySharedDataPointer d; -}; - - -class ConfigPaneModel: public QAbstractListModel -{ -public: - ConfigPaneModel(): QAbstractListModel() - { - QString menuFile = XdgMenu::getMenuFileName("config.menu"); - XdgMenu xdgMenu; - xdgMenu.setEnvironments(QStringList() << "X-LXQT" << "LXQt" << "LXDE"); - bool res = xdgMenu.read(menuFile); - if (!res) - { - QMessageBox::warning(0, "Parse error", xdgMenu.errorString()); - return; - } - - DomElementIterator it(xdgMenu.xml().documentElement() , "Menu"); - while(it.hasNext()) - { - this->buildGroup(it.next()); - } - } - - void buildGroup(const QDomElement& xml) - { - QString category; - if (! xml.attribute("title").isEmpty()) - category = xml.attribute("title"); - else - category = xml.attribute("name"); - - DomElementIterator it(xml , "AppLink"); - while(it.hasNext()) - { - QDomElement x = it.next(); - - XdgDesktopFile xdg; - xdg.load(x.attribute("desktopFile")); - - ConfigPane pane; - pane.id() = xdg.value("Icon").toString(); - pane.category() = category; - pane.setXdg(xdg); - m_list.append(pane); - } - } - - void activateItem(const QModelIndex &index) - { - if (!index.isValid()) - return; - m_list[index.row()].xdg().startDetached(); - } - - ~ConfigPaneModel() { } - - int rowCount(const QModelIndex &parent = QModelIndex()) const - { - return m_list.count(); - } - - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) - { - return false; - } - - QVariant data(const QModelIndex &index, int role) const - { - if (role == Qt::DisplayRole || role == Qt::ToolTipRole) - return m_list[index.row()].xdg().name(); - if (role == QCategorizedSortFilterProxyModel::CategoryDisplayRole) - return m_list[index.row()].category(); - if (role == QCategorizedSortFilterProxyModel::CategorySortRole) - return m_list[index.row()].category(); - if (role == Qt::UserRole) - return m_list[index.row()].id(); - if (role == Qt::DecorationRole) - { - return m_list[index.row()].xdg().icon(XdgIcon::defaultApplicationIcon()); - } - return QVariant(); - } - -private: - QList m_list; -}; - -} - - -class ConfigItemDelegate : public QStyledItemDelegate -{ -public: - ConfigItemDelegate(QCategorizedView* view) : mView(view) { } - ~ConfigItemDelegate() { } - - QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const - { - /* We let Qt calculate the real cell size but consider the 4-px margin - around each cell and try to add a 2-px margin around the selection - rectangle for styles that, unlike Fusion, highlight the whole item. */ - QStyleOptionViewItem opt = option; - int delta = opt.rect.width() - (mView->gridSize().width() - 8); - if (delta > 0) - opt.rect.adjust(delta/2, 0 , -delta/2, 0); - QSize defaultSize = QStyledItemDelegate::sizeHint(opt, index); - return QSize(qMin(defaultSize.width() + 4, mView->gridSize().width() - 8), - qMin(defaultSize.height() + 4, mView->gridSize().height() - 8)); - } - -protected: - void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const - { - QStyleOptionViewItem opt = option; - initStyleOption(&opt, index); - - const QSize & iconSize = option.decorationSize; - QSize size(mView->gridSize().width() - 8, // 4-px margin around each cell - iconSize.height()); - // for having sharp non-scalable icons with HDPI - int dpr = qApp->devicePixelRatio(); - if (dpr < 1) dpr = 1; - QPixmap pixmap = opt.icon.pixmap(iconSize / dpr); // -> Qt doc -> QIcon::pixmap() - if (dpr > 1 && pixmap.size() == iconSize) // exceptional (scalable or not from icon set) - pixmap = opt.icon.pixmap(iconSize); - opt.icon = QIcon(pixmap.copy(QRect(QPoint(0, 0), size * dpr))); - opt.decorationSize = size; - - QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &opt, painter); - } - -private: - QCategorizedView *mView; -}; - - -LXQtConfig::MainWindow::MainWindow() : QMainWindow() -{ - setupUi(this); - view->installEventFilter(this); - - /* To always have the intended layout on startup, - the listview should be shown after it's fully formed. */ - view->hide(); - - model = new ConfigPaneModel(); - - view->setViewMode(QListView::IconMode); - view->setWordWrap(true); - view->setUniformItemSizes(true); - view->setCategoryDrawer(new QCategoryDrawerV3(view)); - - connect(view, &QAbstractItemView::activated, [this] (const QModelIndex & index) { pendingActivation = index; }); - view->setFocus(); - - QTimer::singleShot(0, [this] { setSizing(); }); - QTimer::singleShot(1, this, SLOT(load())); - new QShortcut{QKeySequence{Qt::CTRL + Qt::Key_Q}, this, SLOT(close())}; -} - -void LXQtConfig::MainWindow::load() -{ - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - - proxyModel = new QCategorizedSortFilterProxyModel(); - proxyModel->setCategorizedModel(true); - proxyModel->setSourceModel(model); - - view->setModel(proxyModel); - view->setItemDelegate(new ConfigItemDelegate(view)); - - view->show(); - - QApplication::restoreOverrideCursor(); -} - -void LXQtConfig::MainWindow::activateItem() -{ - if (pendingActivation.isValid()) - { - model->activateItem(pendingActivation); - pendingActivation = QModelIndex{}; - } -} - -/*Note: all this delayed activation is here to workaround the auto-repeated - * Enter/Return key activation -> if the user keeps pressing the enter/return - * we normaly will keep activating (spawning new processes) until the focus - * isn't stolen from our window. New process is not spawned until the - * (non-autorepeated) KeyRelease is delivered. - * - * ref https://github.com/lxde/lxqt/issues/965 - */ -bool LXQtConfig::MainWindow::eventFilter(QObject * watched, QEvent * event) -{ - if (view != watched) - return false; - switch (event->type()) - { - case QEvent::KeyPress: - case QEvent::KeyRelease: - { - QKeyEvent * ev = dynamic_cast(event); - switch (ev->key()) - { - case Qt::Key_Enter: - case Qt::Key_Return: - if (QEvent::KeyRelease == ev->type() && !ev->isAutoRepeat()) - activateItem(); - } - } - break; - case QEvent::MouseButtonRelease: - activateItem(); - break; - default: - //keep warnings quiet - break; - } - return false; -} - -void LXQtConfig::MainWindow::setSizing() -{ - // consult the style to know the icon size - int iconSize = qBound(16, view->decorationSize().height(), 256); - // DPR is automatically taken into account in setIconSize() - // but wee need to consider it explicitly below - int dpr = qApp->devicePixelRatio(); - if (dpr < 1) dpr = 1; - iconSize *= dpr; - /* To have an appropriate grid size, we suppose that - * - * (1) The text has 3 lines and each line has 16 chars (for languages like German), at most; - * (2) The selection rect has a margin of 2 px, at most; - * (3) There is, at most, a 3-px spacing between text and icon; and - * (4) There is a 4-px margin around each cell. - */ - QFontMetrics fm = fontMetrics(); - int textWidth = fm.averageCharWidth() * 16; - int textHeight = fm.lineSpacing() * 3; - QSize grid; - grid.setWidth(qMax(iconSize, textWidth) + 4); - grid.setHeight(iconSize + textHeight + 4 + 3); - view->setGridSize(grid + QSize(8, 8)); -} - -bool LXQtConfig::MainWindow::event(QEvent * event) -{ - if (QEvent::StyleChange == event->type()) - setSizing(); - return QMainWindow::event(event); -} diff --git a/src/mainwindow.h b/src/mainwindow.h deleted file mode 100644 index d768fed..0000000 --- a/src/mainwindow.h +++ /dev/null @@ -1,74 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Petr Vanek - * - * This program or library is free software; you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * END_COMMON_COPYRIGHT_HEADER */ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - - - -#include "ui_mainwindow.h" -#include - -class QCategorizedSortFilterProxyModel; - -namespace LXQtConfig { - - class ConfigPaneModel; - -/*! \brief Main config window. -Just read desktop files with Settings category from /usr/share/applications -and list them in view. Then it can start those standalone apps. -*/ -class MainWindow : public QMainWindow, public Ui::MainWindow -{ - Q_OBJECT - -public: - MainWindow(); - -protected: - virtual bool event(QEvent * event) override; - virtual bool eventFilter(QObject * watched, QEvent * event) override; - -private: - QCategorizedSortFilterProxyModel *proxyModel; - ConfigPaneModel *model; - QPersistentModelIndex pendingActivation; - -private: - void builGroup(const QDomElement& xml); - void setSizing(); - void activateItem(); - -private slots: - void load(); -}; - -}; // namespace - - -#endif diff --git a/src/mainwindow.ui b/src/mainwindow.ui deleted file mode 100644 index 02002d6..0000000 --- a/src/mainwindow.ui +++ /dev/null @@ -1,89 +0,0 @@ - - - MainWindow - - - - 0 - 0 - 696 - 404 - - - - Configuration Center - - - - - - - - 0 - - - 1 - - - 1 - - - - - QFrame::NoFrame - - - - - - - 4 - - - 4 - - - 4 - - - 4 - - - - - QDialogButtonBox::Close - - - - - - - - - - - QCategorizedView - QListView -
qcategorizedview.h
-
-
- - - - buttonBox - rejected() - MainWindow - close() - - - 481 - 324 - - - 458 - 341 - - - - -
diff --git a/src/qcategorizedview/CMakeLists.txt b/src/qcategorizedview/CMakeLists.txt deleted file mode 100644 index 2f4577f..0000000 --- a/src/qcategorizedview/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -project(qcategorizedview) - -set(SOURCES - qcategorizedview.cpp - qcategorydrawer.cpp - qcategorizedsortfilterproxymodel.cpp -) - -add_library(qcategorizedview STATIC ${SOURCES}) -target_link_libraries(qcategorizedview Qt5::Widgets) diff --git a/src/qcategorizedview/qcategorizedsortfilterproxymodel.cpp b/src/qcategorizedview/qcategorizedsortfilterproxymodel.cpp deleted file mode 100644 index c74636b..0000000 --- a/src/qcategorizedview/qcategorizedsortfilterproxymodel.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/** - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007 Rafael Fernández López - * Copyright (C) 2007 John Tapsell - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#include "qcategorizedsortfilterproxymodel.h" -#include "qcategorizedsortfilterproxymodel_p.h" - -#include - -#include -#include -#include - -//#include - -int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive) -{ - // This method chops the input a and b into pieces of - // digits and non-digits (a1.05 becomes a | 1 | . | 05) - // and compares these pieces of a and b to each other - // (first with first, second with second, ...). - // - // This is based on the natural sort order code code by Martin Pool - // http://sourcefrog.net/projects/natsort/ - // Martin Pool agreed to license this under LGPL or GPL. - - // FIXME: Using toLower() to implement case insensitive comparison is - // sub-optimal, but is needed because we compare strings with - // localeAwareCompare(), which does not know about case sensitivity. - // A task has been filled for this in Qt Task Tracker with ID 205990. - // http://trolltech.com/developer/task-tracker/index_html?method=entry&id=205990 - QString a; - QString b; - if (caseSensitivity == Qt::CaseSensitive) { - a = _a; - b = _b; - } else { - a = _a.toLower(); - b = _b.toLower(); - } - - const QChar* currA = a.unicode(); // iterator over a - const QChar* currB = b.unicode(); // iterator over b - - if (currA == currB) { - return 0; - } - - while (!currA->isNull() && !currB->isNull()) { - const QChar* begSeqA = currA; // beginning of a new character sequence of a - const QChar* begSeqB = currB; - if (currA->unicode() == QChar::ObjectReplacementCharacter) { - return 1; - } - - if (currB->unicode() == QChar::ObjectReplacementCharacter) { - return -1; - } - - if (currA->unicode() == QChar::ReplacementCharacter) { - return 1; - } - - if (currB->unicode() == QChar::ReplacementCharacter) { - return -1; - } - - // find sequence of characters ending at the first non-character - while (!currA->isNull() && !currA->isDigit() && !currA->isPunct() && !currA->isSpace()) { - ++currA; - } - - while (!currB->isNull() && !currB->isDigit() && !currB->isPunct() && !currB->isSpace()) { - ++currB; - } - - // compare these sequences - const QStringRef& subA(a.midRef(begSeqA - a.unicode(), currA - begSeqA)); - const QStringRef& subB(b.midRef(begSeqB - b.unicode(), currB - begSeqB)); - const int cmp = QStringRef::localeAwareCompare(subA, subB); - if (cmp != 0) { - return cmp < 0 ? -1 : +1; - } - - if (currA->isNull() || currB->isNull()) { - break; - } - - // find sequence of characters ending at the first non-character - while ((currA->isPunct() || currA->isSpace()) && (currB->isPunct() || currB->isSpace())) { - if (*currA != *currB) { - return (*currA < *currB) ? -1 : +1; - } - ++currA; - ++currB; - if (currA->isNull() || currB->isNull()) { - break; - } - } - - // now some digits follow... - if ((*currA == QLatin1Char('0')) || (*currB == QLatin1Char('0'))) { - // one digit-sequence starts with 0 -> assume we are in a fraction part - // do left aligned comparison (numbers are considered left aligned) - while (1) { - if (!currA->isDigit() && !currB->isDigit()) { - break; - } else if (!currA->isDigit()) { - return +1; - } else if (!currB->isDigit()) { - return -1; - } else if (*currA < *currB) { - return -1; - } else if (*currA > *currB) { - return + 1; - } - ++currA; - ++currB; - } - } else { - // No digit-sequence starts with 0 -> assume we are looking at some integer - // do right aligned comparison. - // - // The longest run of digits wins. That aside, the greatest - // value wins, but we can't know that it will until we've scanned - // both numbers to know that they have the same magnitude. - - bool isFirstRun = true; - int weight = 0; - while (1) { - if (!currA->isDigit() && !currB->isDigit()) { - if (weight != 0) { - return weight; - } - break; - } else if (!currA->isDigit()) { - if (isFirstRun) { - return *currA < *currB ? -1 : +1; - } else { - return -1; - } - } else if (!currB->isDigit()) { - if (isFirstRun) { - return *currA < *currB ? -1 : +1; - } else { - return +1; - } - } else if ((*currA < *currB) && (weight == 0)) { - weight = -1; - } else if ((*currA > *currB) && (weight == 0)) { - weight = + 1; - } - ++currA; - ++currB; - isFirstRun = false; - } - } - } - - if (currA->isNull() && currB->isNull()) { - return 0; - } - - return currA->isNull() ? -1 : + 1; -} - -QCategorizedSortFilterProxyModel::QCategorizedSortFilterProxyModel(QObject *parent) - : QSortFilterProxyModel(parent) - , d(new Private()) - -{ -} - -QCategorizedSortFilterProxyModel::~QCategorizedSortFilterProxyModel() -{ - delete d; -} - -void QCategorizedSortFilterProxyModel::sort(int column, Qt::SortOrder order) -{ - d->sortColumn = column; - d->sortOrder = order; - - QSortFilterProxyModel::sort(column, order); -} - -bool QCategorizedSortFilterProxyModel::isCategorizedModel() const -{ - return d->categorizedModel; -} - -void QCategorizedSortFilterProxyModel::setCategorizedModel(bool categorizedModel) -{ - if (categorizedModel == d->categorizedModel) - { - return; - } - - d->categorizedModel = categorizedModel; - - invalidate(); -} - -int QCategorizedSortFilterProxyModel::sortColumn() const -{ - return d->sortColumn; -} - -Qt::SortOrder QCategorizedSortFilterProxyModel::sortOrder() const -{ - return d->sortOrder; -} - -void QCategorizedSortFilterProxyModel::setSortCategoriesByNaturalComparison(bool sortCategoriesByNaturalComparison) -{ - if (sortCategoriesByNaturalComparison == d->sortCategoriesByNaturalComparison) - { - return; - } - - d->sortCategoriesByNaturalComparison = sortCategoriesByNaturalComparison; - - invalidate(); -} - -bool QCategorizedSortFilterProxyModel::sortCategoriesByNaturalComparison() const -{ - return d->sortCategoriesByNaturalComparison; -} - -bool QCategorizedSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - if (d->categorizedModel) - { - int compare = compareCategories(left, right); - - if (compare > 0) // left is greater than right - { - return false; - } - else if (compare < 0) // left is less than right - { - return true; - } - } - - return subSortLessThan(left, right); -} - -bool QCategorizedSortFilterProxyModel::subSortLessThan(const QModelIndex &left, const QModelIndex &right) const -{ - return QSortFilterProxyModel::lessThan(left, right); -} - -int QCategorizedSortFilterProxyModel::compareCategories(const QModelIndex &left, const QModelIndex &right) const -{ - QVariant l = (left.model() ? left.model()->data(left, CategorySortRole) : QVariant()); - QVariant r = (right.model() ? right.model()->data(right, CategorySortRole) : QVariant()); - - Q_ASSERT(l.isValid()); - Q_ASSERT(r.isValid()); - Q_ASSERT(l.type() == r.type()); - - if (l.type() == QVariant::String) - { - QString lstr = l.toString(); - QString rstr = r.toString(); - - if (d->sortCategoriesByNaturalComparison) - { - return naturalCompare(lstr, rstr); - } - else - { - if (lstr < rstr) - { - return -1; - } - - if (lstr > rstr) - { - return 1; - } - - return 0; - } - } - - qlonglong lint = l.toLongLong(); - qlonglong rint = r.toLongLong(); - - if (lint < rint) - { - return -1; - } - - if (lint > rint) - { - return 1; - } - - return 0; -} diff --git a/src/qcategorizedview/qcategorizedsortfilterproxymodel.h b/src/qcategorizedview/qcategorizedsortfilterproxymodel.h deleted file mode 100644 index 95f0c71..0000000 --- a/src/qcategorizedview/qcategorizedsortfilterproxymodel.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007 Rafael Fernández López - * Copyright (C) 2007 John Tapsell - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef KCATEGORIZEDSORTFILTERPROXYMODEL_H -#define KCATEGORIZEDSORTFILTERPROXYMODEL_H - -#include - -#define KDEUI_EXPORT - -//#include - -class QItemSelection; - - -/** - * This class lets you categorize a view. It is meant to be used along with - * QCategorizedView class. - * - * In general terms all you need to do is to reimplement subSortLessThan() and - * compareCategories() methods. In order to make categorization work, you need - * to also call setCategorizedModel() class to enable it, since the categorization - * is disabled by default. - * - * @see QCategorizedView - * - * @author Rafael Fernández López - */ -class KDEUI_EXPORT QCategorizedSortFilterProxyModel - : public QSortFilterProxyModel -{ -public: - enum AdditionalRoles { - // Note: use printf "0x%08X\n" $(($RANDOM*$RANDOM)) - // to define additional roles. - CategoryDisplayRole = 0x17CE990A, ///< This role is used for asking the category to a given index - - CategorySortRole = 0x27857E60 ///< This role is used for sorting categories. You can return a - ///< string or a long long value. Strings will be sorted alphabetically - ///< while long long will be sorted by their value. Please note that this - ///< value won't be shown on the view, is only for sorting purposes. What will - ///< be shown as "Category" on the view will be asked with the role - ///< CategoryDisplayRole. - }; - - QCategorizedSortFilterProxyModel(QObject *parent = 0); - virtual ~QCategorizedSortFilterProxyModel(); - - /** - * Overridden from QSortFilterProxyModel. Sorts the source model using - * @p column for the given @p order. - */ - virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); - - /** - * @return whether the model is categorized or not. Disabled by default. - */ - bool isCategorizedModel() const; - - /** - * Enables or disables the categorization feature. - * - * @param categorizedModel whether to enable or disable the categorization feature. - */ - void setCategorizedModel(bool categorizedModel); - - /** - * @return the column being used for sorting. - */ - int sortColumn() const; - - /** - * @return the sort order being used for sorting. - */ - Qt::SortOrder sortOrder() const; - - /** - * Set if the sorting using CategorySortRole will use a natural comparison - * in the case that strings were returned. If enabled, QString::localeAwareCompare - * will be used for sorting. - * - * @param sortCategoriesByNaturalComparison whether to sort using a natural comparison or not. - */ - void setSortCategoriesByNaturalComparison(bool sortCategoriesByNaturalComparison); - - /** - * @return whether it is being used a natural comparison for sorting. Enabled by default. - */ - bool sortCategoriesByNaturalComparison() const; - -protected: - /** - * Overridden from QSortFilterProxyModel. If you are subclassing - * QCategorizedSortFilterProxyModel, you will probably not need to reimplement this - * method. - * - * It calls compareCategories() to sort by category. If the both items are in the - * same category (i.e. compareCategories returns 0), then subSortLessThan is called. - * - * @return Returns true if the item @p left is less than the item @p right when sorting. - * - * @warning You usually won't need to reimplement this method when subclassing - * from QCategorizedSortFilterProxyModel. - */ - virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; - - /** - * This method has a similar purpose as lessThan() has on QSortFilterProxyModel. - * It is used for sorting items that are in the same category. - * - * @return Returns true if the item @p left is less than the item @p right when sorting. - */ - virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const; - - /** - * This method compares the category of the @p left index with the category - * of the @p right index. - * - * Internally and if not reimplemented, this method will ask for @p left and - * @p right models for role CategorySortRole. In order to correctly sort - * categories, the data() metod of the model should return a qlonglong (or numeric) value, or - * a QString object. QString objects will be sorted with QString::localeAwareCompare if - * sortCategoriesByNaturalComparison() is true. - * - * @note Please have present that: - * QString(QChar(QChar::ObjectReplacementCharacter)) > - * QString(QChar(QChar::ReplacementCharacter)) > - * [ all possible strings ] > - * QString(); - * - * This means that QString() will be sorted the first one, while - * QString(QChar(QChar::ObjectReplacementCharacter)) and - * QString(QChar(QChar::ReplacementCharacter)) will be sorted in last - * position. - * - * @warning Please note that data() method of the model should return always - * information of the same type. If you return a QString for an index, - * you should return always QStrings for all indexes for role CategorySortRole - * in order to correctly sort categories. You can't mix by returning - * a QString for one index, and a qlonglong for other. - * - * @note If you need a more complex layout, you will have to reimplement this - * method. - * - * @return A negative value if the category of @p left should be placed before the - * category of @p right. 0 if @p left and @p right are on the same category, and - * a positive value if the category of @p left should be placed after the - * category of @p right. - */ - virtual int compareCategories(const QModelIndex &left, const QModelIndex &right) const; - -private: - class Private; - Private *const d; -}; - - -#endif // KCATEGORIZEDSORTFILTERPROXYMODEL_H diff --git a/src/qcategorizedview/qcategorizedsortfilterproxymodel_p.h b/src/qcategorizedview/qcategorizedsortfilterproxymodel_p.h deleted file mode 100644 index f2cd9a0..0000000 --- a/src/qcategorizedview/qcategorizedsortfilterproxymodel_p.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007 Rafael Fernández López - * Copyright (C) 2007 John Tapsell - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef KCATEGORIZEDSORTFILTERPROXYMODEL_P_H -#define KCATEGORIZEDSORTFILTERPROXYMODEL_P_H - -class QCategorizedSortFilterProxyModel; - -class QCategorizedSortFilterProxyModel::Private -{ -public: - Private() - : sortColumn(0) - , sortOrder(Qt::AscendingOrder) - , categorizedModel(false) - , sortCategoriesByNaturalComparison(true) - { - } - - ~Private() - { - } - - int sortColumn; - Qt::SortOrder sortOrder; - bool categorizedModel; - bool sortCategoriesByNaturalComparison; -}; - -#endif diff --git a/src/qcategorizedview/qcategorizedview.cpp b/src/qcategorizedview/qcategorizedview.cpp deleted file mode 100644 index 7441a0b..0000000 --- a/src/qcategorizedview/qcategorizedview.cpp +++ /dev/null @@ -1,1581 +0,0 @@ -/** - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007, 2009 Rafael Fernández López - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -/** - * IMPLEMENTATION NOTES: - * - * QListView::setRowHidden() and QListView::isRowHidden() are not taken into - * account. This methods should actually not exist. This effect should be handled - * by an hypothetical QSortFilterProxyModel which filters out the desired rows. - * - * In case this needs to be implemented, contact me, but I consider this a faulty - * design. - */ - -#include "qcategorizedview.h" -#include "qcategorizedview_p.h" - -#include // trunc on C99 compliant systems -//#include // trunc for not C99 compliant systems - -#include -#include -#include - -#include "qcategorydrawer.h" -#include "qcategorizedsortfilterproxymodel.h" - -//BEGIN: Private part - -struct QCategorizedView::Private::Item -{ - Item() - : topLeft(QPoint()) - , size(QSize()) - { - } - - QPoint topLeft; - QSize size; -}; - -struct QCategorizedView::Private::Block -{ - Block() - : topLeft(QPoint()) - , height(-1) - , firstIndex(QModelIndex()) - , quarantineStart(QModelIndex()) - , items(QList()) - , outOfQuarantine(false) - , alternate(false) - , collapsed(false) - { - } - - bool operator!=(const Block &rhs) const - { - return firstIndex != rhs.firstIndex; - } - - static bool lessThan(const Block &left, const Block &right) - { - Q_ASSERT(left.firstIndex.isValid()); - Q_ASSERT(right.firstIndex.isValid()); - return left.firstIndex.row() < right.firstIndex.row(); - } - - QPoint topLeft; - int height; - QPersistentModelIndex firstIndex; - // if we have n elements on this block, and we inserted an element at position i. The quarantine - // will start at index (i, column, parent). This means that for all elements j where i <= j <= n, the - // visual rect position of item j will have to be recomputed (cannot use the cached point). The quarantine - // will only affect the current block, since the rest of blocks can be affected only in the way - // that the whole block will have different offset, but items will keep the same relative position - // in terms of their parent blocks. - QPersistentModelIndex quarantineStart; - QList items; - - // this affects the whole block, not items separately. items contain the topLeft point relative - // to the block. Because of insertions or removals a whole block can be moved, so the whole block - // will enter in quarantine, what is faster than moving all items in absolute terms. - bool outOfQuarantine; - - // should we alternate its color ? is just a hint, could not be used - bool alternate; - bool collapsed; -}; - -QCategorizedView::Private::Private(QCategorizedView *q) - : q(q) - , proxyModel(0) - , categoryDrawer(0) - , categoryDrawerV2(0) - , categoryDrawerV3(0) - , categorySpacing(5) - , alternatingBlockColors(false) - , collapsibleBlocks(false) - , hoveredBlock(new Block()) - , hoveredIndex(QModelIndex()) - , pressedPosition(QPoint()) - , rubberBandRect(QRect()) -{ -} - -QCategorizedView::Private::~Private() -{ - delete hoveredBlock; -} - -bool QCategorizedView::Private::isCategorized() const -{ - return proxyModel && categoryDrawer && proxyModel->isCategorizedModel(); -} - -QStyleOptionViewItem QCategorizedView::Private::blockRect(const QModelIndex &representative) -{ - QStyleOptionViewItem option(q->viewOptions()); - const int height = categoryDrawer->categoryHeight(representative, option); - const QString categoryDisplay = representative.data(QCategorizedSortFilterProxyModel::CategoryDisplayRole).toString(); - QPoint pos = blockPosition(categoryDisplay); - pos.ry() -= height; - option.rect.setTopLeft(pos); - option.rect.setWidth(viewportWidth() + categoryDrawer->leftMargin() + categoryDrawer->rightMargin()); - option.rect.setHeight(height + blockHeight(categoryDisplay)); - option.rect = mapToViewport(option.rect); - - return option; -} - -QPair QCategorizedView::Private::intersectingIndexesWithRect(const QRect &_rect) const -{ - const int rowCount = proxyModel->rowCount(); - - const QRect rect = _rect.normalized(); - - // binary search to find out the top border - int bottom = 0; - int top = rowCount - 1; - while (bottom <= top) { - const int middle = (bottom + top) / 2; - const QModelIndex index = proxyModel->index(middle, q->modelColumn(), q->rootIndex()); - QRect itemRect = q->visualRect(index); - const int verticalOff = q->verticalOffset(); - const int horizontalOff = q->horizontalOffset(); - itemRect.topLeft().ry() += verticalOff; - itemRect.topLeft().rx() += horizontalOff; - itemRect.bottomRight().ry() += verticalOff; - itemRect.bottomRight().rx() += horizontalOff; - if (itemRect.bottomRight().y() <= rect.topLeft().y()) { - bottom = middle + 1; - } else { - top = middle - 1; - } - } - - const QModelIndex bottomIndex = proxyModel->index(bottom, q->modelColumn(), q->rootIndex()); - - // binary search to find out the bottom border - bottom = 0; - top = rowCount - 1; - while (bottom <= top) { - const int middle = (bottom + top) / 2; - const QModelIndex index = proxyModel->index(middle, q->modelColumn(), q->rootIndex()); - QRect itemRect = q->visualRect(index); - const int verticalOff = q->verticalOffset(); - const int horizontalOff = q->horizontalOffset(); - itemRect.topLeft().ry() += verticalOff; - itemRect.topLeft().rx() += horizontalOff; - itemRect.bottomRight().ry() += verticalOff; - itemRect.bottomRight().rx() += horizontalOff; - if (itemRect.topLeft().y() <= rect.bottomRight().y()) { - bottom = middle + 1; - } else { - top = middle - 1; - } - } - - const QModelIndex topIndex = proxyModel->index(top, q->modelColumn(), q->rootIndex()); - - return qMakePair(bottomIndex, topIndex); -} - -QPoint QCategorizedView::Private::blockPosition(const QString &category) -{ - Block &block = blocks[category]; - - if (block.outOfQuarantine && !block.topLeft.isNull()) { - return block.topLeft; - } - - QPoint res(categorySpacing, 0); - - const QModelIndex index = block.firstIndex; - - for (QHash::Iterator it = blocks.begin(); it != blocks.end(); ++it) { - Block &block = *it; - const QModelIndex categoryIndex = block.firstIndex; - if (index.row() < categoryIndex.row()) { - continue; - } - res.ry() += categoryDrawer->categoryHeight(categoryIndex, q->viewOptions()) + categorySpacing; - if (index.row() == categoryIndex.row()) { - continue; - } - res.ry() += blockHeight(it.key()); - } - - block.outOfQuarantine = true; - block.topLeft = res; - - return res; -} - -int QCategorizedView::Private::blockHeight(const QString &category) -{ - Block &block = blocks[category]; - - if (block.collapsed) { - return 0; - } - - if (block.height > -1) { - return block.height; - } - - const QModelIndex firstIndex = block.firstIndex; - const QModelIndex lastIndex = proxyModel->index(firstIndex.row() + block.items.count() - 1, q->modelColumn(), q->rootIndex()); - const QRect topLeft = q->visualRect(firstIndex); - QRect bottomRight = q->visualRect(lastIndex); - - if (hasGrid()) { - bottomRight.setHeight(qMax(bottomRight.height(), q->gridSize().height())); - } else { - if (!q->uniformItemSizes()) { - bottomRight.setHeight(highestElementInLastRow(block) + q->spacing() * 2); - } - } - - const int height = bottomRight.bottomRight().y() - topLeft.topLeft().y() + 1; - block.height = height; - - return height; -} - -int QCategorizedView::Private::viewportWidth() const -{ - return q->viewport()->width() - categorySpacing * 2 - categoryDrawer->leftMargin() - categoryDrawer->rightMargin(); -} - -void QCategorizedView::Private::regenerateAllElements() -{ - for (QHash::Iterator it = blocks.begin(); it != blocks.end(); ++it) { - Block &block = *it; - block.outOfQuarantine = false; - block.quarantineStart = block.firstIndex; - block.height = -1; - } -} - -void QCategorizedView::Private::rowsInserted(const QModelIndex &parent, int start, int end) -{ - if (!isCategorized()) { - return; - } - - for (int i = start; i <= end; ++i) { - const QModelIndex index = proxyModel->index(i, q->modelColumn(), parent); - - Q_ASSERT(index.isValid()); - - const QString category = categoryForIndex(index); - - Block &block = blocks[category]; - - //BEGIN: update firstIndex - // save as firstIndex in block if - // - it forced the category creation (first element on this category) - // - it is before the first row on that category - const QModelIndex firstIndex = block.firstIndex; - if (!firstIndex.isValid() || index.row() < firstIndex.row()) { - block.firstIndex = index; - } - //END: update firstIndex - - Q_ASSERT(block.firstIndex.isValid()); - - const int firstIndexRow = block.firstIndex.row(); - - block.items.insert(index.row() - firstIndexRow, Private::Item()); - block.height = -1; - - q->visualRect(index); - q->viewport()->update(); - } - - //BEGIN: update the items that are in quarantine in affected categories - { - const QModelIndex lastIndex = proxyModel->index(end, q->modelColumn(), parent); - const QString category = categoryForIndex(lastIndex); - Private::Block &block = blocks[category]; - block.quarantineStart = block.firstIndex; - } - //END: update the items that are in quarantine in affected categories - - //BEGIN: mark as in quarantine those categories that are under the affected ones - { - const QModelIndex firstIndex = proxyModel->index(start, q->modelColumn(), parent); - const QString category = categoryForIndex(firstIndex); - const QModelIndex firstAffectedCategory = blocks[category].firstIndex; - //BEGIN: order for marking as alternate those blocks that are alternate - QList blockList = blocks.values(); - qSort(blockList.begin(), blockList.end(), Block::lessThan); - QList firstIndexesRows; - foreach (const Block &block, blockList) { - firstIndexesRows << block.firstIndex.row(); - } - //END: order for marking as alternate those blocks that are alternate - for (QHash::Iterator it = blocks.begin(); it != blocks.end(); ++it) { - Private::Block &block = *it; - if (block.firstIndex.row() > firstAffectedCategory.row()) { - block.outOfQuarantine = false; - block.alternate = firstIndexesRows.indexOf(block.firstIndex.row()) % 2; - } else if (block.firstIndex.row() == firstAffectedCategory.row()) { - block.alternate = firstIndexesRows.indexOf(block.firstIndex.row()) % 2; - } - } - } - //END: mark as in quarantine those categories that are under the affected ones -} - -QRect QCategorizedView::Private::mapToViewport(const QRect &rect) const -{ - const int dx = -q->horizontalOffset(); - const int dy = -q->verticalOffset(); - return rect.adjusted(dx, dy, dx, dy); -} - -QRect QCategorizedView::Private::mapFromViewport(const QRect &rect) const -{ - const int dx = q->horizontalOffset(); - const int dy = q->verticalOffset(); - return rect.adjusted(dx, dy, dx, dy); -} - -int QCategorizedView::Private::highestElementInLastRow(const Block &block) const -{ - //Find the highest element in the last row - const QModelIndex lastIndex = proxyModel->index(block.firstIndex.row() + block.items.count() - 1, q->modelColumn(), q->rootIndex()); - const QRect prevRect = q->visualRect(lastIndex); - int res = prevRect.height(); - QModelIndex prevIndex = proxyModel->index(lastIndex.row() - 1, q->modelColumn(), q->rootIndex()); - if (!prevIndex.isValid()) { - return res; - } - Q_FOREVER { - const QRect tempRect = q->visualRect(prevIndex); - if (tempRect.topLeft().y() < prevRect.topLeft().y()) { - break; - } - res = qMax(res, tempRect.height()); - if (prevIndex == block.firstIndex) { - break; - } - prevIndex = proxyModel->index(prevIndex.row() - 1, q->modelColumn(), q->rootIndex()); - } - - return res; -} - -bool QCategorizedView::Private::hasGrid() const -{ - const QSize gridSize = q->gridSize(); - return gridSize.isValid() && !gridSize.isNull(); -} - -QString QCategorizedView::Private::categoryForIndex(const QModelIndex &index) const -{ - const QModelIndex categoryIndex = index.model()->index(index.row(), proxyModel->sortColumn(), index.parent()); - return categoryIndex.data(QCategorizedSortFilterProxyModel::CategoryDisplayRole).toString(); -} - -void QCategorizedView::Private::leftToRightVisualRect(const QModelIndex &index, Item &item, - const Block &block, const QPoint &blockPos) const -{ - const int firstIndexRow = block.firstIndex.row(); - - if (hasGrid()) { - const int relativeRow = index.row() - firstIndexRow; - const int maxItemsPerRow = qMax(viewportWidth() / q->gridSize().width(), 1); - if (q->layoutDirection() == Qt::LeftToRight) { - item.topLeft.rx() = (relativeRow % maxItemsPerRow) * q->gridSize().width() + blockPos.x() + categoryDrawer->leftMargin(); - } else { - item.topLeft.rx() = viewportWidth() - ((relativeRow % maxItemsPerRow) + 1) * q->gridSize().width() + categoryDrawer->leftMargin() + categorySpacing; - } - item.topLeft.ry() = (relativeRow / maxItemsPerRow) * q->gridSize().height(); - } else { - if (q->uniformItemSizes()) { - const int relativeRow = index.row() - firstIndexRow; - const QSize itemSize = q->sizeHintForIndex(index); - const int maxItemsPerRow = qMax((viewportWidth() - q->spacing()) / (itemSize.width() + q->spacing()), 1); - if (q->layoutDirection() == Qt::LeftToRight) { - item.topLeft.rx() = (relativeRow % maxItemsPerRow) * itemSize.width() + blockPos.x() + categoryDrawer->leftMargin(); - } else { - item.topLeft.rx() = viewportWidth() - (relativeRow % maxItemsPerRow) * itemSize.width() + categoryDrawer->leftMargin() + categorySpacing; - } - item.topLeft.ry() = (relativeRow / maxItemsPerRow) * itemSize.height(); - } else { - const QSize currSize = q->sizeHintForIndex(index); - if (index != block.firstIndex) { - const int viewportW = viewportWidth() - q->spacing(); - QModelIndex prevIndex = proxyModel->index(index.row() - 1, q->modelColumn(), q->rootIndex()); - QRect prevRect = q->visualRect(prevIndex); - prevRect = mapFromViewport(prevRect); - if ((prevRect.bottomRight().x() + 1) + currSize.width() - blockPos.x() + q->spacing() > viewportW) { - // we have to check the whole previous row, and see which one was the - // highest. - Q_FOREVER { - prevIndex = proxyModel->index(prevIndex.row() - 1, q->modelColumn(), q->rootIndex()); - const QRect tempRect = q->visualRect(prevIndex); - if (tempRect.topLeft().y() < prevRect.topLeft().y()) { - break; - } - if (tempRect.bottomRight().y() > prevRect.bottomRight().y()) { - prevRect = tempRect; - } - if (prevIndex == block.firstIndex) { - break; - } - } - if (q->layoutDirection() == Qt::LeftToRight) { - item.topLeft.rx() = categoryDrawer->leftMargin() + blockPos.x() + q->spacing(); - } else { - item.topLeft.rx() = viewportWidth() - currSize.width() + categoryDrawer->leftMargin() + categorySpacing; - } - item.topLeft.ry() = (prevRect.bottomRight().y() + 1) + q->spacing() - blockPos.y(); - } else { - if (q->layoutDirection() == Qt::LeftToRight) { - item.topLeft.rx() = (prevRect.bottomRight().x() + 1) + q->spacing(); - } else { - item.topLeft.rx() = (prevRect.bottomLeft().x() - 1) - q->spacing() - item.size.width() + categoryDrawer->leftMargin() + categorySpacing; - } - item.topLeft.ry() = prevRect.topLeft().y() - blockPos.y(); - } - } else { - if (q->layoutDirection() == Qt::LeftToRight) { - item.topLeft.rx() = blockPos.x() + categoryDrawer->leftMargin() + q->spacing(); - } else { - item.topLeft.rx() = viewportWidth() - currSize.width() + categoryDrawer->leftMargin() + categorySpacing; - } - item.topLeft.ry() = q->spacing(); - } - } - } - item.size = q->sizeHintForIndex(index); -} - -void QCategorizedView::Private::topToBottomVisualRect(const QModelIndex &index, Item &item, - const Block &block, const QPoint &blockPos) const -{ - const int firstIndexRow = block.firstIndex.row(); - - if (hasGrid()) { - const int relativeRow = index.row() - firstIndexRow; - item.topLeft.rx() = blockPos.x() + categoryDrawer->leftMargin(); - item.topLeft.ry() = relativeRow * q->gridSize().height(); - } else { - if (q->uniformItemSizes()) { - const int relativeRow = index.row() - firstIndexRow; - const QSize itemSize = q->sizeHintForIndex(index); - item.topLeft.rx() = blockPos.x() + categoryDrawer->leftMargin(); - item.topLeft.ry() = relativeRow * itemSize.height(); - } else { - if (index != block.firstIndex) { - QModelIndex prevIndex = proxyModel->index(index.row() - 1, q->modelColumn(), q->rootIndex()); - QRect prevRect = q->visualRect(prevIndex); - prevRect = mapFromViewport(prevRect); - item.topLeft.rx() = blockPos.x() + categoryDrawer->leftMargin() + q->spacing(); - item.topLeft.ry() = (prevRect.bottomRight().y() + 1) + q->spacing() - blockPos.y(); - } else { - item.topLeft.rx() = blockPos.x() + categoryDrawer->leftMargin() + q->spacing(); - item.topLeft.ry() = q->spacing(); - } - } - } - item.size = q->sizeHintForIndex(index); - item.size.setWidth(viewportWidth()); -} - -void QCategorizedView::Private::_k_slotCollapseOrExpandClicked(QModelIndex) -{ -} - -//END: Private part - -//BEGIN: Public part - -QCategorizedView::QCategorizedView(QWidget *parent) - : QListView(parent) - , d(new Private(this)) - , enterPressed(false) -{ -} - -QCategorizedView::~QCategorizedView() -{ - delete d; -} - -void QCategorizedView::setModel(QAbstractItemModel *model) -{ - if (d->proxyModel == model) { - return; - } - - d->blocks.clear(); - - if (d->proxyModel) { - disconnect(d->proxyModel, SIGNAL(layoutChanged()), this, SLOT(slotLayoutChanged())); - } - - d->proxyModel = dynamic_cast(model); - - if (d->proxyModel) { - connect(d->proxyModel, SIGNAL(layoutChanged()), this, SLOT(slotLayoutChanged())); - } - - QListView::setModel(model); - - // if the model already had information inserted, update our data structures to it - if (model->rowCount()) { - slotLayoutChanged(); - } -} - -void QCategorizedView::setGridSize(const QSize &size) -{ - setGridSizeOwn(size); -} - -void QCategorizedView::setGridSizeOwn(const QSize &size) -{ - d->regenerateAllElements(); - QListView::setGridSize(size); -} - -QRect QCategorizedView::visualRect(const QModelIndex &index) const -{ - if (!d->isCategorized()) { - return QListView::visualRect(index); - } - - if (!index.isValid()) { - return QRect(); - } - - const QString category = d->categoryForIndex(index); - - if (!d->blocks.contains(category)) { - return QRect(); - } - - Private::Block &block = d->blocks[category]; - const int firstIndexRow = block.firstIndex.row(); - - Q_ASSERT(block.firstIndex.isValid()); - - if (index.row() - firstIndexRow < 0 || index.row() - firstIndexRow >= block.items.count()) { - return QRect(); - } - - const QPoint blockPos = d->blockPosition(category); - - Private::Item &ritem = block.items[index.row() - firstIndexRow]; - - if (ritem.topLeft.isNull() || (block.quarantineStart.isValid() && - index.row() >= block.quarantineStart.row())) { - if (flow() == LeftToRight) { - d->leftToRightVisualRect(index, ritem, block, blockPos); - } else { - d->topToBottomVisualRect(index, ritem, block, blockPos); - } - - //BEGIN: update the quarantine start - const bool wasLastIndex = (index.row() == (block.firstIndex.row() + block.items.count() - 1)); - if (index.row() == block.quarantineStart.row()) { - if (wasLastIndex) { - block.quarantineStart = QModelIndex(); - } else { - const QModelIndex nextIndex = d->proxyModel->index(index.row() + 1, modelColumn(), rootIndex()); - block.quarantineStart = nextIndex; - } - } - //END: update the quarantine start - } - - // we get now the absolute position through the relative position of the parent block. do not - // save this on ritem, since this would override the item relative position in block terms. - Private::Item item(ritem); - item.topLeft.ry() += blockPos.y(); - - const QSize sizeHint = item.size; - - if (d->hasGrid()) { - const QSize sizeGrid = gridSize(); - const QSize resultingSize = sizeHint.boundedTo(sizeGrid); - QRect res(item.topLeft.x() + ((sizeGrid.width() - resultingSize.width()) / 2), - item.topLeft.y(), resultingSize.width(), resultingSize.height()); - if (block.collapsed) { - // we can still do binary search, while we "hide" items. We move those items in collapsed - // blocks to the left and set a 0 height. - res.setLeft(-resultingSize.width()); - res.setHeight(0); - } - return d->mapToViewport(res); - } - - QRect res(item.topLeft.x(), item.topLeft.y(), sizeHint.width(), sizeHint.height()); - if (block.collapsed) { - // we can still do binary search, while we "hide" items. We move those items in collapsed - // blocks to the left and set a 0 height. - res.setLeft(-sizeHint.width()); - res.setHeight(0); - } - return d->mapToViewport(res); -} - -QCategoryDrawer *QCategorizedView::categoryDrawer() const -{ - return d->categoryDrawer; -} - -void QCategorizedView::setCategoryDrawer(QCategoryDrawer *categoryDrawer) -{ - if (d->categoryDrawerV2) { - disconnect(d->categoryDrawerV2, SIGNAL(collapseOrExpandClicked(QModelIndex)), - this, SLOT(_k_slotCollapseOrExpandClicked(QModelIndex))); - } - - d->categoryDrawer = categoryDrawer; - d->categoryDrawerV2 = dynamic_cast(categoryDrawer); - d->categoryDrawerV3 = dynamic_cast(categoryDrawer); - - if (d->categoryDrawerV2) { - connect(d->categoryDrawerV2, SIGNAL(collapseOrExpandClicked(QModelIndex)), - this, SLOT(_k_slotCollapseOrExpandClicked(QModelIndex))); - } -} - -int QCategorizedView::categorySpacing() const -{ - return d->categorySpacing; -} - -void QCategorizedView::setCategorySpacing(int categorySpacing) -{ - if (d->categorySpacing == categorySpacing) { - return; - } - - d->categorySpacing = categorySpacing; - - for (QHash::Iterator it = d->blocks.begin(); it != d->blocks.end(); ++it) { - Private::Block &block = *it; - block.outOfQuarantine = false; - } -} - -bool QCategorizedView::alternatingBlockColors() const -{ - return d->alternatingBlockColors; -} - -void QCategorizedView::setAlternatingBlockColors(bool enable) -{ - d->alternatingBlockColors = enable; -} - -bool QCategorizedView::collapsibleBlocks() const -{ - return d->collapsibleBlocks; -} - -void QCategorizedView::setCollapsibleBlocks(bool enable) -{ - d->collapsibleBlocks = enable; -} - -QModelIndexList QCategorizedView::block(const QString &category) -{ - QModelIndexList res; - const Private::Block &block = d->blocks[category]; - if (block.height == -1) { - return res; - } - QModelIndex current = block.firstIndex; - const int first = current.row(); - for (int i = 1; i <= block.items.count(); ++i) { - if (current.isValid()) { - res << current; - } - current = d->proxyModel->index(first + i, modelColumn(), rootIndex()); - } - return res; -} - -QModelIndexList QCategorizedView::block(const QModelIndex &representative) -{ - return block(representative.data(QCategorizedSortFilterProxyModel::CategoryDisplayRole).toString()); -} - -QModelIndex QCategorizedView::indexAt(const QPoint &point) const -{ - if (!d->isCategorized()) { - return QListView::indexAt(point); - } - - const int rowCount = d->proxyModel->rowCount(); - if (!rowCount) { - return QModelIndex(); - } - - // Binary search that will try to spot if there is an index under point - int bottom = 0; - int top = rowCount - 1; - while (bottom <= top) { - const int middle = (bottom + top) / 2; - const QModelIndex index = d->proxyModel->index(middle, modelColumn(), rootIndex()); - QRect rect = visualRect(index); - const int verticalOff = verticalOffset(); - int horizontalOff = horizontalOffset(); - if (layoutDirection() == Qt::RightToLeft) { - horizontalOff *= -1; - } - rect.topLeft().ry() += verticalOff; - rect.topLeft().rx() += horizontalOff; - rect.bottomRight().ry() += verticalOff; - rect.bottomRight().rx() += horizontalOff; - if (rect.contains(point)) { - if (index.model()->flags(index) & Qt::ItemIsEnabled) { - return index; - } - return QModelIndex(); - } - bool directionCondition; - if (layoutDirection() == Qt::LeftToRight) { - directionCondition = point.x() > rect.bottomRight().x(); - } else { - directionCondition = point.x() < rect.bottomLeft().x(); - } - if (point.y() > rect.bottomRight().y() || - (point.y() > rect.topLeft().y() && point.y() < rect.bottomRight().y() && directionCondition)) { - bottom = middle + 1; - } else { - top = middle - 1; - } - } - return QModelIndex(); -} - -void QCategorizedView::reset() -{ - d->blocks.clear(); - QListView::reset(); -} - -QSize QCategorizedView::decorationSize() const -{ - return viewOptions().decorationSize; -} - -void QCategorizedView::paintEvent(QPaintEvent *event) -{ - if (!d->isCategorized()) { - QListView::paintEvent(event); - return; - } - - const QPair intersecting = d->intersectingIndexesWithRect(viewport()->rect().intersected(event->rect())); - - QPainter p(viewport()); - p.save(); - - Q_ASSERT(selectionModel()->model() == d->proxyModel); - - //BEGIN: draw categories - QHash::ConstIterator it(d->blocks.constBegin()); - while (it != d->blocks.constEnd()) { - const Private::Block &block = *it; - const QModelIndex categoryIndex = d->proxyModel->index(block.firstIndex.row(), d->proxyModel->sortColumn(), rootIndex()); - QStyleOptionViewItem option(viewOptions()); - option.features |= d->alternatingBlockColors && block.alternate ? QStyleOptionViewItem::Alternate - : QStyleOptionViewItem::None; - option.state |= !d->collapsibleBlocks || !block.collapsed ? QStyle::State_Open - : QStyle::State_None; - const int height = d->categoryDrawer->categoryHeight(categoryIndex, option); - QPoint pos = d->blockPosition(it.key()); - pos.ry() -= height; - option.rect.setTopLeft(pos); - option.rect.setWidth(d->viewportWidth() + d->categoryDrawer->leftMargin() + d->categoryDrawer->rightMargin()); - option.rect.setHeight(height + d->blockHeight(it.key())); - option.rect = d->mapToViewport(option.rect); - option.decorationPosition = QStyleOptionViewItem::Bottom; - if (!option.rect.intersects(viewport()->rect())) { - ++it; - continue; - } - d->categoryDrawer->drawCategory(categoryIndex, d->proxyModel->sortRole(), option, &p); - ++it; - } - //END: draw categories - - if (intersecting.first.isValid() && intersecting.second.isValid()) { - //BEGIN: draw items - int i = intersecting.first.row(); - int indexToCheckIfBlockCollapsed = i; - QModelIndex categoryIndex; - QString category; - Private::Block *block = 0; - while (i <= intersecting.second.row()) { - //BEGIN: first check if the block is collapsed. if so, we have to skip the item painting - if (i == indexToCheckIfBlockCollapsed) { - categoryIndex = d->proxyModel->index(i, d->proxyModel->sortColumn(), rootIndex()); - category = categoryIndex.data(QCategorizedSortFilterProxyModel::CategoryDisplayRole).toString(); - block = &d->blocks[category]; - indexToCheckIfBlockCollapsed = block->firstIndex.row() + block->items.count(); - if (block->collapsed) { - i = indexToCheckIfBlockCollapsed; - continue; - } - } - //END: first check if the block is collapsed. if so, we have to skip the item painting - - Q_ASSERT(block); - - const bool alternateItem = (i - block->firstIndex.row()) % 2; - - const QModelIndex index = d->proxyModel->index(i, modelColumn(), rootIndex()); - const Qt::ItemFlags flags = d->proxyModel->flags(index); - QStyleOptionViewItem option(viewOptions()); - option.rect = visualRect(index); - option.widget = this; - option.features |= wordWrap() ? QStyleOptionViewItem::WrapText - : QStyleOptionViewItem::None; - option.features |= alternatingRowColors() && alternateItem ? QStyleOptionViewItem::Alternate - : QStyleOptionViewItem::None; - if (flags & Qt::ItemIsSelectable) { - option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected - : QStyle::State_None; - } else { - option.state &= ~QStyle::State_Selected; - } - option.state |= (index == currentIndex()) ? QStyle::State_HasFocus - : QStyle::State_None; - if (!(flags & Qt::ItemIsEnabled)) { - option.state &= ~QStyle::State_Enabled; - } else { - option.state |= (index == d->hoveredIndex) ? QStyle::State_MouseOver - : QStyle::State_None; - } - - itemDelegate(index)->paint(&p, option, index); - ++i; - } - //END: draw items - } - - //BEGIN: draw selection rect - if (isSelectionRectVisible() && d->rubberBandRect.isValid()) { - QStyleOptionRubberBand opt; - opt.initFrom(this); - opt.shape = QRubberBand::Rectangle; - opt.opaque = false; - opt.rect = d->mapToViewport(d->rubberBandRect).intersected(viewport()->rect().adjusted(-16, -16, 16, 16)); - p.save(); - style()->drawControl(QStyle::CE_RubberBand, &opt, &p); - p.restore(); - } - //END: draw selection rect - - p.restore(); -} - -void QCategorizedView::resizeEvent(QResizeEvent *event) -{ - d->regenerateAllElements(); - QListView::resizeEvent(event); -} - -void QCategorizedView::setSelection(const QRect &rect, - QItemSelectionModel::SelectionFlags flags) -{ - if (!d->isCategorized()) { - QListView::setSelection(rect, flags); - return; - } - - if (rect.topLeft() == rect.bottomRight()) { - const QModelIndex index = indexAt(rect.topLeft()); - selectionModel()->select(index, flags); - return; - } - - const QPair intersecting = d->intersectingIndexesWithRect(rect); - - QItemSelection selection; - - //TODO: think of a faster implementation - QModelIndex firstIndex; - QModelIndex lastIndex; - for (int i = intersecting.first.row(); i <= intersecting.second.row(); ++i) { - const QModelIndex index = d->proxyModel->index(i, modelColumn(), rootIndex()); - const bool visualRectIntersects = visualRect(index).intersects(rect); - if (firstIndex.isValid()) { - if (visualRectIntersects) { - lastIndex = index; - } else { - selection << QItemSelectionRange(firstIndex, lastIndex); - firstIndex = QModelIndex(); - } - } else if (visualRectIntersects) { - firstIndex = index; - lastIndex = index; - } - } - - if (firstIndex.isValid()) { - selection << QItemSelectionRange(firstIndex, lastIndex); - } - - selectionModel()->select(selection, flags); -} - -void QCategorizedView::mouseMoveEvent(QMouseEvent *event) -{ - QListView::mouseMoveEvent(event); - d->hoveredIndex = indexAt(event->pos()); - const SelectionMode itemViewSelectionMode = selectionMode(); - if (state() == DragSelectingState && isSelectionRectVisible() && itemViewSelectionMode != SingleSelection - && itemViewSelectionMode != NoSelection) { - QRect rect(d->pressedPosition, event->pos() + QPoint(horizontalOffset(), verticalOffset())); - rect = rect.normalized(); - update(rect.united(d->rubberBandRect)); - d->rubberBandRect = rect; - } - if (!d->categoryDrawerV2) { - return; - } - QHash::ConstIterator it(d->blocks.constBegin()); - while (it != d->blocks.constEnd()) { - const Private::Block &block = *it; - const QModelIndex categoryIndex = d->proxyModel->index(block.firstIndex.row(), d->proxyModel->sortColumn(), rootIndex()); - QStyleOptionViewItem option(viewOptions()); - const int height = d->categoryDrawer->categoryHeight(categoryIndex, option); - QPoint pos = d->blockPosition(it.key()); - pos.ry() -= height; - option.rect.setTopLeft(pos); - option.rect.setWidth(d->viewportWidth() + d->categoryDrawer->leftMargin() + d->categoryDrawer->rightMargin()); - option.rect.setHeight(height + d->blockHeight(it.key())); - option.rect = d->mapToViewport(option.rect); - const QPoint mousePos = viewport()->mapFromGlobal(QCursor::pos()); - if (option.rect.contains(mousePos)) { - if (d->categoryDrawerV3 && d->hoveredBlock->height != -1 && *d->hoveredBlock != block) { - const QModelIndex categoryIndex = d->proxyModel->index(d->hoveredBlock->firstIndex.row(), d->proxyModel->sortColumn(), rootIndex()); - const QStyleOptionViewItem option = d->blockRect(categoryIndex); - d->categoryDrawerV3->mouseLeft(categoryIndex, option.rect); - *d->hoveredBlock = block; - d->hoveredCategory = it.key(); - viewport()->update(option.rect); - } else if (d->hoveredBlock->height == -1) { - *d->hoveredBlock = block; - d->hoveredCategory = it.key(); - } else if (d->categoryDrawerV3) { - d->categoryDrawerV3->mouseMoved(categoryIndex, option.rect, event); - } else { - d->categoryDrawerV2->mouseButtonMoved(categoryIndex, event); - } - viewport()->update(option.rect); - return; - } - ++it; - } - if (d->categoryDrawerV3 && d->hoveredBlock->height != -1) { - const QModelIndex categoryIndex = d->proxyModel->index(d->hoveredBlock->firstIndex.row(), d->proxyModel->sortColumn(), rootIndex()); - const QStyleOptionViewItem option = d->blockRect(categoryIndex); - d->categoryDrawerV3->mouseLeft(categoryIndex, option.rect); - *d->hoveredBlock = Private::Block(); - d->hoveredCategory = QString(); - viewport()->update(option.rect); - } -} - -void QCategorizedView::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) { - d->pressedPosition = event->pos(); - d->pressedPosition.rx() += horizontalOffset(); - d->pressedPosition.ry() += verticalOffset(); - } - if (!d->categoryDrawerV2) { - QListView::mousePressEvent(event); - return; - } - QHash::ConstIterator it(d->blocks.constBegin()); - while (it != d->blocks.constEnd()) { - const Private::Block &block = *it; - const QModelIndex categoryIndex = d->proxyModel->index(block.firstIndex.row(), d->proxyModel->sortColumn(), rootIndex()); - const QStyleOptionViewItem option = d->blockRect(categoryIndex); - const QPoint mousePos = viewport()->mapFromGlobal(QCursor::pos()); - if (option.rect.contains(mousePos)) { - if (d->categoryDrawerV3) { - d->categoryDrawerV3->mouseButtonPressed(categoryIndex, option.rect, event); - } else { - d->categoryDrawerV2->mouseButtonPressed(categoryIndex, event); - } - viewport()->update(option.rect); - if (!event->isAccepted()) { - QListView::mousePressEvent(event); - } - return; - } - ++it; - } - QListView::mousePressEvent(event); -} - -void QCategorizedView::mouseReleaseEvent(QMouseEvent *event) -{ - d->pressedPosition = QPoint(); - d->rubberBandRect = QRect(); - if (!d->categoryDrawerV2) { - QListView::mouseReleaseEvent(event); - return; - } - QHash::ConstIterator it(d->blocks.constBegin()); - while (it != d->blocks.constEnd()) { - const Private::Block &block = *it; - const QModelIndex categoryIndex = d->proxyModel->index(block.firstIndex.row(), d->proxyModel->sortColumn(), rootIndex()); - const QStyleOptionViewItem option = d->blockRect(categoryIndex); - const QPoint mousePos = viewport()->mapFromGlobal(QCursor::pos()); - if (option.rect.contains(mousePos)) { - if (d->categoryDrawerV3) { - d->categoryDrawerV3->mouseButtonReleased(categoryIndex, option.rect, event); - } else { - d->categoryDrawerV2->mouseButtonReleased(categoryIndex, event); - } - viewport()->update(option.rect); - if (!event->isAccepted()) { - QListView::mouseReleaseEvent(event); - } - return; - } - ++it; - } - QListView::mouseReleaseEvent(event); -} - -void QCategorizedView::leaveEvent(QEvent *event) -{ - QListView::leaveEvent(event); - if (d->hoveredIndex.isValid()) { - viewport()->update(visualRect(d->hoveredIndex)); - d->hoveredIndex = QModelIndex(); - } - if (d->categoryDrawerV3 && d->hoveredBlock->height != -1) { - const QModelIndex categoryIndex = d->proxyModel->index(d->hoveredBlock->firstIndex.row(), d->proxyModel->sortColumn(), rootIndex()); - const QStyleOptionViewItem option = d->blockRect(categoryIndex); - d->categoryDrawerV3->mouseLeft(categoryIndex, option.rect); - *d->hoveredBlock = Private::Block(); - d->hoveredCategory = QString(); - viewport()->update(option.rect); - } -} - -void QCategorizedView::startDrag(Qt::DropActions supportedActions) -{ - QListView::startDrag(supportedActions); -} - -void QCategorizedView::dragMoveEvent(QDragMoveEvent *event) -{ - QListView::dragMoveEvent(event); - d->hoveredIndex = indexAt(event->pos()); -} - -void QCategorizedView::dragEnterEvent(QDragEnterEvent *event) -{ - QListView::dragEnterEvent(event); -} - -void QCategorizedView::dragLeaveEvent(QDragLeaveEvent *event) -{ - QListView::dragLeaveEvent(event); -} - -void QCategorizedView::dropEvent(QDropEvent *event) -{ - QListView::dropEvent(event); -} - -//TODO: improve se we take into account collapsed blocks -//TODO: take into account when there is no grid and no uniformItemSizes -QModelIndex QCategorizedView::moveCursor(CursorAction cursorAction, - Qt::KeyboardModifiers modifiers) -{ - if (!d->isCategorized()) { - return QListView::moveCursor(cursorAction, modifiers); - } - - const QModelIndex current = currentIndex(); - const QRect currentRect = visualRect(current); - if (!current.isValid()) { - const int rowCount = d->proxyModel->rowCount(rootIndex()); - if (!rowCount) { - return QModelIndex(); - } - return d->proxyModel->index(0, modelColumn(), rootIndex()); - } - - switch (cursorAction) { - case MoveLeft: { - if (!current.row()) { - return QModelIndex(); - } - const QModelIndex previous = d->proxyModel->index(current.row() - 1, modelColumn(), rootIndex()); - const QRect previousRect = visualRect(previous); - if (previousRect.top() == currentRect.top()) { - return previous; - } - - return QModelIndex(); - } - case MoveRight: { - if (current.row() == d->proxyModel->rowCount() - 1) { - return QModelIndex(); - } - const QModelIndex next = d->proxyModel->index(current.row() + 1, modelColumn(), rootIndex()); - const QRect nextRect = visualRect(next); - if (nextRect.top() == currentRect.top()) { - return next; - } - - return QModelIndex(); - } - case MoveDown: { - if (d->hasGrid() || uniformItemSizes()) { - const QModelIndex current = currentIndex(); - const QSize itemSize = d->hasGrid() ? gridSize() - : sizeHintForIndex(current); - const Private::Block &block = d->blocks[d->categoryForIndex(current)]; - const int maxItemsPerRow = qMax(d->viewportWidth() / itemSize.width(), 1); - const bool canMove = current.row() + maxItemsPerRow < block.firstIndex.row() + - block.items.count(); - - if (canMove) { - return d->proxyModel->index(current.row() + maxItemsPerRow, modelColumn(), rootIndex()); - } - - const int currentRelativePos = (current.row() - block.firstIndex.row()) % maxItemsPerRow; - const QModelIndex nextIndex = d->proxyModel->index(block.firstIndex.row() + block.items.count(), modelColumn(), rootIndex()); - - if (!nextIndex.isValid()) { - return QModelIndex(); - } - - const Private::Block &nextBlock = d->blocks[d->categoryForIndex(nextIndex)]; - - if (nextBlock.items.count() <= currentRelativePos) { - return QModelIndex(); - } - - if (currentRelativePos < (block.items.count() % maxItemsPerRow)) { - return d->proxyModel->index(nextBlock.firstIndex.row() + currentRelativePos, modelColumn(), rootIndex()); - } - - return QModelIndex(); - } - } - case MoveUp: { - if (d->hasGrid() || uniformItemSizes()) { - const QModelIndex current = currentIndex(); - const QSize itemSize = d->hasGrid() ? gridSize() - : sizeHintForIndex(current); - const Private::Block &block = d->blocks[d->categoryForIndex(current)]; - const int maxItemsPerRow = qMax(d->viewportWidth() / itemSize.width(), 1); - const bool canMove = current.row() - maxItemsPerRow >= block.firstIndex.row(); - - if (canMove) { - return d->proxyModel->index(current.row() - maxItemsPerRow, modelColumn(), rootIndex()); - } - - const int currentRelativePos = (current.row() - block.firstIndex.row()) % maxItemsPerRow; - const QModelIndex prevIndex = d->proxyModel->index(block.firstIndex.row() - 1, modelColumn(), rootIndex()); - - if (!prevIndex.isValid()) { - return QModelIndex(); - } - - const Private::Block &prevBlock = d->blocks[d->categoryForIndex(prevIndex)]; - - if (prevBlock.items.count() <= currentRelativePos) { - return QModelIndex(); - } - - const int remainder = prevBlock.items.count() % maxItemsPerRow; - if (currentRelativePos < remainder) { - return d->proxyModel->index(prevBlock.firstIndex.row() + prevBlock.items.count() - remainder + currentRelativePos, modelColumn(), rootIndex()); - } - - return QModelIndex(); - } - } - default: - break; - } - - return QModelIndex(); -} - -void QCategorizedView::rowsAboutToBeRemoved(const QModelIndex &parent, - int start, - int end) -{ - if (!d->isCategorized()) { - QListView::rowsAboutToBeRemoved(parent, start, end); - return; - } - - *d->hoveredBlock = Private::Block(); - d->hoveredCategory = QString(); - - if (end - start + 1 == d->proxyModel->rowCount()) { - d->blocks.clear(); - QListView::rowsAboutToBeRemoved(parent, start, end); - return; - } - - // Removal feels a bit more complicated than insertion. Basically we can consider there are - // 3 different cases when going to remove items. (*) represents an item, Items between ([) and - // (]) are the ones which are marked for removal. - // - // - 1st case: - // ... * * * * * * [ * * * ... - // - // The items marked for removal are the last part of this category. No need to mark any item - // of this category as in quarantine, because no special offset will be pushed to items at - // the right because of any changes (since the removed items are those on the right most part - // of the category). - // - // - 2nd case: - // ... * * * * * * ] * * * ... - // - // The items marked for removal are the first part of this category. We have to mark as in - // quarantine all items in this category. Absolutely all. All items will have to be moved to - // the left (or moving up, because rows got a different offset). - // - // - 3rd case: - // ... * * [ * * * * ] * * ... - // - // The items marked for removal are in between of this category. We have to mark as in - // quarantine only those items that are at the right of the end of the removal interval, - // (starting on "]"). - // - // It hasn't been explicitly said, but when we remove, we have to mark all blocks that are - // located under the top most affected category as in quarantine (the block itself, as a whole), - // because such a change can force it to have a different offset (note that items themselves - // contain relative positions to the block, so marking the block as in quarantine is enough). - // - // Also note that removal implicitly means that we have to update correctly firstIndex of each - // block, and in general keep updated the internal information of elements. - - QStringList listOfCategoriesMarkedForRemoval; - - QString lastCategory; - int alreadyRemoved = 0; - for (int i = start; i <= end; ++i) { - const QModelIndex index = d->proxyModel->index(i, modelColumn(), parent); - - Q_ASSERT(index.isValid()); - - const QString category = d->categoryForIndex(index); - - if (lastCategory != category) { - lastCategory = category; - alreadyRemoved = 0; - } - - Private::Block &block = d->blocks[category]; - block.items.removeAt(i - block.firstIndex.row() - alreadyRemoved); - ++alreadyRemoved; - - if (!block.items.count()) { - listOfCategoriesMarkedForRemoval << category; - } - - block.height = -1; - - viewport()->update(); - } - - //BEGIN: update the items that are in quarantine in affected categories - { - const QModelIndex lastIndex = d->proxyModel->index(end, modelColumn(), parent); - const QString category = d->categoryForIndex(lastIndex); - Private::Block &block = d->blocks[category]; - if (block.items.count() && start <= block.firstIndex.row() && end >= block.firstIndex.row()) { - block.firstIndex = d->proxyModel->index(end + 1, modelColumn(), parent); - } - block.quarantineStart = block.firstIndex; - } - //END: update the items that are in quarantine in affected categories - - Q_FOREACH (const QString &category, listOfCategoriesMarkedForRemoval) { - d->blocks.remove(category); - } - - //BEGIN: mark as in quarantine those categories that are under the affected ones - { - //BEGIN: order for marking as alternate those blocks that are alternate - QList blockList = d->blocks.values(); - qSort(blockList.begin(), blockList.end(), Private::Block::lessThan); - QList firstIndexesRows; - foreach (const Private::Block &block, blockList) { - firstIndexesRows << block.firstIndex.row(); - } - //END: order for marking as alternate those blocks that are alternate - for (QHash::Iterator it = d->blocks.begin(); it != d->blocks.end(); ++it) { - Private::Block &block = *it; - if (block.firstIndex.row() > start) { - block.outOfQuarantine = false; - block.alternate = firstIndexesRows.indexOf(block.firstIndex.row()) % 2; - } else if (block.firstIndex.row() == start) { - block.alternate = firstIndexesRows.indexOf(block.firstIndex.row()) % 2; - } - } - } - //END: mark as in quarantine those categories that are under the affected ones - - QListView::rowsAboutToBeRemoved(parent, start, end); -} - -void QCategorizedView::updateGeometries() -{ - const int oldVerticalOffset = verticalOffset(); - const Qt::ScrollBarPolicy verticalP = verticalScrollBarPolicy(), horizontalP = horizontalScrollBarPolicy(); - - //BEGIN bugs 213068, 287847 ------------------------------------------------------------ - /* - * QListView::updateGeometries() has it's own opinion on whether the scrollbars should be visible (valid range) or not - * and triggers a (sometimes additionally timered) resize through ::layoutChildren() - * http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/itemviews/qlistview.cpp#line1499 - * (the comment above the main block isn't all accurate, layoutChldren is called regardless of the policy) - * - * As a result QListView and KCategorizedView occasionally started a race on the scrollbar visibility, effectively blocking the UI - * So we prevent QListView from having an own opinion on the scrollbar visibility by - * fixing it before calling the baseclass QListView::updateGeometries() - * - * Since the implicit show/hide by the followin range setting will cause further resizes if the policy is Qt::ScrollBarAsNeeded - * we keep it static until we're done, then restore the original value and ultimately change the scrollbar visibility ourself. - */ - if (d->isCategorized()) { // important! - otherwise we'd pollute the setting if the view is initially not categorized - setVerticalScrollBarPolicy((verticalP == Qt::ScrollBarAlwaysOn || verticalScrollBar()->isVisibleTo(this)) ? - Qt::ScrollBarAlwaysOn : Qt::ScrollBarAlwaysOff); - setHorizontalScrollBarPolicy((horizontalP == Qt::ScrollBarAlwaysOn || horizontalScrollBar()->isVisibleTo(this)) ? - Qt::ScrollBarAlwaysOn : Qt::ScrollBarAlwaysOff); - } - //END bugs 213068, 287847 -------------------------------------------------------------- - - QListView::updateGeometries(); - - if (!d->isCategorized()) { - return; - } - - const int rowCount = d->proxyModel->rowCount(); - if (!rowCount) { - verticalScrollBar()->setRange(0, 0); - // unconditional, see function end todo - horizontalScrollBar()->setRange(0, 0); - return; - } - - const QModelIndex lastIndex = d->proxyModel->index(rowCount - 1, modelColumn(), rootIndex()); - Q_ASSERT(lastIndex.isValid()); - QRect lastItemRect = visualRect(lastIndex); - - if (d->hasGrid()) { - lastItemRect.setSize(lastItemRect.size().expandedTo(gridSize())); - } else { - if (uniformItemSizes()) { - QSize itemSize = sizeHintForIndex(lastIndex); - itemSize.setHeight(itemSize.height() + spacing()); - lastItemRect.setSize(itemSize); - } else { - QSize itemSize = sizeHintForIndex(lastIndex); - const QString category = d->categoryForIndex(lastIndex); - itemSize.setHeight(d->highestElementInLastRow(d->blocks[category]) + spacing()); - lastItemRect.setSize(itemSize); - } - } - - const int bottomRange = lastItemRect.bottomRight().y() + verticalOffset() - viewport()->height(); - - if (verticalScrollMode() == ScrollPerItem) { - verticalScrollBar()->setSingleStep(lastItemRect.height()); - const int rowsPerPage = qMax(viewport()->height() / lastItemRect.height(), 1); - verticalScrollBar()->setPageStep(rowsPerPage * lastItemRect.height()); - } - - verticalScrollBar()->setRange(0, bottomRange); - verticalScrollBar()->setValue(oldVerticalOffset); - - //TODO: also consider working with the horizontal scroll bar. since at this level I am not still - // supporting "top to bottom" flow, there is no real problem. If I support that someday - // (think how to draw categories), we would have to take care of the horizontal scroll bar too. - // In theory, as QCategorizedView has been designed, there is no need of horizontal scroll bar. - horizontalScrollBar()->setRange(0, 0); - - //BEGIN bugs 213068, 287847 ------------------------------------------------------------ - // restoring values from above ... - setVerticalScrollBarPolicy(verticalP); - setHorizontalScrollBarPolicy(horizontalP); - // ... and correct the visibility - bool validRange = verticalScrollBar()->maximum() != verticalScrollBar()->minimum(); - if (verticalP == Qt::ScrollBarAsNeeded && (verticalScrollBar()->isVisibleTo(this) != validRange)) - verticalScrollBar()->setVisible(validRange); - validRange = horizontalScrollBar()->maximum() > horizontalScrollBar()->minimum(); - if (horizontalP == Qt::ScrollBarAsNeeded && (horizontalScrollBar()->isVisibleTo(this) != validRange)) - horizontalScrollBar()->setVisible(validRange); - //END bugs 213068, 287847 -------------------------------------------------------------- -} - -void QCategorizedView::currentChanged(const QModelIndex ¤t, - const QModelIndex &previous) -{ - QListView::currentChanged(current, previous); -} - -void QCategorizedView::dataChanged(const QModelIndex &topLeft, - const QModelIndex &bottomRight, - const QVector & roles) -{ - QListView::dataChanged(topLeft, bottomRight); - if (!d->isCategorized()) { - return; - } - - *d->hoveredBlock = Private::Block(); - d->hoveredCategory = QString(); - - //BEGIN: since the model changed data, we need to reconsider item sizes - int i = topLeft.row(); - int indexToCheck = i; - QModelIndex categoryIndex; - QString category; - Private::Block *block; - while (i <= bottomRight.row()) { - const QModelIndex currIndex = d->proxyModel->index(i, modelColumn(), rootIndex()); - if (i == indexToCheck) { - categoryIndex = d->proxyModel->index(i, d->proxyModel->sortColumn(), rootIndex()); - category = categoryIndex.data(QCategorizedSortFilterProxyModel::CategoryDisplayRole).toString(); - block = &d->blocks[category]; - block->quarantineStart = currIndex; - indexToCheck = block->firstIndex.row() + block->items.count(); - } - visualRect(currIndex); - ++i; - } - //END: since the model changed data, we need to reconsider item sizes -} - -void QCategorizedView::rowsInserted(const QModelIndex &parent, - int start, - int end) -{ - QListView::rowsInserted(parent, start, end); - if (!d->isCategorized()) { - return; - } - - *d->hoveredBlock = Private::Block(); - d->hoveredCategory = QString(); - d->rowsInserted(parent, start, end); -} - -#ifndef KDE_NO_DEPRECATED -void QCategorizedView::rowsInsertedArtifficial(const QModelIndex &parent, - int start, - int end) -{ - Q_UNUSED(parent); - Q_UNUSED(start); - Q_UNUSED(end); -} -#endif - -#ifndef KDE_NO_DEPRECATED -void QCategorizedView::rowsRemoved(const QModelIndex &parent, - int start, - int end) -{ - Q_UNUSED(parent); - Q_UNUSED(start); - Q_UNUSED(end); -} -#endif - -void QCategorizedView::slotLayoutChanged() -{ - if (!d->isCategorized()) { - return; - } - - d->blocks.clear(); - *d->hoveredBlock = Private::Block(); - d->hoveredCategory = QString(); - if (d->proxyModel->rowCount()) { - d->rowsInserted(rootIndex(), 0, d->proxyModel->rowCount() - 1); - } -} - -void QCategorizedView::keyPressEvent(QKeyEvent *event) -{ - // Don't emit activated() by pressing Enter! ... - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - if (state() != EditingState) { - event->ignore(); - if (hasFocus() && !event->isAutoRepeat()) - enterPressed = true; // Pressed after getting focus. - return; - } - break; - default: break; - } - QAbstractItemView::keyPressEvent(event); -} - -void QCategorizedView::keyReleaseEvent(QKeyEvent *event) -{ - // ... Emit activated() by releasing Enter instead! - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - if (hasFocus() && state() != EditingState - && !event->isAutoRepeat() // No multiple signals. - && enterPressed // No signal if Enter is pressed before getting focus. - && currentIndex().isValid()) { - emit activated(currentIndex()); - event->accept(); - enterPressed = false; - return; - } - break; - default: break; - } - QAbstractItemView::keyReleaseEvent(event); -} - -//END: Public part - -#include "moc_qcategorizedview.cpp" diff --git a/src/qcategorizedview/qcategorizedview.h b/src/qcategorizedview/qcategorizedview.h deleted file mode 100644 index 323e012..0000000 --- a/src/qcategorizedview/qcategorizedview.h +++ /dev/null @@ -1,363 +0,0 @@ -/** - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007, 2009 Rafael Fernández López - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef KCATEGORIZEDVIEW_H -#define KCATEGORIZEDVIEW_H - -#include - -//#include - -#define KDEUI_EXPORT -#define KDE_DEPRECATED - - -class QCategoryDrawer; -class QCategoryDrawerV2; - -/** - * @short Item view for listing items in a categorized fashion optionally - * - * QCategorizedView basically has the same functionality as QListView, only that it also lets you - * layout items in a way that they are categorized visually. - * - * For it to work you will need to set a QCategorizedSortFilterProxyModel and a QCategoryDrawer - * with methods setModel() and setCategoryDrawer() respectively. Also, the model will need to be - * flagged as categorized with QCategorizedSortFilterProxyModel::setCategorizedModel(true). - * - * The way it works (if categorization enabled): - * - * - When sorting, it does more things than QListView does. It will ask the model for the - * special role CategorySortRole (@see QCategorizedSortFilterProxyModel). This can return - * a QString or an int in order to tell the view the order of categories. In this sense, for - * instance, if we are sorting by name ascending, "A" would be before than "B". If we are - * sorting by size ascending, 512 bytes would be before 1024 bytes. This way categories are - * also sorted. - * - * - When the view has to paint, it will ask the model with the role CategoryDisplayRole - * (@see QCategorizedSortFilterProxyModel). It will for instance return "F" for "foo.pdf" if - * we are sorting by name ascending, or "Small" if a certain item has 100 bytes, for example. - * - * For drawing categories, QCategoryDrawer will be used. You can inherit this class to do your own - * drawing. - * - * @note All examples cited before talk about filesystems and such, but have present that this - * is a completely generic class, and it can be used for whatever your purpose is. For - * instance when talking about animals, you can separate them by "Mammal" and "Oviparous". In - * this very case, for example, the CategorySortRole and the CategoryDisplayRole could be the - * same ("Mammal" and "Oviparous"). - * - * @note There is a really performance boost if CategorySortRole returns an int instead of a QString. - * Have present that this role is asked (n * log n) times when sorting and compared. Comparing - * ints is always faster than comparing strings, whithout mattering how fast the string - * comparison is. Consider thinking of a way of returning ints instead of QStrings if your - * model can contain a high number of items. - * - * @warning Note that for really drawing items in blocks you will need some things to be done: - * - The model set to this view has to be (or inherit if you want to do special stuff - * in it) QCategorizedSortFilterProxyModel. - * - This model needs to be set setCategorizedModel to true. - * - Set a category drawer by calling setCategoryDrawer. - * - * @see QCategorizedSortFilterProxyModel, QCategoryDrawer - * - * @author Rafael Fernández López - */ -class KDEUI_EXPORT QCategorizedView - : public QListView -{ - Q_OBJECT - Q_PROPERTY(int categorySpacing READ categorySpacing WRITE setCategorySpacing) - Q_PROPERTY(bool alternatingBlockColors READ alternatingBlockColors WRITE setAlternatingBlockColors) - Q_PROPERTY(bool collapsibleBlocks READ collapsibleBlocks WRITE setCollapsibleBlocks) - -public: - QCategorizedView(QWidget *parent = 0); - - ~QCategorizedView(); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void setModel(QAbstractItemModel *model); - - /** - * Calls to setGridSizeOwn(). - */ - void setGridSize(const QSize &size); - - /** - * @warning note that setGridSize is not virtual in the base class (QListView), so if you are - * calling to this method, make sure you have a QCategorizedView pointer around. This - * means that something like: - * @code - * QListView *lv = new QCategorizedView(); - * lv->setGridSize(mySize); - * @endcode - * - * will not call to the expected setGridSize method. Instead do something like this: - * - * @code - * QListView *lv; - * ... - * QCategorizedView *cv = qobject_cast(lv); - * if (cv) { - * cv->setGridSizeOwn(mySize); - * } else { - * lv->setGridSize(mySize); - * } - * @endcode - * - * @note this method will call to QListView::setGridSize among other operations. - * - * @since 4.4 - */ - void setGridSizeOwn(const QSize &size); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual QRect visualRect(const QModelIndex &index) const; - - /** - * Returns the current category drawer. - */ - QCategoryDrawer *categoryDrawer() const; - - /** - * The category drawer that will be used for drawing categories. - */ - void setCategoryDrawer(QCategoryDrawer *categoryDrawer); - - /** - * @return Category spacing. The spacing between categories. - * - * @since 4.4 - */ - int categorySpacing() const; - - /** - * Stablishes the category spacing. This is the spacing between categories. - * - * @since 4.4 - */ - void setCategorySpacing(int categorySpacing); - - /** - * @return Whether blocks should be drawn with alternating colors. - * - * @since 4.4 - */ - bool alternatingBlockColors() const; - - /** - * Sets whether blocks should be drawn with alternating colors. - * - * @since 4.4 - */ - void setAlternatingBlockColors(bool enable); - - /** - * @return Whether blocks can be collapsed or not. - * - * @since 4.4 - */ - bool collapsibleBlocks() const; - - /** - * Sets whether blocks can be collapsed or not. - * - * @since 4.4 - */ - void setCollapsibleBlocks(bool enable); - - /** - * @return Block of indexes that are into @p category. - * - * @since 4.5 - */ - QModelIndexList block(const QString &category); - - /** - * @return Block of indexes that are represented by @p representative. - * - * @since 4.5 - */ - QModelIndexList block(const QModelIndex &representative); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual QModelIndex indexAt(const QPoint &point) const; - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void reset(); - - /** - * @return The icon size by considering all the styling - */ - QSize decorationSize() const; - -protected: - /** - * Reimplemented from QWidget. - */ - virtual void paintEvent(QPaintEvent *event); - - /** - * Reimplemented from QWidget. - */ - virtual void resizeEvent(QResizeEvent *event); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void setSelection(const QRect &rect, - QItemSelectionModel::SelectionFlags flags); - - /** - * Reimplemented from QWidget. - */ - virtual void mouseMoveEvent(QMouseEvent *event); - - /** - * Reimplemented from QWidget. - */ - virtual void mousePressEvent(QMouseEvent *event); - - /** - * Reimplemented from QWidget. - */ - virtual void mouseReleaseEvent(QMouseEvent *event); - - /** - * Reimplemented from QWidget. - */ - virtual void leaveEvent(QEvent *event); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void startDrag(Qt::DropActions supportedActions); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void dragMoveEvent(QDragMoveEvent *event); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void dragEnterEvent(QDragEnterEvent *event); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void dragLeaveEvent(QDragLeaveEvent *event); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void dropEvent(QDropEvent *event); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual QModelIndex moveCursor(CursorAction cursorAction, - Qt::KeyboardModifiers modifiers); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void rowsAboutToBeRemoved(const QModelIndex &parent, - int start, - int end); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void updateGeometries(); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void currentChanged(const QModelIndex ¤t, - const QModelIndex &previous); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void dataChanged(const QModelIndex &topLeft, - const QModelIndex &bottomRight, - const QVector & roles = QVector ()); - - /** - * Reimplemented from QAbstractItemView. - */ - virtual void rowsInserted(const QModelIndex &parent, - int start, - int end); - - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *event); - -protected Q_SLOTS: - /** - * @internal - * @warning Deprecated since 4.4. - */ -#ifndef KDE_NO_DEPRECATED - virtual KDE_DEPRECATED void rowsInsertedArtifficial(const QModelIndex &parent, - int start, - int end); -#endif - - /** - * @internal - * @warning Deprecated since 4.4. - */ -#ifndef KDE_NO_DEPRECATED - virtual KDE_DEPRECATED void rowsRemoved(const QModelIndex &parent, - int start, - int end); -#endif - - /** - * @internal - * Reposition items as needed. - */ - virtual void slotLayoutChanged(); - -private: - class Private; - Private *const d; - /** - * For knowing that Enter is pressed after - * the widget gets focus and not before that. - */ - bool enterPressed; - - Q_PRIVATE_SLOT(d, void _k_slotCollapseOrExpandClicked(QModelIndex)) -}; - -#endif // KCATEGORIZEDVIEW_H diff --git a/src/qcategorizedview/qcategorizedview_p.h b/src/qcategorizedview/qcategorizedview_p.h deleted file mode 100644 index 611160b..0000000 --- a/src/qcategorizedview/qcategorizedview_p.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007, 2009 Rafael Fernández López - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef KCATEGORIZEDVIEW_P_H -#define KCATEGORIZEDVIEW_P_H - -class QCategorizedSortFilterProxyModel; -class QCategoryDrawer; -class QCategoryDrawerV2; -class QCategoryDrawerV3; - -/** - * @internal - */ -class QCategorizedView::Private -{ -public: - struct Block; - struct Item; - - Private(QCategorizedView *q); - ~Private(); - - /** - * @return whether this view has all required elements to be categorized. - */ - bool isCategorized() const; - - /** - * @return the block rect for the representative @p representative. - */ - QStyleOptionViewItem blockRect(const QModelIndex &representative); - - /** - * Returns the first and last element that intersects with rect. - * - * @note see that here we cannot take out items between first and last (as we could - * do with the rubberband). - * - * Complexity: O(log(n)) where n is model()->rowCount(). - */ - QPair intersectingIndexesWithRect(const QRect &rect) const; - - /** - * Returns the position of the block of @p category. - * - * Complexity: O(n) where n is the number of different categories when the block has been - * marked as in quarantine. O(1) the rest of the times (the vast majority). - */ - QPoint blockPosition(const QString &category); - - /** - * Returns the height of the block determined by @p category. - */ - int blockHeight(const QString &category); - - /** - * Returns the actual viewport width. - */ - int viewportWidth() const; - - /** - * Marks all elements as in quarantine. - * - * Complexity: O(n) where n is model()->rowCount(). - * - * @warning this is an expensive operation - */ - void regenerateAllElements(); - - /** - * Update internal information, and keep sync with the real information that the model contains. - */ - void rowsInserted(const QModelIndex &parent, int start, int end); - - /** - * Returns @p rect in viewport terms, taking in count horizontal and vertical offsets. - */ - QRect mapToViewport(const QRect &rect) const; - - /** - * Returns @p rect in absolute terms, converted from viewport position. - */ - QRect mapFromViewport(const QRect &rect) const; - - /** - * Returns the height of the highest element in last row. This is only applicable if there is - * no grid set and uniformItemSizes is false. - * - * @param block in which block are we searching. Necessary to stop the search if we hit the - * first item in this block. - */ - int highestElementInLastRow(const Block &block) const; - - /** - * Returns whether the view has a valid grid size. - */ - bool hasGrid() const; - - /** - * Returns the category for the given index. - */ - QString categoryForIndex(const QModelIndex &index) const; - - /** - * Updates the visual rect for item when flow is LeftToRight. - */ - void leftToRightVisualRect(const QModelIndex &index, Item &item, - const Block &block, const QPoint &blockPos) const; - - /** - * Updates the visual rect for item when flow is TopToBottom. - * @note we only support viewMode == ListMode in this case. - */ - void topToBottomVisualRect(const QModelIndex &index, Item &item, - const Block &block, const QPoint &blockPos) const; - - /** - * Called when expand or collapse has been clicked on the category drawer. - */ - void _k_slotCollapseOrExpandClicked(QModelIndex); - - QCategorizedView *q; - QCategorizedSortFilterProxyModel *proxyModel; - QCategoryDrawer *categoryDrawer; - QCategoryDrawerV2 *categoryDrawerV2; - QCategoryDrawerV3 *categoryDrawerV3; - int categorySpacing; - bool alternatingBlockColors; - bool collapsibleBlocks; - - Block *hoveredBlock; - QString hoveredCategory; - QModelIndex hoveredIndex; - - QPoint pressedPosition; - QRect rubberBandRect; - - QHash blocks; -}; - -#endif // KCATEGORIZEDVIEW_P_H diff --git a/src/qcategorizedview/qcategorydrawer.cpp b/src/qcategorizedview/qcategorydrawer.cpp deleted file mode 100644 index 1b23861..0000000 --- a/src/qcategorizedview/qcategorydrawer.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/** - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007, 2009 Rafael Fernández López - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "qcategorydrawer.h" - -#include -#include -#include - -//#include -#include -#include - -#define HORIZONTAL_HINT 3 - -class QCategoryDrawer::Private -{ -public: - Private() - : leftMargin(0) - , rightMargin(0) - { - } - - ~Private() - { - } - - int leftMargin; - int rightMargin; -}; - -QCategoryDrawer::QCategoryDrawer() - : d(new Private) -{ - setLeftMargin(2); - setRightMargin(2); -} - -QCategoryDrawer::~QCategoryDrawer() -{ - delete d; -} - -void QCategoryDrawer::drawCategory(const QModelIndex &index, - int /*sortRole*/, - const QStyleOption &option, - QPainter *painter) const -{ - painter->setRenderHint(QPainter::Antialiasing); - - const QString category = index.model()->data(index, QCategorizedSortFilterProxyModel::CategoryDisplayRole).toString(); - const QRect optRect = option.rect; - QFont font(QApplication::font()); - font.setBold(true); - const QFontMetrics fontMetrics = QFontMetrics(font); - - QColor outlineColor = option.palette.text().color(); - outlineColor.setAlphaF(0.35); - - //BEGIN: top left corner - { - painter->save(); - painter->setPen(outlineColor); - const QPointF topLeft(optRect.topLeft()); - QRectF arc(topLeft, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 1440, 1440); - painter->restore(); - } - //END: top left corner - - //BEGIN: left vertical line - { - QPoint start(optRect.topLeft()); - start.ry() += 3; - QPoint verticalGradBottom(optRect.topLeft()); - verticalGradBottom.ry() += fontMetrics.height() + 5; - QLinearGradient gradient(start, verticalGradBottom); - gradient.setColorAt(0, outlineColor); - gradient.setColorAt(1, Qt::transparent); - painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient); - } - //END: left vertical line - - //BEGIN: horizontal line - { - QPoint start(optRect.topLeft()); - start.rx() += 3; - QPoint horizontalGradTop(optRect.topLeft()); - horizontalGradTop.rx() += optRect.width() - 6; - painter->fillRect(QRect(start, QSize(optRect.width() - 6, 1)), outlineColor); - } - //END: horizontal line - - //BEGIN: top right corner - { - painter->save(); - painter->setPen(outlineColor); - QPointF topRight(optRect.topRight()); - topRight.rx() -= 4; - QRectF arc(topRight, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 0, 1440); - painter->restore(); - } - //END: top right corner - - //BEGIN: right vertical line - { - QPoint start(optRect.topRight()); - start.ry() += 3; - QPoint verticalGradBottom(optRect.topRight()); - verticalGradBottom.ry() += fontMetrics.height() + 5; - QLinearGradient gradient(start, verticalGradBottom); - gradient.setColorAt(0, outlineColor); - gradient.setColorAt(1, Qt::transparent); - painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient); - } - //END: right vertical line - - //BEGIN: text - { - QRect textRect(option.rect); - textRect.setTop(textRect.top() + 7); - textRect.setLeft(textRect.left() + 7); - textRect.setHeight(fontMetrics.height()); - textRect.setRight(textRect.right() - 7); - - painter->save(); - painter->setFont(font); - QColor penColor(option.palette.text().color()); - penColor.setAlphaF(0.6); - painter->setPen(penColor); - painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, category); - painter->restore(); - } - //END: text -} - -int QCategoryDrawer::categoryHeight(const QModelIndex &index, const QStyleOption &option) const -{ - Q_UNUSED(index); - Q_UNUSED(option) - - QFont font(QApplication::font()); - font.setBold(true); - QFontMetrics fontMetrics(font); - - const int height = fontMetrics.height() + 1 /* 1 pixel-width gradient */ - + 11 /* top and bottom separation */; - return height; -} - -int QCategoryDrawer::leftMargin() const -{ - return d->leftMargin; -} - -void QCategoryDrawer::setLeftMargin(int leftMargin) -{ - d->leftMargin = leftMargin; -} - -int QCategoryDrawer::rightMargin() const -{ - return d->rightMargin; -} - -void QCategoryDrawer::setRightMargin(int rightMargin) -{ - d->rightMargin = rightMargin; -} - -QCategoryDrawer &QCategoryDrawer::operator=(const QCategoryDrawer &cd) -{ - d->leftMargin = cd.d->leftMargin; - d->rightMargin = cd.d->rightMargin; - return *this; -} - -QCategoryDrawerV2::QCategoryDrawerV2(QObject *parent) - : QObject(parent) - , QCategoryDrawer() -{ -} - -QCategoryDrawerV2::~QCategoryDrawerV2() -{ -} - -void QCategoryDrawerV2::mouseButtonPressed(const QModelIndex&, QMouseEvent *event) -{ - event->ignore(); -} - -void QCategoryDrawerV2::mouseButtonReleased(const QModelIndex&, QMouseEvent *event) -{ - event->ignore(); -} - -void QCategoryDrawerV2::mouseButtonMoved(const QModelIndex&, QMouseEvent *event) -{ - event->ignore(); -} - -void QCategoryDrawerV2::mouseButtonDoubleClicked(const QModelIndex&, QMouseEvent *event) -{ - event->ignore(); -} - -class QCategoryDrawerV3::Private -{ -public: - Private(QCategorizedView *view) - : view(view) - { - } - - ~Private() - { - } - - QCategorizedView *view; -}; - -QCategoryDrawerV3::QCategoryDrawerV3(QCategorizedView *view) - : QCategoryDrawerV2(view) - , d(new Private(view)) -{ -} - -QCategoryDrawerV3::~QCategoryDrawerV3() -{ - delete d; -} - -QCategorizedView *QCategoryDrawerV3::view() const -{ - return d->view; -} - -void QCategoryDrawerV3::mouseButtonPressed(const QModelIndex&, const QRect&, QMouseEvent *event) -{ - event->ignore(); -} - -void QCategoryDrawerV3::mouseButtonReleased(const QModelIndex&, const QRect&, QMouseEvent *event) -{ - event->ignore(); -} - -void QCategoryDrawerV3::mouseMoved(const QModelIndex&, const QRect&, QMouseEvent *event) -{ - event->ignore(); -} - -void QCategoryDrawerV3::mouseButtonDoubleClicked(const QModelIndex&, const QRect&, QMouseEvent *event) -{ - event->ignore(); -} - -void QCategoryDrawerV3::mouseLeft(const QModelIndex&, const QRect&) -{ -} - -#include "moc_qcategorydrawer.cpp" diff --git a/src/qcategorizedview/qcategorydrawer.h b/src/qcategorizedview/qcategorydrawer.h deleted file mode 100644 index 4c5af0d..0000000 --- a/src/qcategorizedview/qcategorydrawer.h +++ /dev/null @@ -1,234 +0,0 @@ -/** - * (c)LGPL2+ - * This file is part of the KDE project - * Copyright (C) 2007, 2009 Rafael Fernández López - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef KCATEGORYDRAWER_H -#define KCATEGORYDRAWER_H - -//#include - -#include -#include - -#define KDEUI_EXPORT -#define KDE_DEPRECATED - -class QPainter; -class QModelIndex; -class QStyleOption; - -class QCategorizedView; - -/** - * @deprecated - * - * The category drawing is performed by this class. It also gives information about the category - * height and margins. - * - * @warning Please use QCategoryDrawerV3 instead - */ -class KDEUI_EXPORT QCategoryDrawer -{ -public: - KDE_DEPRECATED QCategoryDrawer(); - - virtual ~QCategoryDrawer(); - - /** - * This method purpose is to draw a category represented by the given - * @param index with the given @param sortRole sorting role - * - * @note This method will be called one time per category, always with the - * first element in that category - */ - virtual void drawCategory(const QModelIndex &index, - int sortRole, - const QStyleOption &option, - QPainter *painter) const; - - /** - * @return The category height for the category representated by index @p index with - * style options @p option. - */ - virtual int categoryHeight(const QModelIndex &index, const QStyleOption &option) const; - - //TODO KDE5: make virtual as leftMargin - /** - * @note 0 by default - * - * @since 4.4 - */ - int leftMargin() const; - - /** - * @note call to this method on the QCategoryDrawer constructor to set the left margin - * - * @since 4.4 - */ - void setLeftMargin(int leftMargin); - - //TODO KDE5: make virtual as rightMargin - /** - * @note 0 by default - * - * @since 4.4 - */ - int rightMargin() const; - - /** - * @note call to this method on the QCategoryDrawer constructor to set the right margin - * - * @since 4.4 - */ - void setRightMargin(int rightMargin); - - QCategoryDrawer &operator=(const QCategoryDrawer &cd); - -private: - class Private; - Private *const d; -}; - - -/** - * @deprecated - * - * @since 4.4 - * - * @warning Please use QCategoryDrawerV3 instead - */ -class KDEUI_EXPORT QCategoryDrawerV2 - : public QObject - , public QCategoryDrawer -{ - Q_OBJECT - -public: - KDE_DEPRECATED QCategoryDrawerV2(QObject *parent = 0); - virtual ~QCategoryDrawerV2(); - - KDE_DEPRECATED virtual void mouseButtonPressed(const QModelIndex &index, QMouseEvent *event); - - KDE_DEPRECATED virtual void mouseButtonReleased(const QModelIndex &index, QMouseEvent *event); - - KDE_DEPRECATED virtual void mouseButtonMoved(const QModelIndex &index, QMouseEvent *event); - - KDE_DEPRECATED virtual void mouseButtonDoubleClicked(const QModelIndex &index, QMouseEvent *event); - -Q_SIGNALS: - /** - * This signal becomes emitted when collapse or expand has been clicked. - */ - void collapseOrExpandClicked(const QModelIndex &index); - - /** - * Emit this signal on your subclass implementation to notify that something happened. Usually - * this will be triggered when you have received an event, and its position matched some "hot spot". - * - * You give this action the integer you want, and having connected this signal to your code, - * the connected slot can perform the needed changes (view, model, selection model, delegate...) - */ - void actionRequested(int action, const QModelIndex &index); -}; - -/** - * @since 4.5 - */ -class KDEUI_EXPORT QCategoryDrawerV3 - : public QCategoryDrawerV2 -{ - friend class QCategorizedView; - -public: - QCategoryDrawerV3(QCategorizedView *view); - virtual ~QCategoryDrawerV3(); - - /** - * @return The view this category drawer is associated with. - */ - QCategorizedView *view() const; - - using QCategoryDrawerV2::mouseButtonPressed; - using QCategoryDrawerV2::mouseButtonReleased; - using QCategoryDrawerV2::mouseButtonDoubleClicked; - -protected: - /** - * Method called when the mouse button has been pressed. - * - * @param index The representative index of the block of items. - * @param blockRect The rect occupied by the block of items. - * @param event The mouse event. - * - * @warning You explicitly have to determine whether the event has been accepted or not. You - * have to call event->accept() or event->ignore() at all possible case branches in - * your code. - */ - virtual void mouseButtonPressed(const QModelIndex &index, const QRect &blockRect, QMouseEvent *event); - - /** - * Method called when the mouse button has been released. - * - * @param index The representative index of the block of items. - * @param blockRect The rect occupied by the block of items. - * @param event The mouse event. - * - * @warning You explicitly have to determine whether the event has been accepted or not. You - * have to call event->accept() or event->ignore() at all possible case branches in - * your code. - */ - virtual void mouseButtonReleased(const QModelIndex &index, const QRect &blockRect, QMouseEvent *event); - - /** - * Method called when the mouse has been moved. - * - * @param index The representative index of the block of items. - * @param blockRect The rect occupied by the block of items. - * @param event The mouse event. - */ - virtual void mouseMoved(const QModelIndex &index, const QRect &blockRect, QMouseEvent *event); - - /** - * Method called when the mouse button has been double clicked. - * - * @param index The representative index of the block of items. - * @param blockRect The rect occupied by the block of items. - * @param event The mouse event. - * - * @warning You explicitly have to determine whether the event has been accepted or not. You - * have to call event->accept() or event->ignore() at all possible case branches in - * your code. - */ - virtual void mouseButtonDoubleClicked(const QModelIndex &index, const QRect &blockRect, QMouseEvent *event); - - /** - * Method called when the mouse button has left this block. - * - * @param index The representative index of the block of items. - * @param blockRect The rect occupied by the block of items. - */ - virtual void mouseLeft(const QModelIndex &index, const QRect &blockRect); - -private: - class Private; - Private *const d; -}; - -#endif // KCATEGORYDRAWER_H diff --git a/src/translations/lxqt-config_ar.desktop b/src/translations/lxqt-config_ar.desktop deleted file mode 100644 index e251c85..0000000 --- a/src/translations/lxqt-config_ar.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ar]=اضبط نظامك -GenericName[ar]=إعدادات النّظام -Name[ar]=مركز لكسكيوت للضّبط diff --git a/src/translations/lxqt-config_ca.desktop b/src/translations/lxqt-config_ca.desktop deleted file mode 100644 index 6056656..0000000 --- a/src/translations/lxqt-config_ca.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[ca]=Centre de configuració de LXQt -GenericName[ca]=Ajusts del sistema -Comment[ca]=Configureu el vostre sistema diff --git a/src/translations/lxqt-config_cs.desktop b/src/translations/lxqt-config_cs.desktop deleted file mode 100644 index b07dceb..0000000 --- a/src/translations/lxqt-config_cs.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[cs]=Nastavit moduly LXQt -GenericName[cs]=Nastavení LXQtu -Name[cs]=Nastavení LXQtu diff --git a/src/translations/lxqt-config_cs_CZ.desktop b/src/translations/lxqt-config_cs_CZ.desktop deleted file mode 100644 index e0281d5..0000000 --- a/src/translations/lxqt-config_cs_CZ.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[cs_CZ]=Nastavit moduly LXQt -GenericName[cs_CZ]=Nastavení LXQtu -Name[cs_CZ]=Nastavení LXQtu diff --git a/src/translations/lxqt-config_da.desktop b/src/translations/lxqt-config_da.desktop deleted file mode 100644 index 6ad9e88..0000000 --- a/src/translations/lxqt-config_da.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[da]=LXQt-konfigurationscenter -GenericName[da]=Systemindstillinger -Comment[da]=Konfigurér dit system diff --git a/src/translations/lxqt-config_de.desktop b/src/translations/lxqt-config_de.desktop deleted file mode 100644 index e82005d..0000000 --- a/src/translations/lxqt-config_de.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[de]=Konfigurationszentrum -GenericName[de]=Systemeinstellungen -Comment[de]=Konfiguration von LXQt- und Systemkomponenten diff --git a/src/translations/lxqt-config_el.desktop b/src/translations/lxqt-config_el.desktop deleted file mode 100644 index 03f7713..0000000 --- a/src/translations/lxqt-config_el.desktop +++ /dev/null @@ -1,5 +0,0 @@ -# Translations -Name[el]=Κέντρο διαμόρφωσης LXQt -GenericName[el]=Ρυθμίσεις συστήματος -Comment[el]=Διαμόρφωση του συστήματος - diff --git a/src/translations/lxqt-config_eo.desktop b/src/translations/lxqt-config_eo.desktop deleted file mode 100644 index 0094fc6..0000000 --- a/src/translations/lxqt-config_eo.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[eo]=Agordi modulojn de LXQt -GenericName[eo]=Agordilo de LXQt -Name[eo]=Agordcentro de LXQt diff --git a/src/translations/lxqt-config_es.desktop b/src/translations/lxqt-config_es.desktop deleted file mode 100644 index 9dc12ca..0000000 --- a/src/translations/lxqt-config_es.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[es]=Configura módulos de LXQt -GenericName[es]=Configuración LXQt -Name[es]=Centro de Configuración LXQt diff --git a/src/translations/lxqt-config_es_VE.desktop b/src/translations/lxqt-config_es_VE.desktop deleted file mode 100644 index 4794885..0000000 --- a/src/translations/lxqt-config_es_VE.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[es_VE]=Configurar modulos de LXQt -GenericName[es_VE]=Configuracion de LXQt -Name[es_VE]=Centro de Configuracion LXQt diff --git a/src/translations/lxqt-config_eu.desktop b/src/translations/lxqt-config_eu.desktop deleted file mode 100644 index 6c54ad9..0000000 --- a/src/translations/lxqt-config_eu.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[eu]=Konfiguratu LXQt moduluak -GenericName[eu]=LXQt konfigurazioa -Name[eu]=LXQt konfigurazio-zentroa diff --git a/src/translations/lxqt-config_fi.desktop b/src/translations/lxqt-config_fi.desktop deleted file mode 100644 index 28667fe..0000000 --- a/src/translations/lxqt-config_fi.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[fi]=Hallitse LXQtin moduuleita -GenericName[fi]=LXQt-hallinta -Name[fi]=LXQtin hallintakeskus diff --git a/src/translations/lxqt-config_fr.desktop b/src/translations/lxqt-config_fr.desktop deleted file mode 100644 index cc3dfa9..0000000 --- a/src/translations/lxqt-config_fr.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[fr]=Configurer les modules de LXQt -GenericName[fr]=Configuration de LXQt -Name[fr]=Centre de configuration de LXQt diff --git a/src/translations/lxqt-config_hu.desktop b/src/translations/lxqt-config_hu.desktop deleted file mode 100644 index 504f0df..0000000 --- a/src/translations/lxqt-config_hu.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[hu]=A LXQt modulok beállítása -GenericName[hu]=LXQt beállítóközpont -Name[hu]=LXQt beállítóközpont diff --git a/src/translations/lxqt-config_id_ID.desktop b/src/translations/lxqt-config_id_ID.desktop deleted file mode 100644 index 52995bd..0000000 --- a/src/translations/lxqt-config_id_ID.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[id_ID]=Konfigurasi modul LXQt -GenericName[id_ID]=Konfigurasi LXQt -Name[id_ID]=Pusat Konfigurasi LXQt diff --git a/src/translations/lxqt-config_it.desktop b/src/translations/lxqt-config_it.desktop deleted file mode 100644 index 4c2c9d7..0000000 --- a/src/translations/lxqt-config_it.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[it]=Configura moduli di LXQt -GenericName[it]=Configura LXQt -Name[it]=Centro di configurazione LXQt diff --git a/src/translations/lxqt-config_ja.desktop b/src/translations/lxqt-config_ja.desktop deleted file mode 100644 index d12f4d3..0000000 --- a/src/translations/lxqt-config_ja.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ja]=LXQtモジュールを設定 -GenericName[ja]=LXQtの設定 -Name[ja]=LXQtコンフィグレーションセンター diff --git a/src/translations/lxqt-config_lt.desktop b/src/translations/lxqt-config_lt.desktop deleted file mode 100644 index 708ef38..0000000 --- a/src/translations/lxqt-config_lt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Name[lt]=LXQt konfigūravimo centras -GenericName[lt]=Sistemos nustatymai -Comment[lt]=Konfigūruoti savo sistemą diff --git a/src/translations/lxqt-config_nl.desktop b/src/translations/lxqt-config_nl.desktop deleted file mode 100644 index 50514bd..0000000 --- a/src/translations/lxqt-config_nl.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[nl]=Configureer LXQt modules -GenericName[nl]=LXQt Configuratie -Name[nl]=LXQt Configuratie Centrum diff --git a/src/translations/lxqt-config_pl.desktop b/src/translations/lxqt-config_pl.desktop deleted file mode 100644 index b120eaf..0000000 --- a/src/translations/lxqt-config_pl.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[pl]=Wszystkie ustawienia LXQt -GenericName[pl]=Panel sterowania LXQt -Name[pl]=Panel sterowania LXQt diff --git a/src/translations/lxqt-config_pl_PL.desktop b/src/translations/lxqt-config_pl_PL.desktop deleted file mode 100644 index c06e74a..0000000 --- a/src/translations/lxqt-config_pl_PL.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[pl_PL]=Konfiguruj moduły LXQt -GenericName[pl_PL]=Konfiguracja LXQt -Name[pl_PL]=Panel sterowania LXQt diff --git a/src/translations/lxqt-config_pt.desktop b/src/translations/lxqt-config_pt.desktop deleted file mode 100644 index 921f3eb..0000000 --- a/src/translations/lxqt-config_pt.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[pt]=Configurar módulos do LXQt -GenericName[pt]=Configuração do LXQt -Name[pt]=Centro de configuração LXQt diff --git a/src/translations/lxqt-config_pt_BR.desktop b/src/translations/lxqt-config_pt_BR.desktop deleted file mode 100644 index 3efbf18..0000000 --- a/src/translations/lxqt-config_pt_BR.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[pt_BR]=Configurar módulos Qt -GenericName[pt_BR]=Configuração -Name[pt_BR]=Centro De Configuração diff --git a/src/translations/lxqt-config_ro_RO.desktop b/src/translations/lxqt-config_ro_RO.desktop deleted file mode 100644 index 1b723ed..0000000 --- a/src/translations/lxqt-config_ro_RO.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ro_RO]=Configurează modulele LXQt -GenericName[ro_RO]=Configurație LXQt -Name[ro_RO]=Centru de configurare LXQt diff --git a/src/translations/lxqt-config_ru.desktop b/src/translations/lxqt-config_ru.desktop deleted file mode 100644 index f9f1dac..0000000 --- a/src/translations/lxqt-config_ru.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[ru]=Настроить вашу систему -GenericName[ru]=Системные настройки -Name[ru]=Системные настройки LXQt diff --git a/src/translations/lxqt-config_sk.desktop b/src/translations/lxqt-config_sk.desktop deleted file mode 100644 index f214d5b..0000000 --- a/src/translations/lxqt-config_sk.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sk]=Centrum nastavení prostredia LXQt -GenericName[sk]=Centrum nastavení -Name[sk]=Centrum nastavení diff --git a/src/translations/lxqt-config_sl.desktop b/src/translations/lxqt-config_sl.desktop deleted file mode 100644 index a13d84f..0000000 --- a/src/translations/lxqt-config_sl.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sl]=Nastavitveni moduli za LXQt -GenericName[sl]=Nastavitve -Name[sl]=Nastavitveno središče za LXQt diff --git a/src/translations/lxqt-config_sr.desktop b/src/translations/lxqt-config_sr.desktop deleted file mode 100644 index 72d992b..0000000 --- a/src/translations/lxqt-config_sr.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sr]=Подесите Рејзорове модуле -GenericName[sr]=Подешавање Рејзора -Name[sr]=Центар за подешавање diff --git a/src/translations/lxqt-config_sr@ijekavian.desktop b/src/translations/lxqt-config_sr@ijekavian.desktop deleted file mode 100644 index bf36e19..0000000 --- a/src/translations/lxqt-config_sr@ijekavian.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[sr@ijekavian]=Центар за подешавање -Comment[sr@ijekavian]=Подесите Рејзорове модуле -GenericName[sr@ijekavian]=Подешавање Рејзора diff --git a/src/translations/lxqt-config_sr@ijekavianlatin.desktop b/src/translations/lxqt-config_sr@ijekavianlatin.desktop deleted file mode 100644 index 84a9f35..0000000 --- a/src/translations/lxqt-config_sr@ijekavianlatin.desktop +++ /dev/null @@ -1,3 +0,0 @@ -Name[sr@ijekavianlatin]=Centar za podešavanje -Comment[sr@ijekavianlatin]=Podesite Rejzorove module -GenericName[sr@ijekavianlatin]=Podešavanje Rejzora diff --git a/src/translations/lxqt-config_sr@latin.desktop b/src/translations/lxqt-config_sr@latin.desktop deleted file mode 100644 index 2b58f2e..0000000 --- a/src/translations/lxqt-config_sr@latin.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[sr@latin]=Podesite Rejzorove module -GenericName[sr@latin]=Podešavanje Rejzora -Name[sr@latin]=Centar za podešavanje diff --git a/src/translations/lxqt-config_th_TH.desktop b/src/translations/lxqt-config_th_TH.desktop deleted file mode 100644 index cbade56..0000000 --- a/src/translations/lxqt-config_th_TH.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[th_TH]=ปรับแต่งมอดูล LXQt -GenericName[th_TH]=ปรับแต่ง LXQt -Name[th_TH]=ศูนย์การปรับแต่ง LXQt diff --git a/src/translations/lxqt-config_tr.desktop b/src/translations/lxqt-config_tr.desktop deleted file mode 100644 index d388eb3..0000000 --- a/src/translations/lxqt-config_tr.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[tr]=LXQt modüllerini yapılandır -GenericName[tr]=LXQt Yapılandırması -Name[tr]=LXQt Yapılandırma Merkezi diff --git a/src/translations/lxqt-config_uk.desktop b/src/translations/lxqt-config_uk.desktop deleted file mode 100644 index 3cf998b..0000000 --- a/src/translations/lxqt-config_uk.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[uk]=Налаштувати модулі LXQt -GenericName[uk]=Налаштування LXQt -Name[uk]=Центр налаштувань LXQt diff --git a/src/translations/lxqt-config_zh_CN.desktop b/src/translations/lxqt-config_zh_CN.desktop deleted file mode 100644 index 9588629..0000000 --- a/src/translations/lxqt-config_zh_CN.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[zh_CN]=配置 LXQt 模块 -GenericName[zh_CN]=LXQt 配置 -Name[zh_CN]=LXQt 配置中心 diff --git a/src/translations/lxqt-config_zh_TW.desktop b/src/translations/lxqt-config_zh_TW.desktop deleted file mode 100644 index bb7780a..0000000 --- a/src/translations/lxqt-config_zh_TW.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[zh_TW]=設定LXQt模組 -GenericName[zh_TW]=LXQt設定 -Name[zh_TW]=LXQt設定中心