mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 10:50:23 +08:00
[Format] Formatted UI file names.
Signed-off-by: Leroy.H.Y <lhy20010403@hotmail.com>
Former-commit-id: adae62393f
This commit is contained in:
parent
fb1963c22b
commit
a890859c55
25
Hv2ray.pro
25
Hv2ray.pro
@ -27,29 +27,30 @@ CONFIG += c++11
|
|||||||
VPATH += ./src
|
VPATH += ./src
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
w_MainWindow.cpp \
|
||||||
|
w_ConnectionEditWindow.cpp \
|
||||||
|
w_ImportConfig.cpp \
|
||||||
|
w_PrefrencesWindow.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
MainWindow.cpp \
|
|
||||||
ConnectionEditWindow.cpp \
|
|
||||||
ImportConfig.cpp \
|
|
||||||
PrefrencesWindow.cpp \
|
|
||||||
vinteract.cpp \
|
vinteract.cpp \
|
||||||
utils.cpp \
|
utils.cpp \
|
||||||
runguard.cpp
|
runguard.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
MainWindow.h \
|
w_MainWindow.h \
|
||||||
ConnectionEditWindow.h \
|
w_ConnectionEditWindow.h \
|
||||||
ImportConfig.h \
|
w_ImportConfig.h \
|
||||||
PrefrencesWindow.h \
|
w_PrefrencesWindow.h \
|
||||||
|
constants.h \
|
||||||
vinteract.h \
|
vinteract.h \
|
||||||
utils.h \
|
utils.h \
|
||||||
runguard.h
|
runguard.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
MainWindow.ui \
|
w_MainWindow.ui \
|
||||||
ConnectionEditWindow.ui \
|
w_ConnectionEditWindow.ui \
|
||||||
ImportConfig.ui \
|
w_ImportConfig.ui \
|
||||||
PrefrencesWindow.ui
|
w_PrefrencesWindow.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc
|
resources.qrc
|
||||||
|
15
src/constants.h
Normal file
15
src/constants.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <QString>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
#ifndef CONSTANTS_H
|
||||||
|
#define CONSTANTS_H
|
||||||
|
|
||||||
|
// Macros
|
||||||
|
#define HV2RAY_CONFIG_DIR_NAME ".hv2ray"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Hv2rayUtils {
|
||||||
|
static QDir ConfigDir;
|
||||||
|
} // namespace Hv2rayConsts
|
||||||
|
|
||||||
|
#endif // CONSTANTS_H
|
25
src/main.cpp
25
src/main.cpp
@ -3,6 +3,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
@ -11,15 +12,19 @@
|
|||||||
|
|
||||||
#include "runguard.h"
|
#include "runguard.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "MainWindow.h"
|
#include "w_MainWindow.h"
|
||||||
#include "ConnectionEditWindow.h"
|
#include "w_ConnectionEditWindow.h"
|
||||||
|
#include "constants.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace Hv2rayUtils;
|
||||||
|
|
||||||
void firstRunCheck()
|
void firstRunCheck()
|
||||||
{
|
{
|
||||||
if(!QDir("conf").exists()) {
|
ConfigDir = QDir(QDir::homePath() + HV2RAY_CONFIG_DIR_NAME);
|
||||||
QDir().mkdir("conf");
|
|
||||||
|
if(!ConfigDir.exists()) {
|
||||||
|
QDir(QDir::homePath()).mkdir(".hv2ray");
|
||||||
qDebug() << "Config directory created.";
|
qDebug() << "Config directory created.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,13 +70,21 @@ int main(int argc, char *argv[])
|
|||||||
QApplication _qApp(argc, argv);
|
QApplication _qApp(argc, argv);
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
if (translator.load(QString(":/translations/zh-CN.qm"), QString("translations")))
|
if (translator.load(":/translations/zh-CN.qm", "translations"))
|
||||||
{
|
{
|
||||||
cout << "Loaded Chinese translations" << endl;
|
cout << "Loaded Chinese translations" << endl;
|
||||||
}
|
}
|
||||||
|
else if (translator.load(":/translations/en-US.qm", "translations")){
|
||||||
|
cout << "Loaded English translations" << endl;
|
||||||
|
} else {
|
||||||
|
showWarnMessageBox(nullptr, "Failed to load translations",
|
||||||
|
"Failed to load translations, user experience may be downgraded. \r\n \
|
||||||
|
无法加载语言文件,用户体验可能会降级.");
|
||||||
|
}
|
||||||
|
|
||||||
_qApp.installTranslator(&translator);
|
_qApp.installTranslator(&translator);
|
||||||
|
|
||||||
RunGuard guard("Hv2ray");
|
RunGuard guard("Hv2ray-Instance-Identifier");
|
||||||
if(!guard.isSingleInstance()) {
|
if(!guard.isSingleInstance()) {
|
||||||
showWarnMessageBox(nullptr, QObject::tr("Hv2Ray"), QObject::tr("AnotherInstanceRunning"));
|
showWarnMessageBox(nullptr, QObject::tr("Hv2Ray"), QObject::tr("AnotherInstanceRunning"));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#ifndef UTILS_H
|
#ifndef UTILS_H
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "MainWindow.h"
|
#include "w_MainWindow.h"
|
||||||
#include "vinteract.h"
|
#include "vinteract.h"
|
||||||
|
|
||||||
bool validationCheck(QString path)
|
bool validationCheck(QString path)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "ConnectionEditWindow.h"
|
#include "w_ConnectionEditWindow.h"
|
||||||
#include "ui_ConnectionEditWindow.h"
|
#include "ui_ConnectionEditWindow.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "MainWindow.h"
|
#include "w_MainWindow.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QIntValidator>
|
#include <QIntValidator>
|
@ -10,10 +10,10 @@
|
|||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#pragma pop_macro("slots")
|
#pragma pop_macro("slots")
|
||||||
|
|
||||||
#include "ConnectionEditWindow.h"
|
#include "w_ConnectionEditWindow.h"
|
||||||
#include "vinteract.h"
|
#include "vinteract.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "ImportConfig.h"
|
#include "w_ImportConfig.h"
|
||||||
#include "ui_ImportConfig.h"
|
#include "ui_ImportConfig.h"
|
||||||
|
|
||||||
ImportConfig::ImportConfig(QWidget *parent) :
|
ImportConfig::ImportConfig(QWidget *parent) :
|
@ -9,10 +9,10 @@
|
|||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
|
||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
#include "PrefrencesWindow.h"
|
#include "w_PrefrencesWindow.h"
|
||||||
#include "MainWindow.h"
|
#include "w_MainWindow.h"
|
||||||
#include "ConnectionEditWindow.h"
|
#include "w_ConnectionEditWindow.h"
|
||||||
#include "ImportConfig.h"
|
#include "w_ImportConfig.h"
|
||||||
#include "vinteract.h"
|
#include "vinteract.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
@ -1,9 +1,7 @@
|
|||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
#define confDir "conf/"
|
|
||||||
#define confDatabase "conf/conf.db"
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include "ConnectionEditWindow.h"
|
#include "w_ConnectionEditWindow.h"
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
@ -56,7 +54,6 @@ private:
|
|||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
void createTrayAction();
|
void createTrayAction();
|
||||||
|
|
||||||
void CreateTrayIcon();
|
void CreateTrayIcon();
|
||||||
};
|
};
|
||||||
|
|
@ -11,7 +11,7 @@
|
|||||||
#include <ui_PrefrencesWindow.h>
|
#include <ui_PrefrencesWindow.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "PrefrencesWindow.h"
|
#include "w_PrefrencesWindow.h"
|
||||||
|
|
||||||
PrefrencesWindow::PrefrencesWindow(QWidget *parent) :
|
PrefrencesWindow::PrefrencesWindow(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
Loading…
Reference in New Issue
Block a user