diff --git a/kcms/colors/CMakeLists.txt b/kcms/colors/CMakeLists.txt --- a/kcms/colors/CMakeLists.txt +++ b/kcms/colors/CMakeLists.txt @@ -1,92 +1,99 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmcolors\") -set(scheme_editor_SRCS - kcolorschemeeditor.cpp - scmeditordialog.cpp - scmeditoroptions.cpp - scmeditorcolors.cpp - scmeditoreffects.cpp - previewwidget.cpp - setpreviewwidget.cpp - colorscm.cpp - ../krdb/krdb.cpp - ) - -set(klauncher_xml ${KINIT_DBUS_INTERFACES_DIR}/kf5_org.kde.KLauncher.xml) - -ki18n_wrap_ui(scheme_editor_SRCS - colorsettings.ui - scmeditordialog.ui - scmeditoroptions.ui - scmeditorcolors.ui - scmeditoreffects.ui - preview.ui - setpreview.ui - ) - -qt5_add_dbus_interface(scheme_editor_SRCS ${klauncher_xml} klauncher_iface) - -add_executable(kcolorschemeeditor ${scheme_editor_SRCS}) - -target_link_libraries(kcolorschemeeditor - KF5::KCMUtils - KF5::GuiAddons - KF5::I18n - KF5::KIOCore - KF5::CoreAddons - KF5::NewStuff - KF5::WindowSystem - ) -if(X11_FOUND) - target_link_libraries(kcolorschemeeditor ${X11_LIBRARIES} Qt5::X11Extras) -endif() -install(TARGETS kcolorschemeeditor DESTINATION ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -install(FILES org.kde.kcolorschemeeditor.desktop DESTINATION ${KDE_INSTALL_APPDIR}) +#set(scheme_editor_SRCS +# kcolorschemeeditor.cpp +# scmeditordialog.cpp +# scmeditoroptions.cpp +# scmeditorcolors.cpp +# scmeditoreffects.cpp +# previewwidget.cpp +# setpreviewwidget.cpp +# colorscm.cpp +# ../krdb/krdb.cpp +# ) +# +#set(klauncher_xml ${KINIT_DBUS_INTERFACES_DIR}/kf5_org.kde.KLauncher.xml) +# +#ki18n_wrap_ui(scheme_editor_SRCS +# colorsettings.ui +# scmeditordialog.ui +# scmeditoroptions.ui +# scmeditorcolors.ui +# scmeditoreffects.ui +# preview.ui +# setpreview.ui +# ) +# +#qt5_add_dbus_interface(scheme_editor_SRCS ${klauncher_xml} klauncher_iface) +# +#add_executable(kcolorschemeeditor ${scheme_editor_SRCS}) +# +#target_link_libraries(kcolorschemeeditor +# KF5::KCMUtils +# KF5::GuiAddons +# KF5::I18n +# KF5::KIOCore +# KF5::CoreAddons +# KF5::NewStuff +# KF5::WindowSystem +# ) +#if(X11_FOUND) +# target_link_libraries(kcolorschemeeditor ${X11_LIBRARIES} Qt5::X11Extras) +#endif() +#install(TARGETS kcolorschemeeditor DESTINATION ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) +#install(FILES org.kde.kcolorschemeeditor.desktop DESTINATION ${KDE_INSTALL_APPDIR}) # ---------------- set(kcm_colors_SRCS - ../krdb/krdb.cpp - colorscm.cpp - scmeditordialog.cpp - scmeditoroptions.cpp - scmeditorcolors.cpp - scmeditoreffects.cpp - previewwidget.cpp - setpreviewwidget.cpp + #../krdb/krdb.cpp + #colorscm.cpp + #scmeditordialog.cpp + #scmeditoroptions.cpp + #scmeditorcolors.cpp + #scmeditoreffects.cpp + #previewwidget.cpp + #setpreviewwidget.cpp + colors.cpp ) -qt5_add_dbus_interface(kcm_colors_SRCS ${klauncher_xml} klauncher_iface) +#qt5_add_dbus_interface(kcm_colors_SRCS ${klauncher_xml} klauncher_iface) -ki18n_wrap_ui(kcm_colors_SRCS - colorsettings.ui - scmeditordialog.ui - scmeditoroptions.ui - scmeditorcolors.ui - scmeditoreffects.ui - preview.ui - setpreview.ui) +#ki18n_wrap_ui(kcm_colors_SRCS +# colorsettings.ui +# scmeditordialog.ui +# scmeditoroptions.ui +# scmeditorcolors.ui +# scmeditoreffects.ui +# preview.ui +# setpreview.ui) add_library(kcm_colors MODULE ${kcm_colors_SRCS}) target_link_libraries(kcm_colors + Qt5::DBus KF5::KCMUtils + KF5::CoreAddons + KF5::Declarative KF5::GuiAddons KF5::I18n KF5::KIOCore - KF5::CoreAddons - Qt5::DBus KF5::NewStuff + KF5::QuickAddons KF5::WindowSystem) if(X11_FOUND) target_link_libraries(kcm_colors ${X11_LIBRARIES} Qt5::X11Extras) endif() -install(TARGETS kcm_colors DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install( FILES colors.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) -install( FILES colorschemes.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} ) +kcoreaddons_desktop_to_json(kcm_colors "kcm_colors.desktop") + +install(FILES kcm_colors.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS kcm_colors DESTINATION ${KDE_INSTALL_PLUGINDIR}/kcms) +install(FILES colorschemes.knsrc DESTINATION ${KDE_INSTALL_CONFDIR}) + +kpackage_install_package(package kcm_colors kcms) # built-in color schemes file(GLOB schemefiles schemes/*.colors) diff --git a/kcms/colors/colors.h b/kcms/colors/colors.h new file mode 100644 --- /dev/null +++ b/kcms/colors/colors.h @@ -0,0 +1,89 @@ +/* + * Copyright 2018 Kai Uwe Broulik + * + * 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) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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, see . + */ + +#pragma once + +#include + +#include + +#include + +class QStandardItemModel; + +class KCMColors: public KQuickAddons::ConfigModule +{ + Q_OBJECT + + Q_PROPERTY(QStandardItemModel *colorsModel READ colorsModel CONSTANT) + Q_PROPERTY(QString selectedScheme READ selectedScheme WRITE setSelectedScheme NOTIFY selectedSchemeChanged) + Q_PROPERTY(int selectedSchemeIndex READ selectedSchemeIndex NOTIFY selectedSchemeIndexChanged) + + Q_PROPERTY(bool applyToAlien READ applyToAlien WRITE setApplyToAlien NOTIFY applyToAlienChanged) + +public: + KCMColors(QObject *parent, const QVariantList &args); + ~KCMColors() override; + + enum Roles { + SchemeNameRole = Qt::UserRole + 1, + PaletteRole, + EditableRole, + RemovableRole + }; + + QStandardItemModel *colorsModel() const; + + QString selectedScheme() const; + void setSelectedScheme(const QString &scheme); + + int selectedSchemeIndex() const; + + bool applyToAlien() const; + void setApplyToAlien(bool applyToAlien); + + Q_INVOKABLE void getNewStuff(); + + Q_INVOKABLE void editScheme(const QString &scheme); + +public Q_SLOTS: + void load(); + void save(); + void defaults(); + +Q_SIGNALS: + void selectedSchemeChanged(); + void selectedSchemeIndexChanged(); + + void applyToAlienChanged(); + +private: + void loadModel(); + + QStandardItemModel *m_model; + QString m_selectedScheme; + + bool m_applyToAlien; + + QPointer m_newStuffDialog; + + KSharedConfigPtr m_config; + +}; diff --git a/kcms/colors/colors.cpp b/kcms/colors/colors.cpp new file mode 100644 --- /dev/null +++ b/kcms/colors/colors.cpp @@ -0,0 +1,227 @@ +/* + * Copyright 2018 Kai Uwe Broulik + * + * 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) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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, see . + */ + +#include "colors.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +static const QString s_defaultThemeName = QStringLiteral("/DEFAULT/"); +static const QString s_currentThemeName = QStringLiteral("/CURRENT/"); + +K_PLUGIN_FACTORY_WITH_JSON(KCMColorsFactory, "kcm_colors.json", registerPlugin();) + +KCMColors::KCMColors(QObject *parent, const QVariantList &args) + : KQuickAddons::ConfigModule(parent, args) + , m_config(KSharedConfig::openConfig(QStringLiteral("kdeglobals"))) + , m_applyToAlien(false) +{ + qmlRegisterType(); + + KAboutData *about = new KAboutData(QStringLiteral("kcm_colors"), i18n("Configure color schemes"), + QStringLiteral("2.0"), QString(), KAboutLicense::GPL); + about->addAuthor(i18n("Kai Uwe Broulik"), QString(), QStringLiteral("kde@privat.broulik.de")); + setAboutData(about); + setButtons(Apply | Default); + + m_model = new QStandardItemModel(this); + m_model->setItemRoleNames({ + {Qt::DisplayRole, QByteArrayLiteral("display")}, + {SchemeNameRole, QByteArrayLiteral("schemeName")}, + {PaletteRole, QByteArrayLiteral("palette")}, + {EditableRole, QByteArrayLiteral("editable")}, + {RemovableRole, QByteArrayLiteral("removable")}, + }); + loadModel(); +} + +KCMColors::~KCMColors() +{ + +} + +QStandardItemModel *KCMColors::colorsModel() const +{ + return m_model; +} + +QString KCMColors::selectedScheme() const +{ + return m_selectedScheme; +} + +void KCMColors::setSelectedScheme(const QString &scheme) +{ + if (m_selectedScheme == scheme) { + return; + } + + const bool firstTime = m_selectedScheme.isNull(); + m_selectedScheme = scheme; + emit selectedSchemeChanged(); + emit selectedSchemeIndexChanged(); + + if (!firstTime) { + setNeedsSave(true); + } +} + +int KCMColors::selectedSchemeIndex() const +{ + const auto results = m_model->match(m_model->index(0, 0), SchemeNameRole, m_selectedScheme); + if (results.count() == 1) { + return results.first().row(); + } + + return -1; +} + +bool KCMColors::applyToAlien() const +{ + return m_applyToAlien; +} + +void KCMColors::setApplyToAlien(bool applyToAlien) +{ + if (m_applyToAlien == applyToAlien) { + return; + } + + m_applyToAlien = applyToAlien; + emit applyToAlienChanged(); + setNeedsSave(true); +} + +void KCMColors::loadModel() +{ + m_model->clear(); + + QStringList schemeFiles; + + const QStringList schemeDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("color-schemes"), QStandardPaths::LocateDirectory); + for (const QString &dir : schemeDirs) { + const QStringList fileNames = QDir(dir).entryList(QStringList{QStringLiteral("*.colors")}); + for (const QString &file : fileNames) { + const QString suffixedFileName = QStringLiteral("color-schemes/") + file; + // can't use QSet because of the transform below (passing const QString as this argument discards qualifiers) + if (!schemeFiles.contains(suffixedFileName)) { + schemeFiles.append(suffixedFileName); + } + } + } + + std::transform(schemeFiles.begin(), schemeFiles.end(), schemeFiles.begin(), [](const QString &item) { + return QStandardPaths::locate(QStandardPaths::GenericDataLocation, item); + }); + + for (const QString &schemeFile : schemeFiles) { + const QFileInfo fi(schemeFile); + const QString baseName = fi.baseName(); + + KSharedConfigPtr config = KSharedConfig::openConfig(schemeFile, KConfig::SimpleConfig); + KConfigGroup group(config, "General"); + const QString name = group.readEntry("Name", baseName); + + QStandardItem *item = new QStandardItem(name); + item->setData(baseName, SchemeNameRole); + item->setData(true, EditableRole); + item->setData(fi.isWritable(), RemovableRole); + + item->setData(KColorScheme::createApplicationPalette(config), PaletteRole); + + m_model->appendRow(item); + } + + m_model->sort(0 /*column*/); + + // add default entry (do this here so that the current and default entry appear at the top) + QStandardItem *defaultItem = new QStandardItem(i18nc("Default color scheme", "Default")); + defaultItem->setData(s_defaultThemeName, SchemeNameRole); + defaultItem->setData(true, EditableRole); + defaultItem->setData(false, RemovableRole); + m_model->insertRow(0, defaultItem); + + // add current scheme entry + QStandardItem *currentItem = new QStandardItem(i18nc("Current color scheme", "Current")); + currentItem->setData(s_currentThemeName, SchemeNameRole); + currentItem->setData(true, EditableRole); + currentItem->setData(false, RemovableRole); + m_model->insertRow(0, currentItem); +} + +void KCMColors::getNewStuff() +{ + if (!m_newStuffDialog) { + m_newStuffDialog = new KNS3::DownloadDialog(QStringLiteral("colorschemes.knsrc")); + m_newStuffDialog.data()->setWindowTitle(i18n("Download New Color Schemes")); + // TODO would be lovely to scroll to and select the newly installed scheme, if any + connect(m_newStuffDialog.data(), &KNS3::DownloadDialog::accepted, this, &KCMColors::loadModel); + } + m_newStuffDialog.data()->show(); +} + +void KCMColors::editScheme(const QString &scheme) +{ + // TODO +} + +void KCMColors::load() +{ + m_config->markAsClean(); + m_config->reparseConfiguration(); + + KConfigGroup group(m_config, "General"); + m_selectedScheme = group.readEntry("ColorScheme"); + + // TODO let the checkbox in the UI listen to config changes so it checks/unchecks automatically + m_applyToAlien = group.readEntry("exportKDEColors", true); + + loadModel(); +} + +void KCMColors::save() +{ + KConfigGroup grp(m_config, "General"); + grp.writeEntry("ColorScheme", m_selectedScheme); + + m_config->sync(); + + // TODO save all the other keys, cf KColorCm::updateConfig + + setNeedsSave(false); +} + +void KCMColors::defaults() +{ + // TODO restore defaults +} + +#include "colors.moc" diff --git a/kcms/colors/colors.desktop b/kcms/colors/colors.desktop deleted file mode 100644 --- a/kcms/colors/colors.desktop +++ /dev/null @@ -1,194 +0,0 @@ -[Desktop Entry] -Exec=kcmshell5 colors -Icon=preferences-desktop-color -Type=Service -X-KDE-ServiceTypes=KCModule -X-DocPath=kcontrol/colors/index.html - -X-KDE-Library=kcm_colors -X-KDE-ParentApp=kcontrol - -X-KDE-System-Settings-Parent-Category=color -X-KDE-Weight=60 - -Name=Colors -Name[af]=Kleure -Name[ar]=الألوان -Name[be]=Колеры -Name[be@latin]=Kolery -Name[bg]=Цветове -Name[bn]=রং -Name[bn_IN]=রং -Name[br]=Livioù -Name[bs]=Boje -Name[ca]=Colors -Name[ca@valencia]=Colors -Name[cs]=Barvy -Name[csb]=Farwë -Name[cy]=Lliwiau -Name[da]=Farver -Name[de]=Farben -Name[el]=Χρώματα -Name[en_GB]=Colours -Name[eo]=Koloroj -Name[es]=Colores -Name[et]=Värvid -Name[eu]=Koloreak -Name[fa]=رنگها -Name[fi]=Värit -Name[fr]=Couleurs -Name[fy]=Kleuren -Name[ga]=Dathanna -Name[gl]=Cores -Name[gu]=રંગો -Name[he]=צבעים -Name[hi]=रंग -Name[hne]=रंग -Name[hr]=Boje -Name[hsb]=Barby -Name[hu]=Színek -Name[ia]=Colores -Name[id]=Warna -Name[is]=Litir -Name[it]=Colori -Name[ja]=色 -Name[ka]=ცვეტები -Name[kk]=Түстер -Name[km]=ពណ៌ -Name[kn]=ಬಣ್ಣಗಳು -Name[ko]=색상 -Name[ku]=Reng -Name[lt]=Spalvos -Name[lv]=Krāsas -Name[mai]=रँग -Name[mk]=Бои -Name[ml]=നിറങ്ങള്‍ -Name[mr]=रंग -Name[ms]=Warna -Name[nb]=Farger -Name[nds]=Klören -Name[ne]=रङ -Name[nl]=Kleuren -Name[nn]=Fargar -Name[oc]=Colors -Name[or]=ରଙ୍ଗ -Name[pa]=ਰੰਗ -Name[pl]=Kolory -Name[pt]=Cores -Name[pt_BR]=Cores -Name[ro]=Culori -Name[ru]=Цвета -Name[se]=Ivnnit -Name[si]=වර්‍ණ -Name[sk]=Farby -Name[sl]=Barve -Name[sr]=Боје -Name[sr@ijekavian]=Боје -Name[sr@ijekavianlatin]=Boje -Name[sr@latin]=Boje -Name[sv]=Färger -Name[ta]=வண்ணங்கள் -Name[te]=రంగులు -Name[tg]=Рангҳо -Name[th]=สี -Name[tr]=Renkler -Name[ug]=رەڭلەر -Name[uk]=Кольори -Name[uz]=Ranglar -Name[uz@cyrillic]=Ранглар -Name[vi]=Màu sắc -Name[wa]=Coleurs -Name[xh]=Imibala -Name[x-test]=xxColorsxx -Name[zh_CN]=颜色 -Name[zh_TW]=顏色 - -Comment=Application Color Scheme -Comment[ca]=Esquema de color de les aplicacions -Comment[ca@valencia]=Esquema de color de les aplicacions -Comment[cs]=Barevný motiv aplikací -Comment[da]=Farvetema til program -Comment[de]=Farbschema für Anwendungen -Comment[el]=Θέμα χρωμάτων εφαρμογής -Comment[en_GB]=Application Colour Scheme -Comment[es]=Esquema de color de las aplicaciones -Comment[eu]=Aplikazioen kolore-eskema -Comment[fi]=Ohjelmien väriteema -Comment[fr]=Thème de couleur des applications -Comment[gl]=Esquema de cores do aplicativo -Comment[he]=ערכות צבעים של יישומים -Comment[hu]=Alkalmazások színsémái -Comment[id]=Skema Warna Aplikasi -Comment[it]=Schema di colore delle applicazioni -Comment[ja]=アプリケーションカラースキーム -Comment[ko]=프로그램 색 배열 -Comment[lt]=Programos spalvų derinys -Comment[nb]=Fargeoppsett for program -Comment[nl]=Toepassing Kleurenschema -Comment[nn]=Fargeoppsett for program -Comment[pa]=ਐਪਲੀਕੇਸ਼ਨ ਰੰਗ ਸਕੀਮ -Comment[pl]=Zestaw kolorów programów -Comment[pt]=Esquema de Cores da Aplicação -Comment[pt_BR]=Esquema de cores do aplicativo -Comment[ru]=Цветовая схема для приложений -Comment[sk]=Farebná schéma aplikácie -Comment[sl]=Barvna shema programov -Comment[sr]=Шема боја у програмима -Comment[sr@ijekavian]=Шема боја у програмима -Comment[sr@ijekavianlatin]=Šema boja u programima -Comment[sr@latin]=Šema boja u programima -Comment[sv]=Programmets färgschema -Comment[tr]=Uygulama Renk Şeması -Comment[uk]=Схема кольорів вікон програм -Comment[x-test]=xxApplication Color Schemexx -Comment[zh_CN]=应用程序配色方案 -Comment[zh_TW]=應用程式色彩機制 - -X-KDE-Keywords=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[ar]=لون,ألوان,مخطّط,مخطط,تباين,ألوان الودجات,مخطّط ألوان,مخطط ألوان,نمط اللون,سمة اللون -X-KDE-Keywords[bs]=boje,boje,tema,kontrast,dodatak bojama,tema u boji,stil boja,tema boja -X-KDE-Keywords[ca]=colors,esquema,contrast,colors d'estris,Esquema de color,estil de color, tema de color -X-KDE-Keywords[ca@valencia]=colors,esquema,contrast,colors d'estris,Esquema de color,estil de color, tema de color -X-KDE-Keywords[da]=farver,tema,kontrast,widget-farver,farvetema,farvestil,farveskema -X-KDE-Keywords[de]=Farben,Schema,Kontrast,Farbschema,Elemente -X-KDE-Keywords[el]=χρώματα,χρώματα,σχήμα,αντίθεση,χρώματα γραφικών συστατικών,χρωματικό σχήμα,χρωματικό στιλ,θέμα χρώματος -X-KDE-Keywords[en_GB]=colours,scheme,contrast,Widget colours,Colour Scheme,colour style,colour theme -X-KDE-Keywords[es]=colores,esquema,contraste,colores de elementos gráficos,Esquema de color,estilo de color,tema de color -X-KDE-Keywords[et]=värv,värvid,skeem,kontrast,vidina värvid,värviskeem,värvistiil,värviteema -X-KDE-Keywords[eu]=kolore,koloreak,eskema,kontraste,trepetaren koloreak,kolore-eskema,kolore-estilo, kolorearen gai -X-KDE-Keywords[fi]=värit,teema,kontrasti,käyttöliittymäelementtien värit,elementtien värit,väriteema,värityyli -X-KDE-Keywords[fr]=couleurs, couleurs, schéma, contraste, couleur des composants graphiques, schéma de couleur, style de couleur, thème de couleur -X-KDE-Keywords[ga]=dathanna,scéim,codarsnacht,dathanna Giuirléidí,Scéim Datha,téama datha -X-KDE-Keywords[gl]=cores,esquema,contraste,cores do trebello,esquema de cores, tema de cores -X-KDE-Keywords[he]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,צבעים,ערכת נושא,צבע -X-KDE-Keywords[hu]=színek,színek,séma,kontraszt,Grafikai elemek színei,Színséma,színstílus,színtéma -X-KDE-Keywords[ia]=colores,colores,schema,contrasto,colores de Widget,Schema de Color,stilo de color, thema de color -X-KDE-Keywords[id]=warna,warna,skema,kontras,Widget warna,Skema Warna,gaya warna,tema warna -X-KDE-Keywords[it]=colori,schema,contrasto,colore degli oggetti,schema di colore,stile colore,tema colore -X-KDE-Keywords[kk]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[km]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[ko]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,색,색 배열,고대비 -X-KDE-Keywords[mr]=रंग, रंग, योजना, कॉन्ट्रास्ट, विजेट रंग, रंगयोजना, रंगप्रकार, रंगशैली -X-KDE-Keywords[nb]=farger,oppsett,kontrast,elementfarger,fargeoppsett,fargestil,fargetema -X-KDE-Keywords[nds]=Klöör,Klören,Schema,Kontrast,Lüttprogramm-Klören,Klöörschema,Klöörstil,Klöörmuster -X-KDE-Keywords[nl]=colors,colours, kleuren,scheme,schema,contrast,Widget colors,Widgetkleuren,Color Scheme,kleurschema,kleurstijl,kleurthema -X-KDE-Keywords[nn]=fargar,oppsett,kontrast,elementfargar,fargeoppsett,fargestil,fargetema -X-KDE-Keywords[pa]=ਰੰਗ,ਸਕੀਮ,ਕਨਟਰਾਸਟ,ਵਿਜੈਟ ਰੰਗ,ਰੰਗ ਸਕੀ,ਰੰਗ ਸਟਾਈਲ,ਰੰਗ ਥੀਮ -X-KDE-Keywords[pl]=kolory,schemat,kontrast,kolory elementów interfejsu,zestaw kolorów,styl kolorów,motyw kolorów -X-KDE-Keywords[pt]=cores,esquema,contraste,cores dos elementos,esquema de cores,estilo de cores,tema de cores -X-KDE-Keywords[pt_BR]=cor,cores,esquema,contraste,Cores do widget,Esquema de cores,estilo de cores,tema de cores -X-KDE-Keywords[ru]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,цвет,цвета,схема,контраст,цвета виджета,цветовая схема,цветовой стиль,цветовая тема -X-KDE-Keywords[sk]=farba,farby,schéma,kontrast,farby widgetov,Farebná schéma,štýl farieb,téma farieb -X-KDE-Keywords[sl]=barve,shema,tema,kontrast,barve gradnikov,barvna shema,barvna tema,barvni slog -X-KDE-Keywords[sr]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,боје,шема,контраст,боје виџета,шема боја,стил боја,тема боја -X-KDE-Keywords[sr@ijekavian]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,боје,шема,контраст,боје виџета,шема боја,стил боја,тема боја -X-KDE-Keywords[sr@ijekavianlatin]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,boje,šema,kontrast,boje vidžeta,šema boja,stil boja,tema boja -X-KDE-Keywords[sr@latin]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,boje,šema,kontrast,boje vidžeta,šema boja,stil boja,tema boja -X-KDE-Keywords[sv]=färger,schema,kontrast,Komponentfärger,Färgschema,färgstil,färgtema -X-KDE-Keywords[tr]=renkler,renk,şema,karşıtlık,kontrast,Gereç renkleri,RenkŞeması,renk biçemi,renk teması,renk biçimi -X-KDE-Keywords[uk]=кольори,кольори,схема,контраст,кольори віджетів,схема кольорів,стиль кольорів,тема кольорів,colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme -X-KDE-Keywords[x-test]=xxcolorsxx,xxcoloursxx,xxschemexx,xxcontrastxx,xxWidget colorsxx,xxColor Schemexx,xxcolor stylexx,xxcolor themexx -X-KDE-Keywords[zh_CN]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,颜色,配色方案,对比度,部件颜色,颜色方案,颜色风格,颜色主题 -X-KDE-Keywords[zh_TW]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme - -Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/kcms/colors/colorscm.cpp b/kcms/colors/colorscm.cpp --- a/kcms/colors/colorscm.cpp +++ b/kcms/colors/colorscm.cpp @@ -46,8 +46,8 @@ #include #include -K_PLUGIN_FACTORY( KolorFactory, registerPlugin(); ) -K_EXPORT_PLUGIN( KolorFactory("kcmcolors") ) +//K_PLUGIN_FACTORY( KolorFactory, registerPlugin(); ) +//K_EXPORT_PLUGIN( KolorFactory("kcmcolors") ) KColorCm::KColorCm(QWidget *parent, const QVariantList &) : KCModule( parent ), diff --git a/kcms/colors/kcm_colors.desktop b/kcms/colors/kcm_colors.desktop new file mode 100644 --- /dev/null +++ b/kcms/colors/kcm_colors.desktop @@ -0,0 +1,194 @@ +[Desktop Entry] +Exec=kcmshell5 colors +Icon=preferences-desktop-color +Type=Service +X-KDE-ServiceTypes=KCModule +X-DocPath=kcontrol/colors/index.html + +X-KDE-Library=kcm_colors +X-KDE-ParentApp=kcontrol + +X-KDE-System-Settings-Parent-Category=color +X-KDE-Weight=60 + +Name=Colors +Name[af]=Kleure +Name[ar]=الألوان +Name[be]=Колеры +Name[be@latin]=Kolery +Name[bg]=Цветове +Name[bn]=রং +Name[bn_IN]=রং +Name[br]=Livioù +Name[bs]=Boje +Name[ca]=Colors +Name[ca@valencia]=Colors +Name[cs]=Barvy +Name[csb]=Farwë +Name[cy]=Lliwiau +Name[da]=Farver +Name[de]=Farben +Name[el]=Χρώματα +Name[en_GB]=Colours +Name[eo]=Koloroj +Name[es]=Colores +Name[et]=Värvid +Name[eu]=Koloreak +Name[fa]=رنگها +Name[fi]=Värit +Name[fr]=Couleurs +Name[fy]=Kleuren +Name[ga]=Dathanna +Name[gl]=Cores +Name[gu]=રંગો +Name[he]=צבעים +Name[hi]=रंग +Name[hne]=रंग +Name[hr]=Boje +Name[hsb]=Barby +Name[hu]=Színek +Name[ia]=Colores +Name[id]=Warna +Name[is]=Litir +Name[it]=Colori +Name[ja]=色 +Name[ka]=ცვეტები +Name[kk]=Түстер +Name[km]=ពណ៌ +Name[kn]=ಬಣ್ಣಗಳು +Name[ko]=색상 +Name[ku]=Reng +Name[lt]=Spalvos +Name[lv]=Krāsas +Name[mai]=रँग +Name[mk]=Бои +Name[ml]=നിറങ്ങള്‍ +Name[mr]=रंग +Name[ms]=Warna +Name[nb]=Farger +Name[nds]=Klören +Name[ne]=रङ +Name[nl]=Kleuren +Name[nn]=Fargar +Name[oc]=Colors +Name[or]=ରଙ୍ଗ +Name[pa]=ਰੰਗ +Name[pl]=Kolory +Name[pt]=Cores +Name[pt_BR]=Cores +Name[ro]=Culori +Name[ru]=Цвета +Name[se]=Ivnnit +Name[si]=වර්‍ණ +Name[sk]=Farby +Name[sl]=Barve +Name[sr]=Боје +Name[sr@ijekavian]=Боје +Name[sr@ijekavianlatin]=Boje +Name[sr@latin]=Boje +Name[sv]=Färger +Name[ta]=வண்ணங்கள் +Name[te]=రంగులు +Name[tg]=Рангҳо +Name[th]=สี +Name[tr]=Renkler +Name[ug]=رەڭلەر +Name[uk]=Кольори +Name[uz]=Ranglar +Name[uz@cyrillic]=Ранглар +Name[vi]=Màu sắc +Name[wa]=Coleurs +Name[xh]=Imibala +Name[x-test]=xxColorsxx +Name[zh_CN]=颜色 +Name[zh_TW]=顏色 + +Comment=Application Color Scheme +Comment[ca]=Esquema de color de les aplicacions +Comment[ca@valencia]=Esquema de color de les aplicacions +Comment[cs]=Barevný motiv aplikací +Comment[da]=Farvetema til program +Comment[de]=Farbschema für Anwendungen +Comment[el]=Θέμα χρωμάτων εφαρμογής +Comment[en_GB]=Application Colour Scheme +Comment[es]=Esquema de color de las aplicaciones +Comment[eu]=Aplikazioen kolore-eskema +Comment[fi]=Ohjelmien väriteema +Comment[fr]=Thème de couleur des applications +Comment[gl]=Esquema de cores do aplicativo +Comment[he]=ערכות צבעים של יישומים +Comment[hu]=Alkalmazások színsémái +Comment[id]=Skema Warna Aplikasi +Comment[it]=Schema di colore delle applicazioni +Comment[ja]=アプリケーションカラースキーム +Comment[ko]=프로그램 색 배열 +Comment[lt]=Programos spalvų derinys +Comment[nb]=Fargeoppsett for program +Comment[nl]=Toepassing Kleurenschema +Comment[nn]=Fargeoppsett for program +Comment[pa]=ਐਪਲੀਕੇਸ਼ਨ ਰੰਗ ਸਕੀਮ +Comment[pl]=Zestaw kolorów programów +Comment[pt]=Esquema de Cores da Aplicação +Comment[pt_BR]=Esquema de cores do aplicativo +Comment[ru]=Цветовая схема для приложений +Comment[sk]=Farebná schéma aplikácie +Comment[sl]=Barvna shema programov +Comment[sr]=Шема боја у програмима +Comment[sr@ijekavian]=Шема боја у програмима +Comment[sr@ijekavianlatin]=Šema boja u programima +Comment[sr@latin]=Šema boja u programima +Comment[sv]=Programmets färgschema +Comment[tr]=Uygulama Renk Şeması +Comment[uk]=Схема кольорів вікон програм +Comment[x-test]=xxApplication Color Schemexx +Comment[zh_CN]=应用程序配色方案 +Comment[zh_TW]=應用程式色彩機制 + +X-KDE-Keywords=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme +X-KDE-Keywords[ar]=لون,ألوان,مخطّط,مخطط,تباين,ألوان الودجات,مخطّط ألوان,مخطط ألوان,نمط اللون,سمة اللون +X-KDE-Keywords[bs]=boje,boje,tema,kontrast,dodatak bojama,tema u boji,stil boja,tema boja +X-KDE-Keywords[ca]=colors,esquema,contrast,colors d'estris,Esquema de color,estil de color, tema de color +X-KDE-Keywords[ca@valencia]=colors,esquema,contrast,colors d'estris,Esquema de color,estil de color, tema de color +X-KDE-Keywords[da]=farver,tema,kontrast,widget-farver,farvetema,farvestil,farveskema +X-KDE-Keywords[de]=Farben,Schema,Kontrast,Farbschema,Elemente +X-KDE-Keywords[el]=χρώματα,χρώματα,σχήμα,αντίθεση,χρώματα γραφικών συστατικών,χρωματικό σχήμα,χρωματικό στιλ,θέμα χρώματος +X-KDE-Keywords[en_GB]=colours,scheme,contrast,Widget colours,Colour Scheme,colour style,colour theme +X-KDE-Keywords[es]=colores,esquema,contraste,colores de elementos gráficos,Esquema de color,estilo de color,tema de color +X-KDE-Keywords[et]=värv,värvid,skeem,kontrast,vidina värvid,värviskeem,värvistiil,värviteema +X-KDE-Keywords[eu]=kolore,koloreak,eskema,kontraste,trepetaren koloreak,kolore-eskema,kolore-estilo, kolorearen gai +X-KDE-Keywords[fi]=värit,teema,kontrasti,käyttöliittymäelementtien värit,elementtien värit,väriteema,värityyli +X-KDE-Keywords[fr]=couleurs, couleurs, schéma, contraste, couleur des composants graphiques, schéma de couleur, style de couleur, thème de couleur +X-KDE-Keywords[ga]=dathanna,scéim,codarsnacht,dathanna Giuirléidí,Scéim Datha,téama datha +X-KDE-Keywords[gl]=cores,esquema,contraste,cores do trebello,esquema de cores, tema de cores +X-KDE-Keywords[he]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,צבעים,ערכת נושא,צבע +X-KDE-Keywords[hu]=színek,színek,séma,kontraszt,Grafikai elemek színei,Színséma,színstílus,színtéma +X-KDE-Keywords[ia]=colores,colores,schema,contrasto,colores de Widget,Schema de Color,stilo de color, thema de color +X-KDE-Keywords[id]=warna,warna,skema,kontras,Widget warna,Skema Warna,gaya warna,tema warna +X-KDE-Keywords[it]=colori,schema,contrasto,colore degli oggetti,schema di colore,stile colore,tema colore +X-KDE-Keywords[kk]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme +X-KDE-Keywords[km]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme +X-KDE-Keywords[ko]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,색,색 배열,고대비 +X-KDE-Keywords[mr]=रंग, रंग, योजना, कॉन्ट्रास्ट, विजेट रंग, रंगयोजना, रंगप्रकार, रंगशैली +X-KDE-Keywords[nb]=farger,oppsett,kontrast,elementfarger,fargeoppsett,fargestil,fargetema +X-KDE-Keywords[nds]=Klöör,Klören,Schema,Kontrast,Lüttprogramm-Klören,Klöörschema,Klöörstil,Klöörmuster +X-KDE-Keywords[nl]=colors,colours, kleuren,scheme,schema,contrast,Widget colors,Widgetkleuren,Color Scheme,kleurschema,kleurstijl,kleurthema +X-KDE-Keywords[nn]=fargar,oppsett,kontrast,elementfargar,fargeoppsett,fargestil,fargetema +X-KDE-Keywords[pa]=ਰੰਗ,ਸਕੀਮ,ਕਨਟਰਾਸਟ,ਵਿਜੈਟ ਰੰਗ,ਰੰਗ ਸਕੀ,ਰੰਗ ਸਟਾਈਲ,ਰੰਗ ਥੀਮ +X-KDE-Keywords[pl]=kolory,schemat,kontrast,kolory elementów interfejsu,zestaw kolorów,styl kolorów,motyw kolorów +X-KDE-Keywords[pt]=cores,esquema,contraste,cores dos elementos,esquema de cores,estilo de cores,tema de cores +X-KDE-Keywords[pt_BR]=cor,cores,esquema,contraste,Cores do widget,Esquema de cores,estilo de cores,tema de cores +X-KDE-Keywords[ru]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,цвет,цвета,схема,контраст,цвета виджета,цветовая схема,цветовой стиль,цветовая тема +X-KDE-Keywords[sk]=farba,farby,schéma,kontrast,farby widgetov,Farebná schéma,štýl farieb,téma farieb +X-KDE-Keywords[sl]=barve,shema,tema,kontrast,barve gradnikov,barvna shema,barvna tema,barvni slog +X-KDE-Keywords[sr]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,боје,шема,контраст,боје виџета,шема боја,стил боја,тема боја +X-KDE-Keywords[sr@ijekavian]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,боје,шема,контраст,боје виџета,шема боја,стил боја,тема боја +X-KDE-Keywords[sr@ijekavianlatin]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,boje,šema,kontrast,boje vidžeta,šema boja,stil boja,tema boja +X-KDE-Keywords[sr@latin]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,boje,šema,kontrast,boje vidžeta,šema boja,stil boja,tema boja +X-KDE-Keywords[sv]=färger,schema,kontrast,Komponentfärger,Färgschema,färgstil,färgtema +X-KDE-Keywords[tr]=renkler,renk,şema,karşıtlık,kontrast,Gereç renkleri,RenkŞeması,renk biçemi,renk teması,renk biçimi +X-KDE-Keywords[uk]=кольори,кольори,схема,контраст,кольори віджетів,схема кольорів,стиль кольорів,тема кольорів,colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme +X-KDE-Keywords[x-test]=xxcolorsxx,xxcoloursxx,xxschemexx,xxcontrastxx,xxWidget colorsxx,xxColor Schemexx,xxcolor stylexx,xxcolor themexx +X-KDE-Keywords[zh_CN]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme,颜色,配色方案,对比度,部件颜色,颜色方案,颜色风格,颜色主题 +X-KDE-Keywords[zh_TW]=colors,colours,scheme,contrast,Widget colors,Color Scheme,color style,color theme + +Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/kcms/colors/package/contents/ui/main.qml b/kcms/colors/package/contents/ui/main.qml new file mode 100644 --- /dev/null +++ b/kcms/colors/package/contents/ui/main.qml @@ -0,0 +1,122 @@ +/* + * Copyright 2018 Kai Uwe Broulik + * + * 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) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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, see . + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.3 as QtControls +import org.kde.kirigami 2.4 as Kirigami +import org.kde.kcm 1.1 as KCM + +KCM.GridViewKCM { + KCM.ConfigModule.quickHelp: i18n("This module lets you configure the color scheme of applications.") + + view.model: kcm.colorsModel + view.currentIndex: kcm.selectedSchemeIndex + view.delegate: KCM.GridDelegate { + id: delegate + + text: model.display + + thumbnailAvailable: true + thumbnail: Item { + // FIXME needs a nicer live preview with some controls + // this GridLayout below was just a quick and dirty attempt trying + // to mimic the old thumbnail we had in the list + id: thumb + readonly property var itemPalette: model.palette + readonly property var colorKeys: ["window", "button", "highlight", "bright", "toolTip", ""] + + anchors.fill: parent + + GridLayout { + id: grid + anchors.fill: parent + columns: 3 + columnSpacing: 0 + rowSpacing: 0 + + Repeater { + model: 6 + + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: thumb.itemPalette[thumb.colorKeys[index]] + + QtControls.Label { + anchors { + top: parent.top + left: parent.left + margins: Kirigami.Units.largeSpacing + } + text: "Plasma" + color: thumb.itemPalette[thumb.colorKeys[index] + "Text"] + } + } + } + } + } + + actions: [ + Kirigami.Action { + iconName: "document-edit" + tooltip: i18n("Edit Color Scheme") + enabled: model.editable + onTriggered: kcm.editScheme(model.schemeName) + }, + Kirigami.Action { + iconName: "edit-delete" + tooltip: i18n("Remove Color Scheme") + enabled: model.removable + onTriggered: kcm.removeScheme(model.schemeName) + } + ] + onClicked: { + kcm.selectedScheme = model.schemeName; + view.forceActiveFocus(); + } + } + + footer: RowLayout { + QtControls.CheckBox { + // FIXME why does this accelerator throw it off completely? + text: i18n("Apply colors to &non-Qt applications") + checked: kcm.applyToAlien + onCheckedChanged: kcm.applyToAlien = checked + } + + Item { + Layout.fillWidth: true + } + + QtControls.Button { + text: i18n("Install from File...") + icon.name: "document-import" + // onClicked: TODO + } + + QtControls.Button { + text: i18n("Get New Themes...") + icon.name: "get-hot-new-stuff" + onClicked: kcm.getNewStuff() + } + } +} diff --git a/kcms/colors/package/metadata.desktop b/kcms/colors/package/metadata.desktop new file mode 100644 --- /dev/null +++ b/kcms/colors/package/metadata.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Name=Colors +Comment=Application Color Scheme + +Icon=preferences-desktop-color +Type=Service +X-KDE-PluginInfo-Author=Kai Uwe Broulik +X-KDE-PluginInfo-Email=kde@privat.broulik.de +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-Name=kcm_fonts +X-KDE-PluginInfo-Version= +X-KDE-PluginInfo-Website= +X-KDE-ServiceTypes=Plasma/Generic +X-Plasma-API=declarativeappletscript + +X-Plasma-MainScript=ui/main.qml