mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +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
|
||||
|
||||
SOURCES += \
|
||||
w_MainWindow.cpp \
|
||||
w_ConnectionEditWindow.cpp \
|
||||
w_ImportConfig.cpp \
|
||||
w_PrefrencesWindow.cpp \
|
||||
main.cpp \
|
||||
MainWindow.cpp \
|
||||
ConnectionEditWindow.cpp \
|
||||
ImportConfig.cpp \
|
||||
PrefrencesWindow.cpp \
|
||||
vinteract.cpp \
|
||||
utils.cpp \
|
||||
runguard.cpp
|
||||
|
||||
HEADERS += \
|
||||
MainWindow.h \
|
||||
ConnectionEditWindow.h \
|
||||
ImportConfig.h \
|
||||
PrefrencesWindow.h \
|
||||
w_MainWindow.h \
|
||||
w_ConnectionEditWindow.h \
|
||||
w_ImportConfig.h \
|
||||
w_PrefrencesWindow.h \
|
||||
constants.h \
|
||||
vinteract.h \
|
||||
utils.h \
|
||||
runguard.h
|
||||
|
||||
FORMS += \
|
||||
MainWindow.ui \
|
||||
ConnectionEditWindow.ui \
|
||||
ImportConfig.ui \
|
||||
PrefrencesWindow.ui
|
||||
w_MainWindow.ui \
|
||||
w_ConnectionEditWindow.ui \
|
||||
w_ImportConfig.ui \
|
||||
w_PrefrencesWindow.ui
|
||||
|
||||
RESOURCES += \
|
||||
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
|
33
src/main.cpp
33
src/main.cpp
@ -3,6 +3,7 @@
|
||||
#include <iostream>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QStandardPaths>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
@ -11,15 +12,19 @@
|
||||
|
||||
#include "runguard.h"
|
||||
#include "utils.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ConnectionEditWindow.h"
|
||||
#include "w_MainWindow.h"
|
||||
#include "w_ConnectionEditWindow.h"
|
||||
#include "constants.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Hv2rayUtils;
|
||||
|
||||
void firstRunCheck()
|
||||
{
|
||||
if(!QDir("conf").exists()) {
|
||||
QDir().mkdir("conf");
|
||||
ConfigDir = QDir(QDir::homePath() + HV2RAY_CONFIG_DIR_NAME);
|
||||
|
||||
if(!ConfigDir.exists()) {
|
||||
QDir(QDir::homePath()).mkdir(".hv2ray");
|
||||
qDebug() << "Config directory created.";
|
||||
}
|
||||
|
||||
@ -65,17 +70,25 @@ int main(int argc, char *argv[])
|
||||
QApplication _qApp(argc, argv);
|
||||
|
||||
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;
|
||||
}
|
||||
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);
|
||||
|
||||
RunGuard guard("Hv2ray");
|
||||
if(!guard.isSingleInstance()) {
|
||||
showWarnMessageBox(nullptr, QObject::tr("Hv2Ray"), QObject::tr("AnotherInstanceRunning"));
|
||||
return -1;
|
||||
}
|
||||
RunGuard guard("Hv2ray-Instance-Identifier");
|
||||
if(!guard.isSingleInstance()) {
|
||||
showWarnMessageBox(nullptr, QObject::tr("Hv2Ray"), QObject::tr("AnotherInstanceRunning"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
QDir::setCurrent(QFileInfo(QCoreApplication::applicationFilePath()).path());
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <QWidget>
|
||||
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
#include <QJsonObject>
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QDir>
|
||||
|
||||
#include "utils.h"
|
||||
#include "MainWindow.h"
|
||||
#include "w_MainWindow.h"
|
||||
#include "vinteract.h"
|
||||
|
||||
bool validationCheck(QString path)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "ConnectionEditWindow.h"
|
||||
#include "w_ConnectionEditWindow.h"
|
||||
#include "ui_ConnectionEditWindow.h"
|
||||
#include <iostream>
|
||||
#include "MainWindow.h"
|
||||
#include "w_MainWindow.h"
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QIntValidator>
|
@ -10,10 +10,10 @@
|
||||
#include "Python.h"
|
||||
#pragma pop_macro("slots")
|
||||
|
||||
#include "ConnectionEditWindow.h"
|
||||
#include "w_ConnectionEditWindow.h"
|
||||
#include "vinteract.h"
|
||||
#include "utils.h"
|
||||
#include "ImportConfig.h"
|
||||
#include "w_ImportConfig.h"
|
||||
#include "ui_ImportConfig.h"
|
||||
|
||||
ImportConfig::ImportConfig(QWidget *parent) :
|
@ -9,10 +9,10 @@
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "ui_MainWindow.h"
|
||||
#include "PrefrencesWindow.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ConnectionEditWindow.h"
|
||||
#include "ImportConfig.h"
|
||||
#include "w_PrefrencesWindow.h"
|
||||
#include "w_MainWindow.h"
|
||||
#include "w_ConnectionEditWindow.h"
|
||||
#include "w_ImportConfig.h"
|
||||
#include "vinteract.h"
|
||||
#include "utils.h"
|
||||
|
@ -1,9 +1,7 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#define confDir "conf/"
|
||||
#define confDatabase "conf/conf.db"
|
||||
#include <QMainWindow>
|
||||
#include "ConnectionEditWindow.h"
|
||||
#include "w_ConnectionEditWindow.h"
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMenu>
|
||||
#include <QScrollBar>
|
||||
@ -56,7 +54,6 @@ private:
|
||||
Ui::MainWindow *ui;
|
||||
void closeEvent(QCloseEvent *);
|
||||
void createTrayAction();
|
||||
|
||||
void CreateTrayIcon();
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <ui_PrefrencesWindow.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "PrefrencesWindow.h"
|
||||
#include "w_PrefrencesWindow.h"
|
||||
|
||||
PrefrencesWindow::PrefrencesWindow(QWidget *parent) :
|
||||
QDialog(parent),
|
Loading…
Reference in New Issue
Block a user