summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorBjörn Hagemeister2014-07-29 15:31:56 +0200
committerBjörn Hagemeister2014-07-29 15:31:56 +0200
commit254c7fb41a96f42ef4049d5a495e47fad2e3e983 (patch)
treefb5540996acdb0d8a91cc4a7d9447f7dd2cb8015 /src/server/mainwindow/mainwindow.cpp
parentRead the configfile and place the frames according to the coordinates (diff)
downloadpvs2-254c7fb41a96f42ef4049d5a495e47fad2e3e983.tar.gz
pvs2-254c7fb41a96f42ef4049d5a495e47fad2e3e983.tar.xz
pvs2-254c7fb41a96f42ef4049d5a495e47fad2e3e983.zip
Fixed bug, that frame moved on (0,0) is asked to be deleted.
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 55e4bce..82981b1 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -209,8 +209,8 @@ ConnectionFrame* MainWindow::createFrame()
ConnectionFrame *cf = new ConnectionFrame(ui->frmRoom, _tileWidth, _tileHeight);
_clientFrames.append(cf);
cf->show();
- connect(cf, SIGNAL(frameMoved(ConnectionFrame *)), this, SLOT(onPlaceFrame(ConnectionFrame *)));
- connect(cf, SIGNAL(clicked(ConnectionFrame *)), this, SLOT(onFrameClicked(ConnectionFrame *)));
+ connect(cf, SIGNAL(frameMoved(bool, ConnectionFrame *)), this, SLOT(onPlaceFrame(bool, ConnectionFrame *)));
+ connect(cf, SIGNAL(clicked(bool, ConnectionFrame *)), this, SLOT(onFrameClicked(ConnectionFrame *)));
return cf;
}
@@ -228,7 +228,7 @@ ConnectionFrame* MainWindow::createFrame(QString computerId, QPoint position)
cf->setCurrentPosition(position);
_clientFrames.append(cf);
cf->show();
- connect(cf, SIGNAL(frameMoved(ConnectionFrame *)), this, SLOT(onPlaceFrame(ConnectionFrame *)));
+ connect(cf, SIGNAL(frameMoved(bool, ConnectionFrame *)), this, SLOT(onPlaceFrame(bool, ConnectionFrame *)));
connect(cf, SIGNAL(clicked(ConnectionFrame *)), this, SLOT(onFrameClicked(ConnectionFrame *)));
return cf;
}
@@ -346,7 +346,7 @@ void MainWindow::tryToUseRoomTemplate()
ConnectionFrame *cf = createFrame(conf.value("ip").toString(), coord);
cf->move(cf->getCurrentPosition());
- onPlaceFrame(cf);
+ onPlaceFrame(false, cf);
}
conf.endArray();
}
@@ -525,7 +525,7 @@ void MainWindow::onTutorListDownloaded(QByteArray& tutorList)
* Place Frame to from user specified position.
* @param frame
*/
-void MainWindow::onPlaceFrame(ConnectionFrame* frame)
+void MainWindow::onPlaceFrame(bool activateTrash, ConnectionFrame* frame)
{
if (_tilesX <= 0 || _tilesY <= 0)
return;
@@ -542,31 +542,34 @@ void MainWindow::onPlaceFrame(ConnectionFrame* frame)
else if (y > s.height() - _tileHeight)
y = (_tilesY - 1) * _tileHeight;
- const QRect &trashCenter = ui->trash->geometry();
- // Check if x coordinate is in trash position.
- if (trashCenter.contains(p))
+ // Check if x coordinate is in trash position. Check only if activateTrash = true!
+ if (activateTrash)
{
- // Do not offer deleting online client.
- if (frame->client() != NULL)
- {
- QMessageBox::critical(this, tr("Selection"), sStrClientOnline);
- frame->move(frame->getPreviousPosition());
- return;
- }
- else
+ const QRect &trashCenter = ui->trash->geometry();
+ if (trashCenter.contains(p))
{
- int ret = QMessageBox::question(this, "Warning", "Sure, You want to delete selected client?", 0, 1, 2);
- if (ret == 1)
+ // Do not offer deleting online client.
+ if (frame->client() != NULL)
{
- frame->hide();
- frame->deleteLater();
- _clientFrames.removeOne(frame);
+ QMessageBox::critical(this, tr("Selection"), sStrClientOnline);
+ frame->move(frame->getPreviousPosition());
return;
}
else
{
- frame->move(frame->getPreviousPosition());
- return;
+ int ret = QMessageBox::question(this, "Warning", "Sure, You want to delete selected client?", 0, 1, 2);
+ if (ret == 1)
+ {
+ frame->hide();
+ frame->deleteLater();
+ _clientFrames.removeOne(frame);
+ return;
+ }
+ else
+ {
+ frame->move(frame->getPreviousPosition());
+ return;
+ }
}
}
}
@@ -1027,7 +1030,7 @@ void MainWindow::onClientAuthenticated(Client* client)
y = 0;
qDebug("Move E");
cf->move(x * _tileWidth, y * _tileHeight);
- onPlaceFrame(cf);
+ onPlaceFrame(true, cf);
}
else
{