diff --git a/cuttlefish/package/contents/ui/cuttlefish.qml b/cuttlefish/package/contents/ui/cuttlefish.qml index fc8fea4..0a7e2ab 100644 --- a/cuttlefish/package/contents/ui/cuttlefish.qml +++ b/cuttlefish/package/contents/ui/cuttlefish.qml @@ -1,95 +1,100 @@ /*************************************************************************** * * * Copyright 2014-2015 Sebastian Kügler * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * * ***************************************************************************/ -import QtQuick 2.1 +import QtQuick 2.5 import QtQuick.Layouts 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras Item { id: cuttlefish objectName: "cuttlefish" width: units.gridUnit * 60 height: Math.round(width / 3 * 2) property int iconSize: units.iconSizes.large property bool hoveredHighlight: false property bool darkScheme: false property bool usesPlasmaTheme: true function indexToSize(ix) { var sizes = new Array(); sizes[0] = units.iconSizes.tiny; sizes[1] = units.iconSizes.small; sizes[2] = units.iconSizes.smallMedium; sizes[3] = units.iconSizes.medium; sizes[4] = units.iconSizes.large; sizes[5] = units.iconSizes.huge; sizes[6] = units.iconSizes.enormous; return sizes[ix]; } PlasmaCore.ColorScope { anchors.fill: parent colorGroup: darkScheme ? PlasmaCore.Theme.ComplementaryColorGroup : PlasmaCore.Theme.NormalColorGroup Rectangle { color: PlasmaCore.ColorScope.backgroundColor anchors.fill: parent } GridLayout { columns: 2 anchors.fill: parent rowSpacing: - Math.round(units.gridUnit / 20) Tools { Layout.columnSpan: 2 Layout.fillWidth: true Layout.preferredHeight: units.gridUnit * 2 } PlasmaExtras.ScrollArea { Layout.fillWidth: true Layout.fillHeight: true IconGrid { id: iconGrid anchors.fill: parent footer: SvgGrid { id: svgGrid interactive: false } } } Preview { id: preview Layout.preferredWidth: Math.max(parent.width / 4, units.gridUnit * 12) Layout.fillHeight: true } } } + + Shortcut { + sequence: StandardKey.Quit + onActivated: Qt.quit() + } } diff --git a/cuttlefish/src/main.cpp b/cuttlefish/src/main.cpp index dce86b0..f72e3ae 100644 --- a/cuttlefish/src/main.cpp +++ b/cuttlefish/src/main.cpp @@ -1,72 +1,75 @@ /*************************************************************************** * * * Copyright 2014 Sebastian Kügler * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ // Qt #include #include #include #include +#include // Frameworks #include #include #include // Own #include "view.h" int main(int argc, char **argv) { QApplication app(argc, argv); KLocalizedString::setApplicationDomain("cuttlefish"); app.setApplicationVersion(PROJECT_VERSION); const static auto _category = QStringLiteral("category"); QCommandLineOption category = QCommandLineOption(QStringList() << QStringLiteral("c") << _category, i18n("Start with category"), i18n("category")); const static auto _f = QStringLiteral("fullscreen"); QCommandLineOption fullscreen = QCommandLineOption(QStringList() << QStringLiteral("f") << _f, i18n("Start full-screen")); const static auto _p = QStringLiteral("picker"); QCommandLineOption picker = QCommandLineOption(QStringList() << QStringLiteral("p") << _p, i18n("Run in icon-picker mode")); QCommandLineParser parser; parser.addVersionOption(); parser.setApplicationDescription("Cuttlefish Icon Browser"); parser.addHelpOption(); parser.addOption(category); parser.addOption(fullscreen); parser.addOption(picker); parser.process(app); QString _cc = parser.value(category); auto settingsapp = new CuttleFish::View(_cc, parser); + QObject::connect(settingsapp->engine(), &QQmlEngine::quit, &app, &QApplication::quit); + if (parser.isSet(fullscreen)) { settingsapp->setVisibility(QWindow::FullScreen); } return app.exec(); }