Draft of Connect dialog

pull/53/head
michal.szwaj 2018-03-21 19:38:20 +01:00
parent 3819f5e752
commit 69d6cf835b
8 changed files with 221 additions and 23 deletions

View File

@ -0,0 +1,33 @@
#pragma once
#include <QDialog>
namespace Ui {
class ConnectDialog;
}
namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace ui
{
class ConnectDialog : public QDialog
{
Q_OBJECT
public:
explicit ConnectDialog(QWidget *parent = nullptr);
~ConnectDialog() override;
private:
Ui::ConnectDialog *ui;
};
}
}
}
}

View File

@ -46,6 +46,7 @@ signals:
void exit();
void openSettings();
void toggleCursor();
void openConnectDialog();
private:
Ui::MainWindow* ui_;

View File

@ -0,0 +1,28 @@
#include <f1x/openauto/autoapp/UI/ConnectDialog.hpp>
#include "ui_connectdialog.h"
namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace ui
{
ConnectDialog::ConnectDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConnectDialog)
{
ui->setupUi(this);
}
ConnectDialog::~ConnectDialog()
{
delete ui;
}
}
}
}
}

View File

@ -37,6 +37,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings);
connect(ui_->pushButtonExit, &QPushButton::clicked, this, &MainWindow::exit);
connect(ui_->pushButtonToggleCursor, &QPushButton::clicked, this, &MainWindow::toggleCursor);
connect(ui_->pushButtonWirelessConnection, &QPushButton::clicked, this, &MainWindow::openConnectDialog);
}
MainWindow::~MainWindow()

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConnectDialog</class>
<widget class="QDialog" name="ConnectDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>301</width>
<height>389</height>
</rect>
</property>
<property name="windowTitle">
<string>Connect to device</string>
</property>
<widget class="QGroupBox" name="groupBoxIPAddress">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>281</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>IP Address</string>
</property>
<widget class="QLineEdit" name="lineEditIPAddress">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>261</width>
<height>25</height>
</rect>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxRecent">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>281</width>
<height>181</height>
</rect>
</property>
<property name="title">
<string>Recent</string>
</property>
<widget class="QListView" name="listViewRecent">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>261</width>
<height>141</height>
</rect>
</property>
</widget>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>60</x>
<y>260</y>
<width>221</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;In order to use wireless mode you must enable head unit server in developer settings.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="labelCopyrightsInfoIcon">
<property name="geometry">
<rect>
<x>20</x>
<y>290</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonCancel">
<property name="geometry">
<rect>
<x>100</x>
<y>340</y>
<width>89</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonConnect">
<property name="geometry">
<rect>
<x>200</x>
<y>340</y>
<width>89</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Connect</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -48,7 +48,7 @@ color: rgb(238, 238, 236);</string>
<property name="geometry">
<rect>
<x>630</x>
<y>340</y>
<y>370</y>
<width>161</width>
<height>41</height>
</rect>
@ -67,7 +67,7 @@ color: rgb(238, 238, 236);</string>
<property name="geometry">
<rect>
<x>630</x>
<y>390</y>
<y>420</y>
<width>161</width>
<height>41</height>
</rect>
@ -79,7 +79,7 @@ color: rgb(238, 238, 236);</string>
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelPluginDeviceText">
<property name="geometry">
<rect>
<x>340</x>
@ -92,11 +92,11 @@ color: rgb(238, 238, 236);</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic; color:#eeeeec;&quot;&gt;Plug in your device to start AndroidAuto (tm).&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="labelProjectHomePage">
<property name="geometry">
<rect>
<x>10</x>
<y>410</y>
<y>440</y>
<width>271</width>
<height>21</height>
</rect>
@ -167,20 +167,20 @@ color: rgb(238, 238, 236);</string>
<property name="geometry">
<rect>
<x>220</x>
<y>376</y>
<y>400</y>
<width>21</width>
<height>21</height>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="labelTrademark">
<property name="geometry">
<rect>
<x>250</x>
<y>370</y>
<y>400</y>
<width>361</width>
<height>31</height>
</rect>
@ -193,7 +193,7 @@ color: rgb(238, 238, 236);</string>
<property name="geometry">
<rect>
<x>630</x>
<y>290</y>
<y>270</y>
<width>161</width>
<height>41</height>
</rect>
@ -208,21 +208,31 @@ color: rgb(238, 238, 236);</string>
<bool>false</bool>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
<widget class="QPushButton" name="pushButtonWirelessConnection">
<property name="geometry">
<rect>
<x>630</x>
<y>320</y>
<width>161</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>Wireless connection</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<tabstops>
<tabstop>pushButtonToggleCursor</tabstop>
<tabstop>pushButtonWirelessConnection</tabstop>
<tabstop>pushButtonSettings</tabstop>
<tabstop>pushButtonExit</tabstop>
</tabstops>

View File

@ -23,7 +23,7 @@
</size>
</property>
<property name="windowTitle">
<string>Form</string>
<string>Settings</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(46, 52, 54);

View File

@ -31,6 +31,7 @@
#include <f1x/openauto/autoapp/Configuration/Configuration.hpp>
#include <f1x/openauto/autoapp/UI/MainWindow.hpp>
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
#include <f1x/openauto/autoapp/UI/ConnectDialog.hpp>
#include <f1x/openauto/Common/Log.hpp>
namespace aasdk = f1x::aasdk;
@ -89,8 +90,12 @@ int main(int argc, char* argv[])
autoapp::ui::SettingsWindow settingsWindow(configuration);
settingsWindow.setWindowFlags(Qt::WindowStaysOnTopHint);
autoapp::ui::ConnectDialog connectDialog;
connectDialog.setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::exit, []() { std::exit(0); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::showFullScreen);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec);
qApplication.setOverrideCursor(Qt::BlankCursor);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCursor, [&qApplication]() {
@ -108,8 +113,8 @@ int main(int argc, char* argv[])
autoapp::projection::AndroidAutoEntityFactory androidAutoEntityFactory(ioService, configuration, serviceFactory);
auto usbHub(std::make_shared<aasdk::usb::USBHub>(usbWrapper, ioService, queryChainFactory));
auto ConnectedAccessoriesEnumerator(std::make_shared<aasdk::usb::ConnectedAccessoriesEnumerator>(usbWrapper, ioService, queryChainFactory));
auto app = std::make_shared<autoapp::App>(ioService, usbWrapper, tcpWrapper, androidAutoEntityFactory, std::move(usbHub), std::move(ConnectedAccessoriesEnumerator));
auto connectedAccessoriesEnumerator(std::make_shared<aasdk::usb::ConnectedAccessoriesEnumerator>(usbWrapper, ioService, queryChainFactory));
auto app = std::make_shared<autoapp::App>(ioService, usbWrapper, tcpWrapper, androidAutoEntityFactory, std::move(usbHub), std::move(connectedAccessoriesEnumerator));
app->waitForUSBDevice();
auto result = qApplication.exec();