Commit 9e2ba24d authored by Alf Gaida's avatar Alf Gaida

Cherry-picking upstream version 0.12.0.

parent 9f70435f
......@@ -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.
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
......
......@@ -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)
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
)
[Desktop Entry]
Type=Application
Name=Runner
TryExec=lxqt-runner
Exec=lxqt-runner
OnlyShowIn=LXQt;
X-LXQt-Module=true
#TRANSLATIONS_DIR=translations
# Translations
Name[ar]=المُطْلِق
# Translations
Name[cs]=Spouštěč
# Translations
Name[cs_CZ]=Spouštěč
# Translations
Name[da]=Programstarter
# Translations
Name[de]=Anwendungsstarter
# Translations
Name[el]=Εκτελεστής
# Translations
Name[es]=Lanzador
# Translations
Name[es_VE]=Ejecutor
# Translations
Name[eu]=Abiarazlea
# Translations
Name[fi]=Käynnistin
# Translations
Name[hu]=Indító
# Translations
Name[ja]=ランナー
# Translations
Name[lt]=Paleidiklis
# Translations
Name[pt_BR]=Executor
# Translations
Name[ru]=бегунок
# Translations
Name[ru_RU]=Запускалка программ
# Translations
Name[sl]=Zaganjalnik
# Translations
Name[th_TH]=กล่องป้อนคำสั่ง
# Translations
Name[tr]=Çalıştırıcı
# Translations
Name[uk]=Запускач
# Translations
Name[zh_CN]=启动器
# Translations
Name[zh_TW]=快速執行
......@@ -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<HistoryProvider> 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();
}
......@@ -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); }
......
......@@ -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<void (QSpinBox::*)(int)>(&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());
}
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>312</width>
<height>222</height>
<height>278</height>
</rect>
</property>
<property name="windowTitle">
......@@ -40,13 +40,40 @@
<item row="1" column="1">
<widget class="QComboBox" name="monitorCbx"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="historyCb">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="historyFirstCb">
<property name="text">
<string>Show history first</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="historyUseCb">
<property name="text">
<string>Store/show history</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="toolTip">
<string>&lt;b&gt;Note&lt;/b&gt;: The size of top-level widgets are constrained to 2/3 of the desktop's height and width.</string>
</property>
<property name="text">
<string>Show list with:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="listShownItemsSB">
<property name="suffix">
<string> item(s)</string>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -160,5 +187,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>historyUseCb</sender>
<signal>toggled(bool)</signal>
<receiver>historyFirstCb</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>155</x>
<y>114</y>
</hint>
<hint type="destinationlabel">
<x>155</x>
<y>143</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -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();
......
......@@ -151,10 +151,13 @@
</widget>
</item>
<item>
<widget class="QListView" name="commandList">
<widget class="MyListView" name="commandList">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
......@@ -170,6 +173,11 @@
<header>widgets.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MyListView</class>
<extends>QListView</extends>
<header>mylistview.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>closeButton</tabstop>
......
......@@ -27,6 +27,9 @@
#include <LXQt/SingleApplication>
#include <QCommandLineParser>
#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);
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXQt - a lightweight, Qt based, desktop toolset
* http://lxqt.org
*
* Copyright: 2017 LXQt team
* Authors:
* Palo Kisa <palo.kisa@gmail.com>
*
* 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 <QListView>
#include <QDebug>
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
......@@ -810,7 +810,7 @@ static void muParserInitLocale()
{
MathItem::Parser::initLocale();
}
Q_COREAPP_STARTUP_FUNCTION(muParserInitLocale);
Q_COREAPP_STARTUP_FUNCTION(muParserInitLocale)
/************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment