summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2016-01-07 17:56:44 +0100
committerSimon Rettberg2016-01-07 17:56:44 +0100
commitfcbf51697529688fd6233afc2f518f1723537ff7 (patch)
treecf45c7f5f19a0500601964c391275dbcd64aac05 /src
parentMove user config dir to .config/openslx (diff)
downloadvmchooser2-fcbf51697529688fd6233afc2f518f1723537ff7.tar.gz
vmchooser2-fcbf51697529688fd6233afc2f518f1723537ff7.tar.xz
vmchooser2-fcbf51697529688fd6233afc2f518f1723537ff7.zip
Fix selection of last session if session was a VM
Diffstat (limited to 'src')
-rw-r--r--src/dialog.cpp21
-rw-r--r--src/dialog.h3
2 files changed, 14 insertions, 10 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 4179afd..fdf3d78 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -284,7 +284,6 @@ void Dialog::setTheme() {
backgroundColor.prepend("\\1").append("\\2");
label_l_style.replace(QRegExp("(.*background-color:)#[^;]*(;.*)"), backgroundColor);
label_r_style.replace(QRegExp("(.*background-color:)#[^;]*(;.*)"), backgroundColor);
- //qDebug() << label_r_style << label_l_style;
ui->label_l->setStyleSheet(label_l_style);
ui->label_r->setStyleSheet(label_r_style);
}
@@ -359,7 +358,8 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) {
userInteracted_ = true;
}
-void Dialog::on_treeView_clicked(const QModelIndex&) {
+void Dialog::mousePressEvent(QMouseEvent * event) {
+ QDialog::mousePressEvent(event);
userInteracted_ = true;
}
@@ -370,9 +370,7 @@ void Dialog::treeView_selectionChanged(const QModelIndex& current, const QModelI
const Session* s(item->session());
if (!s) {
- if (debugMode) {
- qDebug() << "invalid selection";
- }
+ qDebug() << "invalid selection";
// no valid session has been selected, do nothing
return;
}
@@ -453,10 +451,13 @@ void Dialog::onTabButtonChanged(int tab) {
ui->treeView->selectionModel()->setCurrentIndex(ui->treeView->model()->index(0, 0, ui->treeView->rootIndex()), QItemSelectionModel::Select);
}
+void Dialog::on_filterEdit_textEdited() {
+ userInteracted_ = true;
+}
+
void Dialog::on_filterEdit_textChanged() {
if (activeTab_ < 0 || activeTab_ >= TAB_COUNT) return;
SessionTreeModel *newModel = NULL;
- userInteracted_ = true;
// filter the current model
if (!ui->filterEdit->text().isEmpty() && ui->filterEdit->text().replace(" ", "").length() > 2) {
@@ -634,7 +635,9 @@ void Dialog::keyPressEvent(QKeyEvent* event) {
}
void Dialog::iconDownloaded(const QUrl& url, const QIcon&) {
- qDebug() << "Icon downloaded... (" << url << ")";
- // TODO: Check which model(s) contain an entry with this icon
- model_[2]->updateView();
+ qDebug() << "Icon downloaded... (" << url << ")";
+ // TODO: Check which model(s) contain an entry with this icon
+ model_[TAB_MY_COURSES]->updateView();
+ model_[TAB_ALL_VMS]->updateView();
}
+
diff --git a/src/dialog.h b/src/dialog.h
index 04ee40f..17d5cd4 100644
--- a/src/dialog.h
+++ b/src/dialog.h
@@ -41,6 +41,7 @@ class Dialog : public QDialog {
protected: // Overrides
void changeEvent(QEvent *e);
+ void mousePressEvent(QMouseEvent *event);
private: // Private vars n methods
Ui::Dialog *ui;
@@ -61,11 +62,11 @@ class Dialog : public QDialog {
private slots:
void on_pushButtonStart_clicked();
void on_pushButtonAbort_clicked();
- void on_treeView_clicked(const QModelIndex& index);
void on_treeView_doubleClicked(const QModelIndex& index);
void on_tabButtonLocal_clicked();
void on_tabButtonMyClasses_clicked();
void on_tabButtonAllClasses_clicked();
+ void on_filterEdit_textEdited();
void on_filterEdit_textChanged();
void treeView_selectionChanged(const QModelIndex& current, const QModelIndex&);
void on_helpNewsButton_clicked();