mirror of https://github.com/f1xpl/openauto.git
Add cursor visibility toggle
parent
92b2095695
commit
392757bee8
|
@ -45,6 +45,7 @@ public:
|
|||
signals:
|
||||
void exit();
|
||||
void openSettings();
|
||||
void toggleCursor();
|
||||
|
||||
private:
|
||||
Ui::MainWindow* ui_;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <f1x/openauto/autoapp/UI/MainWindow.hpp>
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
|
@ -35,6 +36,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui_->setupUi(this);
|
||||
connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings);
|
||||
connect(ui_->pushButtonExit, &QPushButton::clicked, this, &MainWindow::exit);
|
||||
connect(ui_->pushButtonToggleCursor, &QPushButton::clicked, this, &MainWindow::toggleCursor);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
|
@ -189,6 +189,25 @@ color: rgb(238, 238, 236);</string>
|
|||
<string><html><head/><body><p><span style=" font-style:italic;">AndroidAuto is registered trademark of Google Inc.</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonToggleCursor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>630</x>
|
||||
<y>290</y>
|
||||
<width>161</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Toggle cursor</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
|
@ -203,8 +222,9 @@ color: rgb(238, 238, 236);</string>
|
|||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>pushButtonExit</tabstop>
|
||||
<tabstop>pushButtonToggleCursor</tabstop>
|
||||
<tabstop>pushButtonSettings</tabstop>
|
||||
<tabstop>pushButtonExit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -49,21 +49,26 @@ USBMain::USBMain(libusb_context* context)
|
|||
int USBMain::exec(int argc, char* argv[])
|
||||
{
|
||||
QApplication qApplication(argc, argv);
|
||||
#ifdef RASPBERRYPI3
|
||||
qApplication.setOverrideCursor(Qt::BlankCursor);
|
||||
#endif
|
||||
|
||||
ui::MainWindow mainWindow;
|
||||
mainWindow.setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||
|
||||
ui::SettingsWindow settingsWindow(configuration_);
|
||||
settingsWindow.setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||
|
||||
QObject::connect(&mainWindow, &ui::MainWindow::exit, []() { std::exit(0); });
|
||||
QObject::connect(&mainWindow, &ui::MainWindow::openSettings, &settingsWindow, &ui::SettingsWindow::showFullScreen);
|
||||
|
||||
qApplication.setOverrideCursor(Qt::BlankCursor);
|
||||
bool cursorVisible = false;
|
||||
QObject::connect(&mainWindow, &ui::MainWindow::toggleCursor, [&cursorVisible, &qApplication]() {
|
||||
cursorVisible = !cursorVisible;
|
||||
qApplication.setOverrideCursor(cursorVisible ? Qt::ArrowCursor : Qt::BlankCursor);
|
||||
});
|
||||
|
||||
mainWindow.showFullScreen();
|
||||
|
||||
boost::asio::io_service::work work(ioService_);
|
||||
|
||||
this->startIOServiceWorkers();
|
||||
this->startUSBWorkers();
|
||||
usbApp_->start();
|
||||
|
|
Loading…
Reference in New Issue