imported upstream version 0.12.0

ubuntu/cosmic
Alf Gaida 7 years ago
parent 0fb88adb6f
commit 447d2aa4d1

@ -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+ and BSD-3-clause
The full text of the LGPL-2.1+ licenses can be found in the 'COPYING' file.

@ -1,7 +1,30 @@
liblxqt-0.11.1 / 2017-01-01
liblxqt-0.12.0 / 2017-10-21
===========================
* Bump minimum qtxdg version to 3.1.0
* Don't export github templates
* Bump version and needed versions to the final values
* lxqtpower: Allow disabling of lxqt-session provider
* Drops Qt5Core_VERSION_STRING
* HtmlDelegate: Fix sizeHint() computation
* Add some comments about the meaning of versions
* Move LXQt version back to liblxqt
* Fixes (#118)
* lxqtapplication: Avoid wrong signal handling
* Removes unneeded semicolon in namespace definition
* Fix format conversions [-Wformat-pedantic] warnings
* Suppress compiler warnings about unused function parameters
* Removes extra semicolons in Qt's Q macros
* Translator: Prefer XDG_DATA_DIRS over compiled in path
* Help the compiler optimizing loops
* Use const variables where possible
* Update AUTHORS
0.11.1 / 2017-01-01
===================
* Release 0.11.1: Update changelog
* Bump needed build tools version (#113)
* build: Enable/disable WITH_XDG_DIRS_FALLBACK based on Qt version (#111)
* Updates lxqt-build-tools required version

@ -2,9 +2,25 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(liblxqt)
set(QT_MINIMUM_VERSION "5.4.2")
set(QTXDG_MINIMUM_VERSION "2.0.0")
set(LXQTBT_MINIMUM_VERSION "0.3.1")
set(QT_MINIMUM_VERSION "5.5.0")
set(QTXDG_MINIMUM_VERSION "3.1.0")
set(LXQTBT_MINIMUM_VERSION "0.4.0")
# Major LXQt Version, belong to all components
set(LXQT_MAJOR_VERSION 0)
# Minor LXQt Version, belong to all components
set(LXQT_MINOR_VERSION 12)
#
# Patch Version, belong *only* to the component
# LXQt is 0.11 - liblxqt is at patch version 1
# The official LXQt version will follow liblxqt.
#
# In a perfect world all components would have the same major- and minor- and
# patch-version as liblxqt - in real life it will be fine if every component
# has it's own patch version within a major/minor life cyle.
#
set(LXQT_PATCH_VERSION 0)
set(LXQT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PATCH_VERSION})
include(CMakePackageConfigHelpers)
include(GNUInstallDirs) # Standard directories for installation
@ -118,7 +134,7 @@ find_package(X11 REQUIRED QUIET)
find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Widgets DBus X11Extras LinguistTools)
find_package(Qt5Xdg ${QTXDG_MINIMUM_VERSION} REQUIRED)
find_package(KF5WindowSystem REQUIRED QUIET)
message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION_STRING}")
message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION}")
QT5_ADD_DBUS_INTERFACE(SRCS
dbus/org.freedesktop.Notifications.xml

@ -17,6 +17,18 @@ find_dependency(KF5WindowSystem)
find_dependency(lxqt-build-tools @LXQTBT_MINIMUM_VERSION@)
include(LXQtConfigVars)
# - Set version informations
set(LXQT_MAJOR_VERSION "@LXQT_MAJOR_VERSION@")
set(LXQT_MINOR_VERSION "@LXQT_MINOR_VERSION@")
set(LXQT_PATCH_VERSION "@LXQT_PATCH_VERSION@")
set(LXQT_VERSION "@LXQT_VERSION@")
add_definitions("-DLXQT_MAJOR_VERSION=\"${LXQT_MAJOR_VERSION}\"")
add_definitions("-DLXQT_MINOR_VERSION=\"${LXQT_MINOR_VERSION}\"")
add_definitions("-DLXQT_PATCH_VERSION=\"${LXQT_PATCH_VERSION}\"")
add_definitions("-DLXQT_VERSION=\"${LXQT_VERSION}\"")
if (NOT TARGET @LXQT_LIBRARY_NAME@)
if (POLICY CMP0024)
cmake_policy(SET CMP0024 NEW)

@ -112,6 +112,7 @@ bool ConfigDialog::event(QEvent * event)
void ConfigDialog::closeEvent(QCloseEvent* event)
{
Q_UNUSED(event)
emit save();
mSettings->sync();
}

@ -57,6 +57,7 @@ variable LXQT_DEBUG set
*/
void dbgMessageOutput(QtMsgType type, const QMessageLogContext &ctx, const QString & msgStr)
{
Q_UNUSED(ctx)
QByteArray msgBuf = msgStr.toUtf8();
const char* msg = msgBuf.constData();
QDir dir(XdgDirs::configHome().toUtf8() + QLatin1String("/lxqt"));
@ -84,12 +85,12 @@ void dbgMessageOutput(QtMsgType type, const QMessageLogContext &ctx, const QStri
QByteArray dt = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toUtf8();
if (isatty(STDERR_FILENO))
fprintf(stderr, "%s %s(%p) %s: %s%s\n", color, QAPP_NAME, qApp, typestr, msg, COLOR_RESET);
fprintf(stderr, "%s %s(%p) %s: %s%s\n", color, QAPP_NAME, static_cast<void *>(qApp), typestr, msg, COLOR_RESET);
else
fprintf(stderr, "%s(%p) %s: %s\n", QAPP_NAME, qApp, typestr, msg);
fprintf(stderr, "%s(%p) %s: %s\n", QAPP_NAME, static_cast<void *>(qApp), typestr, msg);
FILE *f = fopen(dir.absoluteFilePath("debug.log").toUtf8().constData(), "a+");
fprintf(f, "%s %s(%p) %s: %s\n", dt.constData(), QAPP_NAME, qApp, typestr, msg);
fprintf(f, "%s %s(%p) %s: %s\n", dt.constData(), QAPP_NAME, static_cast<void *>(qApp), typestr, msg);
fclose(f);
if (type == QtFatalMsg)
@ -102,7 +103,7 @@ Application::Application(int &argc, char** argv)
#ifdef DEBUG
qInstallMessageHandler(dbgMessageOutput);
#else
if (!qgetenv("LXQT_DEBUG").isNull())
if (!qEnvironmentVariableIsSet("LXQT_DEBUG"))
qInstallMessageHandler(dbgMessageOutput);
#endif
@ -128,7 +129,7 @@ Application::Application(int &argc, char** argv, bool handleQuitSignals)
void Application::updateTheme()
{
QString styleSheetKey = QFileInfo(applicationFilePath()).fileName();
const QString styleSheetKey = QFileInfo(applicationFilePath()).fileName();
setStyleSheet(lxqtTheme.qss(styleSheetKey));
emit themeChanged();
}
@ -140,14 +141,14 @@ namespace
public:
static void signalHandler(int signo)
{
int ret = write(instance->mSignalSock[0], &signo, sizeof (int));
const int ret = write(instance->mSignalSock[0], &signo, sizeof (int));
if (sizeof (int) != ret)
qCritical() << QStringLiteral("unable to write into socketpair, %1").arg(strerror(errno));
}
public:
template <class Lambda>
SignalHandler(Lambda signalEmitter)
SignalHandler(Application * app, Lambda signalEmitter)
: mSignalSock{-1, -1}
{
if (0 != socketpair(AF_UNIX, SOCK_STREAM, 0, mSignalSock))
@ -157,7 +158,7 @@ namespace
}
mNotifier.reset(new QSocketNotifier(mSignalSock[1], QSocketNotifier::Read));
QObject::connect(mNotifier.data(), &QSocketNotifier::activated, [this, signalEmitter] {
QObject::connect(mNotifier.data(), &QSocketNotifier::activated, app, [this, signalEmitter] {
int signo = 0;
int ret = read(mSignalSock[1], &signo, sizeof (int));
if (sizeof (int) != ret)
@ -198,6 +199,6 @@ void Application::listenToUnixSignals(QList<int> const & signoList)
static QScopedPointer<QSocketNotifier> signal_notifier;
if (SignalHandler::instance.isNull())
SignalHandler::instance.reset(new SignalHandler{[this] (int signo) { emit unixSignal(signo); }});
SignalHandler::instance.reset(new SignalHandler{this, [this] (int signo) { emit unixSignal(signo); }});
SignalHandler::instance->listenToSignals(signoList);
}

@ -38,9 +38,10 @@ AutostartEntry::AutostartEntry() :
AutostartEntry::AutostartEntry(const QString& name):
mLocalState(StateNone), mSystem(false)
{
foreach (const QString& dir, XdgDirs::autostartDirs())
const QStringList& dirs = XdgDirs::autostartDirs();
foreach (const QString& dir, dirs)
{
QString path = QString("%1/%2").arg(dir, name);
const QString path = QString("%1/%2").arg(dir, name);
if (QFile(path).exists())
{
mSystemFile.load(path);
@ -49,7 +50,7 @@ AutostartEntry::AutostartEntry(const QString& name):
}
}
QString path = QString("%1/%2").arg(XdgDirs::autostartHome(), name);
const QString path = QString("%1/%2").arg(XdgDirs::autostartHome(), name);
if (QFile(path).exists())
{
mLocalFile.load(path);
@ -59,7 +60,7 @@ AutostartEntry::AutostartEntry(const QString& name):
void AutostartEntry::setFile(const XdgDesktopFile& file)
{
bool local = isLocal();
const bool local = isLocal();
if (mSystem && local && file == mSystemFile)
{
removeLocal();

@ -131,7 +131,8 @@ void GridLayoutPrivate::updateCache()
mCellMaxSize = QSize(0, 0);
mVisibleCount = 0;
for (int i=0; i<mItems.count(); ++i)
const int N = mItems.count();
for (int i=0; i < N; ++i)
{
QLayoutItem *item = mItems.at(i);
if (!item->widget() || item->widget()->isHidden())

@ -65,7 +65,7 @@ void HtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
options.icon = QIcon();
// icon size
QSize iconSize = icon.actualSize(mIconSize);
const QSize iconSize = icon.actualSize(mIconSize);
QRect iconRect = QRect(8, 8, iconSize.width(), iconSize.height());
if (is_right_to_left)
{
@ -86,7 +86,7 @@ void HtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
// shift text right to make icon visible
painter->translate(iconRect.right() + 8, 0);
}
QRect clip(0, 0, options.rect.width() - iconRect.width() - 8, options.rect.height());
const QRect clip(0, 0, options.rect.width() - iconRect.width() - 8, options.rect.height());
painter->setClipRect(clip);
// set text color to red for selected item
@ -112,11 +112,16 @@ QSize HtmlDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelInd
QStyleOptionViewItem options = option;
initStyleOption(&options, index);
QSize iconSize = options.icon.actualSize(mIconSize);
QRect iconRect = QRect(8, 8, iconSize.width(), iconSize.height());
const QSize iconSize = options.icon.actualSize(mIconSize);
const QRect iconRect = QRect(8, 8, iconSize.width(), iconSize.height());
const QSize optSize = options.rect.size();
QTextDocument doc;
doc.setHtml(options.text);
doc.setTextWidth(options.rect.width() - iconRect.right() - 8);
return QSize(options.rect.width(), doc.size().height() + 8);
if (optSize.width() > 0)
doc.setTextWidth(optSize.width() - iconRect.right() - 8);
doc.adjustSize();
return QSize(0 < optSize.width() ? optSize.width() : iconRect.width() + 8 + qRound(doc.size().width())
, qMax(qRound(doc.size().height()), iconSize.height()) + 8);
}

@ -158,7 +158,8 @@ void NotificationPrivate::setActions(QStringList actions, int defaultAction)
{
mActions.clear();
mDefaultAction = defaultAction;
for (int ix = 0; ix < actions.size(); ix++)
const int N = actions.size();
for (int ix = 0; ix < N; ix++)
{
if (ix == defaultAction)
mActions.append("default");

@ -72,12 +72,11 @@ bool PluginInfo::isValid() const
************************************************/
QLibrary* PluginInfo::loadLibrary(const QString& libDir) const
{
QString baseName, path;
QFileInfo fi = QFileInfo(fileName());
path = fi.canonicalPath();
baseName = value("X-LXQt-Library", fi.completeBaseName()).toString();
const QFileInfo fi = QFileInfo(fileName());
const QString path = fi.canonicalPath();
const QString baseName = value("X-LXQt-Library", fi.completeBaseName()).toString();
QString soPath = QDir(libDir).filePath(QString("lib%2.so").arg(baseName));
const QString soPath = QDir(libDir).filePath(QString("lib%2.so").arg(baseName));
QLibrary* library = new QLibrary(soPath);
if (!library->load())
@ -87,7 +86,7 @@ QLibrary* PluginInfo::loadLibrary(const QString& libDir) const
return 0;
}
QString locale = QLocale::system().name();
const QString locale = QLocale::system().name();
QTranslator* translator = new QTranslator(library);
translator->load(QString("%1/%2/%2_%3.qm").arg(path, baseName, locale));
@ -107,8 +106,8 @@ PluginInfoList PluginInfo::search(const QStringList& desktopFilesDirs, const QSt
foreach (const QString &desktopFilesDir, desktopFilesDirs)
{
QDir dir(desktopFilesDir);
QFileInfoList files = dir.entryInfoList(QStringList(nameFilter), QDir::Files | QDir::Readable);
const QDir dir(desktopFilesDir);
const QFileInfoList files = dir.entryInfoList(QStringList(nameFilter), QDir::Files | QDir::Readable);
foreach (const QFileInfo &file, files)
{
if (processed.contains(file.fileName()))

@ -33,15 +33,21 @@
using namespace LXQt;
Power::Power(QObject *parent) :
Power::Power(bool useLxqtSessionProvider, QObject * parent /*= nullptr*/) :
QObject(parent)
{
mProviders.append(new CustomProvider(this));
if (useLxqtSessionProvider)
mProviders.append(new LXQtProvider(this));
mProviders.append(new SystemdProvider(this));
mProviders.append(new UPowerProvider(this));
mProviders.append(new ConsoleKitProvider(this));
mProviders.append(new LxSessionProvider(this));
mProviders.append(new LXQtProvider(this));
}
Power::Power(QObject * parent /*= nullptr*/)
: Power(true, parent)
{
}

@ -56,8 +56,16 @@ public:
PowerSuspend /// Suspend the computer
};
/// Constructs a Power with parent.
explicit Power(QObject *parent = 0);
/*!
* Constructs the Power object.
* \param useLxqtSessionProvider indicates if the DBus methods
* provided by lxqt-session should be considered. This is useful to
* avoid recursion if the lxqt-session wants to provide some of the
* methods by itself with internal use of this object.
*/
explicit Power(bool useLxqtSessionProvider, QObject *parent = nullptr);
/// Constructs a Power with using the lxqt-session provider.
explicit Power(QObject *parent = nullptr);
/// Destroys the object.
virtual ~Power();

@ -107,8 +107,8 @@ static bool dbusCall(const QString &service,
// If the method no returns value, we believe that it was successful.
return msg.arguments().isEmpty() ||
msg.arguments().first().isNull() ||
msg.arguments().first().toBool();
msg.arguments().constFirst().isNull() ||
msg.arguments().constFirst().toBool();
}
/************************************************
@ -156,10 +156,10 @@ static bool dbusCallSystemd(const QString &service,
}
// If the method no returns value, we believe that it was successful.
if (msg.arguments().isEmpty() || msg.arguments().first().isNull())
if (msg.arguments().isEmpty() || msg.arguments().constFirst().isNull())
return true;
QString response = msg.arguments().first().toString();
QString response = msg.arguments().constFirst().toString();
qDebug() << "systemd:" << method << "=" << response;
return response == "yes" || response == "challenge";
}
@ -199,7 +199,7 @@ bool dbusGetProperty(const QString &service,
}
return !msg.arguments().isEmpty() &&
msg.arguments().first().value<QDBusVariant>().variant().toBool();
msg.arguments().constFirst().value<QDBusVariant>().variant().toBool();
}
@ -500,31 +500,45 @@ LXQtProvider::~LXQtProvider()
bool LXQtProvider::canAction(Power::Action action) const
{
QString command;
switch (action)
{
case Power::PowerLogout:
// there can be case when razo-session does not run
return dbusCall(LXQT_SERVICE, LXQT_PATH, LXQT_SERVICE,
QDBusConnection::sessionBus(), "canLogout",
PowerProvider::DontCheckDBUS);
command = "canLogout";
break;
case Power::PowerReboot:
command = "canReboot";
break;
case Power::PowerShutdown:
command = "canPowerOff";
break;
default:
return false;
}
// there can be case when lxqtsession-session does not run
return dbusCall(LXQT_SERVICE, LXQT_PATH, LXQT_SERVICE,
QDBusConnection::sessionBus(), command,
PowerProvider::DontCheckDBUS);
}
bool LXQtProvider::doAction(Power::Action action)
{
QString command;
switch (action)
{
case Power::PowerLogout:
command = "logout";
break;
default:
return false;
case Power::PowerLogout:
command = "logout";
break;
case Power::PowerReboot:
command = "reboot";
break;
case Power::PowerShutdown:
command = "powerOff";
break;
default:
return false;
}
return dbusCall(LXQT_SERVICE,
@ -594,12 +608,14 @@ HalProvider::~HalProvider()
bool HalProvider::canAction(Power::Action action) const
{
Q_UNUSED(action)
return false;
}
bool HalProvider::doAction(Power::Action action)
{
Q_UNUSED(action)
return false;
}

@ -41,14 +41,14 @@ namespace LXQt {
class LXQT_API MessageBox: public QMessageBox
{
Q_DECLARE_TR_FUNCTIONS(LXQt::MessageBox);
Q_DECLARE_TR_FUNCTIONS(LXQt::MessageBox)
public:
explicit MessageBox(QWidget *parent = 0): QMessageBox(parent) {}
static QWidget *parentWidget()
{
QWidgetList widgets = QApplication::topLevelWidgets();
const QWidgetList widgets = QApplication::topLevelWidgets();
if (widgets.count())
return widgets.at(0);
@ -69,6 +69,8 @@ public:
static void warning(const QString& title, const QString& text)
{
Q_UNUSED(title)
Q_UNUSED(text)
QMessageBox::warning(parentWidget(), tr("LXQt Power Manager Error"), tr("Hibernate failed."));
}
@ -76,7 +78,8 @@ public:
protected:
virtual void resizeEvent(QResizeEvent* event)
{
QRect screen = QApplication::desktop()->screenGeometry();
Q_UNUSED(event)
const QRect screen = QApplication::desktop()->screenGeometry();
move((screen.width() - this->width()) / 2,
(screen.height() - this->height()) / 2);

@ -31,17 +31,17 @@ using namespace LXQt;
LXQT_API bool ProgramFinder::programExists(const QString& command)
{
QString program = programName(command);
const QString program = programName(command);
if (program[0] == QChar('/'))
{
QFileInfo fi(program);
return fi.isExecutable() && fi.isFile();
}
QString path = qgetenv("PATH");
const QString path = qgetenv("PATH");
foreach (const QString& dirName, path.split(":", QString::SkipEmptyParts))
{
QFileInfo fi(QDir(dirName), program);
const QFileInfo fi(QDir(dirName), program);
if (fi.isExecutable() && fi.isFile())
return true;
}

@ -90,7 +90,7 @@ void RotatedWidget::adjustContentSize()
{
mContent->adjustSize();
QSize before = size();
const QSize before = size();
adjustSize();
@ -147,7 +147,7 @@ void RotatedWidget::paintEvent(QPaintEvent */*event*/)
if (mOrigin == Qt::TopLeftCorner)
return;
QSize sz = mContent->size();
const QSize sz = mContent->size();
QPainter painter(this);

@ -124,7 +124,7 @@ static bool GetIntArrayProperty(XID window,
class ScreenSaverPrivate
{
Q_DECLARE_TR_FUNCTIONS(LXQt::ScreenSaver);
Q_DECLARE_TR_FUNCTIONS(LXQt::ScreenSaver)
Q_DECLARE_PUBLIC(ScreenSaver)
ScreenSaver* const q_ptr;
@ -141,6 +141,7 @@ void ScreenSaverPrivate::_l_xdgProcess_finished(int err, QProcess::ExitStatus st
{
// http://portland.freedesktop.org/xdg-utils-1.1.0-rc1/scripts/xdg-screensaver
Q_UNUSED(status)
Q_Q(ScreenSaver);
if (err == 0)
emit q->activated();

@ -80,7 +80,8 @@ public:
if (dir.cd(mParent->organizationName()) && dir.exists(file_name))
{
QSettings system_settings{dir.absoluteFilePath(file_name), QSettings::IniFormat};
for (const QString & key : system_settings.allKeys())
const QStringList keys = system_settings.allKeys();
for (const QString & key : keys)
{
mParent->setValue(key, system_settings.value(key));
}

@ -77,7 +77,6 @@ namespace LXQt {
class LXQT_API SingleApplication : public Application {
Q_OBJECT
Q_ENUMS(StartOptions)
public:
/*!
@ -101,6 +100,7 @@ public:
/** Don't exit if the connection to the D-Bus session bus fails.*/
NoExitOnDBusFailure
};
Q_ENUM(StartOptions)
/*!
* \brief Construct a LXQt SingleApplication object.
@ -153,6 +153,6 @@ private:
#endif
#define lxqtSingleApp (static_cast<LXQt::SingleApplication *>(qApp))
}; // namespace LXQt
} // namespace LXQt
#endif // LXQTSINGLEAPPLICATION_H

@ -51,8 +51,8 @@ QStringList *getSearchPaths()
if (searchPath == 0)
{
searchPath = new QStringList();
*searchPath << QString(LXQT_SHARE_TRANSLATIONS_DIR);
*searchPath << XdgDirs::dataDirs(QLatin1Char('/') % LXQT_RELATIVE_SHARE_TRANSLATIONS_DIR);
*searchPath << QString(LXQT_SHARE_TRANSLATIONS_DIR);
searchPath->removeDuplicates();
}
@ -85,7 +85,7 @@ void Translator::setTranslationSearchPaths(const QStringList &paths)
************************************************/
bool translate(const QString &name, const QString &owner)
{
QString locale = QLocale::system().name();
const QString locale = QLocale::system().name();
QTranslator *appTranslator = new QTranslator(qApp);
QStringList *paths = getSearchPaths();
@ -132,7 +132,7 @@ bool translate(const QString &name, const QString &owner)
************************************************/
bool Translator::translateApplication(const QString &applicationName)
{
QString locale = QLocale::system().name();
const QString locale = QLocale::system().name();
QTranslator *qtTranslator = new QTranslator(qApp);
if (qtTranslator->load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
@ -170,7 +170,7 @@ bool Translator::translatePlugin(const QString &pluginName, const QString& type)
{
static QSet<QString> loadedPlugins;
QString fullName = type % QChar('/') % pluginName;
const QString fullName = type % QChar('/') % pluginName;
if (loadedPlugins.contains(fullName))
return true;

Loading…
Cancel
Save