Use less pointers in frontend

This commit is contained in:
SimoneN64
2024-09-24 13:05:10 +02:00
parent 60870165d5
commit bd98a3b4ee
16 changed files with 270 additions and 261 deletions

View File

@@ -6,14 +6,23 @@
#include <QPushButton>
#include <QTabWidget>
#include <QWidget>
#include <QButtonGroup>
#include <QFileDialog>
#include <QGroupBox>
#include <QVBoxLayout>
class SettingsWindow : public QWidget {
QPushButton *cancel = new QPushButton("Cancel");
QPushButton *apply = new QPushButton("Apply");
QFileIconProvider *iconProv = new QFileIconProvider;
QPushButton *folderBtn = new QPushButton(iconProv->icon(QFileIconProvider::Folder), "");
QLabel *folderLabelPrefix;
QLabel *folderLabel;
std::unique_ptr<QPushButton> cancel = std::make_unique<QPushButton>("Cancel");
std::unique_ptr<QPushButton> apply = std::make_unique<QPushButton>("Apply");
std::unique_ptr<QFileIconProvider> iconProv = std::make_unique<QFileIconProvider>();
std::unique_ptr<QPushButton> folderBtn = std::make_unique<QPushButton>(iconProv->icon(QFileIconProvider::Folder), "");
std::unique_ptr<QLabel> folderLabelPrefix = std::make_unique<QLabel>("Save files' path: ");
std::unique_ptr<QLabel> folderLabel;
std::unique_ptr<QHBoxLayout> generalLayout = std::make_unique<QHBoxLayout>();
std::unique_ptr<QVBoxLayout> generalLayoutV = std::make_unique<QVBoxLayout>();
std::unique_ptr<QTabWidget> tabs = std::make_unique<QTabWidget>();
std::unique_ptr<QVBoxLayout> mainLayout = std::make_unique<QVBoxLayout>();
std::unique_ptr<QHBoxLayout> buttonsLayout = std::make_unique<QHBoxLayout>();
Q_OBJECT
public:
float getVolumeL() { return float(audioSettings->volumeL->value()) / 100.f; }
@@ -21,10 +30,10 @@ public:
std::array<Qt::Key, 18> keyMap{};
SettingsWindow();
nlohmann::json settings;
CPUSettings *cpuSettings;
AudioSettings *audioSettings;
InputSettings *inputSettings;
QWidget *generalSettings;
std::unique_ptr<CPUSettings> cpuSettings{};
std::unique_ptr<AudioSettings> audioSettings{};
std::unique_ptr<InputSettings> inputSettings{};
std::unique_ptr<QWidget> generalSettings{};
Q_SIGNALS:
void regrabKeyboard();
};