summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoanna Hulboj <joanna.hulboj@isode.com>2017-01-11 09:20:07 (GMT)
committerJoanna Hulboj <joanna.hulboj@isode.com>2017-01-11 09:20:57 (GMT)
commita0c339f80e4585341179edef1898defd21a0d36a (patch)
tree9eec5ff9da0c75f1df0965a13829e4cde4fb9d79
parent6e1b4401f1aaf639293a2bc5b0669b6a07cedeb7 (diff)
downloadswift-a0c339f80e4585341179edef1898defd21a0d36a.zip
swift-a0c339f80e4585341179edef1898defd21a0d36a.tar.bz2
Allow cancelling trellis resize window with escape key
Test-Information: From view menu chose "Change Layout". Cancelled the trellis resizer using Escape. Change-Id: I82e196f813cf34db9b50d812ce0597975432869f
-rw-r--r--.gitignore11
-rw-r--r--Swift/QtUI/Trellis/QtGridSelectionDialog.cpp4
2 files changed, 15 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 41a35b5..0f71819 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,30 +45,41 @@ config.log
.scons2ninja.deps
Swiften/Examples/TuneBot/TuneBot
Swift/QtUI/swift-im
Swift/QtUI/swift
Swift/QtUI/COPYING
Swift/QtUI/DefaultTheme.qrc
checker-report.xml
/VERSION.*
cppcheck.log
/build
/generator
/tmp
/.settings/
/include/
/nbproject/private/
3rdParty/LibMiniUPnPc/src/miniupnpc/miniupnpcstrings.h
*.sublime-workspace
/xmppbench
/.metadata
/Swift/Packaging/WiX/*.msi
/Swift/Packaging/WiX/*.wixpdb
/Swift/Packaging/WiX/*.wixobj
/Swift/Packaging/WiX/gen_files.wxs
/Swift/Packaging/WiX/variables.wxs
/Packages
cscope.sh
cscope.out
cscope.files
ctags.sh
compile_commands.json
+
+# Ignore some of the Visual Studio files
+/Debug/
+/Release/
+*.VC.db
+*.VC.VC.opendb
+*.sln
+*.vcxproj
+*.vcxproj.filters
+*.vcxproj.user
+*.sdf
diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
index f03d0ec..f67a4b8 100644
--- a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
+++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
@@ -60,60 +60,64 @@ QSize QtGridSelectionDialog::getMinGridSize() const {
}
void QtGridSelectionDialog::setMaxGridSize(const QSize& size) {
maxGridSize = size;
emit maxGridSizeChanged(size);
}
QSize QtGridSelectionDialog::getMaxGridSize() const {
return maxGridSize;
}
void QtGridSelectionDialog::keyReleaseEvent(QKeyEvent* event) {
if (event) {
QSize newGridSize = currentGridSize;
if (event->key() == Qt::Key_Up) {
newGridSize += QSize(0, -1);
}
else if (event->key() == Qt::Key_Down) {
newGridSize += QSize(0, 1);
}
else if (event->key() == Qt::Key_Left) {
newGridSize += QSize(-1, 0);
}
else if (event->key() == Qt::Key_Right) {
newGridSize += QSize(1, 0);
}
else if (event->key() == Qt::Key_Return) {
hide();
setCurrentGridSize(currentGridSize);
}
+ else if (event->key() == Qt::Key_Escape) {
+ hide();
+ }
+
if (minGridSize.expandedTo(newGridSize).boundedTo(maxGridSize) != currentGridSize) {
currentGridSize = minGridSize.expandedTo(newGridSize).boundedTo(maxGridSize);
QSize newSizeHint = sizeHint();
resize(newSizeHint);
QCursor::setPos(mapToGlobal(QPoint(newSizeHint.width(), newSizeHint.height()) - QPoint(frameSize.width() / 2, frameSize.height() / 2)));
}
}
}
void QtGridSelectionDialog::mousePressEvent(QMouseEvent*) {
hide();
setCurrentGridSize(currentGridSize);
}
void QtGridSelectionDialog::paintEvent(QPaintEvent*) {
QPainter painter(this);
// draw grid
QRect gridCell = QRect(QPoint(0,0), frameSize);
painter.setBrush(palette().highlight());
painter.setPen(Qt::NoPen);
for (int x = 0; x < currentGridSize.width(); x++) {
for (int y = 0; y < currentGridSize.height(); y++) {
int xPos = horizontalMargin + (x * (frameSize.width() + padding));
int yPos = verticalMargin + (y * (frameSize.height() + padding));
gridCell.moveTo(QPoint(xPos, yPos));
painter.drawRect(gridCell);
}
}