/* # Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg # # This program is free software distributed under the GPL version 2. # See http://openslx.org/COPYING # # If you have any feedback please consult http://openslx.org/feedback and # send your suggestions, praise, or complaints to feedback@openslx.org # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # profileDialog.cpp # - GUI to define the profile. # ----------------------------------------------------------------------------- */ #include "profileDialog.h" profileDialog::profileDialog(QWidget * parent) : QDialog(parent) { setupUi(this); _profiles = new QSettings("openslx", "profiles", this); _current = _profiles->value("current").toString(); listWidget->addItems(_profiles->childGroups()); connect(addButton, SIGNAL(clicked()), this, SLOT(add())); connect(loadButton, SIGNAL(clicked()), this, SLOT(load())); connect(removeButton, SIGNAL(clicked()), this, SLOT(remove())); } profileDialog::~profileDialog() { } void profileDialog::add() { _current = ""; save(); } void profileDialog::remove() { if (listWidget->currentItem()) { _profiles->remove(listWidget->currentItem()->text()); listWidget->clear(); listWidget->addItems(_profiles->childGroups()); } } void profileDialog::save() { if (_current == "") { QString profile = QInputDialog::getText(this, tr("New Profile"), tr("Save profile as:")); if (!profile.isEmpty()) { _current = profile; _profiles->setValue("current", _current); } else return; } QList clients = MainWindow::getConnectionWindow()->getAllFrameOnWindow(); _profiles->beginGroup(_current); foreach (ConnectionFrame *client, clients) { QString key = client->getTaskbarTitle(); QPoint value = client->pos(); _profiles->setValue(key, value); } _profiles->endGroup(); listWidget->clear(); listWidget->addItems(_profiles->childGroups()); } void profileDialog::load() { if (listWidget->currentItem()) _current = listWidget->currentItem()->text(); QList clients = MainWindow::getConnectionWindow()->getAllFrameOnWindow(); _profiles->beginGroup(_current); foreach (ConnectionFrame *client, clients) { QString key = client->getTaskbarTitle(); client->move(_profiles->value(key).toPoint()); } _profiles->endGroup(); _profiles->setValue("current", _current); }