mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 19:30:26 +08:00
misc tweaks
This commit is contained in:
parent
5212bf968a
commit
bca1eaedd0
@ -36,10 +36,10 @@ namespace Qv2ray
|
||||
hTray = new QSystemTrayIcon();
|
||||
}
|
||||
|
||||
void Qv2rayApplication::QuitApplication(int retcode)
|
||||
void Qv2rayApplication::QuitApplication(int retCode)
|
||||
{
|
||||
isExiting = true;
|
||||
QCoreApplication::exit(retcode);
|
||||
QCoreApplication::exit(retCode);
|
||||
}
|
||||
|
||||
Qv2rayApplication::Qv2raySetupStatus Qv2rayApplication::SetupQv2ray()
|
||||
@ -60,7 +60,7 @@ namespace Qv2ray
|
||||
if (isSecondary())
|
||||
{
|
||||
sendMessage(JsonToString(Qv2rayProcessArgument.toJson(), QJsonDocument::Compact).toUtf8());
|
||||
return SINGLEAPPLICATION;
|
||||
return SINGLE_APPLICATION;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -182,9 +182,9 @@ namespace Qv2ray
|
||||
|
||||
bool Qv2rayApplication::FindAndCreateInitialConfiguration()
|
||||
{
|
||||
if (initilized)
|
||||
if (initialized)
|
||||
{
|
||||
LOG(MODULE_INIT, "Qv2ray has already been initilized!")
|
||||
LOG(MODULE_INIT, "Qv2ray has already been initialized!")
|
||||
return false;
|
||||
}
|
||||
LOG(MODULE_INIT, "Application exec path: " + applicationDirPath())
|
||||
@ -373,7 +373,7 @@ namespace Qv2ray
|
||||
return true;
|
||||
}
|
||||
|
||||
void Qv2rayApplication::InitilizeGlobalVariables()
|
||||
void Qv2rayApplication::InitializeGlobalVariables()
|
||||
{
|
||||
StyleManager = new QvStyleManager();
|
||||
PluginHost = new QvPluginHost();
|
||||
@ -382,7 +382,7 @@ namespace Qv2ray
|
||||
StyleManager->ApplyStyle(GlobalConfig.uiConfig.theme);
|
||||
}
|
||||
|
||||
bool Qv2rayApplication::PreInitilize(int argc, char *argv[])
|
||||
bool Qv2rayApplication::PreInitialize(int argc, char **argv)
|
||||
{
|
||||
QString errorMessage;
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace Qv2ray
|
||||
{
|
||||
QV2RAY_NORMAL = 0,
|
||||
QV2RAY_SECONDARY_INSTANCE = 0,
|
||||
QV2RAY_PREINITIALIZE_FAIL = -1,
|
||||
QV2RAY_PRE_INITIALIZE_FAIL = -1,
|
||||
QV2RAY_EARLY_SETUP_FAIL = -2,
|
||||
QV2RAY_CONFIG_PATH_FAIL = -3,
|
||||
QV2RAY_CONFIG_FILE_FAIL = -4,
|
||||
@ -63,17 +63,17 @@ namespace Qv2ray
|
||||
enum Qv2raySetupStatus
|
||||
{
|
||||
NORMAL,
|
||||
SINGLEAPPLICATION,
|
||||
SINGLE_APPLICATION,
|
||||
FAILED
|
||||
};
|
||||
//
|
||||
void QuitApplication(int retcode = 0);
|
||||
static bool PreInitilize(int argc, char *argv[]);
|
||||
void QuitApplication(int retCode = 0);
|
||||
static bool PreInitialize(int argc, char **argv);
|
||||
explicit Qv2rayApplication(int &argc, char *argv[]);
|
||||
Qv2raySetupStatus SetupQv2ray();
|
||||
bool FindAndCreateInitialConfiguration();
|
||||
bool LoadConfiguration();
|
||||
void InitilizeGlobalVariables();
|
||||
void InitializeGlobalVariables();
|
||||
Qv2rayExitCode RunQv2ray();
|
||||
|
||||
public:
|
||||
@ -98,11 +98,11 @@ namespace Qv2ray
|
||||
QSystemTrayIcon *hTray;
|
||||
MainWindow *mainWindow;
|
||||
static commandline_status ParseCommandLine(QString *errorMessage, const QStringList &args);
|
||||
bool initilized = false;
|
||||
bool initialized = false;
|
||||
};
|
||||
} // namespace Qv2ray
|
||||
|
||||
using namespace Qv2ray;
|
||||
|
||||
#define qvApp (static_cast<Qv2ray::Qv2rayApplication *>(QCoreApplication::instance()))
|
||||
#define qvApp (dynamic_cast<Qv2ray::Qv2rayApplication *>(QCoreApplication::instance()))
|
||||
#define qvAppTrayIcon (*qvApp->GetTrayIcon())
|
||||
|
@ -23,7 +23,7 @@ Qv2rayExitCode RunQv2rayApplicationScoped(int argc, char *argv[])
|
||||
switch (setupStatus)
|
||||
{
|
||||
case Qv2rayApplication::NORMAL: break;
|
||||
case Qv2rayApplication::SINGLEAPPLICATION: return QV2RAY_SECONDARY_INSTANCE;
|
||||
case Qv2rayApplication::SINGLE_APPLICATION: return QV2RAY_SECONDARY_INSTANCE;
|
||||
case Qv2rayApplication::FAILED: return QV2RAY_EARLY_SETUP_FAIL;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ Qv2rayExitCode RunQv2rayApplicationScoped(int argc, char *argv[])
|
||||
return QV2RAY_SSL_FAIL;
|
||||
}
|
||||
|
||||
app.InitilizeGlobalVariables();
|
||||
app.InitializeGlobalVariables();
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
signal(SIGUSR1, [](int) { ConnectionManager->RestartConnection(); });
|
||||
@ -101,8 +101,8 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
//
|
||||
// parse the command line before starting as a Qt application
|
||||
if (!Qv2rayApplication::PreInitilize(argc, argv))
|
||||
return QV2RAY_PREINITIALIZE_FAIL;
|
||||
if (!Qv2rayApplication::PreInitialize(argc, argv))
|
||||
return QV2RAY_PRE_INITIALIZE_FAIL;
|
||||
const auto rcode = RunQv2rayApplicationScoped(argc, argv);
|
||||
if (rcode == QV2RAY_NEW_VERSION)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user