diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index abb6e1f..0000000 --- a/AUTHORS +++ /dev/null @@ -1,10 +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: LGPL-2.1+ -The full text of the licenses can be found in the 'COPYING' file. diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 4f61ab7..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,258 +0,0 @@ - -lxqt-runner-0.12.0 / 2017-10-21 -=============================== - - * Set patch version - * Don't export github templates - * Update CMakeLists.txt - * Fixed typo in Lithuanian - * Drops Qt5Core_VERSION_STRING - * set Qt::AA_UseHighDpiPixmaps to true - * Fix pedantic warning - * ui: Add option to show particular count of items - * runner: Make usage of history configurable - * commanditemmodel: Remove unused methods - * Added QCommandLineParser and basic cli interface to lxqt-runner - * Added LXQT_RUNNER_PATCH_VERSION - * Fixes a FTBFS in superbuild mode - * Added merged autostart to CMakeLists.txt - * Updated *_da.desktop files and removed *_da_DK.desktop files - * Update desktop entries and Replace fr_FR by fr - * Update Greek translation (el) Remove country variant from language code - * CMake: Adds Runtime and Devel install COMPONENTs - * Coding style changes - * Updates the build system to use the Targets infrastructure - * Drops hardcoded /etc/xdg paths - * Updated german translation, replaced Qt4 by Qt in all xsession/translations - * Updates translations infrastructure - * Update the required minimum cmake version - * remove dead template lines switch OnlyShowIn from Razor -> LXQt stringchanges LxQt -> LXQt - * Support lxqt-session and add necessary xdg autostart desktop entry files. - * Bump year - -0.11.1 / 2017-01-01 -=================== - - * Release 0.11.1: Update changelog - * MathItem: Honor system locale (#52) - * Use the new MenuCache configuration CMake module - * Fixes FTBFS when libmenu-cache was installed to non-standard location - * Remove cpack (#49) - * - Fix endif placement when test for MATH library. - -0.11.0 / 2016-09-24 -=================== - - * Release 0.11.0: Add changelog - * Add README.md - * Math: Enhance evaluation logic - * Math: Use libmuparser for math evaluation - * runner: Follow virtual desktop switching - * Properly hide the runner when it loses focus - * runner: Sort history items by relevance - * build: Use external translations (#41) - * ts-files removal (#40) - * Use QString() instead of "" - * Fix layout and focus to get history items right - * Bump year - * main: Add activation by running second instance - * Italian translation update - * dialog: Default icons - * dialog: Fill background - * upd: lxqt-runner_hu.ts - * Update lxqt-runner_it.ts - -0.10.0 / 2015-10-31 -=================== - - * Fix license file - * Update translations - * providers: don't show custom command/binary in case existing application (.desktop) is shown - * providers: internal functions as static & which moved to the beginning for using it below - * Updated german translation, made common for all regions. - * Removed country variant _IT - * Rename LxQt to LXQt everywhere - * Remove country variant from language code - * some license fixes - * Handles CMake policy CMP0063 - * lxqt-runner: search case insensitive in items for each provider - * lxqt-runner: correct space(s) according to conding standard - * Use the LXQtCompilerSettings CMake module - * Removes no added value, noisy debug message - * Fixes Action button missing (menu) icon - * Adds Runtime install COMPONENT - * Coding style changes and cleanups - * Use GNUInstallDirs - * Removes unneeded include_directories() entries. - * Reworks WITHOUT_MENU_CACHE option. Renames to USE_MENU_CACHE - * Reworks RUNNER_MATH option - * Reworks Virtual Box options and associated stuff - * Use CMAKE_AUTOUIC, drop qt5_wrap_ui() - * Update the build system to use the Targets infrastructure - * Remove trailing whitespaces - * Fix naming and links - * Hide on shortcut trigger if it's active - * Avoid hiding the dialog on opening the menu - * Remove the provider for power actions - * fallback for executing scripts w/o #! - * rempove KF5/ prefix from include as done in lxde/liblxqt/pull/36 - -0.9.0 / 2015-01-29 -================== - - * Sets the command list to use alternating row colors - * Portuguese update - * - Unify naming for a unique lxqt. No more suffixes - * Drop XdgDesktopFileCache::getFile() - * Add tab-completion - * uniform coding style - * Hide on loosing focus - * Update lxqt-runner_pl_PL.ts - * Fixes lxde/lxqt#347. HtmlDelegate on runner's list. - * Makes the UPDATE_TRANSLATIONS option actually work. - * Cleans up CMakeLists.txt a little bit - * Uses the new liblxqt modules to handle translations - * Moves lxqt_runner_sr_BA.ts to the translations dir. - * Adds an UPDATE_TRANSLATIONS option - * Use the LXQtranslate module to handle translations - * Update Russian translation - * Fixes dialog type, alt+tab won't focus it - * Fix QDesktopWidget::availableGeometry() vs KWindowSystem::workArea() bug - * CMakeLists cleanups - * Fixes lxde/lxde-qt#311, FTBFS - * Port lxqt-runner to KWindowSystem. Purge Qt 4. - * Add Ctrl-p and Ctrl-n movement shortcuts. - * Trim input text. Fixes lxde/lxde-qt#139 - -0.8.0 / 2014-10-08 -================== - - * Adapt to the translation infrastructure - * Use QWindow::windowHandle()->winId() to replace QWidget::winId() due to a bug of Qt5. - * Initial Qt5 support. - * Use new LXQt header files. - * Assorted string polishing - * cmake option to build without menu-cache even if it is installed - * Update dialog.cpp - -0.7.0 / 2014-05-07 -================== - - * Update COPYING - -0.6.99 / 2014-05-01 -=================== - - * Update man page - * Update AUTHORS - * LxQt Power Management -> Power Management - * Add CPack rules for creating tarball - * Update the app icons properly after the xdg menu is reloaded. - * Proper encoding of command arguments - * Removed CMAKE_SOURCE_DIR usage from CMakeLists.txt - * Fix renaming bugs, replacing lxqt-qt with lxde-qt - * Finish the crazy razor=>lxqt renaming tasks. - * Convert utf8 strings to utf16 properly while using libmenu-cache. - * Optionally support libmenu-cache so we can load installed appS from a cache quickly. - * Rename razor to lxqt in some strings. - * Make use of the latest liblxqt & liblxqt-globalkeys. * Rename to lxqt-runnder. - * Add COPYING and AUTHORS - * compile fix: do not include private qt header files - * razor-runner scripting - * X-RAZOR changed to Razor in desktop files - * Experimental submenu added to shortcut selector button - * Global shortcuts client library added and all support for it refactored and fixed. - * fix "shorcut" typo - * ignored duplicate entries in the HistoryProvider - * Some debug prints removed. Timeout for Systray to load increased to 1 minute. Module crash detection improved. - * preliminary manpages primary for razorqt and usefully in venenux - * Translations updated - * first part of fixes based on Coverity Scan (code static analysis) - * Delete bad en_GB translations - * Update translations - * runner: Always select the command first and don't match directories - * Translations updated - * Removed line num from TS files. - * Translations - * Updated .ts.src files - * Extra explaination on compile flags - * indent fixes - * Optional runtime VBoxHeadless support - * Fix for Issue #290 Fails to build on BSD - * Removed translate.sh from razor-runner - * New translation infrastructure - * Ts.src files updated. - * Language name zh_CN.GB2312 braked cmake process. - * Translations updated - * typo fixes - * Razor-runner: history provider didn't expand env variables. - * Fixed a history in the razor-runner. - * lock screen for runner too - * fixed #267 Add logout/lock screen actions to razor runner - * Move configure button to the left of close - * implemented #267 Add logout/lock screen actions to razor runner - * Don't display any VM on empty regex ; adding author header for previously added vbox provider - * GUI for change razor theme. - * fixed #63 Razor launcher should access history on arrow up/down - * Improvements in the razor-runner Added a customommand provider. - * Set window titles for use with WM's like fvwm - * Typos in code. Thanks Aaron Lewis. * In razor-runner , providers item: title() was typed as tile() * For RazorSettings class , settingsChanged() was typed as settigsChanged() - * Garbage in the code. - * Preloading menu in the razor-runner. - * Fix QRC_FILE definition - * Fix the header path - * Implemention of Virtualbox Runner - * Implemention of VirtualBox runner - * Transifex desktop: sr_BA.ts should be a local - * Transifex desktop: local translations - * Transifex desktop: Translations pulled - * Update Tradidtional Chinese Translations - * RazorApplication class implemented; all modules ported to this class - * Translations update - * Added support for the online translation service. www.transifex.net - * Serbian translation files - * Greek translation by iosifidis - * Razor-runner not activated in kwin. - * Razor-runner not activated in kwin. - * Added danish translations - * Russian translation - * fix #169: italian translation - * Relicense panel & runner - * Set icon theme before instantiating CommandItemModel - * Fix gmail.ru -> gmail.com - * Keep all parts of the theme in one place. Fix in the cmake. - * Keep all parts of the theme in one place - * SVK translation finalized - * Close Issue #120 - * License audit - * Add Chinese(simplified) translation files. - * Add Slovak (sk) translation - * Czech translations (cs_CZ) - * huge refactoring of the libraries build organization - * Closes #64 Razor launcher should focus on alt+f2 - * RazorRunner: IconThemeChanged handler for razor-runner. - * Fix: Wrong actualSize for icons from /usr/pixmaps. - * GPL->LGPL where I'm the author - * Translation for standard buttons in the razor-runner - * Reducing lib dependency in cmake files. - * Fix: Desktop Menu Specification category must be X-RAZOR. - * Polish translation. Closes #46 - * potential fix (workaround) from #40: XdgMenu does not display environment related items - * homepage updated + auto replacement script - * Micro fix in razorqt-runner - * XDG-files are splitted into qtxdg library. - * History mode in razor-runner. - * Fixed #23: Sorting razor-runner command list. - * Translation - * Mathematics support in razor-runner. - * Razor-runner refactoring - Providers classes. - * Small sorted fix. - * Fixed selection color in listview. - * Polish translation - * fix for build (includes) - * Closes #22 - * Closes #21 - * Disabled tests the global shortcut registration result. - * "math mode" for razor-runner (expression ends with '=') - * check for global shortcut duplicity (open cfg if it's in conflict) - * Razor-runner program diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 4b9f35c..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,158 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) - -project(lxqt-runner) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) - -set(REQUIRED_MENUCACHE_VERSION "0.3.3") - -include(CMakeDependentOption) -include(GNUInstallDirs) - -option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) -option(USE_MENU_CACHE "Use libmenu-cache from LXDE to generate the app menu" ON) -option(RUNNER_MATH "Math operations support" ON) -option(RUNNER_VBOX "Virtual Box support" ON) -cmake_dependent_option(RUNNER_VBOX_HEADLESS - "Use headless mode instead of default window" OFF - "RUNNER_VBOX" OFF -) - -find_package(KF5WindowSystem REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5Xml REQUIRED) -find_package(Qt5LinguistTools REQUIRED) -find_package(lxqt REQUIRED) -find_package(lxqt-globalkeys REQUIRED) -find_package(lxqt-globalkeys-ui REQUIRED) -message(STATUS "Building with Qt${Qt5Core_VERSION}") - -include(LXQtCompilerSettings NO_POLICY_SCOPE) - -# Patch Version -set(LXQT_RUNNER_PATCH_VERSION 0) -set(LXQT_RUNNER_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_RUNNER_PATCH_VERSION}) -add_definitions("-DLXQT_RUNNER_VERSION=\"${LXQT_RUNNER_VERSION}\"") - -set(QTX_LIBRARIES Qt5::Widgets Qt5::Xml) - -if (USE_MENU_CACHE OR RUNNER_MATH) - find_package(PkgConfig REQUIRED) -endif () - -if (USE_MENU_CACHE) - # optionally use libmenu-cache from lxde to generate the application menu - find_package(MenuCache "${REQUIRED_MENUCACHE_VERSION}" REQUIRED) -endif() - -if (RUNNER_MATH) - pkg_check_modules(MUPARSER REQUIRED muparser) -endif () - -set(lxqt-runner_H_FILES - dialog.h - commanditemmodel.h - widgets.h - providers.h - yamlparser.h - configuredialog/configuredialog.h -) - -set(lxqt-runner_CPP_FILES - main.cpp - dialog.cpp - commanditemmodel.cpp - widgets.cpp - providers.cpp - yamlparser.cpp - configuredialog/configuredialog.cpp -) - -set(lxqt-runner_UI_FILES - dialog.ui - configuredialog/configuredialog.ui -) - -set(QRC_FILES - -) - -set(lxqt-runner_LIBRARIES - lxqt - lxqt-globalkeys - lxqt-globalkeys-ui - ${MENUCACHE_LIBRARIES} - ${QTX_LIBRARIES} - ${MUPARSER_LDFLAGS} -) - -include(LXQtTranslate) - -lxqt_translate_ts(lxqt-runner_QM_FILES - UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS} - SOURCES - ${lxqt-runner_H_FILES} - ${lxqt-runner_CPP_FILES} - ${lxqt-runner_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} -) - -lxqt_app_translation_loader(lxqt-runner_QM_LOADER ${PROJECT_NAME}) - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -if (RUNNER_VBOX) - list(APPEND QRC_FILES virtualbox-icons.qrc) -endif() - -add_executable(${PROJECT_NAME} - ${lxqt-runner_CPP_FILES} - ${lxqt-runner_QRC_SOURCES} - ${lxqt-runner_QM_FILES} - ${lxqt-runner_QM_LOADER} -) - -if (RUNNER_MATH) - lxqt_enable_target_exceptions("${PROJECT_NAME}" PRIVATE) -endif () - -target_include_directories(${PROJECT_NAME} - PRIVATE "$<$:${MENUCACHE_INCLUDE_DIRS}>" - PRIVATE "$<$:${MUPARSER_INCLUDE_DIRS}>" -) - -target_compile_definitions(${PROJECT_NAME} - PRIVATE "$<$:MATH_ENABLED>" - PRIVATE "$<$:VBOX_ENABLED>" - PRIVATE "$<$:VBOX_HEADLESS_ENABLED>" - PRIVATE "$<$:HAVE_MENU_CACHE=1>" -) - -target_link_libraries(${PROJECT_NAME} - ${lxqt-runner_LIBRARIES} - KF5::WindowSystem -) - -install(TARGETS - ${PROJECT_NAME} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT Runtime -) - -# merged from lxqt-common -add_subdirectory(autostart) 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 4a45359..0000000 --- a/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# lxqt-runner - -## Overview - -lxqt-runner provides a GUI that comes up on the desktop and allows for launching applications or shutting down the system. - -![lxqt-runner](lxqt-runner.png) - -Technically it consists of a single binary `lxqt-runner`. The binary is run in a daemon-like manner as so-called LXQt Module and brings up the GUI when a configured keyboard shortcut is hit. - -## Installation - -### Compiling source code - -Runtime dependencies are muparser, KWindowSystem, menu-cache and [lxqt-globalkeys](https://github.com/lxde/lxqt-globalkeys). -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. - -To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual. - -### Binary packages - -Official binary packages are 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-runner`. - -## Configuration, Usage - -Launching binary `lxqt-runner` as LXQt Module can be adjusted from section "Basic Settings" in configuration dialogue "LXQt Session Settings" (binary `lxqt-config-session`) of [lxqt-session](https://github.com/lxde/lxqt-session). - -The keyboard shortcut to launch the GUI can be configured in "Global Actions Manager" (binary `lxqt-config-globalkeyshortcuts`) of [lxqt-globalkeys](https://github.com/lxde/lxqt-globalkeys). - -The GUI comes with a configuration dialogue to customize settings like the position where it's displayed. It's accessible from a menu that's in turn opened by an icon left of the one to close the GUI, "arrow down" in screenshot above. - -To launch an application corresponding strings need to be filed in the form, next a selection can be made from a list presenting matches. Items to shut down or restart the system and so on are provided by the menu featuring the configuration dialogue as well. diff --git a/autostart/CMakeLists.txt b/autostart/CMakeLists.txt deleted file mode 100644 index e4342a5..0000000 --- a/autostart/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) - -file(GLOB DESKTOP_FILES_IN *.desktop.in) - -# Translations ********************************** -lxqt_translate_desktop(DESKTOP_FILES - SOURCES - ${DESKTOP_FILES_IN} -) -add_custom_target(lxq_runner_autostart_desktop_files ALL DEPENDS ${DESKTOP_FILES}) -#************************************************ - -install(FILES - ${DESKTOP_FILES} - DESTINATION "${LXQT_ETC_XDG_DIR}/autostart" - COMPONENT Runtime -) diff --git a/autostart/lxqt-runner.desktop.in b/autostart/lxqt-runner.desktop.in deleted file mode 100644 index 8ebdeac..0000000 --- a/autostart/lxqt-runner.desktop.in +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Runner -TryExec=lxqt-runner -Exec=lxqt-runner -OnlyShowIn=LXQt; -X-LXQt-Module=true - -#TRANSLATIONS_DIR=translations diff --git a/autostart/translations/lxqt-runner_ar.desktop b/autostart/translations/lxqt-runner_ar.desktop deleted file mode 100644 index f3490f3..0000000 --- a/autostart/translations/lxqt-runner_ar.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ar]=المُطْلِق diff --git a/autostart/translations/lxqt-runner_cs.desktop b/autostart/translations/lxqt-runner_cs.desktop deleted file mode 100644 index 1ebf804..0000000 --- a/autostart/translations/lxqt-runner_cs.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[cs]=Spouštěč diff --git a/autostart/translations/lxqt-runner_cs_CZ.desktop b/autostart/translations/lxqt-runner_cs_CZ.desktop deleted file mode 100644 index 75aa5ba..0000000 --- a/autostart/translations/lxqt-runner_cs_CZ.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[cs_CZ]=Spouštěč diff --git a/autostart/translations/lxqt-runner_da.desktop b/autostart/translations/lxqt-runner_da.desktop deleted file mode 100644 index ac372b8..0000000 --- a/autostart/translations/lxqt-runner_da.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[da]=Programstarter diff --git a/autostart/translations/lxqt-runner_de.desktop b/autostart/translations/lxqt-runner_de.desktop deleted file mode 100644 index 4f1495a..0000000 --- a/autostart/translations/lxqt-runner_de.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[de]=Anwendungsstarter diff --git a/autostart/translations/lxqt-runner_el.desktop b/autostart/translations/lxqt-runner_el.desktop deleted file mode 100644 index 5896bfc..0000000 --- a/autostart/translations/lxqt-runner_el.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[el]=Εκτελεστής diff --git a/autostart/translations/lxqt-runner_eo.desktop b/autostart/translations/lxqt-runner_eo.desktop deleted file mode 100644 index 0e6f690..0000000 --- a/autostart/translations/lxqt-runner_eo.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[eo]=Rulilo diff --git a/autostart/translations/lxqt-runner_es.desktop b/autostart/translations/lxqt-runner_es.desktop deleted file mode 100644 index ed83679..0000000 --- a/autostart/translations/lxqt-runner_es.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[es]=Lanzador diff --git a/autostart/translations/lxqt-runner_es_VE.desktop b/autostart/translations/lxqt-runner_es_VE.desktop deleted file mode 100644 index 51cab8b..0000000 --- a/autostart/translations/lxqt-runner_es_VE.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[es_VE]=Ejecutor diff --git a/autostart/translations/lxqt-runner_eu.desktop b/autostart/translations/lxqt-runner_eu.desktop deleted file mode 100644 index 9b18b34..0000000 --- a/autostart/translations/lxqt-runner_eu.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[eu]=Abiarazlea diff --git a/autostart/translations/lxqt-runner_fi.desktop b/autostart/translations/lxqt-runner_fi.desktop deleted file mode 100644 index 0f8e2e5..0000000 --- a/autostart/translations/lxqt-runner_fi.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[fi]=Käynnistin diff --git a/autostart/translations/lxqt-runner_fr.desktop b/autostart/translations/lxqt-runner_fr.desktop deleted file mode 100644 index 3a5d444..0000000 --- a/autostart/translations/lxqt-runner_fr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[fr]=Lanceur diff --git a/autostart/translations/lxqt-runner_hu.desktop b/autostart/translations/lxqt-runner_hu.desktop deleted file mode 100644 index 255a84c..0000000 --- a/autostart/translations/lxqt-runner_hu.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[hu]=Indító diff --git a/autostart/translations/lxqt-runner_it_IT.desktop b/autostart/translations/lxqt-runner_it_IT.desktop deleted file mode 100644 index e2a30c4..0000000 --- a/autostart/translations/lxqt-runner_it_IT.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[it_IT]=Runner diff --git a/autostart/translations/lxqt-runner_ja.desktop b/autostart/translations/lxqt-runner_ja.desktop deleted file mode 100644 index 2b04377..0000000 --- a/autostart/translations/lxqt-runner_ja.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ja]=ランナー diff --git a/autostart/translations/lxqt-runner_lt.desktop b/autostart/translations/lxqt-runner_lt.desktop deleted file mode 100644 index 22f5b68..0000000 --- a/autostart/translations/lxqt-runner_lt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[lt]=Paleidiklis diff --git a/autostart/translations/lxqt-runner_nl.desktop b/autostart/translations/lxqt-runner_nl.desktop deleted file mode 100644 index b8ae90e..0000000 --- a/autostart/translations/lxqt-runner_nl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[nl]=Starter diff --git a/autostart/translations/lxqt-runner_pl_PL.desktop b/autostart/translations/lxqt-runner_pl_PL.desktop deleted file mode 100644 index 3a7cd3c..0000000 --- a/autostart/translations/lxqt-runner_pl_PL.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[pl_PL]=Runner diff --git a/autostart/translations/lxqt-runner_pt.desktop b/autostart/translations/lxqt-runner_pt.desktop deleted file mode 100644 index 191a23a..0000000 --- a/autostart/translations/lxqt-runner_pt.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[pt]=Runner diff --git a/autostart/translations/lxqt-runner_pt_BR.desktop b/autostart/translations/lxqt-runner_pt_BR.desktop deleted file mode 100644 index 2b49692..0000000 --- a/autostart/translations/lxqt-runner_pt_BR.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[pt_BR]=Executor diff --git a/autostart/translations/lxqt-runner_ru.desktop b/autostart/translations/lxqt-runner_ru.desktop deleted file mode 100644 index f01ca0d..0000000 --- a/autostart/translations/lxqt-runner_ru.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ru]=бегунок diff --git a/autostart/translations/lxqt-runner_ru_RU.desktop b/autostart/translations/lxqt-runner_ru_RU.desktop deleted file mode 100644 index 0ef1ad2..0000000 --- a/autostart/translations/lxqt-runner_ru_RU.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[ru_RU]=Запускалка программ diff --git a/autostart/translations/lxqt-runner_sl.desktop b/autostart/translations/lxqt-runner_sl.desktop deleted file mode 100644 index 7c70e8f..0000000 --- a/autostart/translations/lxqt-runner_sl.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[sl]=Zaganjalnik diff --git a/autostart/translations/lxqt-runner_th_TH.desktop b/autostart/translations/lxqt-runner_th_TH.desktop deleted file mode 100644 index 8bc2812..0000000 --- a/autostart/translations/lxqt-runner_th_TH.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[th_TH]=กล่องป้อนคำสั่ง diff --git a/autostart/translations/lxqt-runner_tr.desktop b/autostart/translations/lxqt-runner_tr.desktop deleted file mode 100644 index 6cfa1b1..0000000 --- a/autostart/translations/lxqt-runner_tr.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[tr]=Çalıştırıcı diff --git a/autostart/translations/lxqt-runner_uk.desktop b/autostart/translations/lxqt-runner_uk.desktop deleted file mode 100644 index 284188f..0000000 --- a/autostart/translations/lxqt-runner_uk.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[uk]=Запускач diff --git a/autostart/translations/lxqt-runner_zh_CN.desktop b/autostart/translations/lxqt-runner_zh_CN.desktop deleted file mode 100644 index 91c03de..0000000 --- a/autostart/translations/lxqt-runner_zh_CN.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[zh_CN]=启动器 diff --git a/autostart/translations/lxqt-runner_zh_TW.desktop b/autostart/translations/lxqt-runner_zh_TW.desktop deleted file mode 100644 index 39c2990..0000000 --- a/autostart/translations/lxqt-runner_zh_TW.desktop +++ /dev/null @@ -1,2 +0,0 @@ -# Translations -Name[zh_TW]=快速執行 diff --git a/commanditemmodel.cpp b/commanditemmodel.cpp deleted file mode 100644 index 01b81a3..0000000 --- a/commanditemmodel.cpp +++ /dev/null @@ -1,463 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 */ - -#include "commanditemmodel.h" -#include -#include -#include -#include -#include -#include - - -/************************************************ - - ************************************************/ -CommandItemModel::CommandItemModel(bool useHistory, QObject *parent) : - QSortFilterProxyModel(parent), - mSourceModel(new CommandSourceItemModel(useHistory, this)), - mOnlyHistory(false), - mShowHistoryFirst(true) -{ - setFilterCaseSensitivity(Qt::CaseInsensitive); - setSortCaseSensitivity(Qt::CaseInsensitive); - setSourceModel(mSourceModel); - sort(0); -} - - -/************************************************ - - ************************************************/ -CommandItemModel::~CommandItemModel() -{ -} - - -/************************************************ - - ************************************************/ -bool CommandItemModel::isOutDated() const -{ - return mSourceModel->isOutDated(); -} - - -/************************************************ - - ************************************************/ -const CommandProviderItem *CommandItemModel::command(const QModelIndex &index) const -{ - if (!index.isValid()) - return 0; - - QModelIndex ind = mapToSource(index); - - return mSourceModel->command(ind); -} - - -/************************************************ - - ************************************************/ -void CommandItemModel::clearHistory() -{ - mSourceModel->clearHistory(); -} - - -/************************************************ - - ************************************************/ -bool CommandItemModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - QRegExp re(filterRegExp()); - - if (re.isEmpty() && !mOnlyHistory) - return false; - - const CommandProviderItem *item = mSourceModel->command(sourceRow); - - if (!item) - return false; - - bool accept = item->compare(re); - if (accept) - { - //check if CustomCommand can be filtered out (equivalent app link is shown) - const CustomCommandItem * cust_i = qobject_cast(item); - if (nullptr != cust_i) - { - for (int i = mSourceModel->rowCount(sourceParent); 0 <= i; --i) - { - const AppLinkItem * app_i = qobject_cast(mSourceModel->command(i)); - if (nullptr != app_i && cust_i->exec() == app_i->exec() && app_i->compare(re)) - return false; - } - } - } - - return accept; -} - - -/************************************************ - - ************************************************/ -bool CommandItemModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - if (left == mSourceModel->customCommandIndex()) - return true; - - if (right == mSourceModel->customCommandIndex()) - return false; - - if (mOnlyHistory) - return left.row() < right.row(); - - HistoryItem const * i_left = dynamic_cast(mSourceModel->command(left)); - HistoryItem const * i_right = dynamic_cast(mSourceModel->command(right)); - if (nullptr != i_left && nullptr == i_right) - return mShowHistoryFirst; - if (nullptr == i_left && nullptr != i_right) - return !mShowHistoryFirst; - if (nullptr != i_left && nullptr != i_right) - { - QRegExp re(filterRegExp()); - //Note: -1 should not be returned if the item passed the filter previously - const int pos_left = re.indexIn(i_left->command()); - const int pos_right = re.indexIn(i_right->command()); - Q_ASSERT(-1 != pos_left && -1 != pos_right); - return pos_left < pos_right - || (pos_left == pos_right && QSortFilterProxyModel::lessThan(left, right)); - } - - return QSortFilterProxyModel::lessThan(left, right); -} - - -/************************************************ - - ************************************************/ -int CommandItemModel::itemType(const QModelIndex &index) const -{ - if (index.row() == mSourceModel->customCommandIndex().row()) - return 1; - else if (index.row() < mSourceModel->externalProviderStartIndex().row()) - return 2; - else - return 3; -} - - -/************************************************ - - ************************************************/ -QModelIndex CommandItemModel::appropriateItem(const QString &pattern) const -{ - QModelIndex res; - unsigned int rank = 0; - - int cnt = rowCount(); - - for (int i=0; icustomCommandIndex()) - return ind; - - const CommandProviderItem *item = mSourceModel->command(srcIndex); - if (!item) - continue; - - unsigned int r = item->rank(pattern); - if (r > rank) - { - res = ind; - rank = r; - } - - if (rank >= MAX_RANK) - break; - } - - if (!res.isValid()) - res = index(0, 0); - - return res; -} - - -/************************************************ - - ************************************************/ -void CommandItemModel::showHistoryFirst(bool first/* = true*/) -{ - mShowHistoryFirst = first; - invalidate(); -} - -/************************************************ - - ************************************************/ -void CommandItemModel::rebuild() -{ - mSourceModel->rebuild(); -} - - -/************************************************ - - ************************************************/ -CommandSourceItemModel::CommandSourceItemModel(bool useHistory, QObject *parent) : - QAbstractListModel(parent), - mHistoryProvider(nullptr) -{ - mCustomCommandProvider = new CustomCommandProvider; - mProviders.append(mCustomCommandProvider); - rebuild(); - mCustomCommandIndex = index(0, 0); - - if (useHistory) - { - mHistoryProvider = new HistoryProvider(); - mProviders.append(mHistoryProvider); - mCustomCommandProvider->setHistoryProvider(mHistoryProvider); - } - - mProviders.append(new AppLinkProvider()); -#ifdef MATH_ENABLED - mProviders.append(new MathProvider()); -#endif -#ifdef VBOX_ENABLED - mProviders.append(new VirtualBoxProvider()); -#endif - - rebuild(); - mExternalProviderStartIndex = index(rowCount(), 0); - - LXQt::Settings settings("lxqt-runner"); - int numExternalProviders = settings.beginReadArray("external providers"); - for (int i = 0; i < numExternalProviders; i++) - { - settings.setArrayIndex(i); - qDebug() << "Adding external provider:" << settings.value("name") << settings.value("executable"); - ExternalProvider* externalProvider = new ExternalProvider(settings.value("name").toString(), - settings.value("executable").toString()); - mProviders.append(externalProvider); - mExternalProviders.append(externalProvider); - } - settings.endArray(); - - foreach(CommandProvider* provider, mProviders) - { - connect(provider, SIGNAL(changed()), this, SIGNAL(layoutChanged())); - connect(provider, SIGNAL(aboutToBeChanged()), this, SIGNAL(layoutAboutToBeChanged())); - } - - rebuild(); -} - - -/************************************************ - - ************************************************/ -CommandSourceItemModel::~CommandSourceItemModel() -{ - qDeleteAll(mProviders); - mHistoryProvider = 0; -} - - -/************************************************ - - ************************************************/ -int CommandSourceItemModel::rowCount(const QModelIndex& /*parent*/) const -{ - int ret=0; - foreach(CommandProvider* provider, mProviders) - ret += provider->count(); - - return ret; -} - - -/************************************************ - - ************************************************/ -QVariant CommandSourceItemModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - if (index.row() >= rowCount()) - return QVariant(); - - const CommandProviderItem *item = command(index); - if (!item) - return QVariant(); - - switch (role) - { - case Qt::DisplayRole: - return QString("%1
\n%2\n").arg(item->title(), item->comment()); - - case Qt::DecorationRole: - return item->icon(); - - case Qt::ToolTipRole: - return item->toolTip(); - - } - - return QVariant(); -} - - -/************************************************ - - ************************************************/ -bool CommandSourceItemModel::isOutDated() const -{ - QListIterator i(mProviders); - while (i.hasNext()) - { - if (i.next()->isOutDated()) - return true; - } - - return false; -} - - -/************************************************ - - ************************************************/ -void CommandSourceItemModel::rebuild() -{ - emit layoutAboutToBeChanged(); - // FIXME: is this implementation correct? - QListIterator i(mProviders); - while (i.hasNext()) - { - CommandProvider *p = i.next(); - if (p->isOutDated()) - p->rebuild(); - } - emit layoutChanged(); -} - - -/************************************************ - - ************************************************/ -void CommandSourceItemModel::clearHistory() -{ - if (mHistoryProvider) - { - beginResetModel(); - mHistoryProvider->clearHistory(); - endResetModel(); - } else - { - QScopedPointer history_p{new HistoryProvider}; - history_p->clearHistory(); - } -} - - -/************************************************ - - ************************************************/ -const CommandProviderItem *CommandSourceItemModel::command(int row) const -{ - int n = row; - QListIterator i(mProviders); - while (i.hasNext()) - { - CommandProvider *p = i.next(); - if (n < p->count()) - return p->at(n); - else - n -=p->count(); - } - - return 0; -} - - -/************************************************ - - ************************************************/ -const CommandProviderItem *CommandSourceItemModel::command(const QModelIndex &index) const -{ - if (!index.isValid()) - return 0; - - return command(index.row()); -} - - -/*********************************************** - - ***********************************************/ -void CommandSourceItemModel::setCommand(const QString& command) -{ - mCustomCommandProvider->setCommand(command); - foreach (ExternalProvider* externalProvider, mExternalProviders) - { - externalProvider->setSearchTerm(command); - } -} - - -/*********************************************** - - ***********************************************/ -void CommandSourceItemModel::setUseHistory(bool useHistory) -{ - const bool now_using_history = mHistoryProvider != nullptr; - if (now_using_history == useHistory) - return; - beginResetModel(); - if (now_using_history) - { - mProviders.removeAll(mHistoryProvider); - mCustomCommandProvider->setHistoryProvider(nullptr); - delete mHistoryProvider; - mHistoryProvider = nullptr; - } else - { - mHistoryProvider = new HistoryProvider; - mProviders.append(mHistoryProvider); - mCustomCommandProvider->setHistoryProvider(mHistoryProvider); - connect(mHistoryProvider, SIGNAL(changed()), this, SIGNAL(layoutChanged())); - connect(mHistoryProvider, SIGNAL(aboutToBeChanged()), this, SIGNAL(layoutAboutToBeChanged())); - } - endResetModel(); -} diff --git a/commanditemmodel.h b/commanditemmodel.h deleted file mode 100644 index a2c7343..0000000 --- a/commanditemmodel.h +++ /dev/null @@ -1,113 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 COMMANDITEMMODEL_H -#define COMMANDITEMMODEL_H - -#include -#include -#include -#include - - -class CommandSourceItemModel: public QAbstractListModel -{ - Q_OBJECT -public: - explicit CommandSourceItemModel(bool useHistory, QObject *parent = 0); - virtual ~CommandSourceItemModel(); - - int rowCount(const QModelIndex &parent=QModelIndex()) const; - QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; - - bool isOutDated() const; - const CommandProviderItem *command(const QModelIndex &index) const; - const CommandProviderItem *command(int row) const; - - QString command() const { return mCustomCommandProvider->command(); } - void setCommand(const QString &command); - - QPersistentModelIndex customCommandIndex() const { return mCustomCommandIndex; } - QPersistentModelIndex externalProviderStartIndex() const { return mExternalProviderStartIndex; } - - /*! Flag if the history should be shown/stored - */ - void setUseHistory(bool useHistory); -public slots: - void rebuild(); - void clearHistory(); - -private: - QList mProviders; - HistoryProvider *mHistoryProvider; - CustomCommandProvider *mCustomCommandProvider; - QPersistentModelIndex mCustomCommandIndex; - QList mExternalProviders; - QPersistentModelIndex mExternalProviderStartIndex; -}; - - -class CommandItemModel: public QSortFilterProxyModel -{ - Q_OBJECT -public: - explicit CommandItemModel(bool useHistory, QObject *parent = 0); - virtual ~CommandItemModel(); - - bool isOutDated() const; - const CommandProviderItem *command(const QModelIndex &index) const; - - QModelIndex appropriateItem(const QString &pattern) const; - - bool isShowOnlyHistory() const { return mOnlyHistory; } - void showOnlyHistory(bool onlyHistory) { mOnlyHistory = onlyHistory; } - - void showHistoryFirst(bool first = true); - - /*! Flag if the history should be shown/stored - */ - inline void setUseHistory(bool useHistory) { mSourceModel->setUseHistory(useHistory); } - - QString command() const { return mSourceModel->command(); } - void setCommand(const QString &command) { mSourceModel->setCommand(command); } - -public slots: - void rebuild(); - void clearHistory(); - -protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const; - -private: - int itemType(const QModelIndex &index) const; - CommandSourceItemModel *mSourceModel; - bool mOnlyHistory; - bool mShowHistoryFirst; //!< flag for history items to be shown first/last -}; - -#endif // COMMANDITEMMODEL_H diff --git a/configuredialog/configuredialog.cpp b/configuredialog/configuredialog.cpp deleted file mode 100644 index 6d4e6a7..0000000 --- a/configuredialog/configuredialog.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 */ - - -#include "configuredialog.h" -#include "ui_configuredialog.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - - -/************************************************ - - ************************************************/ -ConfigureDialog::ConfigureDialog(QSettings *settings, const QString &defaultShortcut, QWidget *parent) : - QDialog(parent), - ui(new Ui::ConfigureDialog), - mSettings(settings), - mOldSettings(new LXQt::SettingsCache(settings)), - mDefaultShortcut(defaultShortcut) -{ - ui->setupUi(this); - - connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(resetSettings())); - - // Position ................................. - ui->positionCbx->addItem(tr("Top edge of the screen"), QVariant(ConfigureDialog::PositionTop)); - ui->positionCbx->addItem(tr("Center of the screen"), QVariant(ConfigureDialog::PositionCenter)); - connect(ui->positionCbx, SIGNAL(currentIndexChanged(int)), this, SLOT(positionCbxChanged(int))); - - // Monitor .................................. - QDesktopWidget *desktop = qApp->desktop(); - - ui->monitorCbx->addItem(tr("Focused screen"), QVariant(-1)); - - int monCnt = desktop->screenCount(); - for (int i = 0; i < monCnt; ++i) - ui->monitorCbx->addItem(tr("Always on screen %1").arg(i + 1), QVariant(i)); - - ui->monitorCbx->setEnabled(monCnt > 1); - connect(ui->monitorCbx, SIGNAL(currentIndexChanged(int)), this, SLOT(monitorCbxChanged(int))); - - - // Shortcut ................................. - connect(ui->shortcutEd, SIGNAL(shortcutGrabbed(QString)), this, SLOT(shortcutChanged(QString))); - - connect(ui->shortcutEd->addMenuAction(tr("Reset")), SIGNAL(triggered()), this, SLOT(shortcutReset())); - - settingsChanged(); - - connect(ui->historyUseCb, &QAbstractButton::toggled, [this] (bool checked) { mSettings->setValue("dialog/history_use", checked); }); - connect(ui->historyFirstCb, &QAbstractButton::toggled, [this] (bool checked) { mSettings->setValue("dialog/history_first", checked); }); - connect(ui->listShownItemsSB, static_cast(&QSpinBox::valueChanged), [this] (int i) { mSettings->setValue("dialog/list_shown_items", i); }); -} - - -/************************************************ - - ************************************************/ -void ConfigureDialog::settingsChanged() -{ - if (mSettings->value("dialog/show_on_top", true).toBool()) - ui->positionCbx->setCurrentIndex(0); - else - ui->positionCbx->setCurrentIndex(1); - - ui->monitorCbx->setCurrentIndex(mSettings->value("dialog/monitor", -1).toInt() + 1); - ui->shortcutEd->setText(mSettings->value("dialog/shortcut", "Alt+F2").toString()); - const bool history_use = mSettings->value("dialog/history_use", true).toBool(); - ui->historyUseCb->setChecked(history_use); - ui->historyFirstCb->setChecked(mSettings->value("dialog/history_first", true).toBool()); - ui->historyFirstCb->setEnabled(history_use); - ui->listShownItemsSB->setValue(mSettings->value("dialog/list_shown_items", 4).toInt()); -} - - -/************************************************ - - ************************************************/ -ConfigureDialog::~ConfigureDialog() -{ - delete mOldSettings; - delete ui; -} - - -/************************************************ - - ************************************************/ -void ConfigureDialog::shortcutChanged(const QString &text) -{ - ui->shortcutEd->setText(text); - mSettings->setValue("dialog/shortcut", text); -} - - -/************************************************ - - ************************************************/ -void ConfigureDialog::shortcutReset() -{ - shortcutChanged(mDefaultShortcut); -} - - -/************************************************ - - ************************************************/ -void ConfigureDialog::positionCbxChanged(int index) -{ - mSettings->setValue("dialog/show_on_top", index == 0); -} - - -/************************************************ - - ************************************************/ -void ConfigureDialog::monitorCbxChanged(int index) -{ - mSettings->setValue("dialog/monitor", index - 1); -} - - -/************************************************ - - ************************************************/ -void ConfigureDialog::resetSettings() -{ - mOldSettings->loadToSettings(); - ui->shortcutEd->clear(); - settingsChanged(); -} diff --git a/configuredialog/configuredialog.h b/configuredialog/configuredialog.h deleted file mode 100644 index e19a98f..0000000 --- a/configuredialog/configuredialog.h +++ /dev/null @@ -1,76 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 CONFIGUREDIALOG_H -#define CONFIGUREDIALOG_H - -#include - -namespace Ui { - class ConfigureDialog; -} - -class QSettings; - -namespace LXQt { - class SettingsCache; -} - -class ConfigureDialog : public QDialog -{ - Q_OBJECT - -public: - enum Position { - PositionTop, - PositionCenter - }; - - - explicit ConfigureDialog(QSettings *settings, const QString &defaultShortcut, QWidget *parent = 0); - ~ConfigureDialog(); - -protected: - // void closeEvent(QCloseEvent *event); - -private: - Ui::ConfigureDialog *ui; - QSettings *mSettings; - LXQt::SettingsCache *mOldSettings; - QString mDefaultShortcut; - -private slots: - void shortcutChanged(const QString &text); - void shortcutReset(); - void settingsChanged(); - void positionCbxChanged(int index); - void monitorCbxChanged(int index); - void resetSettings(); -}; - -#endif // CONFIGUREDIALOG_H diff --git a/configuredialog/configuredialog.ui b/configuredialog/configuredialog.ui deleted file mode 100644 index 3ca1b59..0000000 --- a/configuredialog/configuredialog.ui +++ /dev/null @@ -1,207 +0,0 @@ - - - ConfigureDialog - - - - 0 - 0 - 312 - 278 - - - - Runner Settings - - - - - - Appearance - - - - - - Positioning: - - - - - - - - - - Show on: - - - - - - - - - - Show history first - - - - - - - Store/show history - - - - - - - <b>Note</b>: The size of top-level widgets are constrained to 2/3 of the desktop's height and width. - - - Show list with: - - - - - - - item(s) - - - 1 - - - - - - - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - Shortcut: - - - - - - - - 81 - 0 - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 38 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close|QDialogButtonBox::Reset - - - - - - - - ShortcutSelector - QToolButton -
LXQtGlobalKeysUi/ShortcutSelector
-
-
- - - - buttonBox - accepted() - ConfigureDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - ConfigureDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - historyUseCb - toggled(bool) - historyFirstCb - setEnabled(bool) - - - 155 - 114 - - - 155 - 143 - - - - -
diff --git a/dialog.cpp b/dialog.cpp deleted file mode 100644 index 76a1d60..0000000 --- a/dialog.cpp +++ /dev/null @@ -1,492 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * 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 "dialog.h" -#include "ui_dialog.h" -#include "widgets.h" -#include "commanditemmodel.h" -#include "configuredialog/configuredialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define DEFAULT_SHORTCUT "Alt+F2" - -/************************************************ - - ************************************************/ -Dialog::Dialog(QWidget *parent) : - QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), - ui(new Ui::Dialog), - mSettings(new LXQt::Settings("lxqt-runner", this)), - mGlobalShortcut(0), - mLockCascadeChanges(false), - mDesktopChanged(false), - mConfigureDialog(0) -{ - ui->setupUi(this); - setWindowTitle("LXQt Runner"); - setAttribute(Qt::WA_TranslucentBackground); - - connect(LXQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update())); - connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); - connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings())); - - ui->commandEd->installEventFilter(this); - - connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); - connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand())); - - mCommandItemModel = new CommandItemModel(mSettings->value("dialog/history_use", true).toBool(), this); - ui->commandList->installEventFilter(this); - ui->commandList->setModel(mCommandItemModel); - ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers); - connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand())); - setFilter(QString()); - dataChanged(); - - ui->commandList->setItemDelegate(new LXQt::HtmlDelegate(QSize(32, 32), ui->commandList)); - - // Popup menu ............................... - QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure"), this); - connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog())); - addAction(a); - - a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear History"), this); - connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory())); - addAction(a); - - mPowerManager = new LXQt::PowerManager(this); - addActions(mPowerManager->availableActions()); - mScreenSaver = new LXQt::ScreenSaver(this); - addActions(mScreenSaver->availableActions()); - - setContextMenuPolicy(Qt::ActionsContextMenu); - - QMenu *menu = new QMenu(this); - menu->addActions(actions()); - ui->actionButton->setMenu(menu); - // End of popup menu ........................ - - applySettings(); - - connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(realign())); - connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(realign())); - connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide())); - connect(mGlobalShortcut, SIGNAL(shortcutChanged(QString,QString)), this, SLOT(shortcutChanged(QString,QString))); - connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(onActiveWindowChanged(WId))); - connect(KWindowSystem::self(), &KWindowSystem::currentDesktopChanged, this, &Dialog::onCurrentDesktopChanged); - - resize(mSettings->value("dialog/width", 400).toInt(), size().height()); - - // TEST - connect(mCommandItemModel, SIGNAL(layoutChanged()), this, SLOT(dataChanged())); -} - - -/************************************************ - - ************************************************/ -Dialog::~Dialog() -{ - delete ui; -} - - -/************************************************ - - ************************************************/ -void Dialog::closeEvent(QCloseEvent *event) -{ - hide(); - event->accept(); -} - - -/************************************************ - - ************************************************/ -QSize Dialog::sizeHint() const -{ - QSize size = QDialog::sizeHint(); - size.setWidth(this->size().width()); - return size; -} - - -/************************************************ - - ************************************************/ -void Dialog::resizeEvent(QResizeEvent *event) -{ - mSettings->setValue("dialog/width", size().width()); -} - - -/************************************************ - - ************************************************/ -bool Dialog::eventFilter(QObject *object, QEvent *event) -{ - if (event->type() == QEvent::KeyPress) - { - QKeyEvent *keyEvent = static_cast(event); - - if (object == ui->commandEd) - return editKeyPressEvent(keyEvent); - - if (object == ui->commandList) - return listKeyPressEvent(keyEvent); - } - - return QDialog::eventFilter(object, event); -} - - -/************************************************ - eventFilter for ui->commandEd - ************************************************/ -bool Dialog::editKeyPressEvent(QKeyEvent *event) -{ - switch (event->key()) - { - case Qt::Key_N: - if (event->modifiers().testFlag(Qt::ControlModifier)) - { - QKeyEvent ev(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier); - editKeyPressEvent(&ev); - return true; - } - return false; - - case Qt::Key_P: - if (event->modifiers().testFlag(Qt::ControlModifier)) - { - QKeyEvent ev(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); - editKeyPressEvent(&ev); - return true; - } - return false; - - case Qt::Key_Up: - case Qt::Key_PageUp: - if (ui->commandEd->text().isEmpty() && - ui->commandList->isVisible() && - ui->commandList->currentIndex().row() == 0 - ) - { - setFilter(QString(), false); - return true; - } - qApp->sendEvent(ui->commandList, event); - return true; - - case Qt::Key_Down: - case Qt::Key_PageDown: - if (ui->commandEd->text().isEmpty() && - ui->commandList->isHidden() - ) - { - setFilter(QString(), true); - - // set focus to the list so that it highlights the first item correctly, - // and then set it back to the textfield, where it belongs - ui->commandList->setFocus(); - ui->commandEd->setFocus(); - return true; - } - qApp->sendEvent(ui->commandList, event); - return true; - - case Qt::Key_Tab: - const CommandProviderItem *command = mCommandItemModel->command(ui->commandList->currentIndex()); - if (command) - ui->commandEd->setText(command->title()); - return true; - } - - return QDialog::eventFilter(ui->commandList, event); -} - - -/************************************************ - eventFilter for ui->commandList - ************************************************/ -bool Dialog::listKeyPressEvent(QKeyEvent *event) -{ - switch (event->key()) - { - case Qt::Key_Up: - case Qt::Key_PageUp: - if (ui->commandList->currentIndex().row() == 0) - { - ui->commandEd->setFocus(); - return true; - } - break; - - case Qt::Key_Left: - case Qt::Key_Right: - ui->commandEd->setFocus(); - qApp->sendEvent(ui->commandEd, event); - return true; - - default: - // Alphabetical or number key ........... - if (!event->text().isEmpty()) - { - ui->commandEd->setFocus(); - qApp->sendEvent(ui->commandEd, event); - return true; - } - } - - return QDialog::eventFilter(ui->commandEd, event); -} - - -/************************************************ - - ************************************************/ -void Dialog::showHide() -{ - // Using KWindowSystem to detect the active window since - // QWidget::isActiveWindow is not working reliably. - if (isVisible() && (KWindowSystem::activeWindow() == winId())) - { - hide(); - } - else - { - realign(); - show(); - KWindowSystem::forceActiveWindow(winId()); - ui->commandEd->setFocus(); - } -} - - -/************************************************ - - ************************************************/ -void Dialog::realign() -{ - QRect desktop; - - int screen = mMonitor; - if (mMonitor < 0 || mMonitor > QApplication::desktop()->screenCount() - 1) - screen = QApplication::desktop()->screenNumber(QCursor::pos()); - - desktop = QApplication::desktop()->availableGeometry(screen).intersected(KWindowSystem::workArea(screen)); - - QRect rect = this->geometry(); - rect.moveCenter(desktop.center()); - - if (mShowOnTop) - rect.moveTop(desktop.top()); - else - rect.moveTop(desktop.center().y() - ui->panel->sizeHint().height()); - - setGeometry(rect); -} - - -/************************************************ - - ************************************************/ -void Dialog::applySettings() -{ - if (mLockCascadeChanges) - return; - - // Shortcut ................................. - QString shortcut = mSettings->value("dialog/shortcut", DEFAULT_SHORTCUT).toString(); - if (shortcut.isEmpty()) - shortcut = DEFAULT_SHORTCUT; - - if (!mGlobalShortcut) - mGlobalShortcut = GlobalKeyShortcut::Client::instance()->addAction(shortcut, "/runner/show_hide_dialog", tr("Show/hide runner dialog"), this); - else if (mGlobalShortcut->shortcut() != shortcut) - mGlobalShortcut->changeShortcut(shortcut); - - mShowOnTop = mSettings->value("dialog/show_on_top", true).toBool(); - - mMonitor = mSettings->value("dialog/monitor", -1).toInt(); - - mCommandItemModel->setUseHistory(mSettings->value("dialog/history_use", true).toBool()); - mCommandItemModel->showHistoryFirst(mSettings->value("dialog/history_first", true).toBool()); - ui->commandList->setShownCount(mSettings->value("dialog/list_shown_items", 4).toInt()); - - realign(); - mSettings->sync(); -} - - -/************************************************ - - ************************************************/ -void Dialog::shortcutChanged(const QString &/*oldShortcut*/, const QString &newShortcut) -{ - if (!newShortcut.isEmpty()) - { - mLockCascadeChanges = true; - - mSettings->setValue("dialog/shortcut", newShortcut); - mSettings->sync(); - - mLockCascadeChanges = false; - } -} - - -/************************************************ - - ************************************************/ -void Dialog::onActiveWindowChanged(WId id) -{ - if (isVisible() && 0 != id && id != winId()) - { - if (mDesktopChanged) - { - mDesktopChanged = false; - KWindowSystem::forceActiveWindow(winId()); - } else - { - hide(); - } - } -} - - -/************************************************ - - ************************************************/ -void Dialog::onCurrentDesktopChanged(int screen) -{ - if (isVisible()) - { - KWindowSystem::setOnDesktop(winId(), screen); - KWindowSystem::forceActiveWindow(winId()); - //Note: workaround for changing desktop while runner is shown - // The KWindowSystem::forceActiveWindow may fail to correctly activate runner if there - // are any other windows on the new desktop (probably because of the sequence while WM - // changes the virtual desktop (change desktop and activate any of the windows on it)) - mDesktopChanged = true; - } -} - - -/************************************************ - - ************************************************/ -void Dialog::setFilter(const QString &text, bool onlyHistory) -{ - if (mCommandItemModel->isOutDated()) - mCommandItemModel->rebuild(); - - QString trimmedText = text.simplified(); - mCommandItemModel->setCommand(trimmedText); - mCommandItemModel->showOnlyHistory(onlyHistory); - mCommandItemModel->setFilterRegExp(trimmedText); - mCommandItemModel->invalidate(); - - // tidy up layout and select first item - ui->commandList->doItemsLayout(); - ui->commandList->setCurrentIndex(mCommandItemModel->index(0, 0)); -} - -/************************************************ - - ************************************************/ -void Dialog::dataChanged() -{ - if (mCommandItemModel->rowCount()) - { - ui->commandList->setCurrentIndex(mCommandItemModel->appropriateItem(mCommandItemModel->command())); - ui->commandList->scrollTo(ui->commandList->currentIndex()); - ui->commandList->show(); - } - else - { - ui->commandList->hide(); - } - - adjustSize(); - -} - - -/************************************************ - - ************************************************/ -void Dialog::runCommand() -{ - bool res =false; - const CommandProviderItem *command = mCommandItemModel->command(ui->commandList->currentIndex()); - - if (command) - res = command->run(); - - if (res) - { - hide(); - ui->commandEd->clear(); - } - -} - - -/************************************************ - - ************************************************/ -void Dialog::showConfigDialog() -{ - if (!mConfigureDialog) - mConfigureDialog = new ConfigureDialog(mSettings, DEFAULT_SHORTCUT, this); - mConfigureDialog->exec(); -} - -#undef DEFAULT_SHORTCUT diff --git a/dialog.h b/dialog.h deleted file mode 100644 index a1c7611..0000000 --- a/dialog.h +++ /dev/null @@ -1,99 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 DIALOG_H -#define DIALOG_H - -#include - -namespace Ui { - class Dialog; -} - -namespace LXQt { - class Settings; - class PowerManager; - class ScreenSaver; -} - -class CommandListView; -class CommandItemModel; -class ConfigureDialog; - -namespace GlobalKeyShortcut -{ -class Action; -} - - -class Dialog : public QDialog -{ - Q_OBJECT - -public: - explicit Dialog(QWidget *parent = 0); - ~Dialog(); - - QSize sizeHint() const; - -protected: - void closeEvent(QCloseEvent *event); - void resizeEvent(QResizeEvent *event); - bool eventFilter(QObject *object, QEvent *event); - bool editKeyPressEvent(QKeyEvent *event); - bool listKeyPressEvent(QKeyEvent *event); - -private: - Ui::Dialog *ui; - LXQt::Settings *mSettings; - GlobalKeyShortcut::Action *mGlobalShortcut; - CommandItemModel *mCommandItemModel; - bool mShowOnTop; - int mMonitor; - LXQt::PowerManager *mPowerManager; - LXQt::ScreenSaver *mScreenSaver; - - bool mLockCascadeChanges; - bool mDesktopChanged; //!< \note flag for changing desktop & activation workaround - - ConfigureDialog *mConfigureDialog; - -private slots: - void realign(); - void applySettings(); - void showHide(); - void setFilter(const QString &text, bool onlyHistory=false); - void dataChanged(); - void runCommand(); - void showConfigDialog(); - void shortcutChanged(const QString &oldShortcut, const QString &newShortcut); - void onActiveWindowChanged(WId id); - void onCurrentDesktopChanged(int desktop); -}; - -#endif // DIALOG_H - diff --git a/dialog.ui b/dialog.ui deleted file mode 100644 index e8eaa17..0000000 --- a/dialog.ui +++ /dev/null @@ -1,187 +0,0 @@ - - - Dialog - - - - 0 - 0 - 342 - 236 - - - - - 0 - 0 - - - - - 300 - 0 - - - - Application launcher - - - false - - - - 0 - - - 0 - - - - - true - - - QFrame::NoFrame - - - QFrame::Raised - - - - -1 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 3 - 0 - - - - - 3 - 16777215 - - - - SizeHorCursor - - - - - - - - - - - - - - - - QToolButton::InstantPopup - - - true - - - Qt::NoArrow - - - - - - - X - - - - - - true - - - - - - - - 0 - 0 - - - - - 3 - 0 - - - - - 3 - 16777215 - - - - SizeHorCursor - - - - - - - - - - - - - - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - - - - - - - HorizSizeGrip - QWidget -
widgets.h
- 1 -
- - MyListView - QListView -
mylistview.h
-
-
- - closeButton - - - -
diff --git a/lxqt-runner.png b/lxqt-runner.png deleted file mode 100644 index 1310158..0000000 Binary files a/lxqt-runner.png and /dev/null differ diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 0325cf0..0000000 --- a/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 */ - - -#include - -#include - -#include "dialog.h" - - -int main(int argc, char *argv[]) -{ - LXQt::SingleApplication a(argc, argv); - a.setQuitOnLastWindowClosed(false); - a.setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - QCommandLineParser parser; - parser.setApplicationDescription(QStringLiteral("LXQt Runner")); - const QString VERINFO = QStringLiteral(LXQT_RUNNER_VERSION - "\nliblxqt " LXQT_VERSION - "\nQt " QT_VERSION_STR); - a.setApplicationVersion(VERINFO); - parser.addVersionOption(); - parser.addHelpOption(); - parser.process(a); - - QWidget hiddenPreviewParent{0, Qt::Tool}; - Dialog d(&hiddenPreviewParent); - a.setActivationWindow(&d); - - return a.exec(); - -} diff --git a/man/lxqt-runner.1 b/man/lxqt-runner.1 deleted file mode 100644 index d5d2481..0000000 --- a/man/lxqt-runner.1 +++ /dev/null @@ -1,49 +0,0 @@ -.TH lxqt-runner "1" "September 2012" "LXQt\ 0.7.0" "LXQt\ Module" -.SH NAME -lxqt-runner \- Application runner module of \fBLXQt\fR, the Lightweight Desktop Environment -.SH SYNOPSIS -.B lxqt-runner -.br -.SH DESCRIPTION -This module will allow you to launch an application by typing Alt+F2 its pressed on the keyboard. -.P -The \fBLXQt modules\fR are desktop independent tools, -and operate as daemons for the local user for desktop specific operations. -.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 \fI(this)\fR - * Settings center - * Session handler - * Polkit handler - * 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. -.SH BEHAVIOR -As you type, suggestions will appear. Once you see the application you wish to run you can navigate -to it using the mouse or arrow keys on your keyboard. Pressing enter or clicking it will launch -the application. The activation key can be changed using the window manager or shortcut daemon -such as \fBlxqt-globalkeyshortcuts\fR. -.SH AUTOSTART -This module only shows at \fBLXQt\fR desktop environment, but you can use in others desktops, by -setting an configuring into session startup. -.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 for manage LXQt complete environment -.P -\fBlxqt-config-session.1\fR LXQt application for config modules on desktop -.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/mylistview.h b/mylistview.h deleted file mode 100644 index 09549ea..0000000 --- a/mylistview.h +++ /dev/null @@ -1,65 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXQt - a lightweight, Qt based, desktop toolset - * http://lxqt.org - * - * Copyright: 2017 LXQt team - * Authors: - * Palo Kisa - * - * 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 */ - -#if !defined(mylistview_h) -#define mylistview_h - -#include -#include - -class MyListView : public QListView -{ -public: - using QListView::QListView; - - inline void setShownCount(int shownCount) - { - mShownCount = shownCount; - } - -protected: - virtual QSize viewportSizeHint() const override - { - QAbstractItemModel * m = model(); - if (m == nullptr) - return QSize{}; - - QSize s{0, 0}; - for (int i = 0, i_e = qMin(mShownCount, model()->rowCount(QModelIndex{})); i != i_e; ++i) - { - const QSize s_i = sizeHintForIndex(m->index(i, 0, QModelIndex{})); - s.rwidth() = qMax(s.width(), s_i.width()); - s.rheight() += s_i.height(); - } - return s; - } - -private: - int mShownCount = 4; -}; - -#endif // mylistview_h diff --git a/providers.cpp b/providers.cpp deleted file mode 100644 index 35cedfc..0000000 --- a/providers.cpp +++ /dev/null @@ -1,999 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2013 Razor team - * Authors: - * Alexander Sokoloff - * Aaron Lewis - * Petr Vanek - * 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 "providers.h" -#include "yamlparser.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "providers.h" -#include -#include -#include - -#define MAX_HISTORY 100 - - -/************************************************ - - ************************************************/ -static QString expandCommand(const QString &command, QStringList *arguments=0) -{ - QString program; - wordexp_t words; - - if (wordexp(command.toLocal8Bit().data(), &words, 0) != 0) - return QString(); - - char **w; - w = words.we_wordv; - program = QString::fromLocal8Bit(w[0]); - - if (arguments) - { - for (size_t i = 1; i < words.we_wordc; i++) - *arguments << QString::fromLocal8Bit(w[i]); - } - - wordfree(&words); - return program; -} - - -/************************************************ - - ************************************************/ -static QString which(const QString &progName) -{ - if (progName.isEmpty()) - return QString(); - - if (progName.startsWith(QDir::separator())) - { - QFileInfo fileInfo(progName); - if (fileInfo.isExecutable() && fileInfo.isFile()) - return fileInfo.absoluteFilePath(); - } - - const QStringList dirs = QString(getenv("PATH")).split(":"); - - foreach (const QString &dir, dirs) - { - QFileInfo fileInfo(QDir(dir), progName); - if (fileInfo.isExecutable() && fileInfo.isFile()) - return fileInfo.absoluteFilePath(); - } - - return QString(); -} - - -/************************************************ - - ************************************************/ -static bool startProcess(QString command) -{ - QStringList args; - QString program = expandCommand(command, &args); - if (program.isEmpty()) - return false; - if (QProcess::startDetached(program, args)) - { - return true; - } else - { - //fallback for executable script with no #! - //trying as in system(2) - args.prepend(program); - args.prepend(QStringLiteral("-c")); - return QProcess::startDetached(QStringLiteral("/bin/sh"), args); - } - -} - - -/************************************************ - - ************************************************/ -unsigned int CommandProviderItem::stringRank(const QString str, const QString pattern) const -{ - int n = str.indexOf(pattern, 0, Qt::CaseInsensitive); - if (n<0) - return 0; - - return MAX_RANK - ((str.length() - pattern.length()) + n * 5); -} - - -/************************************************ - - ************************************************/ -CommandProvider::CommandProvider(): - QObject(), - QList() -{ -} - - -/************************************************ - - ************************************************/ -CommandProvider::~CommandProvider() -{ -// qDebug() << "*****************************************"; -// qDebug() << hex << this; -// qDebug() << "DESTROY"; - qDeleteAll(*this); -// qDebug() << "*****************************************"; -} - - -/************************************************ - - ************************************************/ -AppLinkItem::AppLinkItem(const QDomElement &element): - CommandProviderItem() -{ - mIconName = element.attribute("icon"); - mTitle = element.attribute("title"); - mComment = element.attribute("genericName"); - mToolTip = element.attribute("comment"); - mCommand = element.attribute("exec"); - mProgram = QFileInfo(element.attribute("exec")).baseName().section(" ", 0, 0); - mDesktopFile = element.attribute("desktopFile"); - initExec(); - QMetaObject::invokeMethod(this, "updateIcon", Qt::QueuedConnection); -} - -#ifdef HAVE_MENU_CACHE -AppLinkItem::AppLinkItem(MenuCacheApp* app): - CommandProviderItem() -{ - MenuCacheItem* item = MENU_CACHE_ITEM(app); - mIconName = QString::fromUtf8(menu_cache_item_get_icon(item)); - mTitle = QString::fromUtf8(menu_cache_item_get_name(item)); - mComment = QString::fromUtf8(menu_cache_item_get_comment(item)); - mToolTip = mComment; - mCommand = menu_cache_app_get_exec(app); - mProgram = QFileInfo(mCommand).baseName().section(" ", 0, 0); - char* path = menu_cache_item_get_file_path(MENU_CACHE_ITEM(app)); - mDesktopFile = QString::fromLocal8Bit(path); - g_free(path); - initExec(); - QMetaObject::invokeMethod(this, "updateIcon", Qt::QueuedConnection); - // qDebug() << "FOUND: " << mIconName << ", " << mCommand; -} -#endif - -/************************************************ - - ************************************************/ -void AppLinkItem::updateIcon() -{ -// qDebug() << "*****************************************"; -// qDebug() << hex << this; -// qDebug() << Q_FUNC_INFO; - if (mIcon.isNull()) - mIcon = XdgIcon::fromTheme(mIconName); -// qDebug() << "*****************************************"; -} - - -/************************************************ - - ************************************************/ -void AppLinkItem::operator=(const AppLinkItem &other) -{ - mTitle = other.title(); - mComment = other.comment(); - mToolTip = other.toolTip(); - - mCommand = other.mCommand; - mProgram = other.mProgram; - mDesktopFile = other.mDesktopFile; - mExec = other.mExec; - - mIconName = other.mIconName; - mIcon = other.icon(); -} - - -/************************************************ - - ************************************************/ -unsigned int AppLinkItem::rank(const QString &pattern) const -{ - unsigned int result = qMax(stringRank(mProgram, pattern), - stringRank(mTitle, pattern) - ); - return result; -} - - -/************************************************ - - ************************************************/ -bool AppLinkItem::run() const -{ - XdgDesktopFile desktop; - if (desktop.load(mDesktopFile)) - return desktop.startDetached(); - else - return false; -} - - -/************************************************ - - ************************************************/ -bool AppLinkItem::compare(const QRegExp ®Exp) const -{ - if (regExp.isEmpty()) - return false; - - return mProgram.contains(regExp) || - mTitle.contains(regExp) ; -} - - -/************************************************ - - ************************************************/ -void AppLinkItem::initExec() -{ - static const QRegExp split_re{QStringLiteral("\\s")}; - XdgDesktopFile desktop; - if (desktop.load(mDesktopFile)) - { - QStringList cmd = desktop.value(QStringLiteral("Exec")).toString().split(split_re); - if (0 < cmd.size()) - mExec = which(expandCommand(cmd[0])); - } -} - - -/************************************************ - - ************************************************/ -AppLinkProvider::AppLinkProvider(): - CommandProvider() -{ -#ifdef HAVE_MENU_CACHE - menu_cache_init(0); - mMenuCache = menu_cache_lookup(XdgMenu::getMenuFileName().toLocal8Bit()); - if(mMenuCache) - mMenuCacheNotify = menu_cache_add_reload_notify(mMenuCache, (MenuCacheReloadNotify)menuCacheReloadNotify, this); - else - mMenuCacheNotify = 0; -#else - mXdgMenu = new XdgMenu(); - mXdgMenu->setEnvironments(QStringList() << "X-LXQT" << "LXQt"); - connect(mXdgMenu, SIGNAL(changed()), this, SLOT(update())); - mXdgMenu->read(XdgMenu::getMenuFileName()); - update(); -#endif -} - - -/************************************************ - - ************************************************/ -AppLinkProvider::~AppLinkProvider() -{ -#ifdef HAVE_MENU_CACHE - if(mMenuCache) - { - menu_cache_remove_reload_notify(mMenuCache, mMenuCacheNotify); - menu_cache_unref(mMenuCache); - } -#else - delete mXdgMenu; -#endif -} - - -/************************************************ - - ************************************************/ - #ifdef HAVE_MENU_CACHE - -void AppLinkProvider::menuCacheReloadNotify(MenuCache* cache, gpointer user_data) -{ - // qDebug() << Q_FUNC_INFO; - reinterpret_cast(user_data)->update(); -} - - #else // without menu-cache, use libqtxdg - - void doUpdate(const QDomElement &xml, QHash &items) -{ - DomElementIterator it(xml, QString()); - while (it.hasNext()) - { - QDomElement e = it.next(); - - // Build submenu ........................ - if (e.tagName() == "Menu") - doUpdate(e, items); - - //Build application link ................ - else if (e.tagName() == "AppLink") - { - AppLinkItem *item = new AppLinkItem(e); - delete items[item->command()]; // delete previous item; - items.insert(item->command(), item); - } - } -} -#endif - -/************************************************ - - ************************************************/ -void AppLinkProvider::update() -{ - emit aboutToBeChanged(); - QHash newItems; - -#ifdef HAVE_MENU_CACHE - // libmenu-cache is available, use it to get cached app list - GSList* apps = menu_cache_list_all_apps(mMenuCache); - for(GSList* l = apps; l; l = l->next) - { - MenuCacheApp* app = MENU_CACHE_APP(l->data); - AppLinkItem *item = new AppLinkItem(app); - AppLinkItem *prevItem = newItems[item->command()]; - if(prevItem) - delete prevItem; // delete previous item; - newItems.insert(item->command(), item); - menu_cache_item_unref(MENU_CACHE_ITEM(app)); - } - g_slist_free(apps); -#else - // use libqtxdg XdgMenu to get installed apps - doUpdate(mXdgMenu->xml().documentElement(), newItems); -#endif - { - QMutableListIterator i(*this); - while (i.hasNext()) { - AppLinkItem *item = static_cast(i.next()); - AppLinkItem *newItem = newItems.take(item->command()); - if (newItem) - { - *(item) = *newItem; // Copy by value, not pointer! - // After the item is copied, the original "updateIcon" call queued - // on the newItem object is never called since the object iss going to - // be deleted. Hence we need to call it on the copied item manually. - // Otherwise the copied item will have no icon. - // FIXME: this is a dirty hack and it should be made cleaner later. - if(item->icon().isNull()) - QMetaObject::invokeMethod(item, "updateIcon", Qt::QueuedConnection); - delete newItem; - } - else - { - i.remove(); - delete item; - } - } - } - - { - QHashIterator i(newItems); - while (i.hasNext()) - { - append(i.next().value()); - } - } - - emit changed(); -} - - - - -/************************************************ - - ************************************************/ -HistoryItem::HistoryItem(const QString &command): - CommandProviderItem() -{ - mIcon = XdgIcon::defaultApplicationIcon(); - mTitle = command; - mComment = QObject::tr("History"); - mCommand = command; -} - - -/************************************************ - - ************************************************/ -bool HistoryItem::run() const -{ - return startProcess(mCommand); -} - - -/************************************************ - - ************************************************/ -bool HistoryItem::compare(const QRegExp ®Exp) const -{ - return mCommand.contains(regExp); -} - - -/************************************************ - - ************************************************/ -unsigned int HistoryItem::rank(const QString &pattern) const -{ - return stringRank(mCommand, pattern); -} - - -/************************************************ - - ************************************************/ -HistoryProvider::HistoryProvider(): - CommandProvider() -{ - QString fileName = (XdgDirs::cacheHome() + "/lxqt-runner.history"); - mHistoryFile = new QSettings(fileName, QSettings::IniFormat); - mHistoryFile->beginGroup("commands"); - for (uint i=0; icontains(key)) - { - HistoryItem *item = new HistoryItem(mHistoryFile->value(key).toString()); - append(item); - } - } -} - - -/************************************************ - - ************************************************/ -HistoryProvider::~HistoryProvider() -{ - delete mHistoryFile; -} - - -/************************************************ - - ************************************************/ -void HistoryProvider::AddCommand(const QString &command) -{ - bool commandExists = false; - for (int i=0; !commandExists && i(at(i))->command()) - { - move(i, 0); - commandExists = true; - } - } - - if (!commandExists) - { - HistoryItem *item = new HistoryItem(command); - insert(0, item); - } - - mHistoryFile->clear(); - for (int i=0; isetValue(key, static_cast(at(i))->command()); - } -} - -void HistoryProvider::clearHistory() -{ - clear(); - mHistoryFile->clear(); -} - -/************************************************ - - ************************************************/ -CustomCommandItem::CustomCommandItem(CustomCommandProvider *provider): - CommandProviderItem(), - mProvider(provider) -{ - mIcon = XdgIcon::fromTheme("utilities-terminal"); -} - - -/************************************************ - - ************************************************/ -void CustomCommandItem::setCommand(const QString &command) -{ - mCommand = command; - mTitle = mCommand; - - mExec = which(expandCommand(command)); - - if (!mExec.isEmpty()) - mComment = QString("%1 %2").arg(mExec, command.section(' ', 1)); - else - mComment = QString(); - -} - - -/************************************************ - - ************************************************/ -bool CustomCommandItem::run() const -{ - bool ret = startProcess(mCommand); - if (ret && mProvider->historyProvider()) - mProvider->historyProvider()->AddCommand(mCommand); - - return ret; -} - - -/************************************************ - - ************************************************/ -bool CustomCommandItem::compare(const QRegExp ®Exp) const -{ - return !mComment.isEmpty(); -} - - -/************************************************ - - ************************************************/ -unsigned int CustomCommandItem::rank(const QString &pattern) const -{ - return 0; -} - - -/************************************************ - - ************************************************/ -CustomCommandProvider::CustomCommandProvider(): - CommandProvider(), - mHistoryProvider(0) -{ - mItem = new CustomCommandItem(this); - append(mItem); -} - -#ifdef VBOX_ENABLED -VirtualBoxItem::VirtualBoxItem(const QString & MachineName , const QIcon & Icon): - CommandProviderItem() -{ - mTitle = MachineName; - mIcon = Icon; -} - -void VirtualBoxItem::setRDEPort(const QString & portNum) -{ - m_rdePortNum = portNum; -} - -bool VirtualBoxItem::run() const -{ - QStringList arguments; -#ifdef VBOX_HEADLESS_ENABLED - arguments << "-startvm" << title(); - return QProcess::startDetached ("VBoxHeadless" , arguments); -#else - arguments << "startvm" << title(); - return QProcess::startDetached ("VBoxManage" , arguments); -#endif - -} - -bool VirtualBoxItem::compare(const QRegExp ®Exp) const -{ - return (! regExp.isEmpty() && -1 != regExp.indexIn (title ())); -} - -unsigned int VirtualBoxItem::rank(const QString &pattern) const -{ - return stringRank(mTitle, pattern); -} - -inline QString homeDir() { - return QStandardPaths::writableLocation(QStandardPaths::HomeLocation); -} - -/////// -VirtualBoxProvider::VirtualBoxProvider(): - virtualBoxConfig ( homeDir() + "/.VirtualBox/VirtualBox.xml") -{ - fp.setFileName (virtualBoxConfig); - - static const char *kOSTypeIcons [][2] = - { - {"Other", ":/vbox-icons/os_other.png"}, - {"DOS", ":/vbox-icons/os_dos.png"}, - {"Netware", ":/vbox-icons/os_netware.png"}, - {"L4", ":/vbox-icons/os_l4.png"}, - {"Windows31", ":/vbox-icons/os_win31.png"}, - {"Windows95", ":/vbox-icons/os_win95.png"}, - {"Windows98", ":/vbox-icons/os_win98.png"}, - {"WindowsMe", ":/vbox-icons/os_winme.png"}, - {"WindowsNT4", ":/vbox-icons/os_winnt4.png"}, - {"Windows2000", ":/vbox-icons/os_win2k.png"}, - {"WindowsXP", ":/vbox-icons/os_winxp.png"}, - {"WindowsXP_64", ":/vbox-icons/os_winxp_64.png"}, - {"Windows2003", ":/vbox-icons/os_win2k3.png"}, - {"Windows2003_64", ":/vbox-icons/os_win2k3_64.png"}, - {"WindowsVista", ":/vbox-icons/os_winvista.png"}, - {"WindowsVista_64", ":/vbox-icons/os_winvista_64.png"}, - {"Windows2008", ":/vbox-icons/os_win2k8.png"}, - {"Windows2008_64", ":/vbox-icons/os_win2k8_64.png"}, - {"Windows7", ":/vbox-icons/os_win7.png"}, - {"Windows7_64", ":/vbox-icons/os_win7_64.png"}, - {"WindowsNT", ":/vbox-icons/os_win_other.png"}, - {"OS2Warp3", ":/vbox-icons/os_os2warp3.png"}, - {"OS2Warp4", ":/vbox-icons/os_os2warp4.png"}, - {"OS2Warp45", ":/vbox-icons/os_os2warp45.png"}, - {"OS2eCS", ":/vbox-icons/os_os2ecs.png"}, - {"OS2", ":/vbox-icons/os_os2_other.png"}, - {"Linux22", ":/vbox-icons/os_linux22.png"}, - {"Linux24", ":/vbox-icons/os_linux24.png"}, - {"Linux24_64", ":/vbox-icons/os_linux24_64.png"}, - {"Linux26", ":/vbox-icons/os_linux26.png"}, - {"Linux26_64", ":/vbox-icons/os_linux26_64.png"}, - {"ArchLinux", ":/vbox-icons/os_archlinux.png"}, - {"ArchLinux_64", ":/vbox-icons/os_archlinux_64.png"}, - {"Debian", ":/vbox-icons/os_debian.png"}, - {"Debian_64", ":/vbox-icons/os_debian_64.png"}, - {"OpenSUSE", ":/vbox-icons/os_opensuse.png"}, - {"OpenSUSE_64", ":/vbox-icons/os_opensuse_64.png"}, - {"Fedora", ":/vbox-icons/os_fedora.png"}, - {"Fedora_64", ":/vbox-icons/os_fedora_64.png"}, - {"Gentoo", ":/vbox-icons/os_gentoo.png"}, - {"Gentoo_64", ":/vbox-icons/os_gentoo_64.png"}, - {"Mandriva", ":/vbox-icons/os_mandriva.png"}, - {"Mandriva_64", ":/vbox-icons/os_mandriva_64.png"}, - {"RedHat", ":/vbox-icons/os_redhat.png"}, - {"RedHat_64", ":/vbox-icons/os_redhat_64.png"}, - {"Ubuntu", ":/vbox-icons/os_ubuntu.png"}, - {"Ubuntu_64", ":/vbox-icons/os_ubuntu_64.png"}, - {"Xandros", ":/vbox-icons/os_xandros.png"}, - {"Xandros_64", ":/vbox-icons/os_xandros_64.png"}, - {"Linux", ":/vbox-icons/os_linux_other.png"}, - {"FreeBSD", ":/vbox-icons/os_freebsd.png"}, - {"FreeBSD_64", ":/vbox-icons/os_freebsd_64.png"}, - {"OpenBSD", ":/vbox-icons/os_openbsd.png"}, - {"OpenBSD_64", ":/vbox-icons/os_openbsd_64.png"}, - {"NetBSD", ":/vbox-icons/os_netbsd.png"}, - {"NetBSD_64", ":/vbox-icons/os_netbsd_64.png"}, - {"Solaris", ":/vbox-icons/os_solaris.png"}, - {"Solaris_64", ":/vbox-icons/os_solaris_64.png"}, - {"OpenSolaris", ":/vbox-icons/os_opensolaris.png"}, - {"OpenSolaris_64", ":/vbox-icons/os_opensolaris_64.png"}, - {"QNX", ":/vbox-icons/os_qnx.png"}, - }; - - for (size_t n = 0; n < sizeof (kOSTypeIcons) / sizeof(kOSTypeIcons[0]); ++ n) - { - osIcons.insert (kOSTypeIcons [n][0], (kOSTypeIcons [n][1])); - } -} - -void VirtualBoxProvider::rebuild() -{ - QDomDocument d; - if ( !d.setContent( &fp ) ) - { - qDebug() << "Unable to parse: " << fp.fileName(); - return; - } - - QDomNodeList _dnlist = d.elementsByTagName( "MachineEntry" ); - for ( int i = 0; i < _dnlist.count(); i++ ) - { - const QDomNode & node = _dnlist.at( i ); - const QString & ref = node.toElement().attribute( "src" ); - if ( ref.isEmpty() ) - { - qDebug() << "MachineEntry with no src attribute"; - continue; - } - - QFile m( ref ); - - QDomDocument mspec; - if ( !mspec.setContent( &m ) ) - { - qDebug() << "Could not parse machine file " << m.fileName(); - continue; - } - - QDomNodeList _mlist = mspec.elementsByTagName( "Machine" ); - for ( int j = 0; j < _mlist.count(); j++ ) - { - QDomNode mnode = _mlist.at( j ); - - QString type = mnode.toElement().attribute( "OSType" ); - VirtualBoxItem *virtualBoxItem = new VirtualBoxItem - ( - mnode.toElement().attribute( "name" ) , - QIcon ( osIcons.value (type , ":/vbox-icons/os_other.png") ) - ); - - const QDomNodeList & rdeportConfig = mnode.toElement().elementsByTagName("VRDEProperties"); - if ( ! rdeportConfig.isEmpty() ) - { - QDomNode portNode = rdeportConfig.at(0).firstChild(); - virtualBoxItem->setRDEPort( portNode.toElement().attribute("value") ); - } - - append ( virtualBoxItem ); - } - } - - timeStamp = QDateTime::currentDateTime(); - -} - -bool VirtualBoxProvider::isOutDated() const -{ - return fp.exists() && ( timeStamp < QFileInfo ( virtualBoxConfig ).lastModified () ); -} -#endif - - -#ifdef MATH_ENABLED -#include - -class MathItem::Parser : public mu::Parser -{ -public: - static void initLocale() - { - try - { - // use the system's locale instead of the "C" - s_locale = std::locale{""}; - } catch (const std::runtime_error & e) - { - qWarning().noquote() << "Unable to set locale for Math, " << e.what(); - } - } -}; -static void muParserInitLocale() -{ - MathItem::Parser::initLocale(); -} -Q_COREAPP_STARTUP_FUNCTION(muParserInitLocale) - -/************************************************ - - ************************************************/ -MathItem::MathItem(): - CommandProviderItem(), - mParser{new Parser} -{ - mToolTip =QObject::tr("Mathematics"); - mIcon = XdgIcon::fromTheme("accessories-calculator"); -} - - -/************************************************ - - ************************************************/ -MathItem::~MathItem() -{ -} - - -/************************************************ - - ************************************************/ -bool MathItem::run() const -{ - return false; -} - - -/************************************************ - - ************************************************/ -bool MathItem::compare(const QRegExp ®Exp) const -{ - QString s = regExp.pattern().trimmed(); - - bool is_math = false; - if (s.startsWith('=')) - { - is_math = true; - s.remove(0, 1); - } - if (s.endsWith("=")) - { - is_math = true; - s.chop(1); - } - - if (is_math) - { - if (s != mCachedInput) - { - MathItem * self = const_cast(this); - mCachedInput = s; - self->mTitle.clear(); - - //try to compute anything suitable - for (int attempts = 20; 0 < attempts && 0 < s.size(); s.chop(1), --attempts) - { - try - { - mParser->SetExpr(s.toStdString()); - self->mTitle = s + "=" + QLocale::system().toString(mParser->Eval()); - break; - } catch (const mu::Parser::exception_type & e) - { - //don't do anything, return false -> no result will be showed - } - } - } - - return !mTitle.isEmpty(); - } - - return false; -} - -/************************************************ - - ************************************************/ -unsigned int MathItem::rank(const QString &pattern) const -{ - return stringRank(mTitle, pattern); -} - - -/************************************************ - - ************************************************/ -MathProvider::MathProvider() -{ - append(new MathItem()); -} - -#endif - -ExternalProviderItem::ExternalProviderItem() -{ -} - -bool ExternalProviderItem::setData(QMap & data) -{ - if (! (data.contains("title") && data.contains("command"))) - { - return false; - } - - mTitle = data["title"]; - mComment = data["comment"]; - mToolTip = data["tooltip"]; - mCommand = data["command"]; - if (data.contains("icon")) - mIcon = XdgIcon::fromTheme(data["icon"]); - - return true; -} - - - -bool ExternalProviderItem::run() const -{ - return startProcess(mCommand); -} - -unsigned int ExternalProviderItem::rank(const QString& pattern) const -{ - return stringRank(title(), pattern); -} - -ExternalProvider::ExternalProvider(const QString name, const QString externalProgram) : -CommandProvider(), mName(name) -{ - mExternalProcess = new QProcess(this); - mYamlParser = new YamlParser(); - connect(mYamlParser, SIGNAL(newListOfMaps(QList >)), - this, SLOT(newListOfMaps(QList >))); - - connect(mExternalProcess, SIGNAL(readyRead()), this, SLOT(readFromProcess())); - mExternalProcess->start(externalProgram); -} - -void ExternalProvider::setSearchTerm(const QString searchTerm) -{ - mExternalProcess->write(searchTerm.toUtf8()); - mExternalProcess->write(QString("\n").toUtf8()); -} - -void ExternalProvider::newListOfMaps(QList > maps) -{ - emit aboutToBeChanged(); - - qDeleteAll(*this); - clear(); - - QMap map; - foreach(map, maps) - { - ExternalProviderItem *item = new ExternalProviderItem(); - if (item->setData(map)) - this->append(item); - else - delete item; - } - - emit changed(); -} - -void ExternalProvider::readFromProcess() -{ - char ch; - while (mExternalProcess->getChar(&ch)) - { - if (ch == '\n') - { - QString textLine = QString::fromLocal8Bit(mBuffer); - mYamlParser->consumeLine(textLine); - mBuffer.clear(); - } - else - { - mBuffer.append(ch); - } - } -} - diff --git a/providers.h b/providers.h deleted file mode 100644 index d62f47b..0000000 --- a/providers.h +++ /dev/null @@ -1,356 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2010-2011 Razor team - * Authors: - * Alexander Sokoloff - * 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 PROVIDERS_H -#define PROVIDERS_H - -#include -#include -#include -#include -#include - -#ifdef HAVE_MENU_CACHE -#include -#endif - -#define MAX_RANK 0xFFFF - -/*! The CommandProviderItem class provides an item for use with CommandProvider. - Items usually contain title, comment, toolTip and icon. - */ -class CommandProviderItem: public QObject -{ - Q_OBJECT -public: - CommandProviderItem(): QObject() {} - virtual ~CommandProviderItem() {} - - virtual bool run() const = 0; - virtual bool compare(const QRegExp ®Exp) const = 0; - - /// Returns the item's icon. - QIcon icon() const { return mIcon; } - - /// Returns the item's title. - QString title() const { return mTitle; } - - /// Returns the item's comment. - QString comment() const { return mComment; } - - /// Returns the item's tooltip. - QString toolTip() const { return mToolTip; } - - /*! The result of this function is used when searching for a apropriate item. - The item with the highest rank will be highlighted. - 0 - not suitable. - MAX_RANK - an exact match. - In the most cases you can yse something like: - return stringRank(mTitle, pattern); - */ - virtual unsigned int rank(const QString &pattern) const = 0; - -protected: - /// Helper function for the CommandProviderItem::rank - unsigned int stringRank(const QString str, const QString pattern) const; - QIcon mIcon; - QString mTitle; - QString mComment; - QString mToolTip; -}; - - -/*! The CommandProvider class provides task for the lxqt-runner. - */ -class CommandProvider: public QObject, public QList -{ - Q_OBJECT -public: - CommandProvider(); - virtual ~CommandProvider(); - - virtual void rebuild() {} - virtual bool isOutDated() const { return false; } - -signals: - void aboutToBeChanged(); - void changed(); -}; - - -/************************************************ - * Application desktop files - ************************************************/ - -class AppLinkItem: public CommandProviderItem -{ - Q_OBJECT -public: - AppLinkItem(const QDomElement &element); - -#ifdef HAVE_MENU_CACHE - AppLinkItem(MenuCacheApp* app); -#endif - - bool run() const; - bool compare(const QRegExp ®Exp) const; - QString command() const { return mCommand; } - QString exec() const { return mExec; } - - void operator=(const AppLinkItem &other); - - virtual unsigned int rank(const QString &pattern) const; -private slots: - void updateIcon(); -private: - void initExec(); -private: - QString mDesktopFile; - QString mIconName; - QString mCommand; - QString mExec; //!< the expanded executable (full path) from desktop file Exec key - QString mProgram; -}; - - -class XdgMenu; -class AppLinkProvider: public CommandProvider -{ - Q_OBJECT -public: - AppLinkProvider(); - virtual ~AppLinkProvider(); - -private slots: - void update(); - -private: -#ifdef HAVE_MENU_CACHE - MenuCache* mMenuCache; - MenuCacheNotifyId mMenuCacheNotify; - static void menuCacheReloadNotify(MenuCache* cache, gpointer user_data); -#else - XdgMenu *mXdgMenu; -#endif -}; - - -/************************************************ - * History - ************************************************/ - -class HistoryItem: public CommandProviderItem -{ -public: - HistoryItem(const QString &command); - - bool run() const; - bool compare(const QRegExp ®Exp) const; - - QString command() const { return mCommand; } - virtual unsigned int rank(const QString &pattern) const; - -private: - QString mCommand; -}; - - - -class QSettings; -class HistoryProvider: public CommandProvider -{ -public: - HistoryProvider(); - virtual ~HistoryProvider(); - - void AddCommand(const QString &command); - void clearHistory(); - -private: - QSettings *mHistoryFile; -}; - - - -/************************************************ - * Custom command - ************************************************/ -class CustomCommandProvider; - -class CustomCommandItem: public CommandProviderItem -{ - Q_OBJECT - -public: - CustomCommandItem(CustomCommandProvider *provider); - - bool run() const; - bool compare(const QRegExp ®Exp) const; - - QString command() const { return mCommand; } - void setCommand(const QString &command); - QString exec() const { return mExec; } - - virtual unsigned int rank(const QString &pattern) const; -private: - QString mCommand; - QString mExec; //!< the expanded executable (full path) - CustomCommandProvider *mProvider; -}; - - - -class QSettings; -class CustomCommandProvider: public CommandProvider -{ -public: - CustomCommandProvider(); - - QString command() const { return mItem->command(); } - void setCommand(const QString &command) { mItem->setCommand(command); } - - HistoryProvider* historyProvider() const { return mHistoryProvider; } - void setHistoryProvider(HistoryProvider *historyProvider) { mHistoryProvider = historyProvider; } - -private: - CustomCommandItem *mItem; - HistoryProvider *mHistoryProvider; -}; - - - -#ifdef MATH_ENABLED -/************************************************ - * Mathematics - ************************************************/ -class MathItem: public CommandProviderItem -{ -public: - class Parser; -public: - MathItem(); - ~MathItem(); - - bool run() const; - bool compare(const QRegExp ®Exp) const; - virtual unsigned int rank(const QString &pattern) const; -private: - QScopedPointer mParser; - mutable QString mCachedInput; -}; - - - -class MathProvider: public CommandProvider -{ -public: - MathProvider(); - //virtual ~MathProvider(); -}; -#endif - -#ifdef VBOX_ENABLED -#include -#include -#include -#include - -class VirtualBoxItem: public CommandProviderItem -{ -public: - VirtualBoxItem(const QString & MachineName , const QIcon & Icon); - - void setRDEPort (const QString & portNum); - bool run() const; - bool compare(const QRegExp ®Exp) const; - virtual unsigned int rank(const QString &pattern) const; -private: - QString m_rdePortNum; -}; - -class VirtualBoxProvider: public CommandProvider -{ -public: - VirtualBoxProvider (); - void rebuild(); - bool isOutDated() const; - -private: - QFile fp; - QMap osIcons; - QString virtualBoxConfig; - QDateTime timeStamp; -}; -#endif - -class ExternalProviderItem: public CommandProviderItem -{ - Q_OBJECT - -public: - ExternalProviderItem(); - - bool setData(QMap & data); - - bool run() const; - bool compare(const QRegExp ®Exp) const {return true;} // We leave the decision to the external process - unsigned int rank(const QString &pattern) const; - - QString mCommand; -}; - -class QProcess; -class YamlParser; -class ExternalProvider: public CommandProvider -{ - Q_OBJECT - -public: - ExternalProvider(const QString name, const QString externalProgram); - - void setSearchTerm(const QString searchTerm); - -signals: - void dataChanged(); - -private slots: - void readFromProcess(); - void newListOfMaps(QList > maps); - -private: - QString mName; - QProcess *mExternalProcess; - QTextStream *mDataToProcess; - YamlParser *mYamlParser; - - QByteArray mBuffer; -}; - - -#endif // PROVIDERS_H diff --git a/vbox-icons/os_archlinux.png b/vbox-icons/os_archlinux.png deleted file mode 100644 index 01e1708..0000000 Binary files a/vbox-icons/os_archlinux.png and /dev/null differ diff --git a/vbox-icons/os_archlinux_64.png b/vbox-icons/os_archlinux_64.png deleted file mode 100644 index 93da7eb..0000000 Binary files a/vbox-icons/os_archlinux_64.png and /dev/null differ diff --git a/vbox-icons/os_debian.png b/vbox-icons/os_debian.png deleted file mode 100644 index 4ca21f3..0000000 Binary files a/vbox-icons/os_debian.png and /dev/null differ diff --git a/vbox-icons/os_debian_64.png b/vbox-icons/os_debian_64.png deleted file mode 100644 index 73f4667..0000000 Binary files a/vbox-icons/os_debian_64.png and /dev/null differ diff --git a/vbox-icons/os_dos.png b/vbox-icons/os_dos.png deleted file mode 100644 index a4cd90c..0000000 Binary files a/vbox-icons/os_dos.png and /dev/null differ diff --git a/vbox-icons/os_fedora.png b/vbox-icons/os_fedora.png deleted file mode 100644 index 69037e0..0000000 Binary files a/vbox-icons/os_fedora.png and /dev/null differ diff --git a/vbox-icons/os_fedora_64.png b/vbox-icons/os_fedora_64.png deleted file mode 100644 index 058bcd0..0000000 Binary files a/vbox-icons/os_fedora_64.png and /dev/null differ diff --git a/vbox-icons/os_freebsd.png b/vbox-icons/os_freebsd.png deleted file mode 100644 index b9e07fc..0000000 Binary files a/vbox-icons/os_freebsd.png and /dev/null differ diff --git a/vbox-icons/os_freebsd_64.png b/vbox-icons/os_freebsd_64.png deleted file mode 100644 index a0bbe1a..0000000 Binary files a/vbox-icons/os_freebsd_64.png and /dev/null differ diff --git a/vbox-icons/os_gentoo.png b/vbox-icons/os_gentoo.png deleted file mode 100644 index 1f8e8d8..0000000 Binary files a/vbox-icons/os_gentoo.png and /dev/null differ diff --git a/vbox-icons/os_gentoo_64.png b/vbox-icons/os_gentoo_64.png deleted file mode 100644 index 14eb242..0000000 Binary files a/vbox-icons/os_gentoo_64.png and /dev/null differ diff --git a/vbox-icons/os_l4.png b/vbox-icons/os_l4.png deleted file mode 100644 index e51f905..0000000 Binary files a/vbox-icons/os_l4.png and /dev/null differ diff --git a/vbox-icons/os_linux.png b/vbox-icons/os_linux.png deleted file mode 100644 index dc4de91..0000000 Binary files a/vbox-icons/os_linux.png and /dev/null differ diff --git a/vbox-icons/os_linux22.png b/vbox-icons/os_linux22.png deleted file mode 100644 index d63493f..0000000 Binary files a/vbox-icons/os_linux22.png and /dev/null differ diff --git a/vbox-icons/os_linux24.png b/vbox-icons/os_linux24.png deleted file mode 100644 index c403ba7..0000000 Binary files a/vbox-icons/os_linux24.png and /dev/null differ diff --git a/vbox-icons/os_linux24_64.png b/vbox-icons/os_linux24_64.png deleted file mode 100644 index ce98c40..0000000 Binary files a/vbox-icons/os_linux24_64.png and /dev/null differ diff --git a/vbox-icons/os_linux26.png b/vbox-icons/os_linux26.png deleted file mode 100644 index 4643b30..0000000 Binary files a/vbox-icons/os_linux26.png and /dev/null differ diff --git a/vbox-icons/os_linux26_64.png b/vbox-icons/os_linux26_64.png deleted file mode 100644 index ebff89c..0000000 Binary files a/vbox-icons/os_linux26_64.png and /dev/null differ diff --git a/vbox-icons/os_linux_other.png b/vbox-icons/os_linux_other.png deleted file mode 100644 index f770ed6..0000000 Binary files a/vbox-icons/os_linux_other.png and /dev/null differ diff --git a/vbox-icons/os_mandriva.png b/vbox-icons/os_mandriva.png deleted file mode 100644 index 8af984c..0000000 Binary files a/vbox-icons/os_mandriva.png and /dev/null differ diff --git a/vbox-icons/os_mandriva_64.png b/vbox-icons/os_mandriva_64.png deleted file mode 100644 index 04b6142..0000000 Binary files a/vbox-icons/os_mandriva_64.png and /dev/null differ diff --git a/vbox-icons/os_netbsd.png b/vbox-icons/os_netbsd.png deleted file mode 100644 index bf68038..0000000 Binary files a/vbox-icons/os_netbsd.png and /dev/null differ diff --git a/vbox-icons/os_netbsd_64.png b/vbox-icons/os_netbsd_64.png deleted file mode 100644 index 83b9932..0000000 Binary files a/vbox-icons/os_netbsd_64.png and /dev/null differ diff --git a/vbox-icons/os_netware.png b/vbox-icons/os_netware.png deleted file mode 100644 index 5475ea4..0000000 Binary files a/vbox-icons/os_netware.png and /dev/null differ diff --git a/vbox-icons/os_openbsd.png b/vbox-icons/os_openbsd.png deleted file mode 100644 index bd12412..0000000 Binary files a/vbox-icons/os_openbsd.png and /dev/null differ diff --git a/vbox-icons/os_openbsd_64.png b/vbox-icons/os_openbsd_64.png deleted file mode 100644 index 2e8c5d9..0000000 Binary files a/vbox-icons/os_openbsd_64.png and /dev/null differ diff --git a/vbox-icons/os_opensolaris.png b/vbox-icons/os_opensolaris.png deleted file mode 100644 index fd7af77..0000000 Binary files a/vbox-icons/os_opensolaris.png and /dev/null differ diff --git a/vbox-icons/os_opensolaris_64.png b/vbox-icons/os_opensolaris_64.png deleted file mode 100644 index 057581d..0000000 Binary files a/vbox-icons/os_opensolaris_64.png and /dev/null differ diff --git a/vbox-icons/os_opensuse.png b/vbox-icons/os_opensuse.png deleted file mode 100644 index 3f8519c..0000000 Binary files a/vbox-icons/os_opensuse.png and /dev/null differ diff --git a/vbox-icons/os_opensuse_64.png b/vbox-icons/os_opensuse_64.png deleted file mode 100644 index 2c0b270..0000000 Binary files a/vbox-icons/os_opensuse_64.png and /dev/null differ diff --git a/vbox-icons/os_os2_other.png b/vbox-icons/os_os2_other.png deleted file mode 100644 index 386fe22..0000000 Binary files a/vbox-icons/os_os2_other.png and /dev/null differ diff --git a/vbox-icons/os_os2ecs.png b/vbox-icons/os_os2ecs.png deleted file mode 100644 index 756719a..0000000 Binary files a/vbox-icons/os_os2ecs.png and /dev/null differ diff --git a/vbox-icons/os_os2warp3.png b/vbox-icons/os_os2warp3.png deleted file mode 100644 index 386fe22..0000000 Binary files a/vbox-icons/os_os2warp3.png and /dev/null differ diff --git a/vbox-icons/os_os2warp4.png b/vbox-icons/os_os2warp4.png deleted file mode 100644 index 273e991..0000000 Binary files a/vbox-icons/os_os2warp4.png and /dev/null differ diff --git a/vbox-icons/os_os2warp45.png b/vbox-icons/os_os2warp45.png deleted file mode 100644 index 931b95e..0000000 Binary files a/vbox-icons/os_os2warp45.png and /dev/null differ diff --git a/vbox-icons/os_other.png b/vbox-icons/os_other.png deleted file mode 100644 index 84c0822..0000000 Binary files a/vbox-icons/os_other.png and /dev/null differ diff --git a/vbox-icons/os_qnx.png b/vbox-icons/os_qnx.png deleted file mode 100644 index 3434bb2..0000000 Binary files a/vbox-icons/os_qnx.png and /dev/null differ diff --git a/vbox-icons/os_redhat.png b/vbox-icons/os_redhat.png deleted file mode 100644 index 699436a..0000000 Binary files a/vbox-icons/os_redhat.png and /dev/null differ diff --git a/vbox-icons/os_redhat_64.png b/vbox-icons/os_redhat_64.png deleted file mode 100644 index 050fccb..0000000 Binary files a/vbox-icons/os_redhat_64.png and /dev/null differ diff --git a/vbox-icons/os_solaris.png b/vbox-icons/os_solaris.png deleted file mode 100644 index 9819fce..0000000 Binary files a/vbox-icons/os_solaris.png and /dev/null differ diff --git a/vbox-icons/os_solaris_64.png b/vbox-icons/os_solaris_64.png deleted file mode 100644 index 2eda933..0000000 Binary files a/vbox-icons/os_solaris_64.png and /dev/null differ diff --git a/vbox-icons/os_ubuntu.png b/vbox-icons/os_ubuntu.png deleted file mode 100644 index 1e4ab75..0000000 Binary files a/vbox-icons/os_ubuntu.png and /dev/null differ diff --git a/vbox-icons/os_ubuntu_64.png b/vbox-icons/os_ubuntu_64.png deleted file mode 100644 index e706aee..0000000 Binary files a/vbox-icons/os_ubuntu_64.png and /dev/null differ diff --git a/vbox-icons/os_win2k.png b/vbox-icons/os_win2k.png deleted file mode 100644 index d32a186..0000000 Binary files a/vbox-icons/os_win2k.png and /dev/null differ diff --git a/vbox-icons/os_win2k3.png b/vbox-icons/os_win2k3.png deleted file mode 100644 index 075fd09..0000000 Binary files a/vbox-icons/os_win2k3.png and /dev/null differ diff --git a/vbox-icons/os_win2k3_64.png b/vbox-icons/os_win2k3_64.png deleted file mode 100644 index 27c904d..0000000 Binary files a/vbox-icons/os_win2k3_64.png and /dev/null differ diff --git a/vbox-icons/os_win2k8.png b/vbox-icons/os_win2k8.png deleted file mode 100644 index 964cad8..0000000 Binary files a/vbox-icons/os_win2k8.png and /dev/null differ diff --git a/vbox-icons/os_win2k8_64.png b/vbox-icons/os_win2k8_64.png deleted file mode 100644 index ec44def..0000000 Binary files a/vbox-icons/os_win2k8_64.png and /dev/null differ diff --git a/vbox-icons/os_win31.png b/vbox-icons/os_win31.png deleted file mode 100644 index f229623..0000000 Binary files a/vbox-icons/os_win31.png and /dev/null differ diff --git a/vbox-icons/os_win7.png b/vbox-icons/os_win7.png deleted file mode 100644 index 2515304..0000000 Binary files a/vbox-icons/os_win7.png and /dev/null differ diff --git a/vbox-icons/os_win7_64.png b/vbox-icons/os_win7_64.png deleted file mode 100644 index e5e4822..0000000 Binary files a/vbox-icons/os_win7_64.png and /dev/null differ diff --git a/vbox-icons/os_win95.png b/vbox-icons/os_win95.png deleted file mode 100644 index ffbc5a0..0000000 Binary files a/vbox-icons/os_win95.png and /dev/null differ diff --git a/vbox-icons/os_win98.png b/vbox-icons/os_win98.png deleted file mode 100644 index 356d024..0000000 Binary files a/vbox-icons/os_win98.png and /dev/null differ diff --git a/vbox-icons/os_win_other.png b/vbox-icons/os_win_other.png deleted file mode 100644 index fa503c8..0000000 Binary files a/vbox-icons/os_win_other.png and /dev/null differ diff --git a/vbox-icons/os_winme.png b/vbox-icons/os_winme.png deleted file mode 100644 index df80c2d..0000000 Binary files a/vbox-icons/os_winme.png and /dev/null differ diff --git a/vbox-icons/os_winnt4.png b/vbox-icons/os_winnt4.png deleted file mode 100644 index cd81805..0000000 Binary files a/vbox-icons/os_winnt4.png and /dev/null differ diff --git a/vbox-icons/os_winvista.png b/vbox-icons/os_winvista.png deleted file mode 100644 index daec590..0000000 Binary files a/vbox-icons/os_winvista.png and /dev/null differ diff --git a/vbox-icons/os_winvista_64.png b/vbox-icons/os_winvista_64.png deleted file mode 100644 index cf9b582..0000000 Binary files a/vbox-icons/os_winvista_64.png and /dev/null differ diff --git a/vbox-icons/os_winxp.png b/vbox-icons/os_winxp.png deleted file mode 100644 index 3d90b38..0000000 Binary files a/vbox-icons/os_winxp.png and /dev/null differ diff --git a/vbox-icons/os_winxp_64.png b/vbox-icons/os_winxp_64.png deleted file mode 100644 index 1951045..0000000 Binary files a/vbox-icons/os_winxp_64.png and /dev/null differ diff --git a/vbox-icons/os_xandros.png b/vbox-icons/os_xandros.png deleted file mode 100644 index 076223e..0000000 Binary files a/vbox-icons/os_xandros.png and /dev/null differ diff --git a/vbox-icons/os_xandros_64.png b/vbox-icons/os_xandros_64.png deleted file mode 100644 index 184147e..0000000 Binary files a/vbox-icons/os_xandros_64.png and /dev/null differ diff --git a/vbox-icons/state_running_16px.png b/vbox-icons/state_running_16px.png deleted file mode 100644 index dd95f9c..0000000 Binary files a/vbox-icons/state_running_16px.png and /dev/null differ diff --git a/vbox-icons/vrdp_16px.png b/vbox-icons/vrdp_16px.png deleted file mode 100644 index 29e859c..0000000 Binary files a/vbox-icons/vrdp_16px.png and /dev/null differ diff --git a/virtualbox-icons.qrc b/virtualbox-icons.qrc deleted file mode 100644 index 6da056a..0000000 --- a/virtualbox-icons.qrc +++ /dev/null @@ -1,68 +0,0 @@ - - - vbox-icons/os_archlinux_64.png - vbox-icons/os_archlinux.png - vbox-icons/os_debian_64.png - vbox-icons/os_debian.png - vbox-icons/os_dos.png - vbox-icons/os_fedora_64.png - vbox-icons/os_fedora.png - vbox-icons/os_freebsd_64.png - vbox-icons/os_freebsd.png - vbox-icons/os_gentoo_64.png - vbox-icons/os_gentoo.png - vbox-icons/os_l4.png - vbox-icons/os_linux22.png - vbox-icons/os_linux24_64.png - vbox-icons/os_linux24.png - vbox-icons/os_linux26_64.png - vbox-icons/os_linux26.png - vbox-icons/os_linux_other.png - vbox-icons/os_linux.png - vbox-icons/os_mandriva_64.png - vbox-icons/os_mandriva.png - vbox-icons/os_netbsd_64.png - vbox-icons/os_netbsd.png - vbox-icons/os_netware.png - vbox-icons/os_openbsd_64.png - vbox-icons/os_openbsd.png - vbox-icons/os_opensolaris_64.png - vbox-icons/os_opensolaris.png - vbox-icons/os_opensuse_64.png - vbox-icons/os_opensuse.png - vbox-icons/os_os2ecs.png - vbox-icons/os_os2_other.png - vbox-icons/os_os2warp3.png - vbox-icons/os_os2warp45.png - vbox-icons/os_os2warp4.png - vbox-icons/os_other.png - vbox-icons/os_qnx.png - vbox-icons/os_redhat_64.png - vbox-icons/os_redhat.png - vbox-icons/os_solaris_64.png - vbox-icons/os_solaris.png - vbox-icons/os_ubuntu_64.png - vbox-icons/os_ubuntu.png - vbox-icons/os_win2k3_64.png - vbox-icons/os_win2k3.png - vbox-icons/os_win2k8_64.png - vbox-icons/os_win2k8.png - vbox-icons/os_win2k.png - vbox-icons/os_win31.png - vbox-icons/os_win7_64.png - vbox-icons/os_win7.png - vbox-icons/os_win95.png - vbox-icons/os_win98.png - vbox-icons/os_winme.png - vbox-icons/os_winnt4.png - vbox-icons/os_win_other.png - vbox-icons/os_winvista_64.png - vbox-icons/os_winvista.png - vbox-icons/os_winxp_64.png - vbox-icons/os_winxp.png - vbox-icons/os_xandros_64.png - vbox-icons/os_xandros.png - vbox-icons/state_running_16px.png - vbox-icons/vrdp_16px.png - - diff --git a/widgets.cpp b/widgets.cpp deleted file mode 100644 index 1583472..0000000 --- a/widgets.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 */ - -#include "widgets.h" - -#include -#include - - -#include -#include -#include - - -/************************************************ - - ************************************************/ -HorizSizeGrip::HorizSizeGrip(QWidget *parent): - QWidget(parent) -{ -} - - -/************************************************ - - ************************************************/ -void HorizSizeGrip::mouseMoveEvent(QMouseEvent *event) -{ - if (!parentWidget()) - return; - - QWidget *parent = parentWidget(); - while (parent->parentWidget() && !parent->isWindow()) - { - parent = parent->parentWidget(); - } - - QRect rect = parent->geometry(); - int delta = event->globalPos().x() - rect.center().x(); - - bool isLeft = pos().x() < parent->size().width() - geometry().right(); - if (isLeft) - { - rect.setLeft(event->globalPos().x()); - rect.setRight(parent->geometry().center().x() - delta); - } - else - { - rect.setLeft(parent->geometry().center().x() - delta); - rect.setRight(event->globalPos().x()); - } - - if (rect.width() < parent->minimumWidth() || - rect.width() > parent->maximumWidth()) - return; - - parent->setGeometry(rect); -} - - -/************************************************ - - ************************************************/ -CommandComboBox::CommandComboBox(QWidget *parent) : - QComboBox(parent) -{ - -} - - -/************************************************ - - ************************************************/ -CommandListView::CommandListView(QWidget *parent) : - QListView(parent) -{ - -} diff --git a/widgets.h b/widgets.h deleted file mode 100644 index 8eb071c..0000000 --- a/widgets.h +++ /dev/null @@ -1,72 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * 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 WIDGETS_H -#define WIDGETS_H - - -#include -#include -#include -#include - -class QEvent; - -class HorizSizeGrip: public QWidget -{ - Q_OBJECT -public: - HorizSizeGrip(QWidget *parent = 0); - -protected: - void mouseMoveEvent(QMouseEvent *event); - -}; - - -class CommandComboBox : public QComboBox -{ - Q_OBJECT -public: - explicit CommandComboBox(QWidget *parent = 0); -}; - - -class CommandListView : public QListView -{ - Q_OBJECT -public: - explicit CommandListView(QWidget *parent = 0); - -signals: - -public slots: - -}; - - -#endif // WIDGETS_H diff --git a/yamlparser.cpp b/yamlparser.cpp deleted file mode 100644 index 454ffad..0000000 --- a/yamlparser.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * 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 "yamlparser.h" - -YamlParser::YamlParser() -{ - state = start; -} - -YamlParser::~YamlParser() -{ -} - -void YamlParser::consumeLine(QString line) -{ - static QRegExp documentStart("---\\s*(\\[\\]\\s*)?"); - static QRegExp mapStart("(-\\s*)(\\w*)\\s*:(.*)$"); - static QRegExp mapEntry("(\\s*)(\\w*)\\s*:(.*)"); - static QRegExp continuation("(\\s*)(.*)"); - static QRegExp documentEnd("...\\s*"); - static QRegExp emptyLine("\\s*(#.*)?"); - - qDebug() << line; - - if (documentStart.exactMatch(line)) - { - m_ListOfMaps.clear(); - state = atdocumentstart; - m_CurrentIndent = -1; - } - else if (state == error) - { - // Skip - } - else if (emptyLine.exactMatch(line)) - { - // Skip - } - else if ((state == atdocumentstart || state == inlist) && mapStart.exactMatch(line)) - { - m_ListOfMaps << QMap(); - addEntryToCurrentMap(mapStart.cap(2), mapStart.cap(3)); - m_CurrentIndent = mapStart.cap(1).size(); - state = inlist; - } - else if (state == inlist && mapEntry.exactMatch(line) && mapEntry.cap(1).size() == m_CurrentIndent) - { - addEntryToCurrentMap(mapEntry.cap(2), mapEntry.cap(3)); - } - else if (state == inlist && continuation.exactMatch(line) && continuation.cap(1).size() > m_CurrentIndent) - { - m_ListOfMaps.last()[m_LastKey].append(continuation.cap(2)); - } - else if ((state == atdocumentstart || state == inlist) && documentEnd.exactMatch(line)) - { - qDebug() << "emitting:" << m_ListOfMaps; - emit newListOfMaps(m_ListOfMaps); - state = documentdone; - } - else - { - qWarning() << "Yaml parser could not read:" << line; - state = error; - } -} - -void YamlParser::addEntryToCurrentMap(QString key, QString value) -{ - m_ListOfMaps.last()[key.trimmed()] = value.trimmed(); - m_LastKey = key.trimmed(); -} diff --git a/yamlparser.h b/yamlparser.h deleted file mode 100644 index faf168e..0000000 --- a/yamlparser.h +++ /dev/null @@ -1,69 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * (c)LGPL2+ - * - * LXDE-Qt - a lightweight, Qt based, desktop toolset - * http://razor-qt.org - * - * Copyright: 2013 Razor team - * Authors: - * 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 YAMLPARSER_H -#define YAMLPARSER_H - -#include -#include -#include -#include - -class QIODevice; - -class YamlParser : public QObject -{ - Q_OBJECT -public: - YamlParser(); - virtual ~YamlParser(); - - void consumeLine(QString line); - -signals: - void newListOfMaps(QList > maps); - -private: - - QList > m_ListOfMaps; - - enum - { - start, - atdocumentstart, - inlist, - documentdone, - error - } state; - - int m_CurrentIndent; - QString m_LastKey; - - void addEntryToCurrentMap(QString key, QString value); -}; - -#endif /* YAMLPARSER_H */