Files
minecraft-launcher/mainwindow.h

53 lines
1.8 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QProcess>
#include <QSettings>
#include <QJsonObject> // Важно: добавить для хранения данных профилей
// Предварительное объявление класса, сгенерированного из mainwindow.ui
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
// Слоты для кнопок (автоматически подключаются по имени: on_<имя_объекта>_<сигнал>)
void on_launchButton_clicked();
void on_modsFolderButton_clicked();
void on_updateModsButton_clicked();
void on_settingsButton_clicked();
void on_addProfileButton_clicked(); // Слот для кнопки "Новый..."
void on_editProfileButton_clicked(); // <-- ДОБАВЬТЕ ЭТОТ СЛОТ
void on_profileComboBox_currentIndexChanged(int index); // Слот для смены профиля
// Слоты для QProcess (подключаются вручную)
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void onProcessError(QProcess::ProcessError error);
void readProcessOutput();
private:
QString getMinecraftPath();
// Новые методы для работы с профилями
void loadProfiles();
void saveProfiles();
void createNewProfile();
QString profilesPath; // Путь к launcher_profiles.json
QJsonObject profilesData; // JSON данные из файла
Ui::MainWindow *ui; // Указатель на объект интерфейса
QProcess *process;
QSettings *settings;
};
#endif // MAINWINDOW_H