summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--src/server/connectionframe/connectionframe.cpp2
-rw-r--r--src/server/connectionframe/connectionframe.h2
-rw-r--r--src/server/mainwindow/mainwindow.cpp51
-rw-r--r--src/server/mainwindow/mainwindow.h2
5 files changed, 31 insertions, 28 deletions
diff --git a/TODO b/TODO
index df8c6ca..22a982f 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
----------------------------------- B U G S -------------------------------------
-[ ] Frame auf 0,0 gemoved will gelöscht werden. sollte nicht sein.
+[x] Frame auf 0,0 gemoved will gelöscht werden. sollte nicht sein.
--------------------------- P V S M G R ----------------------------------------
diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp
index 1bf6fb6..39aba12 100644
--- a/src/server/connectionframe/connectionframe.cpp
+++ b/src/server/connectionframe/connectionframe.cpp
@@ -188,7 +188,7 @@ void ConnectionFrame::mouseReleaseEvent(QMouseEvent* event)
if ((this->pos() - _previousPosition).manhattanLength() > _startDragDistance )
{
qDebug("Moved");
- emit frameMoved(this);
+ emit frameMoved(true, this);
}
else
{
diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h
index faa1390..3f1815b 100644
--- a/src/server/connectionframe/connectionframe.h
+++ b/src/server/connectionframe/connectionframe.h
@@ -78,7 +78,7 @@ protected:
void timerEvent(QTimerEvent* event);
signals:
- void frameMoved(ConnectionFrame* frame);
+ void frameMoved(bool activateTrash, ConnectionFrame* frame);
void doubleClicked(ConnectionFrame* frame);
void clicked(ConnectionFrame* frame);
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
{
diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h
index acecc28..1990fe6 100644
--- a/src/server/mainwindow/mainwindow.h
+++ b/src/server/mainwindow/mainwindow.h
@@ -111,7 +111,7 @@ protected slots:
void DisableButtons();
void EnableButtons();
// connection frame
- void onPlaceFrame(ConnectionFrame* frame);
+ void onPlaceFrame(bool activateTrash, ConnectionFrame* frame);
void onFrameClicked(ConnectionFrame* frame);
// Net
void onClientConnected(Client* client);