diff --git a/kcmkwin/kwindecoration/CMakeLists.txt b/kcmkwin/kwindecoration/CMakeLists.txt index 848a6b601b..e5d45bc7e7 100644 --- a/kcmkwin/kwindecoration/CMakeLists.txt +++ b/kcmkwin/kwindecoration/CMakeLists.txt @@ -16,7 +16,6 @@ set(kcm_kwindecoration_PART_SRCS configdialog.cpp preview.cpp decorationmodel.cpp - ../utils/uitranslator.cpp ${AURORAE_SOURCE_DIR}/auroraetheme.cpp ${AURORAE_SOURCE_DIR}/themeconfig.cpp ) diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp index 48e8f957ab..87c962d90a 100644 --- a/kcmkwin/kwindecoration/kwindecoration.cpp +++ b/kcmkwin/kwindecoration/kwindecoration.cpp @@ -34,7 +34,6 @@ #include "decorationmodel.h" #include "auroraetheme.h" #include "preview.h" -#include "uitranslator.h" // Qt #include #include @@ -48,6 +47,7 @@ #include #include #include +#include #include #include #include diff --git a/kcmkwin/kwindecoration/kwindecoration.h b/kcmkwin/kwindecoration/kwindecoration.h index 60f4a52b60..beb2ee01c5 100644 --- a/kcmkwin/kwindecoration/kwindecoration.h +++ b/kcmkwin/kwindecoration/kwindecoration.h @@ -40,11 +40,11 @@ class QQuickView; class QSortFilterProxyModel; +class KLocalizedTranslator; namespace KWin { class DecorationModel; -class KLocalizedTranslator; class KWinDecorationForm : public QWidget, public Ui::KWinDecorationForm { diff --git a/kcmkwin/utils/uitranslator.cpp b/kcmkwin/utils/uitranslator.cpp deleted file mode 100644 index d839389c99..0000000000 --- a/kcmkwin/utils/uitranslator.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2014 Martin Gräßlin - -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, see . -*********************************************************************/ -#include "uitranslator.h" -// frameworks -#include -// Qt -#include -#include -#include - -namespace KWin -{ - -KLocalizedTranslator::KLocalizedTranslator(QObject* parent) - : QTranslator(parent) -{ -} - -void KLocalizedTranslator::setTranslationDomain(const QString &translationDomain) -{ - m_translationDomain = translationDomain; -} - -void KLocalizedTranslator::addContextToMonitor(const QString &context) -{ - m_monitoredContexts.insert(context); -} - -QString KLocalizedTranslator::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const -{ - if (m_translationDomain.isEmpty() || !m_monitoredContexts.contains(QString::fromUtf8(context))) { - return QTranslator::translate(context, sourceText, disambiguation, n); - } - if (qstrlen(disambiguation) == 0) { - return ki18nd(m_translationDomain.toUtf8().constData(), sourceText).toString(); - } else { - return ki18ndc(m_translationDomain.toUtf8().constData(), disambiguation, sourceText).toString(); - } -} - -} // namespace KWin diff --git a/kcmkwin/utils/uitranslator.h b/kcmkwin/utils/uitranslator.h deleted file mode 100644 index 20532194df..0000000000 --- a/kcmkwin/utils/uitranslator.h +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2014 Martin Gräßlin - -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, see . -*********************************************************************/ -#ifndef KWIN_KCMUTILS_UITRANSLATOR_H -#define KWIN_KCMUTILS_UITRANSLATOR_H - -#include -#include - -class QWidget; - -namespace KWin -{ - -class KLocalizedTranslator : public QTranslator -{ - Q_OBJECT -public: - explicit KLocalizedTranslator(QObject *parent = 0); - QString translate(const char *context, const char *sourceText, const char *disambiguation = 0, int n = -1) const override; - - void setTranslationDomain(const QString &translationDomain); - void addContextToMonitor(const QString &context); - -private: - QString m_translationDomain; - QSet m_monitoredContexts; -}; - -} - -#endif diff --git a/scripting/CMakeLists.txt b/scripting/CMakeLists.txt index 1f727a8261..abb7271937 100644 --- a/scripting/CMakeLists.txt +++ b/scripting/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${KWIN_SOURCE_DIR}/kcmkwin/utils/) -set(kcm_kwin4_genericscripted_SRCS genericscriptedconfig.cpp ${KWIN_SOURCE_DIR}/kcmkwin/utils/uitranslator.cpp) +set(kcm_kwin4_genericscripted_SRCS genericscriptedconfig.cpp) qt5_add_dbus_interface(kcm_kwin4_genericscripted_SRCS ${kwin_effects_dbus_xml} kwineffects_interface) add_library(kcm_kwin4_genericscripted MODULE ${kcm_kwin4_genericscripted_SRCS}) target_link_libraries( kcm_kwin4_genericscripted diff --git a/scripting/genericscriptedconfig.cpp b/scripting/genericscriptedconfig.cpp index 3fb873630d..9c1798a36f 100644 --- a/scripting/genericscriptedconfig.cpp +++ b/scripting/genericscriptedconfig.cpp @@ -20,11 +20,11 @@ #include "genericscriptedconfig.h" #include "config-kwin.h" -#include "uitranslator.h" #include #include #define TRANSLATION_DOMAIN "kwin_scripting" #include +#include #include #include diff --git a/scripting/genericscriptedconfig.h b/scripting/genericscriptedconfig.h index 4e3a8a02b1..0ba73476ad 100644 --- a/scripting/genericscriptedconfig.h +++ b/scripting/genericscriptedconfig.h @@ -25,11 +25,11 @@ #include #include +class KLocalizedTranslator; + namespace KWin { -class KLocalizedTranslator; - class GenericScriptedConfigFactory : public KPluginFactory { Q_OBJECT