mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Dynamic translation
qTox can now retranslate its GUI dynamically, without needing a restart Fixes #1671 Closes #1672
This commit is contained in:
parent
0fd489fbba
commit
15ca7a587f
|
@ -15,6 +15,7 @@
|
||||||
#include "chatlog.h"
|
#include "chatlog.h"
|
||||||
#include "chatmessage.h"
|
#include "chatmessage.h"
|
||||||
#include "chatlinecontent.h"
|
#include "chatlinecontent.h"
|
||||||
|
#include "src/translator.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
@ -61,7 +62,6 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
// copy action (ie. Ctrl+C)
|
// copy action (ie. Ctrl+C)
|
||||||
copyAction = new QAction(this);
|
copyAction = new QAction(this);
|
||||||
copyAction->setIcon(QIcon::fromTheme("edit-copy"));
|
copyAction->setIcon(QIcon::fromTheme("edit-copy"));
|
||||||
copyAction->setText(tr("Copy"));
|
|
||||||
copyAction->setShortcut(QKeySequence::Copy);
|
copyAction->setShortcut(QKeySequence::Copy);
|
||||||
copyAction->setEnabled(false);
|
copyAction->setEnabled(false);
|
||||||
connect(copyAction, &QAction::triggered, this, [this]() { copySelectedText(); });
|
connect(copyAction, &QAction::triggered, this, [this]() { copySelectedText(); });
|
||||||
|
@ -74,9 +74,8 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// select all action (ie. Ctrl+A)
|
// select all action (ie. Ctrl+A)
|
||||||
QAction* selectAllAction = new QAction(this);
|
selectAllAction = new QAction(this);
|
||||||
selectAllAction->setIcon(QIcon::fromTheme("edit-select-all"));
|
selectAllAction->setIcon(QIcon::fromTheme("edit-select-all"));
|
||||||
selectAllAction->setText(tr("Select all"));
|
|
||||||
selectAllAction->setShortcut(QKeySequence::SelectAll);
|
selectAllAction->setShortcut(QKeySequence::SelectAll);
|
||||||
connect(selectAllAction, &QAction::triggered, this, [this]() { selectAll(); });
|
connect(selectAllAction, &QAction::triggered, this, [this]() { selectAll(); });
|
||||||
addAction(selectAllAction);
|
addAction(selectAllAction);
|
||||||
|
@ -103,10 +102,15 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
copySelectedText(true);
|
copySelectedText(true);
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
Translator::registerHandler(std::bind(&ChatLog::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatLog::~ChatLog()
|
ChatLog::~ChatLog()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
|
|
||||||
// Remove chatlines from scene
|
// Remove chatlines from scene
|
||||||
for (ChatLine::Ptr l : lines)
|
for (ChatLine::Ptr l : lines)
|
||||||
l->removeFromScene();
|
l->removeFromScene();
|
||||||
|
@ -812,3 +816,9 @@ void ChatLog::focusOutEvent(QFocusEvent* ev)
|
||||||
lines[i]->selectionFocusChanged(false);
|
lines[i]->selectionFocusChanged(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatLog::retranslateUi()
|
||||||
|
{
|
||||||
|
copyAction->setText(tr("Copy"));
|
||||||
|
selectAllAction->setText(tr("Select all"));
|
||||||
|
}
|
||||||
|
|
|
@ -99,6 +99,9 @@ private slots:
|
||||||
void onSelectionTimerTimeout();
|
void onSelectionTimerTimeout();
|
||||||
void onWorkerTimeout();
|
void onWorkerTimeout();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum SelectionMode {
|
enum SelectionMode {
|
||||||
None,
|
None,
|
||||||
|
@ -113,6 +116,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
QAction* copyAction = nullptr;
|
QAction* copyAction = nullptr;
|
||||||
|
QAction* selectAllAction = nullptr;
|
||||||
QGraphicsScene* scene = nullptr;
|
QGraphicsScene* scene = nullptr;
|
||||||
QGraphicsScene* busyScene = nullptr;
|
QGraphicsScene* busyScene = nullptr;
|
||||||
QVector<ChatLine::Ptr> lines;
|
QVector<ChatLine::Ptr> lines;
|
||||||
|
@ -141,9 +145,6 @@ private:
|
||||||
// layout
|
// layout
|
||||||
QMargins margins = QMargins(10,10,10,10);
|
QMargins margins = QMargins(10,10,10,10);
|
||||||
qreal lineSpacing = 5.0f;
|
qreal lineSpacing = 5.0f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATLOG_H
|
#endif // CHATLOG_H
|
||||||
|
|
|
@ -6,11 +6,16 @@
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
|
||||||
QTranslator* Translator::translator{nullptr};
|
QTranslator* Translator::translator{nullptr};
|
||||||
|
QVector<QPair<void*, std::function<void()>>> Translator::callbacks;
|
||||||
|
QMutex Translator::lock;
|
||||||
|
|
||||||
void Translator::translate()
|
void Translator::translate()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker{&lock};
|
||||||
|
|
||||||
if (!translator)
|
if (!translator)
|
||||||
translator = new QTranslator();
|
translator = new QTranslator();
|
||||||
|
|
||||||
|
@ -20,29 +25,51 @@ void Translator::translate()
|
||||||
if ((locale = Settings::getInstance().getTranslation()).isEmpty())
|
if ((locale = Settings::getInstance().getTranslation()).isEmpty())
|
||||||
locale = QLocale::system().name().section('_', 0, 0);
|
locale = QLocale::system().name().section('_', 0, 0);
|
||||||
|
|
||||||
if (locale == "en")
|
if (locale != "en")
|
||||||
return;
|
|
||||||
|
|
||||||
if (translator->load(locale, ":translations/"))
|
|
||||||
{
|
{
|
||||||
qDebug() << "Loaded translation" << locale;
|
if (translator->load(locale, ":translations/"))
|
||||||
|
|
||||||
// system menu translation
|
|
||||||
QTranslator *qtTranslator = new QTranslator();
|
|
||||||
QString s_locale = "qt_"+locale;
|
|
||||||
if (qtTranslator->load(s_locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
|
||||||
{
|
{
|
||||||
QApplication::installTranslator(qtTranslator);
|
qDebug() << "Loaded translation" << locale;
|
||||||
qDebug() << "System translation loaded" << locale;
|
|
||||||
|
// system menu translation
|
||||||
|
QTranslator *qtTranslator = new QTranslator();
|
||||||
|
QString s_locale = "qt_"+locale;
|
||||||
|
if (qtTranslator->load(s_locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
||||||
|
{
|
||||||
|
QApplication::installTranslator(qtTranslator);
|
||||||
|
qDebug() << "System translation loaded" << locale;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "System translation not loaded" << locale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "System translation not loaded" << locale;
|
qDebug() << "Error loading translation" << locale;
|
||||||
|
}
|
||||||
|
QCoreApplication::installTranslator(translator);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto pair : callbacks)
|
||||||
|
pair.second();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Translator::registerHandler(std::function<void()> f, void *owner)
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&lock};
|
||||||
|
callbacks.push_back({owner, f});
|
||||||
|
}
|
||||||
|
|
||||||
|
void Translator::unregister(void *owner)
|
||||||
|
{
|
||||||
|
QMutexLocker locker{&lock};
|
||||||
|
for (int i=0; i<callbacks.size(); i++)
|
||||||
|
{
|
||||||
|
if (callbacks[i].first == owner)
|
||||||
|
{
|
||||||
|
callbacks.removeAt(i);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug() << "Error loading translation" << locale;
|
|
||||||
}
|
|
||||||
QCoreApplication::installTranslator(translator);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#ifndef TRANSLATOR_H
|
#ifndef TRANSLATOR_H
|
||||||
#define TRANSLATOR_H
|
#define TRANSLATOR_H
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
|
#include <QPair>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
class QTranslator;
|
class QTranslator;
|
||||||
|
|
||||||
class Translator
|
class Translator
|
||||||
|
@ -8,9 +13,15 @@ class Translator
|
||||||
public:
|
public:
|
||||||
/// Loads the translations according to the settings or locale
|
/// Loads the translations according to the settings or locale
|
||||||
static void translate();
|
static void translate();
|
||||||
|
/// Register a function to be called when the UI needs to be retranslated
|
||||||
|
static void registerHandler(std::function<void()>, void* owner);
|
||||||
|
/// Unregisters all handlers of an owner
|
||||||
|
static void unregister(void* owner);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QTranslator* translator;
|
static QTranslator* translator;
|
||||||
|
static QVector<QPair<void*, std::function<void()>>> callbacks;
|
||||||
|
static QMutex lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSLATOR_H
|
#endif // TRANSLATOR_H
|
||||||
|
|
|
@ -26,18 +26,16 @@
|
||||||
#include "src/toxdns.h"
|
#include "src/toxdns.h"
|
||||||
#include "src/misc/settings.h"
|
#include "src/misc/settings.h"
|
||||||
#include "src/widget/gui.h"
|
#include "src/widget/gui.h"
|
||||||
|
#include "src/translator.h"
|
||||||
|
|
||||||
AddFriendForm::AddFriendForm()
|
AddFriendForm::AddFriendForm()
|
||||||
{
|
{
|
||||||
main = new QWidget(), head = new QWidget();
|
main = new QWidget(), head = new QWidget();
|
||||||
QFont bold;
|
QFont bold;
|
||||||
bold.setBold(true);
|
bold.setBold(true);
|
||||||
headLabel.setText(tr("Add Friends"));
|
|
||||||
headLabel.setFont(bold);
|
headLabel.setFont(bold);
|
||||||
|
|
||||||
toxIdLabel.setText(tr("Tox ID","Tox ID of the person you're sending a friend request to"));
|
retranslateUi();
|
||||||
messageLabel.setText(tr("Message","The message you send in friend requests"));
|
|
||||||
sendButton.setText(tr("Send friend request"));
|
|
||||||
|
|
||||||
main->setLayout(&layout);
|
main->setLayout(&layout);
|
||||||
layout.addWidget(&toxIdLabel);
|
layout.addWidget(&toxIdLabel);
|
||||||
|
@ -52,10 +50,13 @@ AddFriendForm::AddFriendForm()
|
||||||
connect(&toxId,&QLineEdit::returnPressed, this, &AddFriendForm::onSendTriggered);
|
connect(&toxId,&QLineEdit::returnPressed, this, &AddFriendForm::onSendTriggered);
|
||||||
connect(&sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered()));
|
connect(&sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered()));
|
||||||
connect(Nexus::getCore(), &Core::usernameSet, this, &AddFriendForm::onUsernameSet);
|
connect(Nexus::getCore(), &Core::usernameSet, this, &AddFriendForm::onUsernameSet);
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&AddFriendForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddFriendForm::~AddFriendForm()
|
AddFriendForm::~AddFriendForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
head->deleteLater();
|
head->deleteLater();
|
||||||
main->deleteLater();
|
main->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,8 @@ QString AddFriendForm::getMessage() const
|
||||||
|
|
||||||
void AddFriendForm::onUsernameSet(const QString& username)
|
void AddFriendForm::onUsernameSet(const QString& username)
|
||||||
{
|
{
|
||||||
message.setPlaceholderText(tr("%1 here! Tox me maybe?","Default message in friend requests if the field is left blank. Write something appropriate!").arg(username));
|
lastUsername = username;
|
||||||
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFriendForm::onSendTriggered()
|
void AddFriendForm::onSendTriggered()
|
||||||
|
@ -133,3 +135,14 @@ void AddFriendForm::setIdFromClipboard()
|
||||||
toxId.setText(id);
|
toxId.setText(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddFriendForm::retranslateUi()
|
||||||
|
{
|
||||||
|
headLabel.setText(tr("Add Friends"));
|
||||||
|
toxIdLabel.setText(tr("Tox ID","Tox ID of the person you're sending a friend request to"));
|
||||||
|
messageLabel.setText(tr("Message","The message you send in friend requests"));
|
||||||
|
sendButton.setText(tr("Send friend request"));
|
||||||
|
message.setPlaceholderText(tr("%1 here! Tox me maybe?",
|
||||||
|
"Default message in friend requests if the field is left blank. Write something appropriate!")
|
||||||
|
.arg(lastUsername));
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void onSendTriggered();
|
void onSendTriggered();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setIdFromClipboard();
|
void setIdFromClipboard();
|
||||||
QLabel headLabel, toxIdLabel, messageLabel;
|
QLabel headLabel, toxIdLabel, messageLabel;
|
||||||
|
@ -50,6 +53,7 @@ private:
|
||||||
QTextEdit message;
|
QTextEdit message;
|
||||||
QVBoxLayout layout, headLayout;
|
QVBoxLayout layout, headLayout;
|
||||||
QWidget *head, *main;
|
QWidget *head, *main;
|
||||||
|
QString lastUsername; // Cached username so we can retranslate the invite message
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ADDFRIENDFORM_H
|
#endif // ADDFRIENDFORM_H
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "src/offlinemsgengine.h"
|
#include "src/offlinemsgengine.h"
|
||||||
#include "src/widget/tool/screenshotgrabber.h"
|
#include "src/widget/tool/screenshotgrabber.h"
|
||||||
#include "src/widget/tool/flyoutoverlaywidget.h"
|
#include "src/widget/tool/flyoutoverlaywidget.h"
|
||||||
|
#include "src/translator.h"
|
||||||
|
|
||||||
ChatForm::ChatForm(Friend* chatFriend)
|
ChatForm::ChatForm(Friend* chatFriend)
|
||||||
: f(chatFriend)
|
: f(chatFriend)
|
||||||
|
@ -79,7 +80,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
headTextLayout->addWidget(callDuration, 1, Qt::AlignCenter);
|
headTextLayout->addWidget(callDuration, 1, Qt::AlignCenter);
|
||||||
callDuration->hide();
|
callDuration->hide();
|
||||||
|
|
||||||
menu.addAction(QObject::tr("Load chat history..."), this, SLOT(onLoadHistory()));
|
loadHistoryAction = menu.addAction(QString(), this, SLOT(onLoadHistory()));
|
||||||
|
|
||||||
connect(Core::getInstance(), &Core::fileSendStarted, this, &ChatForm::startFileSend);
|
connect(Core::getInstance(), &Core::fileSendStarted, this, &ChatForm::startFileSend);
|
||||||
connect(sendButton, &QPushButton::clicked, this, &ChatForm::onSendTriggered);
|
connect(sendButton, &QPushButton::clicked, this, &ChatForm::onSendTriggered);
|
||||||
|
@ -100,10 +101,14 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
} );
|
} );
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
Translator::registerHandler(std::bind(&ChatForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatForm::~ChatForm()
|
ChatForm::~ChatForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete netcam;
|
delete netcam;
|
||||||
delete callConfirm;
|
delete callConfirm;
|
||||||
delete offlineEngine;
|
delete offlineEngine;
|
||||||
|
@ -1049,3 +1054,8 @@ void ChatForm::hideNetcam()
|
||||||
delete netcam;
|
delete netcam;
|
||||||
netcam = nullptr;
|
netcam = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatForm::retranslateUi()
|
||||||
|
{
|
||||||
|
loadHistoryAction->setText(tr("Load chat history..."));
|
||||||
|
}
|
||||||
|
|
|
@ -96,6 +96,9 @@ private slots:
|
||||||
void onScreenshotTaken(const QPixmap &pixmap);
|
void onScreenshotTaken(const QPixmap &pixmap);
|
||||||
void doScreenshot();
|
void doScreenshot();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showNetcam();
|
void showNetcam();
|
||||||
void hideNetcam();
|
void hideNetcam();
|
||||||
|
@ -116,6 +119,7 @@ private:
|
||||||
QTimer *disableCallButtonsTimer;
|
QTimer *disableCallButtonsTimer;
|
||||||
QElapsedTimer timeElapsed;
|
QElapsedTimer timeElapsed;
|
||||||
OfflineMsgEngine *offlineEngine;
|
OfflineMsgEngine *offlineEngine;
|
||||||
|
QAction* loadHistoryAction;
|
||||||
|
|
||||||
QHash<uint, FileTransferInstance*> ftransWidgets;
|
QHash<uint, FileTransferInstance*> ftransWidgets;
|
||||||
void startCounter();
|
void startCounter();
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "filesform.h"
|
#include "filesform.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
|
#include "src/translator.h"
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -26,7 +27,6 @@ FilesForm::FilesForm()
|
||||||
head = new QWidget();
|
head = new QWidget();
|
||||||
QFont bold;
|
QFont bold;
|
||||||
bold.setBold(true);
|
bold.setBold(true);
|
||||||
headLabel.setText(tr("Transfered Files","\"Headline\" of the window"));
|
|
||||||
headLabel.setFont(bold);
|
headLabel.setFont(bold);
|
||||||
head->setLayout(&headLayout);
|
head->setLayout(&headLayout);
|
||||||
headLayout.addWidget(&headLabel);
|
headLayout.addWidget(&headLabel);
|
||||||
|
@ -34,16 +34,19 @@ FilesForm::FilesForm()
|
||||||
recvd = new QListWidget;
|
recvd = new QListWidget;
|
||||||
sent = new QListWidget;
|
sent = new QListWidget;
|
||||||
|
|
||||||
main.addTab(recvd, tr("Downloads"));
|
main.addTab(recvd, QString());
|
||||||
main.addTab(sent, tr("Uploads"));
|
main.addTab(sent, QString());
|
||||||
|
|
||||||
connect(sent, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(onFileActivated(QListWidgetItem*)));
|
connect(sent, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(onFileActivated(QListWidgetItem*)));
|
||||||
connect(recvd, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(onFileActivated(QListWidgetItem*)));
|
connect(recvd, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(onFileActivated(QListWidgetItem*)));
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
Translator::registerHandler(std::bind(&FilesForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilesForm::~FilesForm()
|
FilesForm::~FilesForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete recvd;
|
delete recvd;
|
||||||
delete sent;
|
delete sent;
|
||||||
head->deleteLater();
|
head->deleteLater();
|
||||||
|
@ -82,3 +85,10 @@ void FilesForm::onFileActivated(QListWidgetItem* item)
|
||||||
|
|
||||||
Widget::confirmExecutableOpen(QFileInfo(tmp->path));
|
Widget::confirmExecutableOpen(QFileInfo(tmp->path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FilesForm::retranslateUi()
|
||||||
|
{
|
||||||
|
headLabel.setText(tr("Transfered Files","\"Headline\" of the window"));
|
||||||
|
main.setTabText(0, tr("Downloads"));
|
||||||
|
main.setTabText(1, tr("Uploads"));
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,9 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void onFileActivated(QListWidgetItem* item);
|
void onFileActivated(QListWidgetItem* item);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* head;
|
QWidget* head;
|
||||||
QLabel headLabel;
|
QLabel headLabel;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "src/chatlog/chatlog.h"
|
#include "src/chatlog/chatlog.h"
|
||||||
#include "src/chatlog/content/timestamp.h"
|
#include "src/chatlog/content/timestamp.h"
|
||||||
#include "src/widget/tool/flyoutoverlaywidget.h"
|
#include "src/widget/tool/flyoutoverlaywidget.h"
|
||||||
|
#include "src/translator.h"
|
||||||
|
|
||||||
GenericChatForm::GenericChatForm(QWidget *parent)
|
GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
@ -69,21 +70,15 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
msgEdit = new ChatTextEdit();
|
msgEdit = new ChatTextEdit();
|
||||||
|
|
||||||
sendButton = new QPushButton();
|
sendButton = new QPushButton();
|
||||||
sendButton->setToolTip(tr("Send message"));
|
|
||||||
emoteButton = new QPushButton();
|
emoteButton = new QPushButton();
|
||||||
emoteButton->setToolTip(tr("Smileys"));
|
|
||||||
|
|
||||||
// Setting the sizes in the CSS doesn't work (glitch with high DPIs)
|
// Setting the sizes in the CSS doesn't work (glitch with high DPIs)
|
||||||
fileButton = new QPushButton();
|
fileButton = new QPushButton();
|
||||||
fileButton->setToolTip(tr("Send file(s)"));
|
|
||||||
screenshotButton = new QPushButton;
|
screenshotButton = new QPushButton;
|
||||||
screenshotButton->setToolTip(tr("Send a screenshot"));
|
|
||||||
callButton = new QPushButton();
|
callButton = new QPushButton();
|
||||||
callButton->setFixedSize(50,40);
|
callButton->setFixedSize(50,40);
|
||||||
callButton->setToolTip(tr("Start an audio call"));
|
|
||||||
videoButton = new QPushButton();
|
videoButton = new QPushButton();
|
||||||
videoButton->setFixedSize(50,40);
|
videoButton->setFixedSize(50,40);
|
||||||
videoButton->setToolTip(tr("Start a video call"));
|
|
||||||
volButton = new QPushButton();
|
volButton = new QPushButton();
|
||||||
//volButton->setFixedSize(25,20);
|
//volButton->setFixedSize(25,20);
|
||||||
volButton->setToolTip("");
|
volButton->setToolTip("");
|
||||||
|
@ -172,8 +167,8 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
|
|
||||||
menu.addActions(chatWidget->actions());
|
menu.addActions(chatWidget->actions());
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addAction(QIcon::fromTheme("document-save"), tr("Save chat log"), this, SLOT(onSaveLogClicked()));
|
saveChatAction = menu.addAction(QIcon::fromTheme("document-save"), QString(), this, SLOT(onSaveLogClicked()));
|
||||||
menu.addAction(QIcon::fromTheme("edit-clear"), tr("Clear displayed messages"), this, SLOT(clearChatArea(bool)));
|
clearAction = menu.addAction(QIcon::fromTheme("edit-clear"), QString(), this, SLOT(clearChatArea(bool)));
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
connect(emoteButton, &QPushButton::clicked, this, &GenericChatForm::onEmoteButtonClicked);
|
connect(emoteButton, &QPushButton::clicked, this, &GenericChatForm::onEmoteButtonClicked);
|
||||||
|
@ -188,6 +183,14 @@ GenericChatForm::GenericChatForm(QWidget *parent)
|
||||||
fileFlyout->setParent(this);
|
fileFlyout->setParent(this);
|
||||||
fileButton->installEventFilter(this);
|
fileButton->installEventFilter(this);
|
||||||
fileFlyout->installEventFilter(this);
|
fileFlyout->installEventFilter(this);
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
Translator::registerHandler(std::bind(&GenericChatForm::retranslateUi, this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
GenericChatForm::~GenericChatForm()
|
||||||
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::adjustFileMenuPosition()
|
void GenericChatForm::adjustFileMenuPosition()
|
||||||
|
@ -459,3 +462,15 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenericChatForm::retranslateUi()
|
||||||
|
{
|
||||||
|
sendButton->setToolTip(tr("Send message"));
|
||||||
|
emoteButton->setToolTip(tr("Smileys"));
|
||||||
|
fileButton->setToolTip(tr("Send file(s)"));
|
||||||
|
screenshotButton->setToolTip(tr("Send a screenshot"));
|
||||||
|
callButton->setToolTip(tr("Start an audio call"));
|
||||||
|
videoButton->setToolTip(tr("Start a video call"));
|
||||||
|
saveChatAction->setText(tr("Save chat log"));
|
||||||
|
clearAction->setText(tr("Clear displayed messages"));
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ class GenericChatForm : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GenericChatForm(QWidget *parent = 0);
|
GenericChatForm(QWidget *parent = 0);
|
||||||
|
~GenericChatForm();
|
||||||
|
|
||||||
virtual void setName(const QString &newName);
|
virtual void setName(const QString &newName);
|
||||||
virtual void show(Ui::MainWindow &ui);
|
virtual void show(Ui::MainWindow &ui);
|
||||||
|
@ -79,6 +80,9 @@ protected slots:
|
||||||
void showFileMenu();
|
void showFileMenu();
|
||||||
void hideFileMenu();
|
void hideFileMenu();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString resolveToxId(const ToxId &id);
|
QString resolveToxId(const ToxId &id);
|
||||||
void insertChatMessage(ChatMessage::Ptr msg);
|
void insertChatMessage(ChatMessage::Ptr msg);
|
||||||
|
@ -86,6 +90,7 @@ protected:
|
||||||
void resizeEvent(QResizeEvent* event);
|
void resizeEvent(QResizeEvent* event);
|
||||||
void adjustFileMenuPosition();
|
void adjustFileMenuPosition();
|
||||||
|
|
||||||
|
QAction* saveChatAction, *clearAction;
|
||||||
ToxId previousId;
|
ToxId previousId;
|
||||||
QDateTime prevMsgDateTime;
|
QDateTime prevMsgDateTime;
|
||||||
Widget *parent;
|
Widget *parent;
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
#include "src/widget/maskablepixmapwidget.h"
|
#include "src/widget/maskablepixmapwidget.h"
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include "src/misc/style.h"
|
#include "src/misc/style.h"
|
||||||
|
#include "src/historykeeper.h"
|
||||||
|
#include "src/misc/flowlayout.h"
|
||||||
|
#include "src/translator.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTimer>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include "src/historykeeper.h"
|
|
||||||
#include "src/misc/flowlayout.h"
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
GroupChatForm::GroupChatForm(Group* chatGroup)
|
GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
: group(chatGroup), inCall{false}
|
: group(chatGroup), inCall{false}
|
||||||
|
@ -53,8 +54,8 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
nameLabel->setText(group->getGroupWidget()->getName());
|
nameLabel->setText(group->getGroupWidget()->getName());
|
||||||
|
|
||||||
nusersLabel->setFont(Style::getFont(Style::Medium));
|
nusersLabel->setFont(Style::getFont(Style::Medium));
|
||||||
nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->getPeersCount()));
|
|
||||||
nusersLabel->setObjectName("statusLabel");
|
nusersLabel->setObjectName("statusLabel");
|
||||||
|
retranslateUi();
|
||||||
|
|
||||||
avatar->setPixmap(Style::scaleSvgImage(":/img/group_dark.svg", avatar->width(), avatar->height()), Qt::transparent);
|
avatar->setPixmap(Style::scaleSvgImage(":/img/group_dark.svg", avatar->width(), avatar->height()), Qt::transparent);
|
||||||
|
|
||||||
|
@ -88,6 +89,12 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
{if (text != orig) emit groupTitleChanged(group->getGroupId(), text.left(128));} );
|
{if (text != orig) emit groupTitleChanged(group->getGroupId(), text.left(128));} );
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
Translator::registerHandler(std::bind(&GroupChatForm::retranslateUi, this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupChatForm::~GroupChatForm()
|
||||||
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupChatForm::onSendTriggered()
|
void GroupChatForm::onSendTriggered()
|
||||||
|
@ -319,3 +326,8 @@ void GroupChatForm::keyReleaseEvent(QKeyEvent* ev)
|
||||||
if (msgEdit->hasFocus())
|
if (msgEdit->hasFocus())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupChatForm::retranslateUi()
|
||||||
|
{
|
||||||
|
nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->getPeersCount()));
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ class GroupChatForm : public GenericChatForm
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GroupChatForm(Group* chatGroup);
|
GroupChatForm(Group* chatGroup);
|
||||||
|
~GroupChatForm();
|
||||||
|
|
||||||
void onUserListChanged();
|
void onUserListChanged();
|
||||||
void peerAudioPlaying(int peer);
|
void peerAudioPlaying(int peer);
|
||||||
|
@ -50,6 +51,9 @@ protected:
|
||||||
void dragEnterEvent(QDragEnterEvent* ev);
|
void dragEnterEvent(QDragEnterEvent* ev);
|
||||||
void dropEvent(QDropEvent* ev);
|
void dropEvent(QDropEvent* ev);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Group* group;
|
Group* group;
|
||||||
QList<QLabel*> peerLabels; // maps peernumbers to the QLabels in namesListLayout
|
QList<QLabel*> peerLabels; // maps peernumbers to the QLabels in namesListLayout
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "src/misc/style.h"
|
#include "src/misc/style.h"
|
||||||
#include "src/profilelocker.h"
|
#include "src/profilelocker.h"
|
||||||
#include "src/profile.h"
|
#include "src/profile.h"
|
||||||
|
#include "src/translator.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
@ -51,14 +52,13 @@ ProfileForm::ProfileForm(QWidget *parent) :
|
||||||
QLabel* imgLabel = new QLabel();
|
QLabel* imgLabel = new QLabel();
|
||||||
headLayout->addWidget(imgLabel);
|
headLayout->addWidget(imgLabel);
|
||||||
|
|
||||||
QLabel* nameLabel = new QLabel();
|
nameLabel = new QLabel();
|
||||||
QFont bold;
|
QFont bold;
|
||||||
bold.setBold(true);
|
bold.setBold(true);
|
||||||
nameLabel->setFont(bold);
|
nameLabel->setFont(bold);
|
||||||
headLayout->addWidget(nameLabel);
|
headLayout->addWidget(nameLabel);
|
||||||
headLayout->addStretch(1);
|
headLayout->addStretch(1);
|
||||||
|
|
||||||
nameLabel->setText(QObject::tr("User Profile"));
|
|
||||||
imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));
|
imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));
|
||||||
|
|
||||||
// tox
|
// tox
|
||||||
|
@ -106,10 +106,14 @@ ProfileForm::ProfileForm(QWidget *parent) :
|
||||||
cb->installEventFilter(this);
|
cb->installEventFilter(this);
|
||||||
cb->setFocusPolicy(Qt::StrongFocus);
|
cb->setFocusPolicy(Qt::StrongFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
Translator::registerHandler(std::bind(&ProfileForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileForm::~ProfileForm()
|
ProfileForm::~ProfileForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete qr;
|
delete qr;
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
head->deleteLater();
|
head->deleteLater();
|
||||||
|
@ -336,3 +340,11 @@ void ProfileForm::onChangePassClicked()
|
||||||
QString newPass = dialog->getPassword();
|
QString newPass = dialog->getPassword();
|
||||||
Nexus::getProfile()->setPassword(newPass);
|
Nexus::getProfile()->setPassword(newPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileForm::retranslateUi()
|
||||||
|
{
|
||||||
|
bodyUI->retranslateUi(this);
|
||||||
|
nameLabel->setText(QObject::tr("User Profile"));
|
||||||
|
// We have to add the toxId tooltip here and not in the .ui or Qt won't know how to translate it dynamically
|
||||||
|
toxId->setToolTip(tr("This bunch of characters tells other Tox clients how to contact you.\nShare it with your friends to communicate."));
|
||||||
|
}
|
||||||
|
|
|
@ -72,16 +72,19 @@ private slots:
|
||||||
void onDeletePassClicked();
|
void onDeletePassClicked();
|
||||||
void onChangePassClicked();
|
void onChangePassClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refreshProfiles();
|
void refreshProfiles();
|
||||||
Ui::IdentitySettings* bodyUI;
|
Ui::IdentitySettings* bodyUI;
|
||||||
MaskablePixmapWidget* profilePicture;
|
MaskablePixmapWidget* profilePicture;
|
||||||
|
QLabel* nameLabel;
|
||||||
QWidget *head;
|
QWidget *head;
|
||||||
Core* core;
|
Core* core;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
bool hasCheck = false;
|
bool hasCheck = false;
|
||||||
QRWidget *qr;
|
QRWidget *qr;
|
||||||
|
|
||||||
ClickableTE* toxId;
|
ClickableTE* toxId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>630</width>
|
<width>579</width>
|
||||||
<height>625</height>
|
<height>625</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -104,21 +104,13 @@ Share it with your friends to communicate.</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="toxId">
|
<widget class="QLineEdit" name="toxId"/>
|
||||||
<property name="toolTip">
|
|
||||||
<string comment="Tox ID tooltip">This bunch of characters tells other Tox clients how to contact you.
|
|
||||||
Share it with your friends to communicate.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="verticalFrame">
|
<widget class="QFrame" name="verticalFrame">
|
||||||
<layout class="QHBoxLayout" name="qrGroup">
|
<layout class="QHBoxLayout" name="qrGroup">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="qrCode">
|
<widget class="QLabel" name="qrCode">
|
||||||
<property name="text">
|
|
||||||
<string>QRCODE</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
#include "src/historykeeper.h"
|
#include "src/historykeeper.h"
|
||||||
#include "src/misc/settings.h"
|
#include "src/misc/settings.h"
|
||||||
#include "src/misc/db/plaindb.h"
|
#include "src/misc/db/plaindb.h"
|
||||||
|
#include "src/translator.h"
|
||||||
|
|
||||||
AdvancedForm::AdvancedForm() :
|
AdvancedForm::AdvancedForm() :
|
||||||
GenericForm(tr("Advanced"), QPixmap(":/img/settings/general.png"))
|
GenericForm(QPixmap(":/img/settings/general.png"))
|
||||||
{
|
{
|
||||||
bodyUI = new Ui::AdvancedSettings;
|
bodyUI = new Ui::AdvancedSettings;
|
||||||
bodyUI->setupUi(this);
|
bodyUI->setupUi(this);
|
||||||
|
@ -46,10 +47,13 @@ AdvancedForm::AdvancedForm() :
|
||||||
cb->installEventFilter(this);
|
cb->installEventFilter(this);
|
||||||
cb->setFocusPolicy(Qt::StrongFocus);
|
cb->setFocusPolicy(Qt::StrongFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&AdvancedForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdvancedForm::~AdvancedForm()
|
AdvancedForm::~AdvancedForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,3 +86,8 @@ bool AdvancedForm::eventFilter(QObject *o, QEvent *e)
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(o, e);
|
return QWidget::eventFilter(o, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdvancedForm::retranslateUi()
|
||||||
|
{
|
||||||
|
bodyUI->retranslateUi(this);
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ class AdvancedForm : public GenericForm
|
||||||
public:
|
public:
|
||||||
AdvancedForm();
|
AdvancedForm();
|
||||||
virtual ~AdvancedForm();
|
virtual ~AdvancedForm();
|
||||||
|
QString getFormName() final {return tr("Advanced");}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *o, QEvent *e);
|
bool eventFilter(QObject *o, QEvent *e);
|
||||||
|
@ -38,6 +39,9 @@ private slots:
|
||||||
void onDbSyncTypeUpdated();
|
void onDbSyncTypeUpdated();
|
||||||
void resetToDefault();
|
void resetToDefault();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AdvancedSettings* bodyUI;
|
Ui::AdvancedSettings* bodyUI;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "src/video/camerasource.h"
|
#include "src/video/camerasource.h"
|
||||||
#include "src/video/cameradevice.h"
|
#include "src/video/cameradevice.h"
|
||||||
#include "src/widget/videosurface.h"
|
#include "src/widget/videosurface.h"
|
||||||
|
#include "src/translator.h"
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
#include <OpenAL/al.h>
|
#include <OpenAL/al.h>
|
||||||
|
@ -35,7 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AVForm::AVForm() :
|
AVForm::AVForm() :
|
||||||
GenericForm(tr("Audio/Video"), QPixmap(":/img/settings/av.png")),
|
GenericForm(QPixmap(":/img/settings/av.png")),
|
||||||
camVideoSurface{nullptr}, camera{nullptr}
|
camVideoSurface{nullptr}, camera{nullptr}
|
||||||
{
|
{
|
||||||
bodyUI = new Ui::AVSettings;
|
bodyUI = new Ui::AVSettings;
|
||||||
|
@ -62,10 +63,13 @@ AVForm::AVForm() :
|
||||||
cb->installEventFilter(this);
|
cb->installEventFilter(this);
|
||||||
cb->setFocusPolicy(Qt::StrongFocus);
|
cb->setFocusPolicy(Qt::StrongFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&AVForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVForm::~AVForm()
|
AVForm::~AVForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
if (camera)
|
if (camera)
|
||||||
{
|
{
|
||||||
|
@ -387,3 +391,8 @@ void AVForm::killVideoSurface()
|
||||||
delete camVideoSurface;
|
delete camVideoSurface;
|
||||||
camVideoSurface = nullptr;
|
camVideoSurface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AVForm::retranslateUi()
|
||||||
|
{
|
||||||
|
bodyUI->retranslateUi(this);
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#define AVFORM_H
|
#define AVFORM_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "genericsettings.h"
|
#include "genericsettings.h"
|
||||||
#include "src/video/videomode.h"
|
#include "src/video/videomode.h"
|
||||||
|
@ -33,6 +34,7 @@ class AVForm : public GenericForm
|
||||||
public:
|
public:
|
||||||
AVForm();
|
AVForm();
|
||||||
~AVForm();
|
~AVForm();
|
||||||
|
QString getFormName() final {return tr("Audio/Video");}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void getAudioInDevices();
|
void getAudioInDevices();
|
||||||
|
@ -42,6 +44,8 @@ private:
|
||||||
void createVideoSurface();
|
void createVideoSurface();
|
||||||
void killVideoSurface();
|
void killVideoSurface();
|
||||||
|
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_videoModescomboBox_currentIndexChanged(int index);
|
void on_videoModescomboBox_currentIndexChanged(int index);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ static QStringList timeFormats = {"hh:mm AP", "hh:mm", "hh:mm:ss AP", "hh:mm:ss"
|
||||||
static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"};
|
static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"};
|
||||||
|
|
||||||
GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
GenericForm(tr("General"), QPixmap(":/img/settings/general.png"))
|
GenericForm(QPixmap(":/img/settings/general.png"))
|
||||||
{
|
{
|
||||||
parent = myParent;
|
parent = myParent;
|
||||||
|
|
||||||
|
@ -197,10 +197,13 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
|
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
|
||||||
bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable
|
bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&GeneralForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralForm::~GeneralForm()
|
GeneralForm::~GeneralForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,3 +447,8 @@ bool GeneralForm::eventFilter(QObject *o, QEvent *e)
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(o, e);
|
return QWidget::eventFilter(o, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralForm::retranslateUi()
|
||||||
|
{
|
||||||
|
bodyUI->retranslateUi(this);
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ class GeneralForm : public GenericForm
|
||||||
public:
|
public:
|
||||||
GeneralForm(SettingsWidget *parent);
|
GeneralForm(SettingsWidget *parent);
|
||||||
~GeneralForm();
|
~GeneralForm();
|
||||||
|
QString getFormName() final {return tr("General");}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onEnableIPv6Updated();
|
void onEnableIPv6Updated();
|
||||||
|
@ -64,6 +65,9 @@ private slots:
|
||||||
void onGroupchatPositionChanged();
|
void onGroupchatPositionChanged();
|
||||||
void onThemeColorChanged(int);
|
void onThemeColorChanged(int);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSettings *bodyUI;
|
Ui::GeneralSettings *bodyUI;
|
||||||
void reloadSmiles();
|
void reloadSmiles();
|
||||||
|
|
|
@ -21,14 +21,13 @@ class GenericForm : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GenericForm(const QString &name, const QPixmap &icon) : formName(name), formIcon(icon) {;}
|
GenericForm(const QPixmap &icon) : formIcon(icon) {;}
|
||||||
~GenericForm() {;}
|
~GenericForm() {;}
|
||||||
|
|
||||||
QString getFormName() {return formName;}
|
virtual QString getFormName() = 0;
|
||||||
QPixmap getFormIcon() {return formIcon;}
|
QPixmap getFormIcon() {return formIcon;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString formName;
|
|
||||||
QPixmap formIcon;
|
QPixmap formIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,13 @@
|
||||||
#include "src/widget/widget.h"
|
#include "src/widget/widget.h"
|
||||||
#include "src/widget/gui.h"
|
#include "src/widget/gui.h"
|
||||||
#include "src/widget/form/setpassworddialog.h"
|
#include "src/widget/form/setpassworddialog.h"
|
||||||
|
#include "src/translator.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
PrivacyForm::PrivacyForm() :
|
PrivacyForm::PrivacyForm() :
|
||||||
GenericForm(tr("Privacy"), QPixmap(":/img/settings/privacy.png"))
|
GenericForm(QPixmap(":/img/settings/privacy.png"))
|
||||||
{
|
{
|
||||||
bodyUI = new Ui::PrivacySettings;
|
bodyUI = new Ui::PrivacySettings;
|
||||||
bodyUI->setupUi(this);
|
bodyUI->setupUi(this);
|
||||||
|
@ -36,10 +37,13 @@ PrivacyForm::PrivacyForm() :
|
||||||
connect(bodyUI->nospamLineEdit, SIGNAL(editingFinished()), this, SLOT(setNospam()));
|
connect(bodyUI->nospamLineEdit, SIGNAL(editingFinished()), this, SLOT(setNospam()));
|
||||||
connect(bodyUI->randomNosapamButton, SIGNAL(clicked()), this, SLOT(generateRandomNospam()));
|
connect(bodyUI->randomNosapamButton, SIGNAL(clicked()), this, SLOT(generateRandomNospam()));
|
||||||
connect(bodyUI->nospamLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onNospamEdit()));
|
connect(bodyUI->nospamLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onNospamEdit()));
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&PrivacyForm::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivacyForm::~PrivacyForm()
|
PrivacyForm::~PrivacyForm()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete bodyUI;
|
delete bodyUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,3 +100,8 @@ void PrivacyForm::onNospamEdit()
|
||||||
bodyUI->nospamLineEdit->setCursorPosition(curs);
|
bodyUI->nospamLineEdit->setCursorPosition(curs);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrivacyForm::retranslateUi()
|
||||||
|
{
|
||||||
|
bodyUI->retranslateUi(this);
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ class PrivacyForm : public GenericForm
|
||||||
public:
|
public:
|
||||||
PrivacyForm();
|
PrivacyForm();
|
||||||
~PrivacyForm();
|
~PrivacyForm();
|
||||||
|
QString getFormName() final {return tr("Privacy");}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onEnableLoggingUpdated();
|
void onEnableLoggingUpdated();
|
||||||
|
@ -36,6 +37,9 @@ private slots:
|
||||||
void onNospamEdit();
|
void onNospamEdit();
|
||||||
virtual void showEvent(QShowEvent*);
|
virtual void showEvent(QShowEvent*);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PrivacySettings* bodyUI;
|
Ui::PrivacySettings* bodyUI;
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "src/widget/form/settings/privacyform.h"
|
#include "src/widget/form/settings/privacyform.h"
|
||||||
#include "src/widget/form/settings/avform.h"
|
#include "src/widget/form/settings/avform.h"
|
||||||
#include "src/widget/form/settings/advancedform.h"
|
#include "src/widget/form/settings/advancedform.h"
|
||||||
|
#include "src/translator.h"
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
|
||||||
SettingsWidget::SettingsWidget(QWidget* parent)
|
SettingsWidget::SettingsWidget(QWidget* parent)
|
||||||
|
@ -53,15 +54,18 @@ SettingsWidget::SettingsWidget(QWidget* parent)
|
||||||
AVForm* avfrm = new AVForm;
|
AVForm* avfrm = new AVForm;
|
||||||
AdvancedForm *expfrm = new AdvancedForm;
|
AdvancedForm *expfrm = new AdvancedForm;
|
||||||
|
|
||||||
GenericForm* cfgForms[] = { gfrm, pfrm, avfrm, expfrm };
|
cfgForms = {{ gfrm, pfrm, avfrm, expfrm }};
|
||||||
for (GenericForm* cfgForm : cfgForms)
|
for (GenericForm* cfgForm : cfgForms)
|
||||||
settingsWidgets->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
settingsWidgets->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
||||||
|
|
||||||
connect(settingsWidgets, &QTabWidget::currentChanged, this, &SettingsWidget::onTabChanged);
|
connect(settingsWidgets, &QTabWidget::currentChanged, this, &SettingsWidget::onTabChanged);
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&SettingsWidget::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsWidget::~SettingsWidget()
|
SettingsWidget::~SettingsWidget()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWidget::setBodyHeadStyle(QString style)
|
void SettingsWidget::setBodyHeadStyle(QString style)
|
||||||
|
@ -86,3 +90,11 @@ void SettingsWidget::onTabChanged(int index)
|
||||||
nameLabel->setText(currentWidget->getFormName());
|
nameLabel->setText(currentWidget->getFormName());
|
||||||
imgLabel->setPixmap(currentWidget->getFormIcon().scaledToHeight(40, Qt::SmoothTransformation));
|
imgLabel->setPixmap(currentWidget->getFormIcon().scaledToHeight(40, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsWidget::retranslateUi()
|
||||||
|
{
|
||||||
|
GenericForm* currentWidget = static_cast<GenericForm*>(settingsWidgets->currentWidget());
|
||||||
|
nameLabel->setText(currentWidget->getFormName());
|
||||||
|
for (size_t i=0; i<cfgForms.size(); i++)
|
||||||
|
settingsWidgets->setTabText(i, cfgForms[i]->getFormName());
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
class Camera;
|
class Camera;
|
||||||
class GenericForm;
|
class GenericForm;
|
||||||
|
@ -47,10 +48,15 @@ signals:
|
||||||
private slots:
|
private slots:
|
||||||
void onTabChanged(int);
|
void onTabChanged(int);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *head, *body;
|
QWidget *head, *body;
|
||||||
QTabWidget *settingsWidgets;
|
QTabWidget *settingsWidgets;
|
||||||
QLabel *nameLabel, *imgLabel;
|
QLabel *nameLabel, *imgLabel;
|
||||||
|
std::array<GenericForm*, 4> cfgForms;
|
||||||
|
int currentIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSWIDGET_H
|
#endif // SETTINGSWIDGET_H
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "src/nexus.h"
|
#include "src/nexus.h"
|
||||||
#include "src/misc/settings.h"
|
#include "src/misc/settings.h"
|
||||||
#include "src/widget/form/setpassworddialog.h"
|
#include "src/widget/form/setpassworddialog.h"
|
||||||
|
#include "src/translator.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
@ -30,10 +31,13 @@ LoginScreen::LoginScreen(QWidget *parent) :
|
||||||
connect(ui->autoLoginCB, &QCheckBox::stateChanged, this, &LoginScreen::onAutoLoginToggled);
|
connect(ui->autoLoginCB, &QCheckBox::stateChanged, this, &LoginScreen::onAutoLoginToggled);
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
retranslateUi();
|
||||||
|
Translator::registerHandler(std::bind(&LoginScreen::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginScreen::~LoginScreen()
|
LoginScreen::~LoginScreen()
|
||||||
{
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ void LoginScreen::reset()
|
||||||
|
|
||||||
Profile::scanProfiles();
|
Profile::scanProfiles();
|
||||||
QString lastUsed = Settings::getInstance().getCurrentProfile();
|
QString lastUsed = Settings::getInstance().getCurrentProfile();
|
||||||
qDebug() << "Last used is "<<lastUsed;
|
qDebug() << "Last used profile is "<<lastUsed;
|
||||||
QVector<QString> profiles = Profile::getProfiles();
|
QVector<QString> profiles = Profile::getProfiles();
|
||||||
for (QString profile : profiles)
|
for (QString profile : profiles)
|
||||||
{
|
{
|
||||||
|
@ -187,3 +191,8 @@ void LoginScreen::onAutoLoginToggled(int state)
|
||||||
|
|
||||||
Settings::getInstance().save(false);
|
Settings::getInstance().save(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoginScreen::retranslateUi()
|
||||||
|
{
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@ private slots:
|
||||||
void onCreateNewProfile();
|
void onCreateNewProfile();
|
||||||
void onLogin();
|
void onLogin();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::LoginScreen *ui;
|
Ui::LoginScreen *ui;
|
||||||
QShortcut quitShortcut;
|
QShortcut quitShortcut;
|
||||||
|
|
|
@ -13,13 +13,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "chattextedit.h"
|
#include "chattextedit.h"
|
||||||
|
#include "src/translator.h"
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
ChatTextEdit::ChatTextEdit(QWidget *parent) :
|
ChatTextEdit::ChatTextEdit(QWidget *parent) :
|
||||||
QTextEdit(parent)
|
QTextEdit(parent)
|
||||||
{
|
{
|
||||||
setPlaceholderText(tr("Type your message here..."));
|
retranslateUi();
|
||||||
setAcceptRichText(false);
|
setAcceptRichText(false);
|
||||||
|
|
||||||
|
Translator::registerHandler(std::bind(&ChatTextEdit::retranslateUi, this), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatTextEdit::~ChatTextEdit()
|
||||||
|
{
|
||||||
|
Translator::unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatTextEdit::keyPressEvent(QKeyEvent * event)
|
void ChatTextEdit::keyPressEvent(QKeyEvent * event)
|
||||||
|
@ -51,3 +59,8 @@ void ChatTextEdit::setLastMessage(QString lm)
|
||||||
{
|
{
|
||||||
lastMessage = lm;
|
lastMessage = lm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatTextEdit::retranslateUi()
|
||||||
|
{
|
||||||
|
setPlaceholderText(tr("Type your message here..."));
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ class ChatTextEdit : public QTextEdit
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ChatTextEdit(QWidget *parent = 0);
|
explicit ChatTextEdit(QWidget *parent = 0);
|
||||||
|
~ChatTextEdit();
|
||||||
virtual void keyPressEvent(QKeyEvent * event) override;
|
virtual void keyPressEvent(QKeyEvent * event) override;
|
||||||
void setLastMessage(QString lm);
|
void setLastMessage(QString lm);
|
||||||
|
|
||||||
|
@ -30,6 +31,9 @@ signals:
|
||||||
void tabPressed();
|
void tabPressed();
|
||||||
void keyPressed();
|
void keyPressed();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString lastMessage;
|
QString lastMessage;
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,13 +101,13 @@ void Widget::init()
|
||||||
restoreState(Settings::getInstance().getWindowState());
|
restoreState(Settings::getInstance().getWindowState());
|
||||||
ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());
|
ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());
|
||||||
|
|
||||||
statusOnline = new QAction(tr("Online", "Button to set your status to 'Online'"), this);
|
statusOnline = new QAction(this);
|
||||||
statusOnline->setIcon(getStatusIcon(Status::Online, 10, 10));
|
statusOnline->setIcon(getStatusIcon(Status::Online, 10, 10));
|
||||||
connect(statusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
|
connect(statusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
|
||||||
statusAway = new QAction(tr("Away", "Button to set your status to 'Away'"), this);
|
statusAway = new QAction(this);
|
||||||
statusAway->setIcon(getStatusIcon(Status::Away, 10, 10));
|
statusAway->setIcon(getStatusIcon(Status::Away, 10, 10));
|
||||||
connect(statusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
|
connect(statusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
|
||||||
statusBusy = new QAction(tr("Busy", "Button to set your status to 'Busy'"), this);
|
statusBusy = new QAction(this);
|
||||||
statusBusy->setIcon(getStatusIcon(Status::Busy, 10, 10));
|
statusBusy->setIcon(getStatusIcon(Status::Busy, 10, 10));
|
||||||
connect(statusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));
|
connect(statusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));
|
||||||
|
|
||||||
|
@ -128,14 +128,6 @@ void Widget::init()
|
||||||
ui->mainHead->layout()->setMargin(0);
|
ui->mainHead->layout()->setMargin(0);
|
||||||
ui->mainHead->layout()->setSpacing(0);
|
ui->mainHead->layout()->setSpacing(0);
|
||||||
|
|
||||||
ui->searchContactFilterCBox->addItem(tr("All"));
|
|
||||||
ui->searchContactFilterCBox->addItem(tr("Online"));
|
|
||||||
ui->searchContactFilterCBox->addItem(tr("Offline"));
|
|
||||||
ui->searchContactFilterCBox->addItem(tr("Friends"));
|
|
||||||
ui->searchContactFilterCBox->addItem(tr("Groups"));
|
|
||||||
|
|
||||||
ui->searchContactText->setPlaceholderText(tr("Search Contacts"));
|
|
||||||
|
|
||||||
if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
|
if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
|
||||||
&& Settings::getInstance().getStyle() != "None")
|
&& Settings::getInstance().getStyle() != "None")
|
||||||
{
|
{
|
||||||
|
@ -222,6 +214,10 @@ void Widget::init()
|
||||||
if (Settings::getInstance().getCheckUpdates())
|
if (Settings::getInstance().getCheckUpdates())
|
||||||
AutoUpdater::checkUpdatesAsyncInteractive();
|
AutoUpdater::checkUpdatesAsyncInteractive();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
Translator::registerHandler(std::bind(&Widget::retranslateUi, this), this);
|
||||||
|
|
||||||
if (!Settings::getInstance().getShowSystemTray())
|
if (!Settings::getInstance().getShowSystemTray())
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
@ -274,6 +270,7 @@ void Widget::updateIcons()
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
{
|
{
|
||||||
qDebug() << "Deleting Widget";
|
qDebug() << "Deleting Widget";
|
||||||
|
Translator::unregister(this);
|
||||||
AutoUpdater::abortUpdates();
|
AutoUpdater::abortUpdates();
|
||||||
if (icon)
|
if (icon)
|
||||||
icon->hide();
|
icon->hide();
|
||||||
|
@ -1454,3 +1451,22 @@ void Widget::setActiveToolMenuButton(ActiveToolMenuButton newActiveButton)
|
||||||
ui->settingsButton->setChecked(newActiveButton == Widget::SettingButton);
|
ui->settingsButton->setChecked(newActiveButton == Widget::SettingButton);
|
||||||
ui->settingsButton->setDisabled(newActiveButton == Widget::SettingButton);
|
ui->settingsButton->setDisabled(newActiveButton == Widget::SettingButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::retranslateUi()
|
||||||
|
{
|
||||||
|
QString name = ui->nameLabel->text(), status = ui->statusLabel->text();
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
ui->nameLabel->setText(name);
|
||||||
|
ui->statusLabel->setText(status);
|
||||||
|
ui->searchContactFilterCBox->clear();
|
||||||
|
ui->searchContactFilterCBox->addItem(tr("All"));
|
||||||
|
ui->searchContactFilterCBox->addItem(tr("Online"));
|
||||||
|
ui->searchContactFilterCBox->addItem(tr("Offline"));
|
||||||
|
ui->searchContactFilterCBox->addItem(tr("Friends"));
|
||||||
|
ui->searchContactFilterCBox->addItem(tr("Groups"));
|
||||||
|
ui->searchContactText->setPlaceholderText(tr("Search Contacts"));
|
||||||
|
statusOnline->setText(tr("Online", "Button to set your status to 'Online'"));
|
||||||
|
statusAway->setText(tr("Away", "Button to set your status to 'Away'"));
|
||||||
|
statusBusy->setText(tr("Busy", "Button to set your status to 'Busy'"));
|
||||||
|
setWindowTitle(tr("Settings"));
|
||||||
|
}
|
||||||
|
|
|
@ -173,6 +173,7 @@ private:
|
||||||
void saveWindowGeometry();
|
void saveWindowGeometry();
|
||||||
void saveSplitterGeometry();
|
void saveSplitterGeometry();
|
||||||
void cycleContacts(int offset);
|
void cycleContacts(int offset);
|
||||||
|
void retranslateUi();
|
||||||
SystemTrayIcon *icon;
|
SystemTrayIcon *icon;
|
||||||
QMenu *trayMenu;
|
QMenu *trayMenu;
|
||||||
QAction *statusOnline,
|
QAction *statusOnline,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user