2021-12-28 16:47:10 +06:00
|
|
|
#ifndef QT_PROGSETTINGS_HPP
|
|
|
|
|
#define QT_PROGSETTINGS_HPP
|
|
|
|
|
|
|
|
|
|
#include <QDialog>
|
2022-01-08 00:53:45 +06:00
|
|
|
#include <QTranslator>
|
2021-12-28 16:47:10 +06:00
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
class ProgSettings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ProgSettings : public QDialog
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit ProgSettings(QWidget *parent = nullptr);
|
|
|
|
|
~ProgSettings();
|
|
|
|
|
static QString getIconSetPath();
|
2022-01-08 23:17:20 +06:00
|
|
|
static QIcon loadIcon(QString file);
|
2022-01-08 16:39:51 +06:00
|
|
|
static void loadTranslators(QObject* parent = nullptr);
|
|
|
|
|
static void reloadStrings();
|
|
|
|
|
class CustomTranslator : public QTranslator
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CustomTranslator(QObject* parent = nullptr) : QTranslator(parent) {};
|
|
|
|
|
protected:
|
|
|
|
|
QString translate(const char *context, const char *sourceText,
|
|
|
|
|
const char *disambiguation = nullptr, int n = -1) const override
|
|
|
|
|
{
|
2022-02-13 07:09:30 +05:00
|
|
|
if (strcmp(sourceText, "&Fullscreen") == 0) sourceText = "&Fullscreen\tCtrl+Alt+PgUp";
|
2022-01-08 16:39:51 +06:00
|
|
|
if (strcmp(sourceText, "&Ctrl+Alt+Del") == 0) sourceText = "&Ctrl+Alt+Del\tCtrl+F12";
|
|
|
|
|
if (strcmp(sourceText, "Take s&creenshot") == 0) sourceText = "Take s&creenshot\tCtrl+F11";
|
2022-02-04 15:19:18 +06:00
|
|
|
if (strcmp(sourceText, "Begin trace") == 0) sourceText = "Begin trace\tCtrl+T";
|
|
|
|
|
if (strcmp(sourceText, "End trace") == 0) sourceText = "End trace\tCtrl+T";
|
2022-01-08 16:39:51 +06:00
|
|
|
if (strcmp(sourceText, "&Qt (Software)") == 0)
|
|
|
|
|
{
|
|
|
|
|
QString finalstr = QTranslator::translate("", "&SDL (Software)", disambiguation, n);
|
|
|
|
|
finalstr.replace("SDL", "Qt");
|
|
|
|
|
finalstr.replace("(&S)", "(&Q)");
|
|
|
|
|
return finalstr;
|
|
|
|
|
}
|
|
|
|
|
QString finalstr = QTranslator::translate("", sourceText, disambiguation, n);
|
|
|
|
|
#ifdef Q_OS_MACOS
|
|
|
|
|
if (finalstr.contains('\t')) finalstr.truncate(finalstr.indexOf('\t'));
|
|
|
|
|
#endif
|
|
|
|
|
return finalstr;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
static CustomTranslator* translator;
|
|
|
|
|
static QTranslator* qtTranslator;
|
|
|
|
|
static QMap<uint32_t, QPair<QString, QString>> lcid_langcode;
|
|
|
|
|
static QMap<int, std::wstring> translatedstrings;
|
2021-12-28 16:47:10 +06:00
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
|
void accept() override;
|
|
|
|
|
private slots:
|
|
|
|
|
void on_pushButton_released();
|
2022-01-08 16:39:51 +06:00
|
|
|
void on_pushButtonLanguage_released();
|
2021-12-28 16:47:10 +06:00
|
|
|
|
2022-06-01 15:31:58 +06:00
|
|
|
void on_horizontalSlider_valueChanged(int value);
|
|
|
|
|
|
2021-12-28 16:47:10 +06:00
|
|
|
private:
|
|
|
|
|
Ui::ProgSettings *ui;
|
|
|
|
|
|
|
|
|
|
friend class MainWindow;
|
2022-06-01 15:31:58 +06:00
|
|
|
double mouseSensitivity;
|
2021-12-28 16:47:10 +06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // QT_PROGSETTINGS_HPP
|