add support for translations
This commit is contained in:
parent
886a71eee3
commit
8d71edb748
|
@ -15,12 +15,12 @@ include(KDEInstallDirs)
|
||||||
include(KDECompilerSettings)
|
include(KDECompilerSettings)
|
||||||
include(KDECMakeSettings)
|
include(KDECMakeSettings)
|
||||||
|
|
||||||
include(ECMAddAppIcon)
|
|
||||||
include(ECMInstallIcons)
|
|
||||||
include(ECMSetupVersion)
|
|
||||||
include(ECMPackageConfigHelpers)
|
|
||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
|
|
||||||
|
include(ECMAddAppIcon)
|
||||||
|
include(ECMInstallIcons)
|
||||||
|
include(ECMPackageConfigHelpers)
|
||||||
|
include(ECMSetupVersion)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
option(WITH_FRONTENDS "Build frontends currently only useful if WITH_SNORE_DAEMON=ON" OFF)
|
option(WITH_FRONTENDS "Build frontends currently only useful if WITH_SNORE_DAEMON=ON" OFF)
|
||||||
|
@ -36,9 +36,10 @@ set(SNORE_CamelCase_SUFFIX "Qt5")
|
||||||
|
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
find_package(Qt5Core REQUIRED)
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5LinguistTools REQUIRED)
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
find_package(Qt5Quick REQUIRED)
|
find_package(Qt5Quick REQUIRED)
|
||||||
|
find_package(Qt5Widgets REQUIRED)
|
||||||
|
|
||||||
|
|
||||||
find_package(Doxygen QUIET)
|
find_package(Doxygen QUIET)
|
||||||
|
@ -66,8 +67,9 @@ message(STATUS "Installing plugins to ${LIBSNORE_PLUGIN_PATH}")
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(data)
|
add_subdirectory(data)
|
||||||
add_subdirectory(share)
|
add_subdirectory(lang)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(share)
|
||||||
|
|
||||||
|
|
||||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)
|
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
set(LIBSNORE_LANGS de en)
|
||||||
|
|
||||||
|
set(TS_FILES )
|
||||||
|
set( snore_i18n_content "<!DOCTYPE RCC><RCC version=\"1.0\">\n<qresource prefix=\"/lang/libsnore\">\n" )
|
||||||
|
foreach( lang ${LIBSNORE_LANGS} )
|
||||||
|
list(APPEND TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.ts)
|
||||||
|
set( snore_i18n_content "${snore_i18n_content}<file>${lang}.qm</file>\n" )
|
||||||
|
endforeach()
|
||||||
|
set( snore_i18n_content "${snore_i18n_content}</qresource>\n</RCC>\n" )
|
||||||
|
|
||||||
|
file( WRITE ${CMAKE_BINARY_DIR}/lang/snore_i18n.qrc "${snore_i18n_content}" )
|
||||||
|
|
||||||
|
qt5_add_translation(libsnore_lang ${TS_FILES})
|
||||||
|
|
||||||
|
add_custom_target(libsnore_lang_translation ALL DEPENDS ${libsnore_lang})
|
|
@ -0,0 +1,145 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="de_CH">
|
||||||
|
<context>
|
||||||
|
<name>GrowlSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/growl/growlsettings.cpp" line="30"/>
|
||||||
|
<source>Host:</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/growl/growlsettings.cpp" line="31"/>
|
||||||
|
<source>Password:</source>
|
||||||
|
<translation>Passwort:</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SettingsDialog</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="14"/>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Einstellungen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="34"/>
|
||||||
|
<source>General</source>
|
||||||
|
<translation>Allgemein</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="45"/>
|
||||||
|
<source>Primary Backend:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="55"/>
|
||||||
|
<source>Timeout:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="62"/>
|
||||||
|
<source>s</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="72"/>
|
||||||
|
<source>Primary Backends</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="82"/>
|
||||||
|
<source>Secondary Bckends</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="92"/>
|
||||||
|
<source>Frontends</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="102"/>
|
||||||
|
<source>Plugins</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="115"/>
|
||||||
|
<source>Display Test Notification</source>
|
||||||
|
<translation>Zeige test Mitteilung an</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SettingsWindow</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/settings/settingswindow.ui" line="14"/>
|
||||||
|
<source>Snore Settings</source>
|
||||||
|
<translation>Snore Einstellungen</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/settings/settingswindow.ui" line="23"/>
|
||||||
|
<source>Application</source>
|
||||||
|
<translation>Anwendungen</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SnarlSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snarl/snarlsettings.cpp" line="29"/>
|
||||||
|
<source>Password:</source>
|
||||||
|
<translation>Passwort:</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SnoreNotifierSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="30"/>
|
||||||
|
<source>TopLeftCorner</source>
|
||||||
|
<translation>ObereLinkeEcke</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="31"/>
|
||||||
|
<source>TopRightCorner</source>
|
||||||
|
<translation>ObereRechteEcke</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="32"/>
|
||||||
|
<source>BottomLeftCorner</source>
|
||||||
|
<translation>UntereLinkeEcke</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="33"/>
|
||||||
|
<source>BottomRightCorner</source>
|
||||||
|
<translation>UntereRechteEcke</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="34"/>
|
||||||
|
<source>Position:</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SoundSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/sound/soundsettings.cpp" line="31"/>
|
||||||
|
<source>Sound File:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/sound/soundsettings.cpp" line="32"/>
|
||||||
|
<source>Select a sound File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/sound/soundsettings.cpp" line="35"/>
|
||||||
|
<source>All Audio files</source>
|
||||||
|
<translation>Alle Audio Dateien</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>ToastySettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/toasty/toastysettings.cpp" line="28"/>
|
||||||
|
<source>Device ID:</source>
|
||||||
|
<translation>Geräte ID:</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
|
@ -0,0 +1,145 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1">
|
||||||
|
<context>
|
||||||
|
<name>GrowlSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/growl/growlsettings.cpp" line="30"/>
|
||||||
|
<source>Host:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/growl/growlsettings.cpp" line="31"/>
|
||||||
|
<source>Password:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SettingsDialog</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="14"/>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="34"/>
|
||||||
|
<source>General</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="45"/>
|
||||||
|
<source>Primary Backend:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="55"/>
|
||||||
|
<source>Timeout:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="62"/>
|
||||||
|
<source>s</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="72"/>
|
||||||
|
<source>Primary Backends</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="82"/>
|
||||||
|
<source>Secondary Bckends</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="92"/>
|
||||||
|
<source>Frontends</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="102"/>
|
||||||
|
<source>Plugins</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/libsnore/settingsdialog.ui" line="115"/>
|
||||||
|
<source>Display Test Notification</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SettingsWindow</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/settings/settingswindow.ui" line="14"/>
|
||||||
|
<source>Snore Settings</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/settings/settingswindow.ui" line="23"/>
|
||||||
|
<source>Application</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SnarlSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snarl/snarlsettings.cpp" line="29"/>
|
||||||
|
<source>Password:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SnoreNotifierSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="30"/>
|
||||||
|
<source>TopLeftCorner</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="31"/>
|
||||||
|
<source>TopRightCorner</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="32"/>
|
||||||
|
<source>BottomLeftCorner</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="33"/>
|
||||||
|
<source>BottomRightCorner</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/backends/snore/snorenotifiersettings.cpp" line="34"/>
|
||||||
|
<source>Position:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SoundSettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/sound/soundsettings.cpp" line="31"/>
|
||||||
|
<source>Sound File:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/sound/soundsettings.cpp" line="32"/>
|
||||||
|
<source>Select a sound File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/sound/soundsettings.cpp" line="35"/>
|
||||||
|
<source>All Audio files</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>ToastySettings</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/plugins/secondary_backends/toasty/toastysettings.cpp" line="28"/>
|
||||||
|
<source>Device ID:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
</TS>
|
|
@ -10,7 +10,7 @@ set(LIBSNORE_INCLUDE_DIR ${KDE_INSTALL_INCLUDEDIR}/libsnore)
|
||||||
|
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/version.cpp")
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/version.cpp")
|
||||||
|
|
||||||
QT5_ADD_RESOURCES(SNORENOTIFY_RCS ${SNORE_RCS})
|
QT5_ADD_RESOURCES(SNORENOTIFY_RCS ${SNORE_RCS} ${CMAKE_BINARY_DIR}/lang/snore_i18n.qrc)
|
||||||
|
|
||||||
add_subdirectory(notification)
|
add_subdirectory(notification)
|
||||||
add_subdirectory(plugins)
|
add_subdirectory(plugins)
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="primaryBackendLabel">
|
<widget class="QLabel" name="primaryBackendLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Primary Backend</string>
|
<string>Primary Backend:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="timeoutLabel">
|
<widget class="QLabel" name="timeoutLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Timeout</string>
|
<string>Timeout:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnoreCore::SnoreCore()
|
SnoreCore::SnoreCore(QObject *parent):
|
||||||
|
QObject(parent)
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() != qApp->thread() ) {
|
if (QThread::currentThread() != parent->thread() ) {
|
||||||
moveToThread(qApp->thread());
|
moveToThread(parent->thread());
|
||||||
}
|
}
|
||||||
SnoreCorePrivate::registerMetaTypes();
|
|
||||||
d_ptr = new SnoreCorePrivate();
|
d_ptr = new SnoreCorePrivate();
|
||||||
Q_D(SnoreCore);
|
Q_D(SnoreCore);
|
||||||
d->q_ptr = this;
|
d->q_ptr = this;
|
||||||
|
@ -47,8 +47,13 @@ SnoreCore::SnoreCore()
|
||||||
|
|
||||||
SnoreCore &SnoreCore::instance()
|
SnoreCore &SnoreCore::instance()
|
||||||
{
|
{
|
||||||
static SnoreCore instance;
|
static SnoreCore *instance = nullptr;
|
||||||
return instance;
|
if(!instance) {
|
||||||
|
SnoreCorePrivate::loadTranslator();
|
||||||
|
SnoreCorePrivate::registerMetaTypes();
|
||||||
|
instance = new SnoreCore(qApp);
|
||||||
|
}
|
||||||
|
return *instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
SnoreCore::~SnoreCore()
|
SnoreCore::~SnoreCore()
|
||||||
|
|
|
@ -177,7 +177,7 @@ signals:
|
||||||
void notificationClosed(Snore::Notification);
|
void notificationClosed(Snore::Notification);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SnoreCore();
|
SnoreCore(QObject *parent);
|
||||||
SnoreCorePrivate *d_ptr;
|
SnoreCorePrivate *d_ptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTemporaryDir>
|
#include <QTemporaryDir>
|
||||||
|
#include <QTranslator>
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
|
@ -218,6 +219,7 @@ void SnoreCorePrivate::slotNotificationClosed(Notification n)
|
||||||
Q_Q(SnoreCore);
|
Q_Q(SnoreCore);
|
||||||
emit q->notificationClosed(n);
|
emit q->notificationClosed(n);
|
||||||
if (n.data()->source()) {
|
if (n.data()->source()) {
|
||||||
|
//TODO: drop source and use signal aswell
|
||||||
n.data()->source()->notificationClosed(n);
|
n.data()->source()->notificationClosed(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,3 +234,33 @@ void SnoreCorePrivate::slotAboutToQuit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SnoreCorePrivate::loadTranslator(){
|
||||||
|
auto installTranslator = [](const QString &locale)
|
||||||
|
{
|
||||||
|
snoreDebug(SNORE_DEBUG) << locale;
|
||||||
|
if(locale != "C") {
|
||||||
|
QTranslator* translator = new QTranslator( qApp->instance() );
|
||||||
|
if ( translator->load(locale, ":/lang/libsnore/") )
|
||||||
|
{
|
||||||
|
snoreDebug(SNORE_INFO) << "Using system locale:" << locale;
|
||||||
|
snoreDebug(SNORE_INFO) << qApp->installTranslator( translator );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
translator->deleteLater();
|
||||||
|
QString fileName = QString(":/lang/libsnore/%1.qm").arg(locale);
|
||||||
|
snoreDebug(SNORE_WARNING)<< "Failed to load translations for:" << locale << fileName << QFile::exists(fileName) ;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
installTranslator("en");
|
||||||
|
QLocale locale = QLocale::system();
|
||||||
|
if (locale.name() != "en") {
|
||||||
|
if (!installTranslator(locale.name())) {
|
||||||
|
installTranslator(locale.bcp47Name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ public:
|
||||||
*/
|
*/
|
||||||
static QString tempPath();
|
static QString tempPath();
|
||||||
|
|
||||||
|
static void loadTranslator();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SnoreCorePrivate *instance();
|
static SnoreCorePrivate *instance();
|
||||||
~SnoreCorePrivate();
|
~SnoreCorePrivate();
|
||||||
|
|
|
@ -27,8 +27,8 @@ GrowlSettings::GrowlSettings(SnorePlugin *plugin, QWidget *parent):
|
||||||
m_password(new QLineEdit)
|
m_password(new QLineEdit)
|
||||||
{
|
{
|
||||||
m_password->setEchoMode(QLineEdit::Password);
|
m_password->setEchoMode(QLineEdit::Password);
|
||||||
addRow("Host:", m_host);
|
addRow(tr("Host:"), m_host);
|
||||||
addRow("Password:", m_password);
|
addRow(tr("Password:"), m_password);
|
||||||
}
|
}
|
||||||
|
|
||||||
GrowlSettings::~GrowlSettings()
|
GrowlSettings::~GrowlSettings()
|
||||||
|
|
|
@ -24,6 +24,7 @@ class QLineEdit;
|
||||||
|
|
||||||
class GrowlSettings : public Snore::PluginSettingsWidget
|
class GrowlSettings : public Snore::PluginSettingsWidget
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit GrowlSettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
explicit GrowlSettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
||||||
~GrowlSettings();
|
~GrowlSettings();
|
||||||
|
|
|
@ -26,7 +26,7 @@ SnarlSettings::SnarlSettings(SnorePlugin *plugin, QWidget *parent):
|
||||||
m_password(new QLineEdit)
|
m_password(new QLineEdit)
|
||||||
{
|
{
|
||||||
m_password->setEchoMode(QLineEdit::Password);
|
m_password->setEchoMode(QLineEdit::Password);
|
||||||
addRow("Password:", m_password);
|
addRow(tr("Password:"), m_password);
|
||||||
}
|
}
|
||||||
|
|
||||||
SnarlSettings::~SnarlSettings()
|
SnarlSettings::~SnarlSettings()
|
||||||
|
|
|
@ -24,6 +24,7 @@ class QLineEdit;
|
||||||
|
|
||||||
class SnarlSettings : public Snore::PluginSettingsWidget
|
class SnarlSettings : public Snore::PluginSettingsWidget
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SnarlSettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
explicit SnarlSettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
||||||
~SnarlSettings();
|
~SnarlSettings();
|
||||||
|
|
|
@ -27,11 +27,11 @@ SnoreNotifierSettings::SnoreNotifierSettings(SnorePlugin *snore, QWidget *parent
|
||||||
m_comboBox(new QComboBox)
|
m_comboBox(new QComboBox)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_comboBox->addItem("TopLeftCorner", Qt::TopLeftCorner);
|
m_comboBox->addItem(tr("TopLeftCorner"), Qt::TopLeftCorner);
|
||||||
m_comboBox->addItem("TopRightCorner", Qt::TopRightCorner);
|
m_comboBox->addItem(tr("TopRightCorner"), Qt::TopRightCorner);
|
||||||
m_comboBox->addItem("BottomLeftCorner", Qt::BottomLeftCorner);
|
m_comboBox->addItem(tr("BottomLeftCorner"), Qt::BottomLeftCorner);
|
||||||
m_comboBox->addItem("BottomRightCorner", Qt::BottomRightCorner);
|
m_comboBox->addItem(tr("BottomRightCorner"), Qt::BottomRightCorner);
|
||||||
addRow("Position:", m_comboBox);
|
addRow(tr("Position:"), m_comboBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
SnoreNotifierSettings::~SnoreNotifierSettings()
|
SnoreNotifierSettings::~SnoreNotifierSettings()
|
||||||
|
|
|
@ -29,7 +29,6 @@ class QComboBox;
|
||||||
class SnoreNotifierSettings : public Snore::PluginSettingsWidget
|
class SnoreNotifierSettings : public Snore::PluginSettingsWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SnoreNotifierSettings(Snore::SnorePlugin *snore, QWidget *parent = nullptr);
|
explicit SnoreNotifierSettings(Snore::SnorePlugin *snore, QWidget *parent = nullptr);
|
||||||
~SnoreNotifierSettings();
|
~SnoreNotifierSettings();
|
||||||
|
|
|
@ -28,11 +28,11 @@ SoundSettings::SoundSettings(SnorePlugin *snorePlugin, QWidget *parent) :
|
||||||
PluginSettingsWidget(snorePlugin, parent),
|
PluginSettingsWidget(snorePlugin, parent),
|
||||||
m_lineEdit(new QLineEdit)
|
m_lineEdit(new QLineEdit)
|
||||||
{
|
{
|
||||||
addRow("Sound File:", m_lineEdit);
|
addRow(tr("Sound File:"), m_lineEdit);
|
||||||
QPushButton *button = new QPushButton("Select a sound File");
|
QPushButton *button = new QPushButton(tr("Select a sound File"));
|
||||||
connect(button, &QPushButton::clicked, [this]() {
|
connect(button, &QPushButton::clicked, [this]() {
|
||||||
QFileDialog dialog;
|
QFileDialog dialog;
|
||||||
dialog.setNameFilter("All Audio files (*.mp3 *.wav *.ogg)");
|
dialog.setNameFilter(tr("All Audio files").append("(*.mp3 *.wav *.ogg)"));
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
dialog.setDirectory(m_lineEdit->text());
|
dialog.setDirectory(m_lineEdit->text());
|
||||||
if (dialog.exec()) {
|
if (dialog.exec()) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ ToastySettings::ToastySettings(Snore::SnorePlugin *plugin, QWidget *parent) :
|
||||||
Snore::PluginSettingsWidget(plugin, parent),
|
Snore::PluginSettingsWidget(plugin, parent),
|
||||||
m_lineEdit(new QLineEdit)
|
m_lineEdit(new QLineEdit)
|
||||||
{
|
{
|
||||||
addRow("Device ID:", m_lineEdit);
|
addRow(tr("Device ID:"), m_lineEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToastySettings::~ToastySettings()
|
ToastySettings::~ToastySettings()
|
||||||
|
|
|
@ -25,7 +25,6 @@ class QLineEdit;
|
||||||
class ToastySettings : public Snore::PluginSettingsWidget
|
class ToastySettings : public Snore::PluginSettingsWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ToastySettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
explicit ToastySettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
||||||
~ToastySettings();
|
~ToastySettings();
|
||||||
|
|
Loading…
Reference in New Issue