summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorChristian Klinger2016-05-02 16:51:33 +0200
committerChristian Klinger2016-05-02 16:51:33 +0200
commit87f6719c74ab169f342962ff40b46c83df29af59 (patch)
tree55fb21d5e4beaa3440617b9afc12b79e2f6a2004 /src/server/mainwindow/mainwindow.cpp
parentbetter behaviour when placing a client symbol on top of another. (diff)
downloadpvs2-87f6719c74ab169f342962ff40b46c83df29af59.tar.gz
pvs2-87f6719c74ab169f342962ff40b46c83df29af59.tar.xz
pvs2-87f6719c74ab169f342962ff40b46c83df29af59.zip
fixed "off-by-one" bug.
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 32d5186..c21f2d6 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -209,8 +209,8 @@ void MainWindow::placeFrameInFreeSlot(ConnectionFrame* frame, QPoint preferred)
/* Now place in next free cell, start looking at current position of frame */
vector<QPoint> freePositions;
- for (int x = 0; x < _tilesX - clientSize.width(); x++) {
- for ( int y = 0; y < _tilesY - clientSize.height(); y++) {
+ for (int x = 0; x <= _tilesX - clientSize.width(); x++) {
+ for ( int y = 0; y <= _tilesY - clientSize.height(); y++) {
/* check if (x,y) is free */
bool isFree = true;
for (int dx = 0; dx < clientSize.width(); dx++) {
@@ -222,6 +222,7 @@ void MainWindow::placeFrameInFreeSlot(ConnectionFrame* frame, QPoint preferred)
}
if (isFree) {
QPoint freePos(x,y);
+ qDebug() << "found free: " << freePos;
freePositions.push_back(freePos);
}
}
@@ -617,6 +618,7 @@ void MainWindow::unlockContextButtons() {
ui->action_SetAsTutor->setEnabled(false);
ui->action_StudentToTutorExclusive->setEnabled(false);
ui->action_StudentToTutor->setEnabled(false);
+ ui->action_TutorToStudent->setEnabled(false);
}
@@ -695,14 +697,18 @@ void MainWindow::onPlaceFrame(bool activateTrash, ConnectionFrame* connectionFra
/* round to grid */
int x = p.x() / getTileWidthPx();
int y = p.y() / getTileHeightPx();
- if (x < 0)
+ if (x < 0) {
x = 0;
- else if (x > s.width() - getTileWidthPx())
+ } else if (x > s.width() - getTileWidthPx()) {
+ qDebug() << "oopsie";
x = (_tilesX - 1);
- if (y < 0)
+ }
+ if (y < 0) {
y = 0;
- else if (y > s.height() - getTileHeightPx())
+ } else if (y > s.height() - getTileHeightPx()) {
+ qDebug() << "oopsie2";
y = (_tilesY - 1);
+ }
/* --- */
QPoint newPos(x,y);