From d8b81ac547d623e724e87ed003e96b72b0539336 Mon Sep 17 00:00:00 2001 From: iejMac Date: Mon, 22 Mar 2021 15:59:32 -0700 Subject: [PATCH 1/8] initial_commit --- SConstruct | 5 ++++- selfdrive/ui/qt/offroad/onboarding.cc | 12 +++++++++++- selfdrive/ui/qt/offroad/onboarding.hpp | 1 + selfdrive/ui/qt/offroad/terms.qml | 27 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 selfdrive/ui/qt/offroad/terms.qml diff --git a/SConstruct b/SConstruct index 358d337fef..ce26be8864 100644 --- a/SConstruct +++ b/SConstruct @@ -264,7 +264,7 @@ Export('envCython') # Qt build environment qt_env = env.Clone() -qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia"] +qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick"] if arch != "aarch64": qt_modules += ["DBus", "WebEngine", "WebEngineWidgets"] @@ -307,6 +307,9 @@ qt_flags = [ "-DQT_NO_DEBUG", "-DQT_WIDGETS_LIB", "-DQT_GUI_LIB", + "-DQT_QUICK_LIB", + "-DQT_QUICKWIDGETS_LIB", + "-DQT_QML_LIB", "-DQT_CORE_LIB" ] qt_env['CXXFLAGS'] += qt_flags diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index 1f95eb0db6..ccc1d50f42 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -13,6 +13,9 @@ #include "home.hpp" #include "util.h" +#include +//#include + void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { int leftOffset = (geometry().width()-1620)/2; @@ -53,6 +56,13 @@ void TrainingGuide::paintEvent(QPaintEvent *event) { painter.drawImage(rect.topLeft(), image); } +QWidget* OnboardingWindow::terms_screen2() { + QQuickView *view = new QQuickView; + QWidget* container = QWidget::createWindowContainer(view, 0); + view->setSource(QUrl::fromLocalFile("qt/offroad/terms.qml")); + return container; +} + QWidget* OnboardingWindow::terms_screen() { QVBoxLayout *main_layout = new QVBoxLayout; @@ -142,7 +152,7 @@ OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) { current_terms_version = params.get("TermsVersion", false); current_training_version = params.get("TrainingVersion", false); - addWidget(terms_screen()); + addWidget(terms_screen2()); TrainingGuide* tr = new TrainingGuide(this); connect(tr, &TrainingGuide::completedTraining, [=](){ diff --git a/selfdrive/ui/qt/offroad/onboarding.hpp b/selfdrive/ui/qt/offroad/onboarding.hpp index e307bb63a5..f09e096164 100644 --- a/selfdrive/ui/qt/offroad/onboarding.hpp +++ b/selfdrive/ui/qt/offroad/onboarding.hpp @@ -43,6 +43,7 @@ private: QTextEdit *terms_text; QWidget *terms_screen(); + QWidget *terms_screen2(); QWidget *training_screen(); signals: diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml new file mode 100644 index 0000000000..328e1f060a --- /dev/null +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -0,0 +1,27 @@ +import QtQuick 2.1 + +Rectangle { + id: rectangle + color: "red" + width: 200 + height: 200 + + Text { + id: text + text: "This is QML code.\n(Click to pause)" + font.pointSize: 14 + anchors.centerIn: parent + PropertyAnimation { + id: animation + target: text + property: "rotation" + from: 0; to: 360; duration: 5000 + loops: Animation.Infinite + } + } + MouseArea { + anchors.fill: parent + onClicked: animation.paused ? animation.resume() : animation.pause() + } + Component.onCompleted: animation.start() +} From f76a154e5456efa83badf00584f0305cdb8c9d9e Mon Sep 17 00:00:00 2001 From: iejMac Date: Mon, 22 Mar 2021 17:42:11 -0700 Subject: [PATCH 2/8] rich text + color --- selfdrive/ui/qt/offroad/terms.qml | 94 +++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml index 328e1f060a..c246efb2ba 100644 --- a/selfdrive/ui/qt/offroad/terms.qml +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -1,27 +1,71 @@ -import QtQuick 2.1 - -Rectangle { - id: rectangle - color: "red" - width: 200 - height: 200 - - Text { - id: text - text: "This is QML code.\n(Click to pause)" - font.pointSize: 14 - anchors.centerIn: parent - PropertyAnimation { - id: animation - target: text - property: "rotation" - from: 0; to: 360; duration: 5000 - loops: Animation.Infinite - } - } - MouseArea { - anchors.fill: parent - onClicked: animation.paused ? animation.resume() : animation.pause() +import QtQuick 2.3 + +Item { + id: root + width: 1920 + height: 1080 + + Rectangle { + color: "black" + width: 1920 + height: 1080 } - Component.onCompleted: animation.start() + + Text { + // HTML like markup can also be used + text: ' + + + + openpilot Terms of Service + + + + +

openpilot Terms and Conditions

+

The Terms and Conditions below are effective for all users

+

Last Updated on October 18, 2019

+

Please read these Terms of Use (“Terms”) carefully before using openpilot which is open-sourced software developed by Comma.ai, Inc., a corporation organized under the laws of Delaware (“comma,” “us,” “we,” or “our”).

+

Before using and by accessing openpilot, you indicate that you have read, understood, and agree to these Terms. These Terms apply to all users and others who access or use openpilot. If others use openpilot through your user account or vehicle, you are responsible to ensure that they only use openpilot when it is safe to do so, and in compliance with these Terms and with applicable law. If you disagree with any part of the Terms, you should not access or use openpilot.

+

Communications

+

You agree that comma may contact you by email or telephone in connection with openpilot or for other business purposes. You may opt out of receiving email messages at any time by contacting us at support@comma.ai.

+

We collect, use, and share information from and about you and your vehicle in connection with openpilot. You consent to comma accessing the systems associated with openpilot, without additional notice or consent, for the purposes of providing openpilot, data collection, software updates, safety and cybersecurity, suspension or removal of your account, and as disclosed in the Privacy Policy (available at https://my.comma.ai/privacy).

+

Safety

+

openpilot performs the functions of Adaptive Cruise Control (ACC) and Lane Keeping Assist System (LKAS) designed for use in compatible motor vehicles. While using openpilot, it is your responsibility to obey all laws, traffic rules, and traffic regulations governing your vehicle and its operation. Access to and use of openpilot is at your own risk and responsibility, and openpilot should be accessed and/or used only when you can do so safely.

+

openpilot does not make your vehicle “autonomous” or capable of operation without the active monitoring of a licensed driver. It is designed to assist a licensed driver. A licensed driver must pay attention to the road, remain aware of navigation at all times, and be prepared to take immediate action. Failure to do so can cause damage, injury, or death.

+

Supported Locations and Models

+

openpilot is compatible only with particular makes and models of vehicles. For a complete list of currently supported vehicles, visit https://comma.ai. openpilot will not function properly when installed in an incompatible vehicle. openpilot is compatible only within the geographical boundaries of the United States of America.

+

Indemnification

+

To the maximum extent allowable by law, you agree to defend, indemnify and hold harmless comma, and its employees, partners, suppliers, contractors, investors, agents, officers, directors, and affiliates, from and against any and all claims, damages, causes of action, penalties, interest, demands, obligations, losses, liabilities, costs or debt, additional taxes, and expenses (including but not limited to attorneys’ fees), resulting from or arising out of (i) your use and access of, or inability to use or access, openpilot, (ii) your breach of these Terms, (iii) the inaccuracy of any information, representation or warranty made by you, (iv) activities of anyone other than you in connection with openpilot conducted through your comma device or account, (v) any other of your activities under or in connection with these Terms or openpilot.

+

Limitation of Liability

+

In no event shall comma, nor its directors, employees, partners, agents, suppliers, or affiliates, be liable for any indirect, incidental, special, consequential or punitive damages, including without limitation, loss of profits, data, use, goodwill, or other intangible losses, resulting from (i) your access to or use of or inability to access or use of the Software; or (ii) any conduct or content of any third party on the Software whether based on warranty, contract, tort (including negligence) or any other legal theory, whether or not we have been informed of the possibility of such damage, and even if a remedy set forth herein is found to have failed of its essential purpose.

+

No Warranty or Obligations to Maintain or Service

+

comma provides openpilot without representations, conditions, or warranties of any kind. openpilot is provided on an “AS IS” and “AS AVAILABLE” basis, including with all faults and errors as may occur. To the extent permitted by law and unless prohibited by law, comma on behalf of itself and all persons and parties acting by, through, or for comma, explicitly disclaims all warranties or conditions, express, implied, or collateral, including any implied warranties of merchantability, satisfactory quality, and fitness for a particular purpose in respect of openpilot.

+

To the extent permitted by law, comma does not warrant the operation, performance, or availability of openpilot under all conditions. comma is not responsible for any failures caused by server errors, misdirected or redirected transmissions, failed internet connections, interruptions or failures in the transmission of data, any computer virus, or any acts or omissions of third parties that damage the network or impair wireless service.

+

We undertake reasonable measures to preserve and secure information collected through our openpilot. However, no data collection, transmission or storage system is 100% secure, and there is always a risk that your information may be intercepted without our consent. In using openpilot, you acknowledge that comma is not responsible for intercepted information, and you hereby release us from any and all claims arising out of or related to the use of intercepted information in any unauthorized manner.

+

By providing openpilot, comma does not transfer or license its intellectual property or grant rights in its brand names, nor does comma make representations with respect to third-party intellectual property rights.

+

We are not obligated to provide any maintenance or support for openpilot, technical or otherwise. If we voluntarily provide any maintenance or support for openpilot, we may stop any such maintenance, support, or services at any time in our sole discretion.

+

Modification of Software

+

In no event shall comma, nor its directors, employees, partners, agents, suppliers, or affiliates, be liable if you choose to modify the software.

+

Changes

+

We reserve the right, at our sole discretion, to modify or replace these Terms at any time. If a revision is material we will provide at least 15 days’ notice prior to any new terms taking effect. What constitutes a material change will be determined at our sole discretion.

+

By continuing to access or use our Software after any revisions become effective, you agree to be bound by the revised terms. If you do not agree to the new terms, you are no longer authorized to use the Software.

+

Contact Us

+

If you have any questions about these Terms, please contact us at support@comma.ai.

+ + ' + + // This could also be written font { pointSize: 14 }. Both syntaxes are valid. + font.pointSize: 24 + + // StyledText format supports fewer tags, but is more efficient than RichText + textFormat: Text.RichText + color: "white" + } } + + From bb469e511a8057b92796e5416ff0402febeb7d5f Mon Sep 17 00:00:00 2001 From: iejMac Date: Mon, 22 Mar 2021 18:20:27 -0700 Subject: [PATCH 3/8] nice scrolling --- selfdrive/ui/qt/offroad/terms.qml | 125 ++++++++++++++++-------------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml index c246efb2ba..98623b7104 100644 --- a/selfdrive/ui/qt/offroad/terms.qml +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -1,71 +1,82 @@ import QtQuick 2.3 Item { - id: root - width: 1920 - height: 1080 + id: root + width: 1920 + height: 1080 - Rectangle { - color: "black" - width: 1920 - height: 1080 - } + Rectangle { + color: "black" + width: 1920 + height: 1080 + } + + Flickable { + id: flickArea + anchors.fill: parent + contentHeight: helpText.height + contentWidth: helpText.width + flickableDirection: Flickable.VerticalFlick + clip: true Text { - // HTML like markup can also be used - text: ' + // HTML like markup can also be used + id: helpText + width: 1920 + text: ' - - - openpilot Terms of Service - - + + + openpilot Terms of Service + + - -

openpilot Terms and Conditions

-

The Terms and Conditions below are effective for all users

-

Last Updated on October 18, 2019

-

Please read these Terms of Use (“Terms”) carefully before using openpilot which is open-sourced software developed by Comma.ai, Inc., a corporation organized under the laws of Delaware (“comma,” “us,” “we,” or “our”).

-

Before using and by accessing openpilot, you indicate that you have read, understood, and agree to these Terms. These Terms apply to all users and others who access or use openpilot. If others use openpilot through your user account or vehicle, you are responsible to ensure that they only use openpilot when it is safe to do so, and in compliance with these Terms and with applicable law. If you disagree with any part of the Terms, you should not access or use openpilot.

-

Communications

-

You agree that comma may contact you by email or telephone in connection with openpilot or for other business purposes. You may opt out of receiving email messages at any time by contacting us at support@comma.ai.

-

We collect, use, and share information from and about you and your vehicle in connection with openpilot. You consent to comma accessing the systems associated with openpilot, without additional notice or consent, for the purposes of providing openpilot, data collection, software updates, safety and cybersecurity, suspension or removal of your account, and as disclosed in the Privacy Policy (available at https://my.comma.ai/privacy).

-

Safety

-

openpilot performs the functions of Adaptive Cruise Control (ACC) and Lane Keeping Assist System (LKAS) designed for use in compatible motor vehicles. While using openpilot, it is your responsibility to obey all laws, traffic rules, and traffic regulations governing your vehicle and its operation. Access to and use of openpilot is at your own risk and responsibility, and openpilot should be accessed and/or used only when you can do so safely.

-

openpilot does not make your vehicle “autonomous” or capable of operation without the active monitoring of a licensed driver. It is designed to assist a licensed driver. A licensed driver must pay attention to the road, remain aware of navigation at all times, and be prepared to take immediate action. Failure to do so can cause damage, injury, or death.

-

Supported Locations and Models

-

openpilot is compatible only with particular makes and models of vehicles. For a complete list of currently supported vehicles, visit https://comma.ai. openpilot will not function properly when installed in an incompatible vehicle. openpilot is compatible only within the geographical boundaries of the United States of America.

-

Indemnification

-

To the maximum extent allowable by law, you agree to defend, indemnify and hold harmless comma, and its employees, partners, suppliers, contractors, investors, agents, officers, directors, and affiliates, from and against any and all claims, damages, causes of action, penalties, interest, demands, obligations, losses, liabilities, costs or debt, additional taxes, and expenses (including but not limited to attorneys’ fees), resulting from or arising out of (i) your use and access of, or inability to use or access, openpilot, (ii) your breach of these Terms, (iii) the inaccuracy of any information, representation or warranty made by you, (iv) activities of anyone other than you in connection with openpilot conducted through your comma device or account, (v) any other of your activities under or in connection with these Terms or openpilot.

-

Limitation of Liability

-

In no event shall comma, nor its directors, employees, partners, agents, suppliers, or affiliates, be liable for any indirect, incidental, special, consequential or punitive damages, including without limitation, loss of profits, data, use, goodwill, or other intangible losses, resulting from (i) your access to or use of or inability to access or use of the Software; or (ii) any conduct or content of any third party on the Software whether based on warranty, contract, tort (including negligence) or any other legal theory, whether or not we have been informed of the possibility of such damage, and even if a remedy set forth herein is found to have failed of its essential purpose.

-

No Warranty or Obligations to Maintain or Service

-

comma provides openpilot without representations, conditions, or warranties of any kind. openpilot is provided on an “AS IS” and “AS AVAILABLE” basis, including with all faults and errors as may occur. To the extent permitted by law and unless prohibited by law, comma on behalf of itself and all persons and parties acting by, through, or for comma, explicitly disclaims all warranties or conditions, express, implied, or collateral, including any implied warranties of merchantability, satisfactory quality, and fitness for a particular purpose in respect of openpilot.

-

To the extent permitted by law, comma does not warrant the operation, performance, or availability of openpilot under all conditions. comma is not responsible for any failures caused by server errors, misdirected or redirected transmissions, failed internet connections, interruptions or failures in the transmission of data, any computer virus, or any acts or omissions of third parties that damage the network or impair wireless service.

-

We undertake reasonable measures to preserve and secure information collected through our openpilot. However, no data collection, transmission or storage system is 100% secure, and there is always a risk that your information may be intercepted without our consent. In using openpilot, you acknowledge that comma is not responsible for intercepted information, and you hereby release us from any and all claims arising out of or related to the use of intercepted information in any unauthorized manner.

-

By providing openpilot, comma does not transfer or license its intellectual property or grant rights in its brand names, nor does comma make representations with respect to third-party intellectual property rights.

-

We are not obligated to provide any maintenance or support for openpilot, technical or otherwise. If we voluntarily provide any maintenance or support for openpilot, we may stop any such maintenance, support, or services at any time in our sole discretion.

-

Modification of Software

-

In no event shall comma, nor its directors, employees, partners, agents, suppliers, or affiliates, be liable if you choose to modify the software.

-

Changes

-

We reserve the right, at our sole discretion, to modify or replace these Terms at any time. If a revision is material we will provide at least 15 days’ notice prior to any new terms taking effect. What constitutes a material change will be determined at our sole discretion.

-

By continuing to access or use our Software after any revisions become effective, you agree to be bound by the revised terms. If you do not agree to the new terms, you are no longer authorized to use the Software.

-

Contact Us

-

If you have any questions about these Terms, please contact us at support@comma.ai.

- - ' + +

openpilot Terms and Conditions

+

The Terms and Conditions below are effective for all users

+

Last Updated on October 18, 2019

+

Please read these Terms of Use (“Terms”) carefully before using openpilot which is open-sourced software developed by Comma.ai, Inc., a corporation organized under the laws of Delaware (“comma,” “us,” “we,” or “our”).

+

Before using and by accessing openpilot, you indicate that you have read, understood, and agree to these Terms. These Terms apply to all users and others who access or use openpilot. If others use openpilot through your user account or vehicle, you are responsible to ensure that they only use openpilot when it is safe to do so, and in compliance with these Terms and with applicable law. If you disagree with any part of the Terms, you should not access or use openpilot.

+

Communications

+

You agree that comma may contact you by email or telephone in connection with openpilot or for other business purposes. You may opt out of receiving email messages at any time by contacting us at support@comma.ai.

+

We collect, use, and share information from and about you and your vehicle in connection with openpilot. You consent to comma accessing the systems associated with openpilot, without additional notice or consent, for the purposes of providing openpilot, data collection, software updates, safety and cybersecurity, suspension or removal of your account, and as disclosed in the Privacy Policy (available at https://my.comma.ai/privacy).

+

Safety

+

openpilot performs the functions of Adaptive Cruise Control (ACC) and Lane Keeping Assist System (LKAS) designed for use in compatible motor vehicles. While using openpilot, it is your responsibility to obey all laws, traffic rules, and traffic regulations governing your vehicle and its operation. Access to and use of openpilot is at your own risk and responsibility, and openpilot should be accessed and/or used only when you can do so safely.

+

openpilot does not make your vehicle “autonomous” or capable of operation without the active monitoring of a licensed driver. It is designed to assist a licensed driver. A licensed driver must pay attention to the road, remain aware of navigation at all times, and be prepared to take immediate action. Failure to do so can cause damage, injury, or death.

+

Supported Locations and Models

+

openpilot is compatible only with particular makes and models of vehicles. For a complete list of currently supported vehicles, visit https://comma.ai. openpilot will not function properly when installed in an incompatible vehicle. openpilot is compatible only within the geographical boundaries of the United States of America.

+

Indemnification

+

To the maximum extent allowable by law, you agree to defend, indemnify and hold harmless comma, and its employees, partners, suppliers, contractors, investors, agents, officers, directors, and affiliates, from and against any and all claims, damages, causes of action, penalties, interest, demands, obligations, losses, liabilities, costs or debt, additional taxes, and expenses (including but not limited to attorneys’ fees), resulting from or arising out of (i) your use and access of, or inability to use or access, openpilot, (ii) your breach of these Terms, (iii) the inaccuracy of any information, representation or warranty made by you, (iv) activities of anyone other than you in connection with openpilot conducted through your comma device or account, (v) any other of your activities under or in connection with these Terms or openpilot.

+

Limitation of Liability

+

In no event shall comma, nor its directors, employees, partners, agents, suppliers, or affiliates, be liable for any indirect, incidental, special, consequential or punitive damages, including without limitation, loss of profits, data, use, goodwill, or other intangible losses, resulting from (i) your access to or use of or inability to access or use of the Software; or (ii) any conduct or content of any third party on the Software whether based on warranty, contract, tort (including negligence) or any other legal theory, whether or not we have been informed of the possibility of such damage, and even if a remedy set forth herein is found to have failed of its essential purpose.

+

No Warranty or Obligations to Maintain or Service

+

comma provides openpilot without representations, conditions, or warranties of any kind. openpilot is provided on an “AS IS” and “AS AVAILABLE” basis, including with all faults and errors as may occur. To the extent permitted by law and unless prohibited by law, comma on behalf of itself and all persons and parties acting by, through, or for comma, explicitly disclaims all warranties or conditions, express, implied, or collateral, including any implied warranties of merchantability, satisfactory quality, and fitness for a particular purpose in respect of openpilot.

+

To the extent permitted by law, comma does not warrant the operation, performance, or availability of openpilot under all conditions. comma is not responsible for any failures caused by server errors, misdirected or redirected transmissions, failed internet connections, interruptions or failures in the transmission of data, any computer virus, or any acts or omissions of third parties that damage the network or impair wireless service.

+

We undertake reasonable measures to preserve and secure information collected through our openpilot. However, no data collection, transmission or storage system is 100% secure, and there is always a risk that your information may be intercepted without our consent. In using openpilot, you acknowledge that comma is not responsible for intercepted information, and you hereby release us from any and all claims arising out of or related to the use of intercepted information in any unauthorized manner.

+

By providing openpilot, comma does not transfer or license its intellectual property or grant rights in its brand names, nor does comma make representations with respect to third-party intellectual property rights.

+

We are not obligated to provide any maintenance or support for openpilot, technical or otherwise. If we voluntarily provide any maintenance or support for openpilot, we may stop any such maintenance, support, or services at any time in our sole discretion.

+

Modification of Software

+

In no event shall comma, nor its directors, employees, partners, agents, suppliers, or affiliates, be liable if you choose to modify the software.

+

Changes

+

We reserve the right, at our sole discretion, to modify or replace these Terms at any time. If a revision is material we will provide at least 15 days’ notice prior to any new terms taking effect. What constitutes a material change will be determined at our sole discretion.

+

By continuing to access or use our Software after any revisions become effective, you agree to be bound by the revised terms. If you do not agree to the new terms, you are no longer authorized to use the Software.

+

Contact Us

+

If you have any questions about these Terms, please contact us at support@comma.ai.

+ + ' - // This could also be written font { pointSize: 14 }. Both syntaxes are valid. - font.pointSize: 24 + // This could also be written font { pointSize: 14 }. Both syntaxes are valid. + font.pointSize: 24 - // StyledText format supports fewer tags, but is more efficient than RichText - textFormat: Text.RichText - color: "white" + textFormat: Text.RichText + color: "white" + wrapMode: Text.Wrap } + } } From dc2c3ca2132091b84cfde444e1aab7dd4afbbb76 Mon Sep 17 00:00:00 2001 From: iejMac Date: Mon, 22 Mar 2021 18:35:38 -0700 Subject: [PATCH 4/8] margin --- selfdrive/ui/qt/offroad/terms.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml index 98623b7104..465f4da34a 100644 --- a/selfdrive/ui/qt/offroad/terms.qml +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -1,4 +1,4 @@ -import QtQuick 2.3 +import QtQuick 2.7 Item { id: root @@ -23,6 +23,8 @@ Item { // HTML like markup can also be used id: helpText width: 1920 + padding: 50 + text: ' From 80fc22b505f4405ebcb04e23c88f7784c1bda55d Mon Sep 17 00:00:00 2001 From: iejMac Date: Tue, 23 Mar 2021 14:02:07 -0700 Subject: [PATCH 5/8] print on scroll + some margins --- selfdrive/ui/qt/offroad/onboarding.cc | 62 +++++++++++++++++++++++--- selfdrive/ui/qt/offroad/onboarding.hpp | 2 + selfdrive/ui/qt/offroad/terms.qml | 8 ++-- 3 files changed, 64 insertions(+), 8 deletions(-) diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index ccc1d50f42..7f79a4fab1 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -14,8 +13,7 @@ #include "util.h" #include -//#include - +#include void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { int leftOffset = (geometry().width()-1620)/2; @@ -56,11 +54,65 @@ void TrainingGuide::paintEvent(QPaintEvent *event) { painter.drawImage(rect.topLeft(), image); } +void OnboardingWindow::accept_buttons(){ + /* + if(QQmlProperty::read(flick, "atYEnd").toBool()){ + accept_btn->setText("Accept"); + accept_btn->setEnabled(true); + } + return; + */ + printf("asdf\n"); + return; +} + QWidget* OnboardingWindow::terms_screen2() { + + QVBoxLayout *main_layout = new QVBoxLayout; + main_layout->setContentsMargins(20, 20, 20, 20); + main_layout->setSpacing(20); + + QQuickView *view = new QQuickView; - QWidget* container = QWidget::createWindowContainer(view, 0); + QWidget* text = QWidget::createWindowContainer(view, 0); view->setSource(QUrl::fromLocalFile("qt/offroad/terms.qml")); - return container; + + main_layout->addWidget(text); + + // TODO: add decline page + QHBoxLayout* buttons = new QHBoxLayout; + main_layout->addLayout(buttons); + + buttons->addWidget(new QPushButton("Decline")); + buttons->addSpacing(50); + + QPushButton *accept_btn = new QPushButton("Scroll to accept"); + accept_btn->setEnabled(false); + buttons->addWidget(accept_btn); + QObject::connect(accept_btn, &QPushButton::released, [=]() { + Params().write_db_value("HasAcceptedTerms", current_terms_version); + updateActiveScreen(); + }); + + QObject *obj = (QObject*)view->rootObject(); + //QObject *flick = obj->findChild("flickArea"); + + QObject::connect(obj, SIGNAL(qmlSignal(QVariant)), SLOT(accept_buttons())); + + QWidget *widget = new QWidget; + widget->setLayout(main_layout); + widget->setStyleSheet(R"( + * { + font-size: 50px; + } + QPushButton { + padding: 50px; + border-radius: 10px; + background-color: #292929; + } + )"); + + return widget; } diff --git a/selfdrive/ui/qt/offroad/onboarding.hpp b/selfdrive/ui/qt/offroad/onboarding.hpp index f09e096164..b7aa30ecbf 100644 --- a/selfdrive/ui/qt/offroad/onboarding.hpp +++ b/selfdrive/ui/qt/offroad/onboarding.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "selfdrive/common/params.h" @@ -51,4 +52,5 @@ signals: public slots: void updateActiveScreen(); + void accept_buttons(); }; diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml index 465f4da34a..7bee3d38b7 100644 --- a/selfdrive/ui/qt/offroad/terms.qml +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -3,12 +3,13 @@ import QtQuick 2.7 Item { id: root width: 1920 - height: 1080 + height: 870 + signal qmlSignal(variant msg) Rectangle { color: "black" width: 1920 - height: 1080 + height: 870 } Flickable { @@ -19,11 +20,12 @@ Item { flickableDirection: Flickable.VerticalFlick clip: true + onMovementStarted: root.qmlSignal("Hello") + Text { // HTML like markup can also be used id: helpText width: 1920 - padding: 50 text: ' From 5c268a03a3bdd803187cde932943abe808dd96a5 Mon Sep 17 00:00:00 2001 From: iejMac Date: Tue, 23 Mar 2021 14:03:59 -0700 Subject: [PATCH 6/8] print on scroll + some margins --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index ce26be8864..6a0ce97924 100644 --- a/SConstruct +++ b/SConstruct @@ -264,7 +264,7 @@ Export('envCython') # Qt build environment qt_env = env.Clone() -qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick"] +qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "Multimedia", "Quick", "Qml"] if arch != "aarch64": qt_modules += ["DBus", "WebEngine", "WebEngineWidgets"] From 17fe0ec6aef51ef208c4cd54bc52eac5a00f6825 Mon Sep 17 00:00:00 2001 From: iejMac Date: Tue, 23 Mar 2021 14:33:51 -0700 Subject: [PATCH 7/8] working, needs a lot of improvements --- selfdrive/ui/qt/offroad/onboarding.cc | 16 ++++++---------- selfdrive/ui/qt/offroad/onboarding.hpp | 4 ++++ selfdrive/ui/qt/offroad/terms.qml | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index 7f79a4fab1..cf500710d9 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -55,14 +55,10 @@ void TrainingGuide::paintEvent(QPaintEvent *event) { } void OnboardingWindow::accept_buttons(){ - /* - if(QQmlProperty::read(flick, "atYEnd").toBool()){ - accept_btn->setText("Accept"); - accept_btn->setEnabled(true); - } - return; - */ - printf("asdf\n"); + if(flickable->property("atYEnd").toInt()){ + accept_btn->setText("Accept"); + accept_btn->setEnabled(true); + } return; } @@ -86,7 +82,7 @@ QWidget* OnboardingWindow::terms_screen2() { buttons->addWidget(new QPushButton("Decline")); buttons->addSpacing(50); - QPushButton *accept_btn = new QPushButton("Scroll to accept"); + accept_btn = new QPushButton("Scroll to accept"); accept_btn->setEnabled(false); buttons->addWidget(accept_btn); QObject::connect(accept_btn, &QPushButton::released, [=]() { @@ -95,7 +91,7 @@ QWidget* OnboardingWindow::terms_screen2() { }); QObject *obj = (QObject*)view->rootObject(); - //QObject *flick = obj->findChild("flickArea"); + flickable = obj->findChild("flickArea"); QObject::connect(obj, SIGNAL(qmlSignal(QVariant)), SLOT(accept_buttons())); diff --git a/selfdrive/ui/qt/offroad/onboarding.hpp b/selfdrive/ui/qt/offroad/onboarding.hpp index b7aa30ecbf..7a13f9fe44 100644 --- a/selfdrive/ui/qt/offroad/onboarding.hpp +++ b/selfdrive/ui/qt/offroad/onboarding.hpp @@ -42,6 +42,10 @@ private: std::string current_terms_version; std::string current_training_version; + //TODO: Remove this (access through .widget(index)) + QPushButton *accept_btn; + QObject* flickable; + QTextEdit *terms_text; QWidget *terms_screen(); QWidget *terms_screen2(); diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml index 7bee3d38b7..e72c2ac59d 100644 --- a/selfdrive/ui/qt/offroad/terms.qml +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -14,13 +14,14 @@ Item { Flickable { id: flickArea + objectName: "flickArea" anchors.fill: parent contentHeight: helpText.height contentWidth: helpText.width flickableDirection: Flickable.VerticalFlick clip: true - onMovementStarted: root.qmlSignal("Hello") + onMovementEnded: root.qmlSignal("Hello") Text { // HTML like markup can also be used From 4749a9635f2c75a46aceacc054ed05f9d5ffd1da Mon Sep 17 00:00:00 2001 From: iejMac Date: Tue, 23 Mar 2021 16:35:41 -0700 Subject: [PATCH 8/8] should be done --- selfdrive/ui/qt/offroad/onboarding.cc | 40 ++++++++++++-------------- selfdrive/ui/qt/offroad/onboarding.hpp | 22 ++++++++++---- selfdrive/ui/qt/offroad/terms.qml | 4 +-- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/selfdrive/ui/qt/offroad/onboarding.cc b/selfdrive/ui/qt/offroad/onboarding.cc index cf500710d9..29e773890a 100644 --- a/selfdrive/ui/qt/offroad/onboarding.cc +++ b/selfdrive/ui/qt/offroad/onboarding.cc @@ -38,7 +38,7 @@ void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { } } -TrainingGuide::TrainingGuide(QWidget* parent) { +TrainingGuide::TrainingGuide(QWidget* parent) : QFrame(parent){ image.load("../assets/training/step0.jpg"); } @@ -54,21 +54,12 @@ void TrainingGuide::paintEvent(QPaintEvent *event) { painter.drawImage(rect.topLeft(), image); } -void OnboardingWindow::accept_buttons(){ - if(flickable->property("atYEnd").toInt()){ - accept_btn->setText("Accept"); - accept_btn->setEnabled(true); - } - return; -} - -QWidget* OnboardingWindow::terms_screen2() { +TermsPage::TermsPage(QWidget *parent) : QFrame(parent){ QVBoxLayout *main_layout = new QVBoxLayout; main_layout->setContentsMargins(20, 20, 20, 20); main_layout->setSpacing(20); - QQuickView *view = new QQuickView; QWidget* text = QWidget::createWindowContainer(view, 0); view->setSource(QUrl::fromLocalFile("qt/offroad/terms.qml")); @@ -86,18 +77,14 @@ QWidget* OnboardingWindow::terms_screen2() { accept_btn->setEnabled(false); buttons->addWidget(accept_btn); QObject::connect(accept_btn, &QPushButton::released, [=]() { - Params().write_db_value("HasAcceptedTerms", current_terms_version); - updateActiveScreen(); + emit acceptedTerms(); }); QObject *obj = (QObject*)view->rootObject(); - flickable = obj->findChild("flickArea"); - - QObject::connect(obj, SIGNAL(qmlSignal(QVariant)), SLOT(accept_buttons())); + QObject::connect(obj, SIGNAL(qmlSignal(QVariant)), SLOT(enable_accept())); - QWidget *widget = new QWidget; - widget->setLayout(main_layout); - widget->setStyleSheet(R"( + setLayout(main_layout); + setStyleSheet(R"( * { font-size: 50px; } @@ -107,10 +94,13 @@ QWidget* OnboardingWindow::terms_screen2() { background-color: #292929; } )"); - - return widget; } +void TermsPage::enable_accept(){ + accept_btn->setText("Accept"); + accept_btn->setEnabled(true); + return; +} QWidget* OnboardingWindow::terms_screen() { QVBoxLayout *main_layout = new QVBoxLayout; @@ -200,7 +190,13 @@ OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) { current_terms_version = params.get("TermsVersion", false); current_training_version = params.get("TrainingVersion", false); - addWidget(terms_screen2()); + TermsPage* terms = new TermsPage(this); + addWidget(terms); + + connect(terms, &TermsPage::acceptedTerms, [=](){ + Params().write_db_value("HasAcceptedTerms", current_terms_version); + updateActiveScreen(); + }); TrainingGuide* tr = new TrainingGuide(this); connect(tr, &TrainingGuide::completedTraining, [=](){ diff --git a/selfdrive/ui/qt/offroad/onboarding.hpp b/selfdrive/ui/qt/offroad/onboarding.hpp index 7a13f9fe44..b0720159ca 100644 --- a/selfdrive/ui/qt/offroad/onboarding.hpp +++ b/selfdrive/ui/qt/offroad/onboarding.hpp @@ -31,6 +31,23 @@ signals: void completedTraining(); }; + +class TermsPage : public QFrame { + Q_OBJECT + +public: + explicit TermsPage(QWidget *parent = 0); + +private: + QPushButton *accept_btn; + +public slots: + void enable_accept(); + +signals: + void acceptedTerms(); +}; + class OnboardingWindow : public QStackedWidget { Q_OBJECT @@ -42,10 +59,6 @@ private: std::string current_terms_version; std::string current_training_version; - //TODO: Remove this (access through .widget(index)) - QPushButton *accept_btn; - QObject* flickable; - QTextEdit *terms_text; QWidget *terms_screen(); QWidget *terms_screen2(); @@ -56,5 +69,4 @@ signals: public slots: void updateActiveScreen(); - void accept_buttons(); }; diff --git a/selfdrive/ui/qt/offroad/terms.qml b/selfdrive/ui/qt/offroad/terms.qml index e72c2ac59d..96ba7b1617 100644 --- a/selfdrive/ui/qt/offroad/terms.qml +++ b/selfdrive/ui/qt/offroad/terms.qml @@ -1,4 +1,4 @@ -import QtQuick 2.7 +import QtQuick 2.0 Item { id: root @@ -21,7 +21,7 @@ Item { flickableDirection: Flickable.VerticalFlick clip: true - onMovementEnded: root.qmlSignal("Hello") + onAtYEndChanged: root.qmlSignal("Hello") Text { // HTML like markup can also be used