mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
fix library translations
This commit is contained in:
parent
983b808247
commit
bbb9aa0747
@ -3,20 +3,13 @@ set (SUBPROJECT ${PROJECT_LIBRARY})
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||
|
||||
# find required libaries
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core Network Widgets)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
||||
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE})
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE})
|
||||
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp)
|
||||
file (GLOB SUBPROJECT_HEADER *.h ${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.h)
|
||||
@ -32,11 +25,11 @@ qt5_wrap_cpp (SUBPROJECT_MOC_SOURCE ${SUBPROJECT_HEADER})
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_MOC_SOURCE}
|
||||
${SUBPROJECT_HEADER} ${SUBPROJECT_UI_HEADER})
|
||||
target_link_libraries (${SUBPROJECT} ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES})
|
||||
target_link_libraries (${SUBPROJECT} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
# install
|
||||
install (DIRECTORY ${SUBPROJECT_GRAPHITEMS} DESTINATION share/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION share/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION share/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION share/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_WEATHER} DESTINATION share/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_GRAPHITEMS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_WEATHER} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
|
@ -72,6 +72,7 @@ private:
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
||||
virtual void translate() = 0;
|
||||
// properties
|
||||
int m_apiVersion = 0;
|
||||
bool m_active = true;
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "abstractextitemaggregator.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QInputDialog>
|
||||
@ -33,9 +35,9 @@ AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent, const bool
|
||||
widgetDialog = new QListWidget(dialog);
|
||||
dialogButtons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close,
|
||||
Qt::Vertical, dialog);
|
||||
copyButton = dialogButtons->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
|
||||
createButton = dialogButtons->addButton(tr("Create"), QDialogButtonBox::ActionRole);
|
||||
deleteButton = dialogButtons->addButton(tr("Remove"), QDialogButtonBox::ActionRole);
|
||||
copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
||||
createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole);
|
||||
deleteButton = dialogButtons->addButton(i18n("Remove"), QDialogButtonBox::ActionRole);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(widgetDialog);
|
||||
layout->addWidget(dialogButtons);
|
||||
@ -62,8 +64,8 @@ QString AbstractExtItemAggregator::getName()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(this, tr("Enter file name"),
|
||||
tr("File name"), QLineEdit::Normal,
|
||||
QString name = QInputDialog::getText(this, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
QString(""), &ok);
|
||||
if ((!ok) || (name.isEmpty())) return QString("");
|
||||
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
// additinal class since QObject macro does not allow class templates
|
||||
class AbstractExtItemAggregator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -18,6 +18,8 @@
|
||||
#ifndef EXTITEMAGGREGATOR_H
|
||||
#define EXTITEMAGGREGATOR_H
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
@ -146,9 +148,9 @@ private:
|
||||
for (int i=0; i<m_items.count(); i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem(m_items[i]->fileName(), widgetDialog);
|
||||
QStringList tooltip;
|
||||
tooltip.append(tr("Name: %1").arg(m_items[i]->name()));
|
||||
tooltip.append(tr("Comment: %1").arg(m_items[i]->comment()));
|
||||
tooltip.append(tr("Identity: %1").arg(m_items[i]->uniq()));
|
||||
tooltip.append(i18n("Name: %1", m_items[i]->name()));
|
||||
tooltip.append(i18n("Comment: %1", m_items[i]->comment()));
|
||||
tooltip.append(i18n("Identity: %1", m_items[i]->uniq()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
widgetDialog->addItem(item);
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "extquotes.h"
|
||||
#include "ui_extquotes.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
@ -40,6 +42,7 @@ ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
|
||||
{
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
values[QString("ask")] = 0.0;
|
||||
values[QString("askchg")] = 0.0;
|
||||
@ -237,6 +240,20 @@ void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label->setText(i18n("<html><head/><body><p>Use YAHOO! finance ticker to get quotes for the instrument. Refer to <a href=\"http://finance.yahoo.com/\"><span style=\" text-decoration: underline; color:#0057ae;\">http://finance.yahoo.com/</span></a></p></body></html>"));
|
||||
ui->label_ticker->setText(i18n("Ticker"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::url() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
@ -61,6 +61,7 @@ private:
|
||||
QNetworkAccessManager *manager;
|
||||
bool isRunning = false;
|
||||
Ui::ExtQuotes *ui;
|
||||
void translate();
|
||||
QString url() const;
|
||||
// properties
|
||||
QString m_ticker = QString("EURUSD=X");
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "extscript.h"
|
||||
#include "ui_extscript.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
@ -40,6 +42,7 @@ ExtScript::ExtScript(QWidget *parent, const QString scriptName,
|
||||
readConfiguration();
|
||||
readJsonFilters();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
value[QString("value")] = QString("");
|
||||
|
||||
@ -407,3 +410,23 @@ void ExtScript::updateValue()
|
||||
// filters
|
||||
value[QString("value")] = applyFilters(value[QString("value")].toString());
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label_command->setText(i18n("Command"));
|
||||
ui->label_prefix->setText(i18n("Prefix"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->checkBox_output->setText(i18n("Has output"));
|
||||
ui->label_redirect->setText(i18n("Redirect"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
ui->groupBox_filters->setTitle(i18n("Additional filters"));
|
||||
ui->checkBox_colorFilter->setText(i18n("Wrap colors"));
|
||||
ui->checkBox_linesFilter->setText(i18n("Wrap new lines"));
|
||||
ui->checkBox_spaceFilter->setText(i18n("Wrap spaces"));
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ private:
|
||||
bool debug;
|
||||
QProcess *process = nullptr;
|
||||
Ui::ExtScript *ui;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_executable = QString("/usr/bin/true");
|
||||
QStringList m_filters = QStringList();
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "extupgrade.h"
|
||||
#include "ui_extupgrade.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
@ -36,6 +38,7 @@ ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
|
||||
{
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
value[QString("value")] = 0;
|
||||
|
||||
@ -211,3 +214,17 @@ void ExtUpgrade::updateValue()
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed();
|
||||
value[QString("value")] = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count() - m_null;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label_command->setText(i18n("Command"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->label_null->setText(i18n("Null"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ private:
|
||||
bool debug;
|
||||
QProcess *process = nullptr;
|
||||
Ui::ExtUpgrade *ui;
|
||||
void translate();
|
||||
// properties
|
||||
QString m_executable = QString("/usr/bin/true");
|
||||
int m_null = 0;
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "extweather.h"
|
||||
#include "ui_extweather.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
@ -40,6 +42,7 @@ ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
|
||||
{
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
values[QString("weatherId")] = 0;
|
||||
values[QString("weather")] = QString("");
|
||||
@ -398,6 +401,21 @@ QVariantMap ExtWeather::parseSingleJson(const QVariantMap json) const
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_number->setText(i18n("Tag"));
|
||||
ui->label_city->setText(i18n("City"));
|
||||
ui->label_country->setText(i18n("Country"));
|
||||
ui->label_timestamp->setText(i18n("Timestamp"));
|
||||
ui->checkBox_active->setText(i18n("Active"));
|
||||
ui->label_interval->setText(i18n("Interval"));
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::url(const bool isForecast) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
@ -70,6 +70,7 @@ private:
|
||||
bool isRunning = false;
|
||||
Ui::ExtWeather *ui;
|
||||
QVariantMap parseSingleJson(const QVariantMap json) const;
|
||||
void translate();
|
||||
QString url(const bool isForecast = false) const;
|
||||
// properties
|
||||
QString m_city = QString("London");
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "graphicalitem.h"
|
||||
#include "ui_graphicalitem.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QColorDialog>
|
||||
#include <QDebug>
|
||||
@ -39,8 +41,9 @@ GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
|
||||
ui(new Ui::GraphicalItem)
|
||||
{
|
||||
readConfiguration();
|
||||
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
connect(ui->pushButton_activeColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||
connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||
}
|
||||
@ -491,3 +494,19 @@ QColor GraphicalItem::stringToColor(const QString _color) const
|
||||
|
||||
return qcolor;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::translate()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
ui->label_comment->setText(i18n("Comment"));
|
||||
ui->label_value->setText(i18n("Value"));
|
||||
ui->label_activeColor->setText(i18n("Active color"));
|
||||
ui->label_inactiveColor->setText(i18n("Inactive color"));
|
||||
ui->label_type->setText(i18n("Type"));
|
||||
ui->label_direction->setText(i18n("Direction"));
|
||||
ui->label_height->setText(i18n("Height"));
|
||||
ui->label_width->setText(i18n("Width"));
|
||||
}
|
||||
|
@ -87,11 +87,12 @@ private slots:
|
||||
void changeColor();
|
||||
|
||||
private:
|
||||
QColor stringToColor(const QString _color) const;
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
||||
Ui::GraphicalItem *ui;
|
||||
QColor stringToColor(const QString _color) const;
|
||||
void translate();
|
||||
// properties
|
||||
int m_apiVersion = 0;
|
||||
QString m_name = QString("none");
|
||||
|
Loading…
Reference in New Issue
Block a user