From e940459596d149046340f468c611ddeee9a83412 Mon Sep 17 00:00:00 2001 From: PKEv Date: Thu, 19 Mar 2015 22:24:06 +0300 Subject: [PATCH 1/5] Correct for Maximized window --- src/widget/widget.cpp | 30 ++++++++++++++++++++++++++++-- src/widget/widget.h | 4 ++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index f514359c3..3ee428e17 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -84,6 +84,7 @@ Widget::Widget(QWidget *parent) eventFlag(false), eventIcon(false) { + installEventFilter(this); translator = new QTranslator; setTranslation(); } @@ -223,6 +224,23 @@ void Widget::setTranslation() QCoreApplication::installTranslator(translator); } +bool Widget::eventFilter(QObject *obj, QEvent *event) +{ + if(event->type() == QEvent::WindowStateChange && obj != NULL) + { + QWindowStateChangeEvent * ce = static_cast(event); + if (windowState() & Qt::WindowMinimized) + { + if (ce->oldState() & Qt::WindowMaximized) + wasMaximized = true; + else + wasMaximized = false; + } + } + event->accept(); + return false; +} + void Widget::updateIcons() { QString status; @@ -459,16 +477,23 @@ void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason) { show(); activateWindow(); - showNormal(); + if (wasMaximized) + showMaximized(); + else + showNormal(); } else if (isMinimized()) { forceShow(); activateWindow(); - showNormal(); + if (wasMaximized) + showMaximized(); + else + showNormal(); } else { + wasMaximized = isMaximized(); if (Settings::getInstance().getMinimizeToTray()) hide(); else @@ -479,6 +504,7 @@ void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason) break; } case QSystemTrayIcon::MiddleClick: + wasMaximized = isMaximized(); if (Settings::getInstance().getMinimizeToTray()) hide(); else diff --git a/src/widget/widget.h b/src/widget/widget.h index bf73699b1..1705b6732 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -51,6 +51,9 @@ class Widget : public QMainWindow { Q_OBJECT +protected: + bool eventFilter(QObject *obj, QEvent *event); + public: explicit Widget(QWidget *parent = 0); void init(); @@ -176,6 +179,7 @@ private: QRegExp nameMention, sanitizedNameMention; bool eventFlag; bool eventIcon; + bool wasMaximized = false; }; bool toxActivateEventHandler(const QByteArray& data); From 7b13bc88fe833cf6eb3543fa7dbe0d7dee573ddd Mon Sep 17 00:00:00 2001 From: niXman Date: Thu, 19 Mar 2015 22:40:45 +0200 Subject: [PATCH 2/5] Update simple_make.sh in Ubuntu `libqrencode-dev` should be used for `qrencode.h` header. --- simple_make.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_make.sh b/simple_make.sh index c845dc26f..555aae1f8 100755 --- a/simple_make.sh +++ b/simple_make.sh @@ -2,7 +2,7 @@ if which apt-get; then sudo apt-get install build-essential qt5-qmake qt5-default libopenal-dev libopencv-dev \ - libtool autotools-dev automake checkinstall check libopus-dev libvpx-dev qttools5-dev-tools qtchooser libxss-dev libqt5svg5* qrencode + libtool autotools-dev automake checkinstall check libopus-dev libvpx-dev qttools5-dev-tools qtchooser libxss-dev libqt5svg5* libqrencode-dev elif which pacman; then sudo pacman -S --needed base-devel qt5 opencv openal opus libvpx libxss qt5-svg qrencode elif which yum; then From eabff1b8e448161eaca820c62d082416b113b4bf Mon Sep 17 00:00:00 2001 From: PKEv Date: Fri, 20 Mar 2015 00:13:56 +0300 Subject: [PATCH 3/5] Correct hearder file for windows --- src/misc/qrwidget.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/misc/qrwidget.cpp b/src/misc/qrwidget.cpp index 045426858..52069124c 100644 --- a/src/misc/qrwidget.cpp +++ b/src/misc/qrwidget.cpp @@ -4,7 +4,12 @@ #include #include #include -#include + +#ifdef Q_OS_WIN32 + #include +#else + #include +#endif QRWidget::QRWidget(QWidget *parent) : QWidget(parent), data("0") //Note: The encoding fails with empty string so I just default to something else. From 15ff9355df531394b2e2b6edbd98f7b3baf7404c Mon Sep 17 00:00:00 2001 From: Stefan Merettig Date: Thu, 19 Mar 2015 22:42:23 +0100 Subject: [PATCH 4/5] INSTALL.md: Fixed package name of 'libvpx' on ArchLinux --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 14a1964e8..526a4ef97 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -96,7 +96,7 @@ First of all install the dependencies of Tox Core. Arch Linux: ```bash -sudo pacman -S --needed opus vpx +sudo pacman -S --needed opus libvpx ``` Debian / Ubuntu: From b201cb22ee22d5c4063b84af56eb9d4c6b0ba2a4 Mon Sep 17 00:00:00 2001 From: PKEv Date: Fri, 20 Mar 2015 01:11:32 +0300 Subject: [PATCH 5/5] manual how to build in Windows with qrencode --- INSTALL.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 14a1964e8..53d9bec40 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -221,6 +221,11 @@ Download the MinGW installer for Windows from [sourceforge.net](http://sourcefor Make sure to install MSYS (a set of Unix tools for Windows). The following steps assume that MinGW is installed at "C:\MinGW". If you decided to choose another location, replace corresponding parts. +###qrencode +Download the qrencode from http://fukuchi.org/works/qrencode/ or direct from https://code.google.com/p/qrencode-win32/source/checkout , +build project "..\qrencode-win32\vc8\qrcodelib\", you must copy files from release in: "qrcodelib.dll" to \qTox\libs\bin\qrcodelib.dll"; +"qrencode.h" to \qTox\libs\include\qrencode.h"; "qrcodelib.lib" to "\qTox\libs\lib\qrencode.lib" with rename!!! + ###Setting up Path Add MinGW/MSYS/CMake binaries to the system path to make them globally accessible. @@ -232,7 +237,7 @@ The very first semicolon must only be added if it is missing. CMake may be added ###Cloning the Repository -Clone the repository (https://github.com/tux3/qTox.git) with your preferred Git client. [SmartGit](http://www.syntevo.com/smartgit/) is very nice for this task. +Clone the repository (https://github.com/tux3/qTox.git) with your preferred Git client. [SmartGit](http://www.syntevo.com/smartgit/) is very nice for this task (you may need to add the path to the git.exe system variable Path). The following steps assume that you cloned the repository at "C:\qTox". If you decided to choose another location, replace corresponding parts. ### Getting dependencies