Renpy translation helper
This commit is contained in:
59
mainwindow.h
Normal file
59
mainwindow.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class QFile;
|
||||
class QNetworkReply;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void on_selectProjectDirButton_clicked();
|
||||
void on_reloadButton_clicked();
|
||||
void on_languageCombo_currentTextChanged(const QString &selectedLanguage);
|
||||
void on_reloadTranslationsButton_clicked();
|
||||
void on_reloadFilesButton_clicked();
|
||||
void on_nextUntranslatedButton_clicked();
|
||||
void on_treeWidget_itemSelectionChanged();
|
||||
void on_setTranslationButton_clicked();
|
||||
void on_setTranslationAndJumpNextButton_clicked();
|
||||
void on_setAndNextAndAutoTranslate_clicked();
|
||||
void on_translationEdit_returnPressed();
|
||||
void on_saveButton_clicked();
|
||||
void on_cleanupButton_clicked();
|
||||
void on_cleanupAndSaveButton_clicked();
|
||||
void onDeeplTranslationPossibilitiesLoaded(QNetworkReply *reply);
|
||||
void on_deeplTranslateFrom_currentTextChanged(const QString &sourceLanguage);
|
||||
void on_autoTranslateButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
std::map<QString, QString> fileContentsMap;
|
||||
std::map<QString, std::vector<QString> > translationsMap;
|
||||
const QString deeplAuthKey = "5f6bc5cc-1e5d-4c69-9ef0-eb3cc2c1ece5:fx";
|
||||
void crawlProject();
|
||||
void populateTreeWidgetFromMap();
|
||||
void saveFiles(QStringList &failedFiles);
|
||||
bool createBackup(const QString &filePath, const QString &backupFileName);
|
||||
bool editAndSaveFile(QTreeWidgetItem *fileItem, const QString &backupFileName, const QString &fileName);
|
||||
bool saveToFile(const QString &backupFileName, const QStringList &lines);
|
||||
bool parseAndEditFile(QFile &backupFile, QTreeWidgetItem *fileItem, QStringList &lines, bool &changed);
|
||||
QString findNewText(QTreeWidgetItem *fileItem, const QString &lineNumber, const QString &originalText);
|
||||
void loadDeeplTranslationPossibilities();
|
||||
void renderDeeplSources();
|
||||
void translationRequestFinished(QNetworkReply *reply);
|
||||
void countAndShowUntranslated();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
Reference in New Issue
Block a user