From 0ba609836592f7e56b143544e8ec240c85ae4666 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Tue, 24 Oct 2017 22:48:10 +0200 Subject: [PATCH 1/3] Cherry-picking upstream release 0.12.0. * Switched to experimental * Bumped liblxqt0-dev to >= 0.12.0 * Bumped liblxqt-globalkeys0-dev to >= 0.12.0 * Bumped liblxqt-globalkeys-ui0-dev to >= 0.12.0 * Bumped Standards to 4.1.1 - no changes needed --- AUTHORS | 2 +- CHANGELOG | 34 ++++++++- CMakeLists.txt | 16 +++-- autostart/CMakeLists.txt | 17 +++++ autostart/lxqt-runner.desktop.in | 9 +++ autostart/translations/lxqt-runner_ar.desktop | 2 + autostart/translations/lxqt-runner_cs.desktop | 2 + .../translations/lxqt-runner_cs_CZ.desktop | 2 + autostart/translations/lxqt-runner_da.desktop | 2 + autostart/translations/lxqt-runner_de.desktop | 2 + autostart/translations/lxqt-runner_el.desktop | 2 + autostart/translations/lxqt-runner_eo.desktop | 2 + autostart/translations/lxqt-runner_es.desktop | 2 + .../translations/lxqt-runner_es_VE.desktop | 2 + autostart/translations/lxqt-runner_eu.desktop | 2 + autostart/translations/lxqt-runner_fi.desktop | 2 + autostart/translations/lxqt-runner_fr.desktop | 2 + autostart/translations/lxqt-runner_hu.desktop | 2 + .../translations/lxqt-runner_it_IT.desktop | 2 + autostart/translations/lxqt-runner_ja.desktop | 2 + autostart/translations/lxqt-runner_lt.desktop | 2 + autostart/translations/lxqt-runner_nl.desktop | 2 + .../translations/lxqt-runner_pl_PL.desktop | 2 + autostart/translations/lxqt-runner_pt.desktop | 2 + .../translations/lxqt-runner_pt_BR.desktop | 2 + autostart/translations/lxqt-runner_ru.desktop | 2 + .../translations/lxqt-runner_ru_RU.desktop | 2 + autostart/translations/lxqt-runner_sl.desktop | 2 + .../translations/lxqt-runner_th_TH.desktop | 2 + autostart/translations/lxqt-runner_tr.desktop | 2 + autostart/translations/lxqt-runner_uk.desktop | 2 + .../translations/lxqt-runner_zh_CN.desktop | 2 + .../translations/lxqt-runner_zh_TW.desktop | 2 + commanditemmodel.cpp | 70 +++++++++++++------ commanditemmodel.h | 16 +++-- configuredialog/configuredialog.cpp | 10 ++- configuredialog/configuredialog.ui | 49 ++++++++++++- debian/changelog | 11 +++ debian/control | 12 ++-- dialog.cpp | 4 +- dialog.ui | 10 ++- main.cpp | 14 ++++ mylistview.h | 65 +++++++++++++++++ providers.cpp | 2 +- 44 files changed, 348 insertions(+), 49 deletions(-) create mode 100644 autostart/CMakeLists.txt create mode 100644 autostart/lxqt-runner.desktop.in create mode 100644 autostart/translations/lxqt-runner_ar.desktop create mode 100644 autostart/translations/lxqt-runner_cs.desktop create mode 100644 autostart/translations/lxqt-runner_cs_CZ.desktop create mode 100644 autostart/translations/lxqt-runner_da.desktop create mode 100644 autostart/translations/lxqt-runner_de.desktop create mode 100644 autostart/translations/lxqt-runner_el.desktop create mode 100644 autostart/translations/lxqt-runner_eo.desktop create mode 100644 autostart/translations/lxqt-runner_es.desktop create mode 100644 autostart/translations/lxqt-runner_es_VE.desktop create mode 100644 autostart/translations/lxqt-runner_eu.desktop create mode 100644 autostart/translations/lxqt-runner_fi.desktop create mode 100644 autostart/translations/lxqt-runner_fr.desktop create mode 100644 autostart/translations/lxqt-runner_hu.desktop create mode 100644 autostart/translations/lxqt-runner_it_IT.desktop create mode 100644 autostart/translations/lxqt-runner_ja.desktop create mode 100644 autostart/translations/lxqt-runner_lt.desktop create mode 100644 autostart/translations/lxqt-runner_nl.desktop create mode 100644 autostart/translations/lxqt-runner_pl_PL.desktop create mode 100644 autostart/translations/lxqt-runner_pt.desktop create mode 100644 autostart/translations/lxqt-runner_pt_BR.desktop create mode 100644 autostart/translations/lxqt-runner_ru.desktop create mode 100644 autostart/translations/lxqt-runner_ru_RU.desktop create mode 100644 autostart/translations/lxqt-runner_sl.desktop create mode 100644 autostart/translations/lxqt-runner_th_TH.desktop create mode 100644 autostart/translations/lxqt-runner_tr.desktop create mode 100644 autostart/translations/lxqt-runner_uk.desktop create mode 100644 autostart/translations/lxqt-runner_zh_CN.desktop create mode 100644 autostart/translations/lxqt-runner_zh_TW.desktop create mode 100644 mylistview.h diff --git a/AUTHORS b/AUTHORS index a66be6d..abb6e1f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,7 +4,7 @@ Upstream Authors: Copyright: Copyright (c) 2010-2012 Razor team - Copyright (c) 2012-2016 LXQt 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 index e622723..4f61ab7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,39 @@ -lxqt-runner-0.11.1 / 2017-01-01 +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 diff --git a/CMakeLists.txt b/CMakeLists.txt index ee9ce26..4b9f35c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,18 +25,23 @@ cmake_dependent_option(RUNNER_VBOX_HEADLESS find_package(KF5WindowSystem REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5Xml REQUIRED) -find_package(Qt5LinguistTools REQUIRED QUIET) +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_STRING}") +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 QUIET) + find_package(PkgConfig REQUIRED) endif () if (USE_MENU_CACHE) @@ -45,7 +50,7 @@ if (USE_MENU_CACHE) endif() if (RUNNER_MATH) - pkg_check_modules(MUPARSER REQUIRED QUIET muparser) + pkg_check_modules(MUPARSER REQUIRED muparser) endif () set(lxqt-runner_H_FILES @@ -148,3 +153,6 @@ install(TARGETS RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT Runtime ) + +# merged from lxqt-common +add_subdirectory(autostart) diff --git a/autostart/CMakeLists.txt b/autostart/CMakeLists.txt new file mode 100644 index 0000000..e4342a5 --- /dev/null +++ b/autostart/CMakeLists.txt @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..8ebdeac --- /dev/null +++ b/autostart/lxqt-runner.desktop.in @@ -0,0 +1,9 @@ +[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 new file mode 100644 index 0000000..f3490f3 --- /dev/null +++ b/autostart/translations/lxqt-runner_ar.desktop @@ -0,0 +1,2 @@ +# Translations +Name[ar]=المُطْلِق diff --git a/autostart/translations/lxqt-runner_cs.desktop b/autostart/translations/lxqt-runner_cs.desktop new file mode 100644 index 0000000..1ebf804 --- /dev/null +++ b/autostart/translations/lxqt-runner_cs.desktop @@ -0,0 +1,2 @@ +# Translations +Name[cs]=Spouštěč diff --git a/autostart/translations/lxqt-runner_cs_CZ.desktop b/autostart/translations/lxqt-runner_cs_CZ.desktop new file mode 100644 index 0000000..75aa5ba --- /dev/null +++ b/autostart/translations/lxqt-runner_cs_CZ.desktop @@ -0,0 +1,2 @@ +# Translations +Name[cs_CZ]=Spouštěč diff --git a/autostart/translations/lxqt-runner_da.desktop b/autostart/translations/lxqt-runner_da.desktop new file mode 100644 index 0000000..ac372b8 --- /dev/null +++ b/autostart/translations/lxqt-runner_da.desktop @@ -0,0 +1,2 @@ +# Translations +Name[da]=Programstarter diff --git a/autostart/translations/lxqt-runner_de.desktop b/autostart/translations/lxqt-runner_de.desktop new file mode 100644 index 0000000..4f1495a --- /dev/null +++ b/autostart/translations/lxqt-runner_de.desktop @@ -0,0 +1,2 @@ +# Translations +Name[de]=Anwendungsstarter diff --git a/autostart/translations/lxqt-runner_el.desktop b/autostart/translations/lxqt-runner_el.desktop new file mode 100644 index 0000000..5896bfc --- /dev/null +++ b/autostart/translations/lxqt-runner_el.desktop @@ -0,0 +1,2 @@ +# Translations +Name[el]=Εκτελεστής diff --git a/autostart/translations/lxqt-runner_eo.desktop b/autostart/translations/lxqt-runner_eo.desktop new file mode 100644 index 0000000..0e6f690 --- /dev/null +++ b/autostart/translations/lxqt-runner_eo.desktop @@ -0,0 +1,2 @@ +# Translations +Name[eo]=Rulilo diff --git a/autostart/translations/lxqt-runner_es.desktop b/autostart/translations/lxqt-runner_es.desktop new file mode 100644 index 0000000..ed83679 --- /dev/null +++ b/autostart/translations/lxqt-runner_es.desktop @@ -0,0 +1,2 @@ +# Translations +Name[es]=Lanzador diff --git a/autostart/translations/lxqt-runner_es_VE.desktop b/autostart/translations/lxqt-runner_es_VE.desktop new file mode 100644 index 0000000..51cab8b --- /dev/null +++ b/autostart/translations/lxqt-runner_es_VE.desktop @@ -0,0 +1,2 @@ +# Translations +Name[es_VE]=Ejecutor diff --git a/autostart/translations/lxqt-runner_eu.desktop b/autostart/translations/lxqt-runner_eu.desktop new file mode 100644 index 0000000..9b18b34 --- /dev/null +++ b/autostart/translations/lxqt-runner_eu.desktop @@ -0,0 +1,2 @@ +# Translations +Name[eu]=Abiarazlea diff --git a/autostart/translations/lxqt-runner_fi.desktop b/autostart/translations/lxqt-runner_fi.desktop new file mode 100644 index 0000000..0f8e2e5 --- /dev/null +++ b/autostart/translations/lxqt-runner_fi.desktop @@ -0,0 +1,2 @@ +# Translations +Name[fi]=Käynnistin diff --git a/autostart/translations/lxqt-runner_fr.desktop b/autostart/translations/lxqt-runner_fr.desktop new file mode 100644 index 0000000..3a5d444 --- /dev/null +++ b/autostart/translations/lxqt-runner_fr.desktop @@ -0,0 +1,2 @@ +# Translations +Name[fr]=Lanceur diff --git a/autostart/translations/lxqt-runner_hu.desktop b/autostart/translations/lxqt-runner_hu.desktop new file mode 100644 index 0000000..255a84c --- /dev/null +++ b/autostart/translations/lxqt-runner_hu.desktop @@ -0,0 +1,2 @@ +# Translations +Name[hu]=Indító diff --git a/autostart/translations/lxqt-runner_it_IT.desktop b/autostart/translations/lxqt-runner_it_IT.desktop new file mode 100644 index 0000000..e2a30c4 --- /dev/null +++ b/autostart/translations/lxqt-runner_it_IT.desktop @@ -0,0 +1,2 @@ +# Translations +Name[it_IT]=Runner diff --git a/autostart/translations/lxqt-runner_ja.desktop b/autostart/translations/lxqt-runner_ja.desktop new file mode 100644 index 0000000..2b04377 --- /dev/null +++ b/autostart/translations/lxqt-runner_ja.desktop @@ -0,0 +1,2 @@ +# Translations +Name[ja]=ランナー diff --git a/autostart/translations/lxqt-runner_lt.desktop b/autostart/translations/lxqt-runner_lt.desktop new file mode 100644 index 0000000..22f5b68 --- /dev/null +++ b/autostart/translations/lxqt-runner_lt.desktop @@ -0,0 +1,2 @@ +# Translations +Name[lt]=Paleidiklis diff --git a/autostart/translations/lxqt-runner_nl.desktop b/autostart/translations/lxqt-runner_nl.desktop new file mode 100644 index 0000000..b8ae90e --- /dev/null +++ b/autostart/translations/lxqt-runner_nl.desktop @@ -0,0 +1,2 @@ +# Translations +Name[nl]=Starter diff --git a/autostart/translations/lxqt-runner_pl_PL.desktop b/autostart/translations/lxqt-runner_pl_PL.desktop new file mode 100644 index 0000000..3a7cd3c --- /dev/null +++ b/autostart/translations/lxqt-runner_pl_PL.desktop @@ -0,0 +1,2 @@ +# Translations +Name[pl_PL]=Runner diff --git a/autostart/translations/lxqt-runner_pt.desktop b/autostart/translations/lxqt-runner_pt.desktop new file mode 100644 index 0000000..191a23a --- /dev/null +++ b/autostart/translations/lxqt-runner_pt.desktop @@ -0,0 +1,2 @@ +# Translations +Name[pt]=Runner diff --git a/autostart/translations/lxqt-runner_pt_BR.desktop b/autostart/translations/lxqt-runner_pt_BR.desktop new file mode 100644 index 0000000..2b49692 --- /dev/null +++ b/autostart/translations/lxqt-runner_pt_BR.desktop @@ -0,0 +1,2 @@ +# Translations +Name[pt_BR]=Executor diff --git a/autostart/translations/lxqt-runner_ru.desktop b/autostart/translations/lxqt-runner_ru.desktop new file mode 100644 index 0000000..f01ca0d --- /dev/null +++ b/autostart/translations/lxqt-runner_ru.desktop @@ -0,0 +1,2 @@ +# Translations +Name[ru]=бегунок diff --git a/autostart/translations/lxqt-runner_ru_RU.desktop b/autostart/translations/lxqt-runner_ru_RU.desktop new file mode 100644 index 0000000..0ef1ad2 --- /dev/null +++ b/autostart/translations/lxqt-runner_ru_RU.desktop @@ -0,0 +1,2 @@ +# Translations +Name[ru_RU]=Запускалка программ diff --git a/autostart/translations/lxqt-runner_sl.desktop b/autostart/translations/lxqt-runner_sl.desktop new file mode 100644 index 0000000..7c70e8f --- /dev/null +++ b/autostart/translations/lxqt-runner_sl.desktop @@ -0,0 +1,2 @@ +# Translations +Name[sl]=Zaganjalnik diff --git a/autostart/translations/lxqt-runner_th_TH.desktop b/autostart/translations/lxqt-runner_th_TH.desktop new file mode 100644 index 0000000..8bc2812 --- /dev/null +++ b/autostart/translations/lxqt-runner_th_TH.desktop @@ -0,0 +1,2 @@ +# Translations +Name[th_TH]=กล่องป้อนคำสั่ง diff --git a/autostart/translations/lxqt-runner_tr.desktop b/autostart/translations/lxqt-runner_tr.desktop new file mode 100644 index 0000000..6cfa1b1 --- /dev/null +++ b/autostart/translations/lxqt-runner_tr.desktop @@ -0,0 +1,2 @@ +# Translations +Name[tr]=Çalıştırıcı diff --git a/autostart/translations/lxqt-runner_uk.desktop b/autostart/translations/lxqt-runner_uk.desktop new file mode 100644 index 0000000..284188f --- /dev/null +++ b/autostart/translations/lxqt-runner_uk.desktop @@ -0,0 +1,2 @@ +# Translations +Name[uk]=Запускач diff --git a/autostart/translations/lxqt-runner_zh_CN.desktop b/autostart/translations/lxqt-runner_zh_CN.desktop new file mode 100644 index 0000000..91c03de --- /dev/null +++ b/autostart/translations/lxqt-runner_zh_CN.desktop @@ -0,0 +1,2 @@ +# Translations +Name[zh_CN]=启动器 diff --git a/autostart/translations/lxqt-runner_zh_TW.desktop b/autostart/translations/lxqt-runner_zh_TW.desktop new file mode 100644 index 0000000..39c2990 --- /dev/null +++ b/autostart/translations/lxqt-runner_zh_TW.desktop @@ -0,0 +1,2 @@ +# Translations +Name[zh_TW]=快速執行 diff --git a/commanditemmodel.cpp b/commanditemmodel.cpp index 2be7411..01b81a3 100644 --- a/commanditemmodel.cpp +++ b/commanditemmodel.cpp @@ -37,9 +37,9 @@ /************************************************ ************************************************/ -CommandItemModel::CommandItemModel(QObject *parent) : +CommandItemModel::CommandItemModel(bool useHistory, QObject *parent) : QSortFilterProxyModel(parent), - mSourceModel(new CommandSourceItemModel(this)), + mSourceModel(new CommandSourceItemModel(useHistory, this)), mOnlyHistory(false), mShowHistoryFirst(true) { @@ -84,11 +84,6 @@ const CommandProviderItem *CommandItemModel::command(const QModelIndex &index) c /************************************************ ************************************************/ -void CommandItemModel::addHistoryCommand(const QString &command) -{ - mSourceModel->addHistoryCommand(command); -} - void CommandItemModel::clearHistory() { mSourceModel->clearHistory(); @@ -239,17 +234,21 @@ void CommandItemModel::rebuild() /************************************************ ************************************************/ -CommandSourceItemModel::CommandSourceItemModel(QObject *parent) : - QAbstractListModel(parent) +CommandSourceItemModel::CommandSourceItemModel(bool useHistory, QObject *parent) : + QAbstractListModel(parent), + mHistoryProvider(nullptr) { mCustomCommandProvider = new CustomCommandProvider; mProviders.append(mCustomCommandProvider); rebuild(); mCustomCommandIndex = index(0, 0); - mHistoryProvider = new HistoryProvider(); - mProviders.append(mHistoryProvider); - mCustomCommandProvider->setHistoryProvider(mHistoryProvider); + if (useHistory) + { + mHistoryProvider = new HistoryProvider(); + mProviders.append(mHistoryProvider); + mCustomCommandProvider->setHistoryProvider(mHistoryProvider); + } mProviders.append(new AppLinkProvider()); #ifdef MATH_ENABLED @@ -379,9 +378,16 @@ void CommandSourceItemModel::rebuild() ************************************************/ void CommandSourceItemModel::clearHistory() { - beginResetModel(); - mHistoryProvider->clearHistory(); - endResetModel(); + if (mHistoryProvider) + { + beginResetModel(); + mHistoryProvider->clearHistory(); + endResetModel(); + } else + { + QScopedPointer history_p{new HistoryProvider}; + history_p->clearHistory(); + } } @@ -417,23 +423,41 @@ const CommandProviderItem *CommandSourceItemModel::command(const QModelIndex &in } -/************************************************ +/*********************************************** - ************************************************/ -void CommandSourceItemModel::addHistoryCommand(const QString &command) + ***********************************************/ +void CommandSourceItemModel::setCommand(const QString& command) { - mHistoryProvider->AddCommand(command); + mCustomCommandProvider->setCommand(command); + foreach (ExternalProvider* externalProvider, mExternalProviders) + { + externalProvider->setSearchTerm(command); + } } /*********************************************** ***********************************************/ -void CommandSourceItemModel::setCommand(const QString& command) +void CommandSourceItemModel::setUseHistory(bool useHistory) { - mCustomCommandProvider->setCommand(command); - foreach (ExternalProvider* externalProvider, mExternalProviders) + const bool now_using_history = mHistoryProvider != nullptr; + if (now_using_history == useHistory) + return; + beginResetModel(); + if (now_using_history) { - externalProvider->setSearchTerm(command); + 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 index dc5bb70..a2c7343 100644 --- a/commanditemmodel.h +++ b/commanditemmodel.h @@ -38,7 +38,7 @@ class CommandSourceItemModel: public QAbstractListModel { Q_OBJECT public: - explicit CommandSourceItemModel(QObject *parent = 0); + explicit CommandSourceItemModel(bool useHistory, QObject *parent = 0); virtual ~CommandSourceItemModel(); int rowCount(const QModelIndex &parent=QModelIndex()) const; @@ -48,13 +48,15 @@ public: const CommandProviderItem *command(const QModelIndex &index) const; const CommandProviderItem *command(int row) const; - void addHistoryCommand(const QString &command); - 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(); @@ -73,14 +75,12 @@ class CommandItemModel: public QSortFilterProxyModel { Q_OBJECT public: - explicit CommandItemModel(QObject *parent = 0); + explicit CommandItemModel(bool useHistory, QObject *parent = 0); virtual ~CommandItemModel(); bool isOutDated() const; const CommandProviderItem *command(const QModelIndex &index) const; - void addHistoryCommand(const QString &command); - QModelIndex appropriateItem(const QString &pattern) const; bool isShowOnlyHistory() const { return mOnlyHistory; } @@ -88,6 +88,10 @@ public: 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); } diff --git a/configuredialog/configuredialog.cpp b/configuredialog/configuredialog.cpp index b9f7c06..6d4e6a7 100644 --- a/configuredialog/configuredialog.cpp +++ b/configuredialog/configuredialog.cpp @@ -81,7 +81,9 @@ ConfigureDialog::ConfigureDialog(QSettings *settings, const QString &defaultShor settingsChanged(); - connect(ui->historyCb, &QAbstractButton::toggled, [this] (bool checked) { mSettings->setValue("dialog/history_first", checked); }); + 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); }); } @@ -97,7 +99,11 @@ void ConfigureDialog::settingsChanged() ui->monitorCbx->setCurrentIndex(mSettings->value("dialog/monitor", -1).toInt() + 1); ui->shortcutEd->setText(mSettings->value("dialog/shortcut", "Alt+F2").toString()); - ui->historyCb->setChecked(mSettings->value("dialog/history_first", true).toBool()); + 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()); } diff --git a/configuredialog/configuredialog.ui b/configuredialog/configuredialog.ui index 0ac88fc..3ca1b59 100644 --- a/configuredialog/configuredialog.ui +++ b/configuredialog/configuredialog.ui @@ -7,7 +7,7 @@ 0 0 312 - 222 + 278 @@ -40,13 +40,40 @@ - - + + 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 + + + @@ -160,5 +187,21 @@ + + historyUseCb + toggled(bool) + historyFirstCb + setEnabled(bool) + + + 155 + 114 + + + 155 + 143 + + + diff --git a/debian/changelog b/debian/changelog index ac9ba7a..49e927d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +lxqt-runner (0.12.0-1) experimental; urgency=medium + + * Cherry-picking upstream release 0.12.0. + * Switched to experimental + * Bumped liblxqt0-dev to >= 0.12.0 + * Bumped liblxqt-globalkeys0-dev to >= 0.12.0 + * Bumped liblxqt-globalkeys-ui0-dev to >= 0.12.0 + * Bumped Standards to 4.1.1 - no changes needed + + -- Alf Gaida Tue, 24 Oct 2017 22:48:02 +0200 + lxqt-runner (0.11.1-2) unstable; urgency=medium * Bumped Standards to 4.0.0 - no changes needed diff --git a/debian/control b/debian/control index 01a0c0d..e08ada8 100644 --- a/debian/control +++ b/debian/control @@ -6,18 +6,18 @@ Section: x11 Priority: optional Build-Depends: debhelper (>= 10), libkf5windowsystem-dev, - liblxqt0-dev (>= 0.11.1), - liblxqt-globalkeys0-dev (>= 0.11.1), - liblxqt-globalkeys-ui0-dev (>= 0.11.1), + liblxqt0-dev (>= 0.12.0), + liblxqt-globalkeys0-dev (>= 0.12.0), + liblxqt-globalkeys-ui0-dev (>= 0.12.0), libmenu-cache-dev, libmuparser-dev, libqt5svg5-dev, libqt5x11extras5-dev, libx11-dev, qtbase5-private-dev -Standards-Version: 4.0.0 -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/lxqt-runner.git/?h=debian/sid -Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/lxqt-runner.git -b debian/sid +Standards-Version: 4.1.1 +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/lxqt-runner.git/?h=debian/experimental +Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/lxqt-runner.git -b debian/experimental Homepage: https://github.com/lxde/lxqt-runner Package: lxqt-runner diff --git a/dialog.cpp b/dialog.cpp index aa23e68..76a1d60 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -80,7 +80,7 @@ Dialog::Dialog(QWidget *parent) : connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand())); - mCommandItemModel = new CommandItemModel(this); + mCommandItemModel = new CommandItemModel(mSettings->value("dialog/history_use", true).toBool(), this); ui->commandList->installEventFilter(this); ui->commandList->setModel(mCommandItemModel); ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers); @@ -356,7 +356,9 @@ void Dialog::applySettings() 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(); diff --git a/dialog.ui b/dialog.ui index cea0b5d..e8eaa17 100644 --- a/dialog.ui +++ b/dialog.ui @@ -151,10 +151,13 @@ - + Qt::ScrollBarAlwaysOff + + QAbstractScrollArea::AdjustToContents + true @@ -170,6 +173,11 @@
widgets.h
1 + + MyListView + QListView +
mylistview.h
+
closeButton diff --git a/main.cpp b/main.cpp index 9177f5a..0325cf0 100644 --- a/main.cpp +++ b/main.cpp @@ -27,6 +27,9 @@ #include + +#include + #include "dialog.h" @@ -34,6 +37,17 @@ 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); diff --git a/mylistview.h b/mylistview.h new file mode 100644 index 0000000..09549ea --- /dev/null +++ b/mylistview.h @@ -0,0 +1,65 @@ +/* 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 index 3daad5b..35cedfc 100644 --- a/providers.cpp +++ b/providers.cpp @@ -810,7 +810,7 @@ static void muParserInitLocale() { MathItem::Parser::initLocale(); } -Q_COREAPP_STARTUP_FUNCTION(muParserInitLocale); +Q_COREAPP_STARTUP_FUNCTION(muParserInitLocale) /************************************************ From 2f0b0fdc5a30c643bbad2e943c584927fd6180d5 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Tue, 24 Oct 2017 22:48:46 +0200 Subject: [PATCH 2/3] Cherry-picking upstream release 0.12.0. * Switched to experimental * Bumped liblxqt0-dev to >= 0.12.0 * Bumped liblxqt-globalkeys0-dev to >= 0.12.0 * Bumped liblxqt-globalkeys-ui0-dev to >= 0.12.0 * Bumped Standards to 4.1.1 - no changes needed --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 49e927d..31107eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,7 @@ lxqt-runner (0.12.0-1) experimental; urgency=medium * Bumped liblxqt-globalkeys-ui0-dev to >= 0.12.0 * Bumped Standards to 4.1.1 - no changes needed - -- Alf Gaida Tue, 24 Oct 2017 22:48:02 +0200 + -- Alf Gaida Tue, 24 Oct 2017 22:48:40 +0200 lxqt-runner (0.11.1-2) unstable; urgency=medium From aa5ad481b73d7d5ac150a7b18bd0d70be595ba1a Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Fri, 27 Oct 2017 22:44:45 +0200 Subject: [PATCH 3/3] Added missed breaks and replaces for lxqt-common << 0.12.0 * (Closes: #879912) - Thanks Andreas Beckmann --- debian/changelog | 7 +++++++ debian/control | 2 ++ 2 files changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index 31107eb..7f3b777 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +lxqt-runner (0.12.0-2) experimental; urgency=medium + + * Added missed breaks and replaces for lxqt-common << 0.12.0 + (Closes: #879912) - Thanks Andreas Beckmann + + -- Alf Gaida Fri, 27 Oct 2017 22:44:36 +0200 + lxqt-runner (0.12.0-1) experimental; urgency=medium * Cherry-picking upstream release 0.12.0. diff --git a/debian/control b/debian/control index e08ada8..5b8ba65 100644 --- a/debian/control +++ b/debian/control @@ -29,6 +29,8 @@ Recommends: lxqt-runner-l10n, lxqt-qtplugin, lxqt-session Suggests: lxqt | lxqt-core +Breaks: lxqt-common (<< 0.12.0) +Replaces: lxqt-common (<< 0.12.0) Description: LXQt program launcher Tool used to launch programs quickly by typing their names .