-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c63559
commit 054be1b
Showing
11 changed files
with
173 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "application.h" | ||
|
||
#include <QIcon> | ||
#include <QTranslator> | ||
|
||
Application::Application(int& argc, char** argv) : QApplication(argc, argv) { | ||
this->setWindowIcon(QIcon(":/WindbgConfig/images/icon.png")); | ||
this->switch_language(Language::zh_CN); | ||
} | ||
|
||
Application::~Application() {} | ||
|
||
bool Application::switch_language(Language lang) { | ||
static QTranslator trans; | ||
return this->_install_lang(trans, lang); | ||
} | ||
|
||
QString Application::AppName() const { | ||
return "WinDbg Config Assistant"; | ||
} | ||
|
||
bool Application::_install_lang(QTranslator& trans, Language lang) { | ||
std::map<Language, QString> _map = { | ||
{Language::zh_CN, ":/EnvTools/translator/env_tools_zh.qm"}, | ||
{Language::en_US, ":/EnvTools/translator/env_tools_en.qm"} }; | ||
|
||
if (!trans.load(_map[lang])) { | ||
return false; | ||
} | ||
return qApp->installTranslator(&trans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <QApplication> | ||
|
||
class Application : public QApplication { | ||
Q_OBJECT | ||
|
||
public: | ||
enum class Language { zh_CN = 0, en_US = 1 }; | ||
|
||
public: | ||
Application(int& argc, char** arg); | ||
~Application(); | ||
|
||
bool switch_language(Language lang); | ||
QString AppName() const; | ||
|
||
private: | ||
bool _install_lang(QTranslator& trans, Language lang); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Microsoft Visual C++ generated resource script. | ||
// | ||
#include "resource.h" | ||
|
||
#define APSTUDIO_READONLY_SYMBOLS | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 2 resource. | ||
// | ||
#include "winres.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#undef APSTUDIO_READONLY_SYMBOLS | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// English (United States) resources | ||
|
||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) | ||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | ||
#pragma code_page(1252) | ||
|
||
#ifdef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TEXTINCLUDE | ||
// | ||
|
||
1 TEXTINCLUDE | ||
BEGIN | ||
"resource.h\0" | ||
END | ||
|
||
2 TEXTINCLUDE | ||
BEGIN | ||
"#include ""winres.h""\r\n" | ||
"\0" | ||
END | ||
|
||
3 TEXTINCLUDE | ||
BEGIN | ||
"\r\n" | ||
"\0" | ||
END | ||
|
||
#endif // APSTUDIO_INVOKED | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// PNG | ||
// | ||
|
||
IDB_PNG1 PNG "res\\icon.png" | ||
|
||
#endif // English (United States) resources | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
|
||
#ifndef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 3 resource. | ||
// | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#endif // not APSTUDIO_INVOKED | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
#include "EnvTools.h" | ||
#include "application.h" | ||
#include <QtWidgets/QApplication> | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); | ||
QApplication a(argc, argv); | ||
a.setWindowIcon(QIcon(":/EnvTools/icon.png")); | ||
Application app(argc, argv); | ||
app.setWindowIcon(QIcon(":/EnvTools/icon.png")); | ||
EnvTools w; | ||
w.show(); | ||
return a.exec(); | ||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<RCC> | ||
<qresource prefix="/EnvTools"> | ||
<file>icon.png</file> | ||
<file>translator/env_tools_zh.qm</file> | ||
</qresource> | ||
</RCC> |
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//{{NO_DEPENDENCIES}} | ||
// Microsoft Visual C++ generated include file. | ||
// Used by env_tools.rc | ||
// | ||
#define IDB_PNG1 101 | ||
|
||
// Next default values for new objects | ||
// | ||
#ifdef APSTUDIO_INVOKED | ||
#ifndef APSTUDIO_READONLY_SYMBOLS | ||
#define _APS_NEXT_RESOURCE_VALUE 102 | ||
#define _APS_NEXT_COMMAND_VALUE 40001 | ||
#define _APS_NEXT_CONTROL_VALUE 1001 | ||
#define _APS_NEXT_SYMED_VALUE 101 | ||
#endif | ||
#endif |