summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorJan Darmochwal2010-10-07 16:56:12 +0200
committerJan Darmochwal2010-10-07 16:56:12 +0200
commite7e9cf2849d0000acf47ecde86e4853687a03409 (patch)
treeaa811c315fa49eccf3691f932ebbc8b28d67fa14 /src/dialog.cpp
parentAdded files to parse command line options (diff)
downloadvmchooser-e7e9cf2849d0000acf47ecde86e4853687a03409.tar.gz
vmchooser-e7e9cf2849d0000acf47ecde86e4853687a03409.tar.xz
vmchooser-e7e9cf2849d0000acf47ecde86e4853687a03409.zip
Tidy up the code
* fixed compiler warnings, added -Werror to CMakeLists.txt * removed LibXml2 and boost stuff from CMakeLists.txt * fixed some things cpplint.py complains about: * make single-argument constructors explicit * add space before if/for/while/... * don't put { on a line of its own * remove space after ! operator * add space between // and comment * remove extra space before ( in function call * remove extra space before ) * shorten lines to <= 80 characters * remove blank lines at the start of a code block * maybe others
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp46
1 files changed, 17 insertions, 29 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 48e2be7..d359c75 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -3,10 +3,8 @@
#include "save_restore_session.h"
#include "sessiontreeitem.h"
-Dialog::Dialog(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::Dialog)
-{
+Dialog::Dialog(QWidget *parent)
+ : QDialog(parent), ui(new Ui::Dialog) {
model_ = new SessionTreeModel(parent);
ui->setupUi(this);
@@ -27,15 +25,13 @@ Dialog::Dialog(QWidget *parent) :
}
}
-Dialog::~Dialog()
-{
+Dialog::~Dialog() {
delete ui;
delete model_;
delete ifaceDBus_;
}
-void Dialog::changeEvent(QEvent *e)
-{
+void Dialog::changeEvent(QEvent *e) {
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
@@ -46,10 +42,9 @@ void Dialog::changeEvent(QEvent *e)
}
}
-void Dialog::on_treeView_activated(QModelIndex index)
-{
- //TODO handle failures
- //TODO get rid of this->entries, storing them in the model should be enough
+void Dialog::on_treeView_activated(QModelIndex index) {
+ // TODO handle failures
+ // TODO get rid of this->entries, storing them in the model should be enough
// alternatively use references instead of copies?
SessionTreeItem* item =
@@ -79,25 +74,21 @@ void Dialog::addItems(const QList<Session*>& entries, const QString& section) {
ui->treeView->expandAll();
}
-void Dialog::on_pushButtonAbort_clicked()
-{
+void Dialog::on_pushButtonAbort_clicked() {
close();
}
-void Dialog::on_pushButtonStart_clicked()
-{
+void Dialog::on_pushButtonStart_clicked() {
// TODO: check if a model is selected
this->on_treeView_activated(ui->treeView->selectionModel()->currentIndex());
}
-void Dialog::readPVSSettings()
-{
+void Dialog::readPVSSettings() {
QDBusPendingReply<QString> reply;
reply = ifaceDBus_->getConfigValue("Permissions/vnc_lecturer");
reply.waitForFinished();
- if (reply.isValid())
- {
+ if (reply.isValid()) {
if (reply.value() == "rw") {
ui->comboBoxLecturer->setCurrentIndex(2);
} else if (reply.value() == "ro") {
@@ -109,8 +100,7 @@ void Dialog::readPVSSettings()
reply = ifaceDBus_->getConfigValue("Permissions/vnc_other");
reply.waitForFinished();
- if (reply.isValid())
- {
+ if (reply.isValid()) {
if (reply.value() == "rw") {
ui->comboBoxOthers->setCurrentIndex(2);
} else if (reply.value() == "ro") {
@@ -131,8 +121,7 @@ void Dialog::readPVSSettings()
ui->checkBoxFileTransfer->setChecked(reply.value() == "T");
}
-void Dialog::writePVSSettings()
-{
+void Dialog::writePVSSettings() {
int accessLecturer = ui->comboBoxLecturer->currentIndex();
if (accessLecturer == 2) {
ifaceDBus_->setConfigValue("Permissions/vnc_lecturer", "rw");
@@ -157,16 +146,14 @@ void Dialog::writePVSSettings()
QString(ui->checkBoxFileTransfer->isChecked() ? "T" : "F"));
}
-void Dialog::on_comboBoxLecturer_currentIndexChanged(int index)
-{
+void Dialog::on_comboBoxLecturer_currentIndexChanged(int index) {
// TODO: may others have more access than lecturer?
if (index < ui->comboBoxOthers->currentIndex()) {
ui->comboBoxOthers->setCurrentIndex(index);
}
}
-void Dialog::on_comboBoxOthers_currentIndexChanged(int index)
-{
+void Dialog::on_comboBoxOthers_currentIndexChanged(int index) {
// TODO: may others have more access than lecturer?
if (index > ui->comboBoxLecturer->currentIndex()) {
ui->comboBoxLecturer->setCurrentIndex(index);
@@ -188,7 +175,8 @@ void Dialog::selectSession(const QString& name) {
const Session* s(item->session());
if (!s) continue;
if (s->shortDescription() == name) {
- ui->treeView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select);
+ ui->treeView->selectionModel()
+ ->setCurrentIndex(index, QItemSelectionModel::Select);
return;
}
}