new vault dialog
This commit is contained in:
@@ -12,7 +12,7 @@ set(CMAKE_AUTOUIC ON)
|
||||
|
||||
qt6_wrap_ui(UI_HEADERS src/mainwindow.ui)
|
||||
|
||||
add_executable(${PROJECT_NAME} src/main.cc ${UI_HEADERS})
|
||||
add_executable(${PROJECT_NAME} src/main.cc src/mainwindow.cc ${UI_HEADERS})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
#include "ui_mainwindow.h"
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QMainWindow window;
|
||||
Ui::MainWindow ui;
|
||||
ui.setupUi(&window);
|
||||
|
||||
MainWindow window;
|
||||
window.show();
|
||||
|
||||
return QApplication::exec();
|
||||
|
||||
21
src/mainwindow.cc
Normal file
21
src/mainwindow.cc
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <fstream>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->actionNew, &QAction::triggered, this, [this]() {
|
||||
QString path = QFileDialog::getSaveFileName(this, "Choose vault location",
|
||||
QDir::currentPath(),
|
||||
"Dull Vaults (*.dull)");
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::ofstream file(path.toStdString(), std::ios::binary);
|
||||
file.write("TEST", 4);
|
||||
});
|
||||
}
|
||||
14
src/mainwindow.h
Normal file
14
src/mainwindow.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QMainWindow>
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
@@ -13,28 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>90</y>
|
||||
<width>681</width>
|
||||
<height>311</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>72</pointsize>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hello, World!</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@@ -44,7 +23,19 @@
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>Vault</string>
|
||||
</property>
|
||||
<addaction name="actionNew"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
</widget>
|
||||
<action name="actionNew">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user