openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
# include <cstdlib>
# include <QString>
# include <QLabel>
# include <QWidget>
# include <QPushButton>
# include <QVBoxLayout>
# include <QApplication>
# include "qt_window.hpp"
int main ( int argc , char * argv [ ] ) {
QApplication a ( argc , argv ) ;
QWidget * window = new QWidget ( ) ;
setMainWindow ( window ) ;
QVBoxLayout * main_layout = new QVBoxLayout ( ) ;
QString text = " " ;
for ( int i = 1 ; i < argc ; i + + ) {
if ( i > 1 ) {
text . append ( " " ) ;
}
text . append ( argv [ i ] ) ;
}
QLabel * label = new QLabel ( text ) ;
label - > setAlignment ( Qt : : AlignTop ) ;
main_layout - > addWidget ( label ) ;
QPushButton * btn = new QPushButton ( ) ;
# ifdef __aarch64__
btn - > setText ( " Reboot " ) ;
QObject : : connect ( btn , & QPushButton : : released , [ = ] ( ) {
std : : system ( " sudo reboot " ) ;
} ) ;
# else
btn - > setText ( " Exit " ) ;
QObject : : connect ( btn , SIGNAL ( released ( ) ) , & a , SLOT ( quit ( ) ) ) ;
# endif
main_layout - > addWidget ( btn ) ;
window - > setLayout ( main_layout ) ;
window - > setStyleSheet ( R " (
QWidget {
margin : 60 px ;
background - color : black ;
}
QLabel {
color : white ;
font - size : 60 px ;
}
QPushButton {
color : white ;
font - size : 50 px ;
padding : 60 px ;
margin - left : 1500 px ;
border - color : white ;
border - width : 2 px ;
border - style : solid ;
border - radius : 20 px ;
}
) " );
return a . exec ( ) ;
}