Added hide/show for task bar (Windows only).

This commit is contained in:
NissimHadar 2018-05-24 16:48:03 -07:00
parent 3dbebe2347
commit 77d6ea6bec
6 changed files with 71 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include <shared/FileUtils.h>
#include <shared/QtHelpers.h>
#include <DependencyManager.h>
#include <MainWindow.h>
#include <OffscreenUi.h>
#include <StatTracker.h>
#include <Trace.h>
@ -186,3 +187,7 @@ void TestScriptingInterface::saveObject(QVariant variant, const QString& filenam
file.write(jsonData);
file.close();
}
void TestScriptingInterface::showMaximized() {
qApp->getWindow()->showMaximized();
}

View file

@ -91,6 +91,11 @@ public slots:
*/
void saveObject(QVariant v, const QString& filename);
/**jsdoc
* Maximizes the window
*/
void showMaximized();
private:
bool waitForCondition(qint64 maxWaitMs, std::function<bool()> condition);
QString _testResultsLocation;

View file

@ -204,6 +204,7 @@ void PluginContainer::setFullscreen(const QScreen* target, bool hideMenu) {
#endif
}
#pragma optimize("", off)
void PluginContainer::unsetFullscreen(const QScreen* avoid) {
auto _window = getPrimaryWindow();
_window->showNormal();

View file

@ -10,6 +10,11 @@
//
#include "AutoTester.h"
#ifdef Q_OS_WIN
#include <windows.h>
#include <shellapi.h>
#endif
AutoTester::AutoTester(QWidget *parent) : QMainWindow(parent) {
ui.setupUi(this);
ui.checkBoxInteractiveMode->setChecked(true);
@ -20,6 +25,11 @@ AutoTester::AutoTester(QWidget *parent) : QMainWindow(parent) {
connect(ui.actionClose, &QAction::triggered, this, &AutoTester::on_closeButton_clicked);
connect(ui.actionAbout, &QAction::triggered, this, &AutoTester::about);
#ifndef Q_OS_WIN
ui.hideTaskbarButton->setVisible(false);
ui.showTaskbarButton->setVisible(false);
#endif
test = new Test();
}
@ -56,6 +66,26 @@ void AutoTester::on_createTestsOutlineButton_clicked() {
test->createTestsOutline();
}
void AutoTester::on_showTaskbarButton_clicked() {
#ifdef Q_OS_WIN
APPBARDATA abd = { sizeof abd };
UINT uState = (UINT)SHAppBarMessage(ABM_GETSTATE, &abd);
LPARAM param = uState & ABS_ALWAYSONTOP;
abd.lParam = param;
SHAppBarMessage(ABM_SETSTATE, &abd);
#endif
}
void AutoTester::on_hideTaskbarButton_clicked() {
#ifdef Q_OS_WIN
APPBARDATA abd = { sizeof abd };
UINT uState = (UINT)SHAppBarMessage(ABM_GETSTATE, &abd);
LPARAM param = uState & ABS_ALWAYSONTOP;
abd.lParam = ABS_AUTOHIDE | param;
SHAppBarMessage(ABM_SETSTATE, &abd);
#endif
}
void AutoTester::on_closeButton_clicked() {
exit(0);
}

View file

@ -36,6 +36,10 @@ private slots:
void on_createMDFileButton_clicked();
void on_createAllMDFilesButton_clicked();
void on_createTestsOutlineButton_clicked();
void on_showTaskbarButton_clicked();
void on_hideTaskbarButton_clicked();
void on_closeButton_clicked();
void saveImage(int index);

View file

@ -147,6 +147,32 @@
<string>Create Tests Outline</string>
</property>
</widget>
<widget class="QPushButton" name="showTaskbarButton">
<property name="geometry">
<rect>
<x>490</x>
<y>280</y>
<width>91</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Show Taskbar</string>
</property>
</widget>
<widget class="QPushButton" name="hideTaskbarButton">
<property name="geometry">
<rect>
<x>490</x>
<y>230</y>
<width>91</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Hide Taskbar</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">