Compare commits
No commits in common. "bf171dc3bb0660722a42ace4c9d07becb3591216" and "b11e5ce8524c4d7aec80238697b283669bf014af" have entirely different histories.
bf171dc3bb
...
b11e5ce852
@ -9,9 +9,7 @@ set(CMAKE_AUTORCC ON)
|
|||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# sudo apt install qt6-base-dev qt6-base-dev-tools
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network)
|
||||||
find_package(Qt6 REQUIRED)
|
|
||||||
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Network)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network)
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network)
|
||||||
|
|
||||||
set(PROJECT_SOURCES
|
set(PROJECT_SOURCES
|
||||||
@ -25,23 +23,6 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|||||||
qt_add_executable(ConanCraft-Launcher
|
qt_add_executable(ConanCraft-Launcher
|
||||||
MANUAL_FINALIZATION
|
MANUAL_FINALIZATION
|
||||||
${PROJECT_SOURCES}
|
${PROJECT_SOURCES}
|
||||||
loading.h loading.cpp loading.ui
|
|
||||||
source.qrc
|
|
||||||
loading-worker.h loading-worker.cpp
|
|
||||||
locales.h
|
|
||||||
locales.cpp
|
|
||||||
install-java.h
|
|
||||||
install-java.cpp
|
|
||||||
network-downloader.h
|
|
||||||
network-downloader.cpp
|
|
||||||
fs-tools.cpp
|
|
||||||
fs-tools.h
|
|
||||||
prog-constains.h
|
|
||||||
prog-constains.cpp
|
|
||||||
install-i2p.h
|
|
||||||
install-i2p.cpp
|
|
||||||
i2p-controller.h i2p-controller.cpp
|
|
||||||
personal-account.h personal-account.cpp personal-account.ui
|
|
||||||
)
|
)
|
||||||
# Define target properties for Android with Qt 6 as:
|
# Define target properties for Android with Qt 6 as:
|
||||||
# set_property(TARGET ConanCraft-Launcher APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
# set_property(TARGET ConanCraft-Launcher APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||||
@ -55,7 +36,26 @@ else()
|
|||||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||||
else()
|
else()
|
||||||
# Qt5 is tool for sons of whole
|
add_executable(ConanCraft-Launcher
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
loading.h loading.cpp loading.ui
|
||||||
|
source.qrc
|
||||||
|
loading-worker.h loading-worker.cpp
|
||||||
|
locales.h
|
||||||
|
locales.cpp
|
||||||
|
install-java.h
|
||||||
|
install-java.cpp
|
||||||
|
network-downloader.h
|
||||||
|
network-downloader.cpp
|
||||||
|
fs-tools.cpp
|
||||||
|
fs-tools.h
|
||||||
|
prog-constains.h
|
||||||
|
prog-constains.cpp
|
||||||
|
install-i2p.h
|
||||||
|
install-i2p.cpp
|
||||||
|
i2p-controller.h i2p-controller.cpp
|
||||||
|
personal-account.h personal-account.cpp personal-account.ui
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -2,15 +2,9 @@
|
|||||||
#include "prog-constains.h"
|
#include "prog-constains.h"
|
||||||
#include "locales.h"
|
#include "locales.h"
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
#include <sys/prctl.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
I2PController::I2PController(QObject *parent)
|
I2PController::I2PController(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
i2p.setWorkingDirectory(I2P_INSTALL_PATH);
|
|
||||||
this->isFatalErrored = false;
|
this->isFatalErrored = false;
|
||||||
|
|
||||||
connect(&i2p, &QProcess::errorOccurred,
|
connect(&i2p, &QProcess::errorOccurred,
|
||||||
@ -20,8 +14,7 @@ I2PController::I2PController(QObject *parent)
|
|||||||
this, &I2PController::onProcessFinished);
|
this, &I2PController::onProcessFinished);
|
||||||
|
|
||||||
connect(&i2p, &QProcess::readyReadStandardOutput, this, [this]() {
|
connect(&i2p, &QProcess::readyReadStandardOutput, this, [this]() {
|
||||||
// Logging I2P
|
qDebug() << "[i2pd]" << i2p.readAllStandardOutput();
|
||||||
//qDebug() << "[i2pd]" << i2p.readAllStandardOutput();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&i2p, &QProcess::readyReadStandardError, this, [this]() {
|
connect(&i2p, &QProcess::readyReadStandardError, this, [this]() {
|
||||||
@ -49,18 +42,6 @@ I2PController::I2PController(QObject *parent)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
I2PController::~I2PController()
|
|
||||||
{
|
|
||||||
if (i2p.state() != QProcess::NotRunning)
|
|
||||||
{
|
|
||||||
i2p.terminate();
|
|
||||||
i2p.waitForFinished(3000);
|
|
||||||
|
|
||||||
if (i2p.state() != QProcess::NotRunning)
|
|
||||||
i2p.kill();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void I2PController::start() {
|
void I2PController::start() {
|
||||||
if (i2p.state() != QProcess::NotRunning)
|
if (i2p.state() != QProcess::NotRunning)
|
||||||
{
|
{
|
||||||
@ -68,13 +49,6 @@ void I2PController::start() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
// If SIGKILL on Linux
|
|
||||||
i2p.setChildProcessModifier([]() {
|
|
||||||
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
this->i2p.start(QDir(I2P_INSTALL_PATH).filePath("i2pd.exe"), args);
|
this->i2p.start(QDir(I2P_INSTALL_PATH).filePath("i2pd.exe"), args);
|
||||||
@ -87,7 +61,6 @@ void I2PController::start() {
|
|||||||
<< "--tunconf" << QDir(configsFolder).filePath("tunnels.conf")
|
<< "--tunconf" << QDir(configsFolder).filePath("tunnels.conf")
|
||||||
<< "--log" << QDir(logsFolder).filePath("i2pd.log");
|
<< "--log" << QDir(logsFolder).filePath("i2pd.log");
|
||||||
|
|
||||||
//qDebug() << "i2pd args:" << args;
|
|
||||||
this->i2p.start(QDir(I2P_INSTALL_PATH).filePath("i2pd"), args);
|
this->i2p.start(QDir(I2P_INSTALL_PATH).filePath("i2pd"), args);
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -12,7 +12,6 @@ class I2PController : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
I2PController(QObject *parent = nullptr);
|
I2PController(QObject *parent = nullptr);
|
||||||
~I2PController();
|
|
||||||
void start();
|
void start();
|
||||||
private:
|
private:
|
||||||
QProcess i2p;
|
QProcess i2p;
|
||||||
|
|||||||
@ -3,55 +3,26 @@
|
|||||||
#include "network-downloader.h"
|
#include "network-downloader.h"
|
||||||
#include "prog-constains.h"
|
#include "prog-constains.h"
|
||||||
|
|
||||||
void addI2PDconfig(QString i2pdConf, QString tunnelsConf)
|
void addI2PDconfig (QString i2pdConf, QString tunnelsConf) {
|
||||||
{
|
#if defined(Q_OS_WIN)
|
||||||
auto writeIfMissing = [](const QString &path, const QString &content)
|
#elif defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||||
{
|
#else
|
||||||
QFileInfo info(path);
|
#endif
|
||||||
|
|
||||||
// create directory if missing
|
|
||||||
QDir dir = info.dir();
|
|
||||||
if (!dir.exists())
|
|
||||||
dir.mkpath(".");
|
|
||||||
|
|
||||||
// create file only if it doesn't exist
|
|
||||||
if (!QFile::exists(path))
|
|
||||||
{
|
|
||||||
QFile file(path);
|
|
||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
|
||||||
{
|
|
||||||
QTextStream out(&file);
|
|
||||||
out << content;
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qWarning() << "Failed to create config:" << path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
writeIfMissing(i2pdConf, DEFAULT_I2PD_CONF);
|
|
||||||
writeIfMissing(tunnelsConf, DEFAULT_TUNNELS_CONF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void configCheckAndMake () {
|
void configCheckAndMake () {
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
#elif defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
|
||||||
QString configsFolder = QDir(I2P_INSTALL_PATH).filePath("configs");
|
QString configsFolder = QDir(I2P_INSTALL_PATH).filePath("configs");
|
||||||
|
|
||||||
QString i2pdConf = QDir(configsFolder).filePath("i2pd.conf");
|
QString i2pdConf = QDir(configsFolder).filePath("i2pd.confconf");
|
||||||
QString tunnelsConf = QDir(configsFolder).filePath("tunnels.conf");
|
QString tunnelsConf = QDir(configsFolder).filePath("tunnels.conf");
|
||||||
if (
|
if (
|
||||||
!QFile(i2pdConf).exists() ||
|
!QFile(i2pdConf).exists() ||
|
||||||
!QFile(tunnelsConf).exists()
|
!QFile(tunnelsConf).exists()
|
||||||
) {
|
) {
|
||||||
qDebug() << "Configs not found. Creating new";
|
qDebug() << "Configs not found. Creating new";
|
||||||
emptyFolder(configsFolder);
|
emptyFolder(configsFolder);
|
||||||
addI2PDconfig(i2pdConf, tunnelsConf);
|
addI2PDconfig(i2pdConf, tunnelsConf);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkI2P () {
|
bool checkI2P () {
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTextStream>
|
|
||||||
|
|
||||||
bool installI2P(std::function<void(QString, unsigned int, unsigned int)> logCallback);
|
bool installI2P(std::function<void(QString, unsigned int, unsigned int)> logCallback);
|
||||||
bool checkI2P ();
|
bool checkI2P ();
|
||||||
|
|||||||
@ -65,18 +65,13 @@ void LoadingWorker::process() {
|
|||||||
configCheckAndMake();
|
configCheckAndMake();
|
||||||
emit startI2P();
|
emit startI2P();
|
||||||
|
|
||||||
// Ping the website
|
// Checking: Is minecraft installed
|
||||||
emit changeStep(QString::fromStdString(localeMap->at("loading.pingWebsite")));
|
emit changeStep(QString::fromStdString(localeMap->at("loading.isMinecraftInst")));
|
||||||
// TODO: Add it later
|
|
||||||
|
|
||||||
// Getting endpoint API
|
// Getting endpoint API
|
||||||
emit changeStep(QString::fromStdString(localeMap->at("loading.gettingEndpoint")));
|
emit changeStep(QString::fromStdString(localeMap->at("loading.gettingEndpoint")));
|
||||||
std::string endpointAPI = "TODO: Add it later";
|
std::string endpointAPI = "TODO: Add it later";
|
||||||
|
|
||||||
// Checking: Is minecraft installed
|
|
||||||
emit changeStep(QString::fromStdString(localeMap->at("loading.isMinecraftInst")));
|
|
||||||
// TODO: Add it later
|
|
||||||
|
|
||||||
// Handle data
|
// Handle data
|
||||||
emit changeStep(QString::fromStdString(localeMap->at("loading.logging")));
|
emit changeStep(QString::fromStdString(localeMap->at("loading.logging")));
|
||||||
// TODO: Add it later
|
// TODO: Add it later
|
||||||
|
|||||||
@ -18,7 +18,6 @@ LocaleMap ru_RU = {
|
|||||||
{"loading.end", "Закончили. Приятной игры"},
|
{"loading.end", "Закончили. Приятной игры"},
|
||||||
{"loading.installI2P", "Установка I2P"},
|
{"loading.installI2P", "Установка I2P"},
|
||||||
{"loading.isMinecraftInst", "Проверим установлен ли Майнкрафт"},
|
{"loading.isMinecraftInst", "Проверим установлен ли Майнкрафт"},
|
||||||
{"loading.pingWebsite", "Пытаемся достучаться до сайта"},
|
|
||||||
// Welcome
|
// Welcome
|
||||||
{"welcome.main", "Главная"},
|
{"welcome.main", "Главная"},
|
||||||
{"welcome.settings", "Настройки"},
|
{"welcome.settings", "Настройки"},
|
||||||
@ -26,7 +25,6 @@ LocaleMap ru_RU = {
|
|||||||
{"welcome.showPassword", "Показать пароль"},
|
{"welcome.showPassword", "Показать пароль"},
|
||||||
{"welcome.logIn", "Войти"},
|
{"welcome.logIn", "Войти"},
|
||||||
{"welcome.register", "Зарегистрироваться"},
|
{"welcome.register", "Зарегистрироваться"},
|
||||||
{"welcome.version", "Версия"},
|
|
||||||
// I2PD
|
// I2PD
|
||||||
{"i2pd.errorTitle", "Ошибка I2P"},
|
{"i2pd.errorTitle", "Ошибка I2P"},
|
||||||
{"i2pd.errorDescription.p1", "I2P Завершилась с фатальной ошибкой:\n\n"},
|
{"i2pd.errorDescription.p1", "I2P Завершилась с фатальной ошибкой:\n\n"},
|
||||||
@ -49,7 +47,6 @@ LocaleMap en_US = {
|
|||||||
{"loading.end", "Finished. Let's start"},
|
{"loading.end", "Finished. Let's start"},
|
||||||
{"loading.installI2P", "Installing I2P"},
|
{"loading.installI2P", "Installing I2P"},
|
||||||
{"loading.isMinecraftInst", "Checking Is Minecraft installed"},
|
{"loading.isMinecraftInst", "Checking Is Minecraft installed"},
|
||||||
{"loading.pingWebsite", "Trying to connect to the website"},
|
|
||||||
// Welcome
|
// Welcome
|
||||||
{"welcome.main", "Home"},
|
{"welcome.main", "Home"},
|
||||||
{"welcome.settings", "Settings"},
|
{"welcome.settings", "Settings"},
|
||||||
@ -57,7 +54,6 @@ LocaleMap en_US = {
|
|||||||
{"welcome.showPassword", "Show the password"},
|
{"welcome.showPassword", "Show the password"},
|
||||||
{"welcome.logIn", "LogIn"},
|
{"welcome.logIn", "LogIn"},
|
||||||
{"welcome.register", "Registration"},
|
{"welcome.register", "Registration"},
|
||||||
{"welcome.version", "Version"},
|
|
||||||
// I2PD
|
// I2PD
|
||||||
{"i2pd.errorTitle", "I2P Error"},
|
{"i2pd.errorTitle", "I2P Error"},
|
||||||
{"i2pd.errorDescription.p1", "A fatal error occurred while running i2pd:\n\n"},
|
{"i2pd.errorDescription.p1", "A fatal error occurred while running i2pd:\n\n"},
|
||||||
|
|||||||
5
main.cpp
5
main.cpp
@ -1,18 +1,15 @@
|
|||||||
#include "loading.h"
|
#include "loading.h"
|
||||||
#include "locales.h"
|
#include "locales.h"
|
||||||
#include "prog-constains.h"
|
|
||||||
//#include "welcome.h"
|
//#include "welcome.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
//qDebug() << QT_VERSION_STR;
|
|
||||||
//return 0;
|
|
||||||
//debugVariables();
|
|
||||||
initLocales();
|
initLocales();
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
Loading w;
|
Loading w;
|
||||||
|
//w.setWindowFlags(Qt::FramelessWindowHint);
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -5,17 +5,10 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
extern const QString VERSION;
|
|
||||||
|
|
||||||
extern const QString __dirname;
|
extern const QString __dirname;
|
||||||
extern const QString JAVA_INSTALL_PATH;
|
extern const QString JAVA_INSTALL_PATH;
|
||||||
extern const QString TEMP_PATH;
|
extern const QString TEMP_PATH;
|
||||||
extern const QString I2P_INSTALL_PATH;
|
extern const QString I2P_INSTALL_PATH;
|
||||||
extern const QString WIKI_URL;
|
extern const QString WIKI_URL;
|
||||||
|
|
||||||
extern const QString DEFAULT_I2PD_CONF;
|
|
||||||
extern const QString DEFAULT_TUNNELS_CONF;
|
|
||||||
|
|
||||||
void debugVariables();
|
|
||||||
|
|
||||||
#endif // PROG_CONSTAINS_H
|
#endif // PROG_CONSTAINS_H
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#include "welcome.h"
|
#include "welcome.h"
|
||||||
#include "./ui_welcome.h"
|
#include "./ui_welcome.h"
|
||||||
#include "locales.h"
|
#include "locales.h"
|
||||||
#include "prog-constains.h"
|
|
||||||
|
|
||||||
Welcome::Welcome(QWidget *parent)
|
Welcome::Welcome(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::Welcome)
|
, ui(new Ui::Welcome)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->statusbar->addPermanentWidget(ui->progVersion, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Welcome::~Welcome()
|
Welcome::~Welcome()
|
||||||
@ -31,7 +29,5 @@ void Welcome::setupWelcomeLocale(QString locale) {
|
|||||||
this->ui->loginBtn->setText(QString::fromStdString(localeMap->at("welcome.logIn")));
|
this->ui->loginBtn->setText(QString::fromStdString(localeMap->at("welcome.logIn")));
|
||||||
this->ui->registerBtn->setText(QString::fromStdString(localeMap->at("welcome.register")));
|
this->ui->registerBtn->setText(QString::fromStdString(localeMap->at("welcome.register")));
|
||||||
|
|
||||||
this->ui->progVersion->setText(QString::fromStdString(localeMap->at("welcome.version")) + ": " + VERSION);
|
|
||||||
|
|
||||||
this->ui->tabWidget->setCurrentIndex(0);
|
this->ui->tabWidget->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|||||||
21
welcome.ui
21
welcome.ui
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>803</width>
|
<width>800</width>
|
||||||
<height>596</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="password">
|
<widget class="QLineEdit" name="password">
|
||||||
<property name="echoMode">
|
<property name="echoMode">
|
||||||
<enum>QLineEdit::EchoMode::Password</enum>
|
<enum>QLineEdit::Password</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -103,26 +103,13 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="progVersion">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>550</y>
|
|
||||||
<width>171</width>
|
|
||||||
<height>18</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>welcome.version</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>803</width>
|
<width>800</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user