Add menu bar and recent file feature.
This commit is contained in:
parent
2854479b97
commit
c165a537a0
@ -15,6 +15,20 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
mDiskLumpCount = 0;
|
||||
mDiskLumpOrder = QVector<quint32>();
|
||||
mLumps = QMap<quint32, Lump>();
|
||||
mRecentFiles = QQueue<QString>();
|
||||
mSettingsValid = false;
|
||||
mRecentFileActions = QVector<QAction*>();
|
||||
|
||||
const QString appSettingsPath = QDir::currentPath() + "/appSettings.ini";
|
||||
QSettings appSettings(appSettingsPath, QSettings::IniFormat);
|
||||
if (appSettings.contains("mRecentFiles")) {
|
||||
mSettingsValid = true;
|
||||
|
||||
QStringList recentFiles = appSettings.value("mRecentFiles").toStringList();
|
||||
foreach (QString recentFile, recentFiles) {
|
||||
mRecentFiles.enqueue(recentFile);
|
||||
}
|
||||
}
|
||||
|
||||
connect(ui->treeWidget_Scripts, &QTreeWidget::itemSelectionChanged, this, &MainWindow::ScriptSelected);
|
||||
connect(ui->comboBox_StringTable, &QComboBox::currentTextChanged, this, &MainWindow::StrTableSelected);
|
||||
@ -114,6 +128,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
const QString appSettingsPath = QDir::currentPath() + "/appSettings.ini";
|
||||
QSettings appSettings(appSettingsPath, QSettings::IniFormat);
|
||||
appSettings.setValue("mRecentFiles", mRecentFiles.toList());
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -193,6 +211,9 @@ void MainWindow::Reset() {
|
||||
mRawFileMap.clear();
|
||||
mTreeMap.clear();
|
||||
mStrTableMap.clear();
|
||||
|
||||
// Refresh recent files
|
||||
RefreshRecentFileMenu();
|
||||
}
|
||||
|
||||
void MainWindow::StrTableSelected(QString aStrTableName) {
|
||||
|
||||
19
mainwindow.h
19
mainwindow.h
@ -12,6 +12,8 @@
|
||||
#include <QDebug>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QSettings>
|
||||
#include <QQueue>
|
||||
|
||||
#include <Qt3DCore/QEntity>
|
||||
#include <Qt3DRender/QCamera>
|
||||
@ -84,9 +86,16 @@ private slots:
|
||||
void on_pushButton_FastFile_clicked();
|
||||
void on_pushButton_FastFile_2_clicked();
|
||||
|
||||
QFile *OpenFastFile();
|
||||
QFile *OpenZoneFile();
|
||||
void ParseFFHeader(QFile *aFastFilePtr);
|
||||
void LogOpenedFile(QString aFileName);
|
||||
void RefreshRecentFileMenu();
|
||||
|
||||
QString GetFastFilePath();
|
||||
QString GetZoneFilePath();
|
||||
|
||||
QByteArray OpenFastFile(QString aFastFilePath);
|
||||
QByteArray OpenZoneFile(QString aZoneFilePath);
|
||||
|
||||
void ParseFFHeader(QByteArray aFastFileData);
|
||||
void ParseFFCompany(QDataStream *aFastFileStream);
|
||||
void ParseFFFileType(QDataStream *afastFileStream);
|
||||
void ParseFFSignage(QDataStream *afastFileStream);
|
||||
@ -141,6 +150,10 @@ private:
|
||||
QMap<QString, QString> mRawFileMap;
|
||||
QMap<QString, QTreeWidgetItem*> mTreeMap;
|
||||
QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap;
|
||||
QQueue<QString> mRecentFiles;
|
||||
bool mSettingsValid;
|
||||
|
||||
QVector<QAction*> mRecentFileActions;
|
||||
|
||||
quint32 mBSPVersion;
|
||||
quint32 mDiskLumpCount;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user