summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohann Latocha2010-11-17 20:21:30 +0100
committerJohann Latocha2010-11-17 20:21:30 +0100
commit1db4bdcc019001c6bb8f72eb540d6ad29845623c (patch)
treeb3f6b79dc7066405fa2871f864f8a3805c1042c1
parentÄnderungen, Umbenennungen in der Dokustruktur. (diff)
downloadpvs-1db4bdcc019001c6bb8f72eb540d6ad29845623c.tar.gz
pvs-1db4bdcc019001c6bb8f72eb540d6ad29845623c.tar.xz
pvs-1db4bdcc019001c6bb8f72eb540d6ad29845623c.zip
[PVSMGR] New profile management
-rw-r--r--misc/pvs.conf2
-rw-r--r--src/gui/mainWindow.cpp44
-rw-r--r--src/gui/mainWindow.h5
-rw-r--r--src/gui/profileDialog.cpp186
-rw-r--r--src/gui/profileDialog.h44
-rw-r--r--src/gui/ui/mainwindow.ui40
-rw-r--r--src/gui/ui/mainwindowtouch.ui18
-rw-r--r--src/gui/ui/profileDialog.ui225
8 files changed, 186 insertions, 378 deletions
diff --git a/misc/pvs.conf b/misc/pvs.conf
index 0e71bc8..f3a7adc 100644
--- a/misc/pvs.conf
+++ b/misc/pvs.conf
@@ -2,7 +2,7 @@
script=/usr/local/bin/pvs-vncsrv
[Permissions]
-vnc_lecturer=no
+vnc_lecturer=ro
vnc_other=no
allow_chat=T
allow_filetransfer=T
diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp
index beb80f4..260da89 100644
--- a/src/gui/mainWindow.cpp
+++ b/src/gui/mainWindow.cpp
@@ -168,6 +168,13 @@ MainWindow::MainWindow(QWidget *parent) :
_serverSocket = new QTcpServer();
_serverSocket->listen(QHostAddress::Any, 29481);
connect(_serverSocket, SIGNAL(newConnection()), this, SLOT(incomingFile()));
+ _profileDialog = new profileDialog(this);
+
+#ifdef MAINWINDOW_USE_TOUCHGUI
+ connect(ui->saveProfileButton, SIGNAL(clicked()), _profileDialog, SLOT(save()));
+#else
+ connect(ui->actionSave_Profile, SIGNAL(triggered()), _profileDialog, SLOT(save()));
+#endif
}
MainWindow::~MainWindow()
@@ -242,27 +249,6 @@ QStringList MainWindow::getProfilList() // loads the profile list
return profilList;
}
-#ifdef MAINWINDOW_USE_NORMALGUI
-void MainWindow::addProfileInMenu(QString name)
-{
- QAction* action = new QAction(name,this);
- ui->menuLoad_profile->addAction(action);
- connect(ui->menuLoad_profile, SIGNAL(triggered(QAction*)), this, SLOT(loadProfile(QAction*)));
- _mapProfileToAction.insert(name, action);
-}
-
-void MainWindow::removeProfileInMenu(QString name)
-{
- if (_mapProfileToAction.contains(name))
- {
- QAction* action = _mapProfileToAction.value(name);
- ui->menuLoad_profile->removeAction(action);
- _mapProfileToAction.take(name);
- }
-
-}
-
-#endif
void MainWindow::loadSettings()
{
QSettings settings("openslx", "pvsmgr");
@@ -319,10 +305,6 @@ void MainWindow::loadSettings()
}
MainWindow::getConnectionWindow()->showFrameFromSettings();
-#ifdef MAINWINDOW_USE_NORMALGUI
- foreach (QString profile, getProfilList())
- addProfileInMenu(profile);
-#endif
}
void MainWindow::loadProfile(QAction* actiontriggered)
@@ -407,18 +389,12 @@ void MainWindow::saveSettings(QString profilname)
profil.append(QString("%1").arg(i + 1));
settings.setValue(profil, current->pos());
}
-#ifdef MAINWINDOW_USE_NORMALGUI
- addProfileInMenu(profilname);
-#endif
}
void MainWindow::removeProfil(QString profilname)
{
QSettings settings("openslx", "pvsmgr");
settings.remove(profilname);
-#ifdef MAINWINDOW_USE_NORMALGUI
- removeProfileInMenu(profilname);
-#endif
}
void MainWindow::addConnection(PVSClient* newCon)
@@ -431,6 +407,8 @@ void MainWindow::addConnection(PVSClient* newCon)
sChatDialog.chat_nicklist_update();
}
// sChatDialog->chat_nicklist_update(newCon->getUserName());
+
+ _profileDialog->load();
}
void MainWindow::removeConnection(PVSClient* newCon)
@@ -885,8 +863,8 @@ void MainWindow::foto() // makes a screenshot of the selected client
void MainWindow::createProfile()
{
- profileDialog proDiag;
- proDiag.exec();
+
+ _profileDialog->exec();
}
void MainWindow::showusername()
diff --git a/src/gui/mainWindow.h b/src/gui/mainWindow.h
index 272d057..46b3b9a 100644
--- a/src/gui/mainWindow.h
+++ b/src/gui/mainWindow.h
@@ -60,8 +60,6 @@ public:
QString test;
QStringList profilList;
QStringList getProfilList();
- void addProfileInMenu(QString name);
- void removeProfileInMenu(QString name);
QString currentProfi;
QString getCurrentProfi()
{
@@ -136,7 +134,8 @@ private:
ConnectionDialog* pwDiag;
ConnectionDialog* messageDiag;*/
- AboutDialog *_aboutDialog;
+ AboutDialog *_aboutDialog;
+ profileDialog *_profileDialog;
QString msgDialog;
QString procToStart;
diff --git a/src/gui/profileDialog.cpp b/src/gui/profileDialog.cpp
index 2cbc155..07a97cf 100644
--- a/src/gui/profileDialog.cpp
+++ b/src/gui/profileDialog.cpp
@@ -15,165 +15,79 @@
*/
#include "profileDialog.h"
-#include "ui_profileDialog.h"
-#include <src/gui/mainWindow.h>
-#include <iostream>
-profileDialog::profileDialog(QWidget * parent):
- QDialog(parent),
- uidiag(new Ui::Dialog)
+profileDialog::profileDialog(QWidget * parent) :
+ QDialog(parent)
{
- uidiag->setupUi(this);
- content = new QTableView(uidiag->widget);
- uidiag->gridLayout->addWidget(content);
+ setupUi(this);
- /*Das Modelfestlegen, wo die Clientname angezeigt werden.*/
- model = new QStandardItemModel(0,1,content); //Leere Tabelle mit einer Spalte erstellen
- model->setHeaderData(0, Qt::Horizontal, tr("Profile")); //Spalte name definieren
- content->setModel(model);
-
- QItemSelectionModel *selectionModel = new QItemSelectionModel(model);
- content->setSelectionModel(selectionModel);
- QHeaderView *headerView = content->horizontalHeader();
- headerView->setStretchLastSection(true);
-
- content->setEditTriggers(QAbstractItemView::NoEditTriggers); //Die Einträge in der Tabelle werden nicht editierbar.
- content->setSelectionMode(QAbstractItemView::ExtendedSelection); //Damit mehere Einträge selektierbar werden.
-
- content->resizeColumnToContents(0);
-
-
-
- uidiag->add->setDisabled(true);
- uidiag->edit->setDisabled(true);
- uidiag->edit->setVisible(false);
- uidiag->remove->setDisabled(true);
- uidiag->load->setDisabled(true);
- uidiag->lineEdit->setDisabled(true);
-
- setUpProfile();
-
- connect(uidiag->add, SIGNAL(clicked ()), this, SLOT(AddProfile()));
- connect(uidiag->new_2, SIGNAL(clicked ()), this, SLOT(onNew()));
- connect(uidiag->load, SIGNAL(clicked ()), this, SLOT(onLoad()));
- connect(uidiag->remove, SIGNAL(clicked ()), this, SLOT(removeProfile()));
- connect(uidiag->close, SIGNAL(clicked ()), this, SLOT(accept()));
- connect(content, SIGNAL(clicked(const QModelIndex)), this, SLOT(selectionChange(const QModelIndex)));
- //show();
+ _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()
{
- // TODO Auto-generated destructor stub
}
-void profileDialog::setUpProfile()
+void profileDialog::add()
{
- QStringList list = MainWindow::getWindow()->getProfilList();
- for (int i=0; i<list.size(); i++)
- {
- model->insertRow(0, QModelIndex());
- model->setData(model->index(0, 0, QModelIndex()),list.at(i));
- }
-}
-
-void profileDialog::AddProfile()
-{
- QString name = QString(uidiag->lineEdit->text());
- if (!ProfilList.contains(name))
- {
- if (!name.isEmpty())
- {
- model->insertRow(0, QModelIndex());
- model->setData(model->index(0, 0, QModelIndex()),name);
- ProfilList.append(name);
- MainWindow::getWindow()->saveSettings(name);
- uidiag->lineEdit->setText("");
- }
- else
- {
- QString message = QString(tr("This field can't be empty."));
- QMessageBox::information(this, "PVS", message);
- }
- }
- else
- {
- QString message = QString(tr("This name is already in the list."));
- QMessageBox::information(this, "PVS", message);
- }
+ _current = "";
+ save();
}
-void profileDialog::removeProfile()
+void profileDialog::remove()
{
- QTableView *temp = static_cast<QTableView*>(content);
- QItemSelectionModel *selectionModel = temp->selectionModel();
-
- QModelIndexList indexes = selectionModel->selectedRows();
- QModelIndex index;
-
- foreach(index, indexes)
- {
- int row = content->currentIndex().row();
- QString current = model->index(content->currentIndex().row(), 0).data(Qt::DisplayRole).toString();
- model->removeRow(row, QModelIndex());
- ProfilList.removeOne(current);
- MainWindow::getWindow()->removeProfil(current);
- }
-
-
- /* if (temp->model()->rowCount()<=0)
- {*/
- uidiag->remove->setDisabled(true);
- uidiag->edit->setDisabled(true);
- uidiag->add->setDisabled(true);
- uidiag->load->setDisabled(true);
- //}
-}
-
-void profileDialog::onNew()
-{
- uidiag->add->setDisabled(false);
- uidiag->lineEdit->setDisabled(false);
- uidiag->lineEdit->setFocus();
+ if (listWidget->currentItem())
+ {
+ _profiles->remove(listWidget->currentItem()->text());
+ listWidget->clear();
+ listWidget->addItems(_profiles->childGroups());
+ }
}
-void profileDialog::onLoad()
+void profileDialog::save()
{
- QTableView *temp = static_cast<QTableView*>(content);
- QItemSelectionModel *selectionModel = temp->selectionModel();
-
- QModelIndexList indexes = selectionModel->selectedRows();
- QModelIndex index;
- if (indexes.size()>1)
+ if (_current == "")
{
- QMessageBox::information(this, "PVS", tr("You can only load one profile at time"));
+ QString profile = QInputDialog::getText(this, tr("New Profile"), tr("Save profile as:"));
+ if (!profile.isEmpty())
+ {
+ _current = profile;
+ _profiles->setValue("current", _current);
+ }
+ else
+ return;
}
- else if(indexes.size() == 1)
+ QList<ConnectionFrame*> clients = MainWindow::getConnectionWindow()->getAllFrameOnWindow();
+ _profiles->beginGroup(_current);
+ foreach (ConnectionFrame *client, clients)
{
- foreach(index, indexes)
- {
- //int row = content->currentIndex().row();
- QString current = model->index(content->currentIndex().row(), 0).data(Qt::DisplayRole).toString();
- MainWindow::getWindow()->loadSettings(current);
- }
+ QString key = client->getTaskbarTitle();
+ QPoint value = client->pos();
+ _profiles->setValue(key, value);
}
-
- emit accept();
+ _profiles->endGroup();
+ listWidget->clear();
+ listWidget->addItems(_profiles->childGroups());
}
-void profileDialog::selectionChange(const QModelIndex & index)
+void profileDialog::load()
{
- uidiag->remove->setDisabled(false);
- uidiag->edit->setDisabled(false);
- uidiag->add->setDisabled(false);
- uidiag->load->setDisabled(false);
+ if (listWidget->currentItem())
+ _current = listWidget->currentItem()->text();
+ QList<ConnectionFrame*> 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);
}
-
-void profileDialog::close()
-{
- close();
-}
-
-
diff --git a/src/gui/profileDialog.h b/src/gui/profileDialog.h
index 5caebfa..58a3de6 100644
--- a/src/gui/profileDialog.h
+++ b/src/gui/profileDialog.h
@@ -2,45 +2,27 @@
#define PROFILEDIALOG_H_
#include <QtGui>
-#include <QDialog>
-#include <src/gui/mainWindow.h>
+#include "ui_profileDialog.h"
+#include "mainWindow.h"
-namespace Ui
+class profileDialog: public QDialog, private Ui::ProfileDialogClass
{
-class Dialog;
-}
-
-class MainWindow;
-
-class profileDialog : public QDialog
-{
- Q_OBJECT
+Q_OBJECT
public:
- profileDialog(QWidget * parent = 0);
- virtual ~profileDialog();
-
- void setUpProfile();
-
-
+ profileDialog(QWidget * parent = 0);
+ ~profileDialog();
-signals:
- void selectionChanged (const QItemSelection &selected);
+public Q_SLOTS:
+ void add();
+ void remove();
+ void save();
+ void load();
private:
- Ui::Dialog *uidiag;
- QTableView *content;
- QAbstractItemModel *model;
- QItemSelectionModel *selectionModel;
- QList<QString> ProfilList;
+ QSettings *_profiles;
+ QString _current;
-private Q_SLOTS:
- void AddProfile();
- void removeProfile();
- void onNew();
- void onLoad();
- void selectionChange(const QModelIndex & index);
- void close();
};
#endif /* PROFILEDIALOG_H_ */
diff --git a/src/gui/ui/mainwindow.ui b/src/gui/ui/mainwindow.ui
index a9d5cad..0a6d0a6 100644
--- a/src/gui/ui/mainwindow.ui
+++ b/src/gui/ui/mainwindow.ui
@@ -28,8 +28,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>778</width>
- <height>542</height>
+ <width>792</width>
+ <height>552</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@@ -195,26 +195,9 @@
<x>0</x>
<y>0</y>
<width>838</width>
- <height>23</height>
+ <height>21</height>
</rect>
</property>
- <widget class="QMenu" name="menu_File">
- <property name="title">
- <string>&amp;File</string>
- </property>
- <widget class="QMenu" name="menuLoad_profile">
- <property name="title">
- <string>Load profile </string>
- </property>
- </widget>
- <addaction name="action_Disconnect"/>
- <addaction name="separator"/>
- <addaction name="actionCreate_profile"/>
- <addaction name="separator"/>
- <addaction name="menuLoad_profile"/>
- <addaction name="separator"/>
- <addaction name="action_Exit"/>
- </widget>
<widget class="QMenu" name="menuClients">
<property name="title">
<string>&amp;Clients</string>
@@ -249,6 +232,18 @@
</property>
<addaction name="actionConfigure_Network"/>
</widget>
+ <widget class="QMenu" name="menu_File">
+ <property name="title">
+ <string>&amp;File</string>
+ </property>
+ <addaction name="action_Disconnect"/>
+ <addaction name="separator"/>
+ <addaction name="actionSave_Profile"/>
+ <addaction name="actionCreate_profile"/>
+ <addaction name="separator"/>
+ <addaction name="separator"/>
+ <addaction name="action_Exit"/>
+ </widget>
<addaction name="menu_File"/>
<addaction name="menuClients"/>
<addaction name="menuLogging"/>
@@ -572,6 +567,11 @@
<string>Start process on the selected client(s)</string>
</property>
</action>
+ <action name="actionSave_Profile">
+ <property name="text">
+ <string>Save Profile</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
diff --git a/src/gui/ui/mainwindowtouch.ui b/src/gui/ui/mainwindowtouch.ui
index 12a2f2b..1f329d6 100644
--- a/src/gui/ui/mainwindowtouch.ui
+++ b/src/gui/ui/mainwindowtouch.ui
@@ -28,8 +28,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>1329</width>
- <height>660</height>
+ <width>1431</width>
+ <height>655</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@@ -134,6 +134,18 @@
</widget>
</item>
<item>
+ <widget class="QPushButton" name="saveProfileButton">
+ <property name="font">
+ <font>
+ <pointsize>15</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Save Profile</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="pushButton">
<property name="font">
<font>
@@ -141,7 +153,7 @@
</font>
</property>
<property name="text">
- <string>Profile</string>
+ <string>Manage Profiles</string>
</property>
</widget>
</item>
diff --git a/src/gui/ui/profileDialog.ui b/src/gui/ui/profileDialog.ui
index 3302a56..c102669 100644
--- a/src/gui/ui/profileDialog.ui
+++ b/src/gui/ui/profileDialog.ui
@@ -1,172 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>Dialog</class>
- <widget class="QDialog" name="Dialog">
+ <class>ProfileDialogClass</class>
+ <widget class="QDialog" name="ProfileDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>332</width>
- <height>485</height>
+ <width>350</width>
+ <height>206</height>
</rect>
</property>
<property name="windowTitle">
- <string>ProfileDialog</string>
+ <string>Dialog</string>
</property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QListWidget" name="listWidget"/>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="addButton">
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="removeButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ </item>
<item>
- <widget class="QSplitter" name="splitter">
+ <spacer name="verticalSpacer_2">
<property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="loadButton">
+ <property name="text">
+ <string>&amp;Load</string>
</property>
- <widget class="QWidget" name="widget" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="styleSheet">
- <string>background-color: rgb(255, 255, 255);</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout"/>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="layoutWidget_2">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QPushButton" name="remove">
- <property name="text">
- <string>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_6">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>18</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="edit">
- <property name="text">
- <string>&amp;Edit</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_5">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>18</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="new_2">
- <property name="text">
- <string>&amp;New</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="load">
- <property name="text">
- <string>&amp;Load</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>218</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLineEdit" name="lineEdit"/>
- </item>
- <item>
- <widget class="QPushButton" name="add">
- <property name="text">
- <string>Add</string>
- </property>
- </widget>
- </item>
- </layout>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
</item>
<item>
- <widget class="QPushButton" name="close">
+ <widget class="QPushButton" name="closeButton">
<property name="text">
- <string>Close</string>
+ <string>&amp;Close</string>
</property>
</widget>
</item>
@@ -175,5 +81,22 @@
</layout>
</widget>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ProfileDialogClass</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>291</x>
+ <y>185</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>324</x>
+ <y>133</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>