summaryrefslogtreecommitdiff
path: root/seentl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'seentl.cpp')
-rw-r--r--seentl.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/seentl.cpp b/seentl.cpp
index e06b5d2..d9f808c 100644
--- a/seentl.cpp
+++ b/seentl.cpp
@@ -1,6 +1,9 @@
#include "seentl.h"
#include "ui_seentl.h"
#include <QHeaderView>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QMessageBox>
#include <QDebug>
SEENTL::SEENTL(QWidget *parent)
@@ -8,8 +11,6 @@ SEENTL::SEENTL(QWidget *parent)
{
ui->setupUi(this);
- script.openScript("SEEN0517.utf");
-
// some settings to make the lines table look good
ui->lines->verticalHeader()->setDefaultSectionSize(ui->lines->fontMetrics().height()+1);
ui->lines->horizontalHeader()->setVisible(0);
@@ -20,9 +21,24 @@ SEENTL::SEENTL(QWidget *parent)
ui->lines->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
ui->lines->horizontalHeader()->setResizeMode(3, QHeaderView::Fixed);
ui->lines->horizontalHeader()->resizeSection(3, 100);
+
+ connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openScript()));
}
SEENTL::~SEENTL()
{
delete ui;
}
+
+void SEENTL::openScript()
+{
+ QString fn = QFileDialog::getOpenFileName(this, "Open File", "", "Script files (*.utf)");
+ if(fn == "")
+ return;
+ QFileInfo fi(fn);
+ if(!fi.exists() || !fi.isFile() || !fi.isReadable() || !fi.isWritable()) {
+ QMessageBox::critical(this, "Can't open file", "File either doesn't exist or isn't readable and writable");
+ return;
+ }
+ script.openScript(fn);
+}