Compare commits

..

No commits in common. "bf171dc3bb0660722a42ace4c9d07becb3591216" and "b11e5ce8524c4d7aec80238697b283669bf014af" have entirely different histories.

12 changed files with 40 additions and 206 deletions

View File

@ -9,9 +9,7 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# sudo apt install qt6-base-dev qt6-base-dev-tools
find_package(Qt6 REQUIRED)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Network)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network)
set(PROJECT_SOURCES
@ -25,23 +23,6 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(ConanCraft-Launcher
MANUAL_FINALIZATION
${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:
# 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:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
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()

View File

@ -2,15 +2,9 @@
#include "prog-constains.h"
#include "locales.h"
#if defined(Q_OS_LINUX)
#include <sys/prctl.h>
#include <signal.h>
#endif
I2PController::I2PController(QObject *parent)
: QObject(parent)
{
i2p.setWorkingDirectory(I2P_INSTALL_PATH);
this->isFatalErrored = false;
connect(&i2p, &QProcess::errorOccurred,
@ -20,8 +14,7 @@ I2PController::I2PController(QObject *parent)
this, &I2PController::onProcessFinished);
connect(&i2p, &QProcess::readyReadStandardOutput, this, [this]() {
// Logging I2P
//qDebug() << "[i2pd]" << i2p.readAllStandardOutput();
qDebug() << "[i2pd]" << i2p.readAllStandardOutput();
});
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() {
if (i2p.state() != QProcess::NotRunning)
{
@ -68,13 +49,6 @@ void I2PController::start() {
return;
}
#if defined(Q_OS_LINUX)
// If SIGKILL on Linux
i2p.setChildProcessModifier([]() {
prctl(PR_SET_PDEATHSIG, SIGTERM);
});
#endif
QStringList args;
#if defined(Q_OS_WIN)
this->i2p.start(QDir(I2P_INSTALL_PATH).filePath("i2pd.exe"), args);
@ -87,7 +61,6 @@ void I2PController::start() {
<< "--tunconf" << QDir(configsFolder).filePath("tunnels.conf")
<< "--log" << QDir(logsFolder).filePath("i2pd.log");
//qDebug() << "i2pd args:" << args;
this->i2p.start(QDir(I2P_INSTALL_PATH).filePath("i2pd"), args);
#else
#endif

View File

@ -12,7 +12,6 @@ class I2PController : public QObject
Q_OBJECT
public:
I2PController(QObject *parent = nullptr);
~I2PController();
void start();
private:
QProcess i2p;

View File

@ -3,55 +3,26 @@
#include "network-downloader.h"
#include "prog-constains.h"
void addI2PDconfig(QString i2pdConf, QString tunnelsConf)
{
auto writeIfMissing = [](const QString &path, const QString &content)
{
QFileInfo info(path);
// 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 addI2PDconfig (QString i2pdConf, QString tunnelsConf) {
#if defined(Q_OS_WIN)
#elif defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
#else
#endif
}
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 i2pdConf = QDir(configsFolder).filePath("i2pd.conf");
QString i2pdConf = QDir(configsFolder).filePath("i2pd.confconf");
QString tunnelsConf = QDir(configsFolder).filePath("tunnels.conf");
if (
!QFile(i2pdConf).exists() ||
!QFile(tunnelsConf).exists()
) {
) {
qDebug() << "Configs not found. Creating new";
emptyFolder(configsFolder);
addI2PDconfig(i2pdConf, tunnelsConf);
}
#else
#endif
}
bool checkI2P () {

View File

@ -15,7 +15,6 @@
#include <QDirIterator>
#include <QThread>
#include <QProcess>
#include <QTextStream>
bool installI2P(std::function<void(QString, unsigned int, unsigned int)> logCallback);
bool checkI2P ();

View File

@ -65,18 +65,13 @@ void LoadingWorker::process() {
configCheckAndMake();
emit startI2P();
// Ping the website
emit changeStep(QString::fromStdString(localeMap->at("loading.pingWebsite")));
// TODO: Add it later
// Checking: Is minecraft installed
emit changeStep(QString::fromStdString(localeMap->at("loading.isMinecraftInst")));
// Getting endpoint API
emit changeStep(QString::fromStdString(localeMap->at("loading.gettingEndpoint")));
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
emit changeStep(QString::fromStdString(localeMap->at("loading.logging")));
// TODO: Add it later

View File

@ -18,7 +18,6 @@ LocaleMap ru_RU = {
{"loading.end", "Закончили. Приятной игры"},
{"loading.installI2P", "Установка I2P"},
{"loading.isMinecraftInst", "Проверим установлен ли Майнкрафт"},
{"loading.pingWebsite", "Пытаемся достучаться до сайта"},
// Welcome
{"welcome.main", "Главная"},
{"welcome.settings", "Настройки"},
@ -26,7 +25,6 @@ LocaleMap ru_RU = {
{"welcome.showPassword", "Показать пароль"},
{"welcome.logIn", "Войти"},
{"welcome.register", "Зарегистрироваться"},
{"welcome.version", "Версия"},
// I2PD
{"i2pd.errorTitle", "Ошибка I2P"},
{"i2pd.errorDescription.p1", "I2P Завершилась с фатальной ошибкой:\n\n"},
@ -49,7 +47,6 @@ LocaleMap en_US = {
{"loading.end", "Finished. Let's start"},
{"loading.installI2P", "Installing I2P"},
{"loading.isMinecraftInst", "Checking Is Minecraft installed"},
{"loading.pingWebsite", "Trying to connect to the website"},
// Welcome
{"welcome.main", "Home"},
{"welcome.settings", "Settings"},
@ -57,7 +54,6 @@ LocaleMap en_US = {
{"welcome.showPassword", "Show the password"},
{"welcome.logIn", "LogIn"},
{"welcome.register", "Registration"},
{"welcome.version", "Version"},
// I2PD
{"i2pd.errorTitle", "I2P Error"},
{"i2pd.errorDescription.p1", "A fatal error occurred while running i2pd:\n\n"},

View File

@ -1,18 +1,15 @@
#include "loading.h"
#include "locales.h"
#include "prog-constains.h"
//#include "welcome.h"
#include <QApplication>
int main(int argc, char *argv[])
{
//qDebug() << QT_VERSION_STR;
//return 0;
//debugVariables();
initLocales();
QApplication a(argc, argv);
Loading w;
//w.setWindowFlags(Qt::FramelessWindowHint);
w.show();
return a.exec();
}

File diff suppressed because one or more lines are too long

View File

@ -5,17 +5,10 @@
#include <QDir>
#include <QCoreApplication>
extern const QString VERSION;
extern const QString __dirname;
extern const QString JAVA_INSTALL_PATH;
extern const QString TEMP_PATH;
extern const QString I2P_INSTALL_PATH;
extern const QString WIKI_URL;
extern const QString DEFAULT_I2PD_CONF;
extern const QString DEFAULT_TUNNELS_CONF;
void debugVariables();
#endif // PROG_CONSTAINS_H

View File

@ -1,14 +1,12 @@
#include "welcome.h"
#include "./ui_welcome.h"
#include "locales.h"
#include "prog-constains.h"
Welcome::Welcome(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::Welcome)
{
ui->setupUi(this);
ui->statusbar->addPermanentWidget(ui->progVersion, 1);
}
Welcome::~Welcome()
@ -31,7 +29,5 @@ void Welcome::setupWelcomeLocale(QString locale) {
this->ui->loginBtn->setText(QString::fromStdString(localeMap->at("welcome.logIn")));
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);
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<height>596</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
@ -68,7 +68,7 @@
<item>
<widget class="QLineEdit" name="password">
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
@ -103,26 +103,13 @@
</attribute>
</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 class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>803</width>
<width>800</width>
<height>23</height>
</rect>
</property>