summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorJan Darmochwal2010-07-13 17:55:06 +0200
committerJan Darmochwal2010-07-13 17:55:06 +0200
commitf29300c556e541f2bf1b63ed8c6399a6c2044c8d (patch)
tree4a549ef967177e82e6b20536f9484e8461893c7b /src/dialog.cpp
parentinitial qt4 version (diff)
downloadvmchooser-f29300c556e541f2bf1b63ed8c6399a6c2044c8d.tar.gz
vmchooser-f29300c556e541f2bf1b63ed8c6399a6c2044c8d.tar.xz
vmchooser-f29300c556e541f2bf1b63ed8c6399a6c2044c8d.zip
qmake -> cmake; (mostly) cosmetic changes
Switched to cmake: CMakeLists.txt in base directory use ./build.sh to build vmchooser (or mkdir -p build; cd build cmake .. && make) updated README removed fltk/ removed libxml2/ removed mesgdisp/ renamed vmchooser/ to src/ moved all header files (.h) from vmchooser/inc/ to src/ added files to repository that must have slipped the last time
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
new file mode 100644
index 0000000..e4c74a4
--- /dev/null
+++ b/src/dialog.cpp
@@ -0,0 +1,60 @@
+#include "dialog.h"
+#include "ui_dialog.h"
+#include "model.h"
+#include "DataEntry.h"
+#include "functions.h"
+
+Dialog::Dialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::Dialog)
+{
+ ui->setupUi(this);
+ //QAbstractListModel *data = new Model(1000, ui->listView);
+ //ui->listView->setModel(data);
+}
+
+Dialog::~Dialog()
+{
+ delete ui;
+}
+
+void Dialog::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+void Dialog::on_listView_activated(QModelIndex index)
+{
+ //TODO handle failures
+ printf ("Item %d has been activated\n", index.row());
+ //TODO get rid of this->entries, storing them in the model should be enough
+ // alternatively use references instead of copies?
+ runImage(this->entries.at(index.row()));
+ close();
+}
+
+void Dialog::addItems(const std::vector<DataEntry>& entries) {
+ // TODO: this is not the right way to do this
+ // we probably do not need a copy of the entries vector in Dialog and Model
+ this->entries = entries;
+ QAbstractListModel *data = new Model(entries, ui->listView);
+ ui->listView->setModel(data);
+}
+
+void Dialog::on_pushButtonAbort_clicked()
+{
+ close();
+}
+
+void Dialog::on_pushButtonStart_clicked()
+{
+ // TODO: check if a model is selected
+ this->on_listView_activated(ui->listView->selectionModel()->currentIndex());
+}