add support for translations
This commit is contained in:
parent
886a71eee3
commit
8d71edb748
|
@ -15,12 +15,12 @@ include(KDEInstallDirs)
|
|||
include(KDECompilerSettings)
|
||||
include(KDECMakeSettings)
|
||||
|
||||
include(ECMAddAppIcon)
|
||||
include(ECMInstallIcons)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMPackageConfigHelpers)
|
||||
include(GenerateExportHeader)
|
||||
|
||||
include(ECMAddAppIcon)
|
||||
include(ECMInstallIcons)
|
||||
include(ECMPackageConfigHelpers)
|
||||
include(ECMSetupVersion)
|
||||
|
||||
#######################################################################
|
||||
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(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
find_package(Qt5Quick REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
|
||||
find_package(Doxygen QUIET)
|
||||
|
@ -66,8 +67,9 @@ message(STATUS "Installing plugins to ${LIBSNORE_PLUGIN_PATH}")
|
|||
|
||||
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(share)
|
||||
add_subdirectory(lang)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(share)
|
||||
|
||||
|
||||
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")
|
||||
|
||||
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(plugins)
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="primaryBackendLabel">
|
||||
<property name="text">
|
||||
<string>Primary Backend</string>
|
||||
<string>Primary Backend:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="timeoutLabel">
|
||||
<property name="text">
|
||||
<string>Timeout</string>
|
||||
<string>Timeout:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
|
||||
using namespace Snore;
|
||||
|
||||
SnoreCore::SnoreCore()
|
||||
SnoreCore::SnoreCore(QObject *parent):
|
||||
QObject(parent)
|
||||
{
|
||||
if (QThread::currentThread() != qApp->thread() ) {
|
||||
moveToThread(qApp->thread());
|
||||
if (QThread::currentThread() != parent->thread() ) {
|
||||
moveToThread(parent->thread());
|
||||
}
|
||||
SnoreCorePrivate::registerMetaTypes();
|
||||
d_ptr = new SnoreCorePrivate();
|
||||
Q_D(SnoreCore);
|
||||
d->q_ptr = this;
|
||||
|
@ -47,8 +47,13 @@ SnoreCore::SnoreCore()
|
|||
|
||||
SnoreCore &SnoreCore::instance()
|
||||
{
|
||||
static SnoreCore instance;
|
||||
return instance;
|
||||
static SnoreCore *instance = nullptr;
|
||||
if(!instance) {
|
||||
SnoreCorePrivate::loadTranslator();
|
||||
SnoreCorePrivate::registerMetaTypes();
|
||||
instance = new SnoreCore(qApp);
|
||||
}
|
||||
return *instance;
|
||||
}
|
||||
|
||||
SnoreCore::~SnoreCore()
|
||||
|
|
|
@ -177,7 +177,7 @@ signals:
|
|||
void notificationClosed(Snore::Notification);
|
||||
|
||||
private:
|
||||
SnoreCore();
|
||||
SnoreCore(QObject *parent);
|
||||
SnoreCorePrivate *d_ptr;
|
||||
|
||||
};
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QTemporaryDir>
|
||||
#include <QTranslator>
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
|
@ -218,6 +219,7 @@ void SnoreCorePrivate::slotNotificationClosed(Notification n)
|
|||
Q_Q(SnoreCore);
|
||||
emit q->notificationClosed(n);
|
||||
if (n.data()->source()) {
|
||||
//TODO: drop source and use signal aswell
|
||||
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 void loadTranslator();
|
||||
|
||||
public:
|
||||
static SnoreCorePrivate *instance();
|
||||
~SnoreCorePrivate();
|
||||
|
|
|
@ -27,8 +27,8 @@ GrowlSettings::GrowlSettings(SnorePlugin *plugin, QWidget *parent):
|
|||
m_password(new QLineEdit)
|
||||
{
|
||||
m_password->setEchoMode(QLineEdit::Password);
|
||||
addRow("Host:", m_host);
|
||||
addRow("Password:", m_password);
|
||||
addRow(tr("Host:"), m_host);
|
||||
addRow(tr("Password:"), m_password);
|
||||
}
|
||||
|
||||
GrowlSettings::~GrowlSettings()
|
||||
|
|
|
@ -24,6 +24,7 @@ class QLineEdit;
|
|||
|
||||
class GrowlSettings : public Snore::PluginSettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GrowlSettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
||||
~GrowlSettings();
|
||||
|
|
|
@ -26,7 +26,7 @@ SnarlSettings::SnarlSettings(SnorePlugin *plugin, QWidget *parent):
|
|||
m_password(new QLineEdit)
|
||||
{
|
||||
m_password->setEchoMode(QLineEdit::Password);
|
||||
addRow("Password:", m_password);
|
||||
addRow(tr("Password:"), m_password);
|
||||
}
|
||||
|
||||
SnarlSettings::~SnarlSettings()
|
||||
|
|
|
@ -24,6 +24,7 @@ class QLineEdit;
|
|||
|
||||
class SnarlSettings : public Snore::PluginSettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SnarlSettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
||||
~SnarlSettings();
|
||||
|
|
|
@ -27,11 +27,11 @@ SnoreNotifierSettings::SnoreNotifierSettings(SnorePlugin *snore, QWidget *parent
|
|||
m_comboBox(new QComboBox)
|
||||
{
|
||||
|
||||
m_comboBox->addItem("TopLeftCorner", Qt::TopLeftCorner);
|
||||
m_comboBox->addItem("TopRightCorner", Qt::TopRightCorner);
|
||||
m_comboBox->addItem("BottomLeftCorner", Qt::BottomLeftCorner);
|
||||
m_comboBox->addItem("BottomRightCorner", Qt::BottomRightCorner);
|
||||
addRow("Position:", m_comboBox);
|
||||
m_comboBox->addItem(tr("TopLeftCorner"), Qt::TopLeftCorner);
|
||||
m_comboBox->addItem(tr("TopRightCorner"), Qt::TopRightCorner);
|
||||
m_comboBox->addItem(tr("BottomLeftCorner"), Qt::BottomLeftCorner);
|
||||
m_comboBox->addItem(tr("BottomRightCorner"), Qt::BottomRightCorner);
|
||||
addRow(tr("Position:"), m_comboBox);
|
||||
}
|
||||
|
||||
SnoreNotifierSettings::~SnoreNotifierSettings()
|
||||
|
|
|
@ -29,7 +29,6 @@ class QComboBox;
|
|||
class SnoreNotifierSettings : public Snore::PluginSettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SnoreNotifierSettings(Snore::SnorePlugin *snore, QWidget *parent = nullptr);
|
||||
~SnoreNotifierSettings();
|
||||
|
|
|
@ -28,11 +28,11 @@ SoundSettings::SoundSettings(SnorePlugin *snorePlugin, QWidget *parent) :
|
|||
PluginSettingsWidget(snorePlugin, parent),
|
||||
m_lineEdit(new QLineEdit)
|
||||
{
|
||||
addRow("Sound File:", m_lineEdit);
|
||||
QPushButton *button = new QPushButton("Select a sound File");
|
||||
addRow(tr("Sound File:"), m_lineEdit);
|
||||
QPushButton *button = new QPushButton(tr("Select a sound File"));
|
||||
connect(button, &QPushButton::clicked, [this]() {
|
||||
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.setDirectory(m_lineEdit->text());
|
||||
if (dialog.exec()) {
|
||||
|
|
|
@ -25,7 +25,7 @@ ToastySettings::ToastySettings(Snore::SnorePlugin *plugin, QWidget *parent) :
|
|||
Snore::PluginSettingsWidget(plugin, parent),
|
||||
m_lineEdit(new QLineEdit)
|
||||
{
|
||||
addRow("Device ID:", m_lineEdit);
|
||||
addRow(tr("Device ID:"), m_lineEdit);
|
||||
}
|
||||
|
||||
ToastySettings::~ToastySettings()
|
||||
|
|
|
@ -25,7 +25,6 @@ class QLineEdit;
|
|||
class ToastySettings : public Snore::PluginSettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ToastySettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
||||
~ToastySettings();
|
||||
|
|
Loading…
Reference in New Issue