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;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
class ProgSettings : public QDialog {
|
2021-12-28 16:47:10 +06:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit ProgSettings(QWidget *parent = nullptr);
|
|
|
|
|
~ProgSettings();
|
|
|
|
|
static QString getIconSetPath();
|
2022-11-19 08:49:04 -05:00
|
|
|
static QIcon loadIcon(QString file);
|
|
|
|
|
static void loadTranslators(QObject *parent = nullptr);
|
|
|
|
|
static void reloadStrings();
|
|
|
|
|
class CustomTranslator : public QTranslator {
|
2022-01-08 16:39:51 +06:00
|
|
|
public:
|
2022-11-19 08:49:04 -05:00
|
|
|
CustomTranslator(QObject *parent = nullptr)
|
|
|
|
|
: QTranslator(parent) {};
|
|
|
|
|
|
2022-01-08 16:39:51 +06:00
|
|
|
protected:
|
|
|
|
|
QString translate(const char *context, const char *sourceText,
|
2022-11-19 08:49:04 -05:00
|
|
|
const char *disambiguation = nullptr, int n = -1) const override
|
2022-01-08 16:39:51 +06:00
|
|
|
{
|
2022-11-19 08:49:04 -05:00
|
|
|
if (strcmp(sourceText, "&Fullscreen") == 0)
|
|
|
|
|
sourceText = "&Fullscreen\tCtrl+Alt+PgUp";
|
|
|
|
|
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";
|
|
|
|
|
if (strcmp(sourceText, "Begin trace") == 0)
|
|
|
|
|
sourceText = "Begin trace\tCtrl+T";
|
|
|
|
|
if (strcmp(sourceText, "End trace") == 0)
|
|
|
|
|
sourceText = "End trace\tCtrl+T";
|
|
|
|
|
if (strcmp(sourceText, "&Qt (Software)") == 0) {
|
2022-01-08 16:39:51 +06:00
|
|
|
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
|
2022-11-19 08:49:04 -05:00
|
|
|
if (finalstr.contains('\t'))
|
|
|
|
|
finalstr.truncate(finalstr.indexOf('\t'));
|
2022-01-08 16:39:51 +06:00
|
|
|
#endif
|
|
|
|
|
return finalstr;
|
|
|
|
|
}
|
|
|
|
|
};
|
2022-11-19 08:49:04 -05:00
|
|
|
static CustomTranslator *translator;
|
|
|
|
|
static QTranslator *qtTranslator;
|
2022-01-08 16:39:51 +06:00
|
|
|
static QMap<uint32_t, QPair<QString, QString>> lcid_langcode;
|
2022-11-19 08:49:04 -05:00
|
|
|
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);
|
|
|
|
|
|
2022-06-01 16:31:06 +06:00
|
|
|
void on_pushButton_2_clicked();
|
|
|
|
|
|
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
|