Fix App Opener widget

This commit is contained in:
lupoDharkael
2017-12-04 18:29:52 +01:00
parent b0f385caf4
commit 9e6a7f76bd
6 changed files with 16 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -59,5 +59,5 @@ QSize launcherItemDelegate::sizeHint(
{
Q_UNUSED(option);
Q_UNUSED(index);
return QSize(100, 100);
return QSize(110, 115);
}

View File

@@ -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=")) {

View File

@@ -38,6 +38,8 @@ struct DesktopFileParse {
private:
QString m_localeName;
QString m_localeDescription;
QString m_localeNameShort;
QString m_localeDescriptionShort;
};