From 9e6a7f76bddb08d391422722791b7d94f67d39bc Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Mon, 4 Dec 2017 18:29:52 +0100 Subject: [PATCH] Fix App Opener widget --- src/capture/tools/linetool.cpp | 1 + src/capture/tools/markertool.cpp | 1 + src/capture/workers/launcher/applauncherwidget.cpp | 1 + .../workers/launcher/launcheritemdelegate.cpp | 2 +- src/utils/desktopfileparse.cpp | 12 ++++++++++-- src/utils/desktopfileparse.h | 2 ++ 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/capture/tools/linetool.cpp b/src/capture/tools/linetool.cpp index 24af58d5..42503bf0 100644 --- a/src/capture/tools/linetool.cpp +++ b/src/capture/tools/linetool.cpp @@ -66,6 +66,7 @@ void LineTool::processImage( void LineTool::onPressed() { } +// Have to force horizontal position bool LineTool::needsAdjustment(const QPoint &p0, const QPoint &p1) const { return (p1.y() >= p0.y() - ADJ_VALUE) && (p1.y() <= p0.y() + ADJ_VALUE); } diff --git a/src/capture/tools/markertool.cpp b/src/capture/tools/markertool.cpp index bb9aad05..c84fd770 100644 --- a/src/capture/tools/markertool.cpp +++ b/src/capture/tools/markertool.cpp @@ -68,6 +68,7 @@ void MarkerTool::processImage( void MarkerTool::onPressed() { } +// Have to force horizontal position bool MarkerTool::needsAdjustment(const QPoint &p0, const QPoint &p1) const { return (p1.y() >= p0.y() - ADJ_VALUE) && (p1.y() <= p0.y() + ADJ_VALUE); } diff --git a/src/capture/workers/launcher/applauncherwidget.cpp b/src/capture/workers/launcher/applauncherwidget.cpp index 0d145871..20a5ee28 100644 --- a/src/capture/workers/launcher/applauncherwidget.cpp +++ b/src/capture/workers/launcher/applauncherwidget.cpp @@ -68,6 +68,7 @@ AppLauncherWidget::AppLauncherWidget(const QPixmap &p, QWidget *parent): listView->setSpacing(4); listView->setFlow(QListView::LeftToRight); listView->setDragEnabled(false); + listView->setMinimumSize(375, 210); for (auto app: appList) { QListWidgetItem *buttonItem = new QListWidgetItem(listView); diff --git a/src/capture/workers/launcher/launcheritemdelegate.cpp b/src/capture/workers/launcher/launcheritemdelegate.cpp index 721abd70..9a88863b 100644 --- a/src/capture/workers/launcher/launcheritemdelegate.cpp +++ b/src/capture/workers/launcher/launcheritemdelegate.cpp @@ -59,5 +59,5 @@ QSize launcherItemDelegate::sizeHint( { Q_UNUSED(option); Q_UNUSED(index); - return QSize(100, 100); + return QSize(110, 115); } diff --git a/src/utils/desktopfileparse.cpp b/src/utils/desktopfileparse.cpp index 9a92b2e6..7d02d78f 100644 --- a/src/utils/desktopfileparse.cpp +++ b/src/utils/desktopfileparse.cpp @@ -23,8 +23,12 @@ DesktopFileParse::DesktopFileParse() { QString locale = QLocale().name(); + QString localeShort = QLocale().name().left(2); m_localeName = QString("Name[%1]").arg(locale); m_localeDescription = QString("Comment[%1]").arg(locale); + m_localeNameShort = QString("Name[%1]").arg(localeShort); + m_localeDescriptionShort = QString("Comment[%1]") + .arg(localeShort); } DesktopAppData DesktopFileParse::parseDesktopFile( @@ -49,7 +53,9 @@ DesktopAppData DesktopFileParse::parseDesktopFile( line.mid(line.indexOf("=")+1).trimmed()); } else if (!nameLocaleSet && line.startsWith("Name")) { - if (line.startsWith(m_localeName)) { + if (line.startsWith(m_localeName) || + line.startsWith(m_localeNameShort)) + { res.name = line.mid(line.indexOf("=")+1).trimmed(); nameLocaleSet = true; } else if (line.startsWith("Name=")) { @@ -57,7 +63,9 @@ DesktopAppData DesktopFileParse::parseDesktopFile( } } else if (!descriptionLocaleSet && line.startsWith("Comment")) { - if (line.startsWith(m_localeName)) { + if (line.startsWith(m_localeDescription) || + line.startsWith(m_localeDescriptionShort)) + { res.description = line.mid(line.indexOf("=")+1).trimmed(); descriptionLocaleSet = true; } else if (line.startsWith("Comment=")) { diff --git a/src/utils/desktopfileparse.h b/src/utils/desktopfileparse.h index 8823c764..abac73b2 100644 --- a/src/utils/desktopfileparse.h +++ b/src/utils/desktopfileparse.h @@ -38,6 +38,8 @@ struct DesktopFileParse { private: QString m_localeName; QString m_localeDescription; + QString m_localeNameShort; + QString m_localeDescriptionShort; };