mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
UI polish
This commit is contained in:
parent
70dba94de4
commit
3e764dc3b8
@ -5,6 +5,7 @@ ArchiveContentsWidget::ArchiveContentsWidget(QWidget* parent, Qt::WindowFlags fl
|
|||||||
{
|
{
|
||||||
setWindowTitle("Archive");
|
setWindowTitle("Archive");
|
||||||
table = new QTableView();
|
table = new QTableView();
|
||||||
|
table->setShowGrid(false);
|
||||||
setWidget(table);
|
setWidget(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "ArchiveContentsWidget.hpp"
|
#include "ArchiveContentsWidget.hpp"
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow(parent, flags)
|
ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow(parent, flags)
|
||||||
{
|
{
|
||||||
@ -12,11 +14,18 @@ ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow(
|
|||||||
this->setCentralWidget(viewer);
|
this->setCentralWidget(viewer);
|
||||||
|
|
||||||
archivewidget = new ArchiveContentsWidget;
|
archivewidget = new ArchiveContentsWidget;
|
||||||
|
archivewidget->setObjectName("archivewidget");
|
||||||
this->addDockWidget(Qt::LeftDockWidgetArea, archivewidget);
|
this->addDockWidget(Qt::LeftDockWidgetArea, archivewidget);
|
||||||
|
|
||||||
QMenuBar* mb = this->menuBar();
|
QMenuBar* mb = this->menuBar();
|
||||||
QMenu* file = mb->addMenu("&File");
|
QMenu* file = mb->addMenu("&File");
|
||||||
file->addAction("Open &Archive", this, SLOT(openArchive()));
|
file->addAction("Open &Archive", this, SLOT(openArchive()));
|
||||||
|
file->addSeparator();
|
||||||
|
file->addAction("E&xit", QApplication::instance(), SLOT(quit()), QKeySequence::Quit);
|
||||||
|
|
||||||
|
QSettings settings("OpenRW", "rwviewer");
|
||||||
|
restoreGeometry(settings.value("geometry").toByteArray());
|
||||||
|
restoreState(settings.value("windowState").toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerWindow::openArchive(const QString& name)
|
void ViewerWindow::openArchive(const QString& name)
|
||||||
@ -33,6 +42,15 @@ void ViewerWindow::openArchive(const QString& name)
|
|||||||
archivewidget->setArchive(ld);
|
archivewidget->setArchive(ld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewerWindow::closeEvent(QCloseEvent* event)
|
||||||
|
{
|
||||||
|
QSettings settings("OpenRW", "rwviewer");
|
||||||
|
settings.setValue("geometry", saveGeometry());
|
||||||
|
settings.setValue("windowState", saveState());
|
||||||
|
QMainWindow::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ViewerWindow::openArchive()
|
void ViewerWindow::openArchive()
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this, "Open Archive", QDir::homePath(), "IMG Archives (*.img)");
|
QFileDialog dialog(this, "Open Archive", QDir::homePath(), "IMG Archives (*.img)");
|
||||||
|
@ -16,6 +16,7 @@ public:
|
|||||||
|
|
||||||
void openArchive(const QString& name);
|
void openArchive(const QString& name);
|
||||||
|
|
||||||
|
virtual void closeEvent(QCloseEvent*);
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void openArchive();
|
void openArchive();
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QStyleFactory>
|
||||||
#include "ViewerWindow.hpp"
|
#include "ViewerWindow.hpp"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
/* HACK until Qt curve supports Qt5 */
|
||||||
|
QApplication::setStyle(QStyleFactory::create("GTK+"));
|
||||||
|
|
||||||
ViewerWindow viewer;
|
ViewerWindow viewer;
|
||||||
viewer.show();
|
viewer.show();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user