2019-06-20 12:02:28 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the 3-clause BSD License
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2017-07-25 07:24:27 +02:00
|
|
|
#include "MainWindow.h"
|
2017-07-26 17:54:25 +02:00
|
|
|
#include "ButtonBar.h"
|
|
|
|
#include "SkinFactory.h"
|
2018-04-05 11:23:38 +02:00
|
|
|
#include "SpeedometerDisplay.h"
|
2017-07-25 07:24:27 +02:00
|
|
|
|
|
|
|
#include <QskGraphic.h>
|
2017-07-25 21:34:27 +02:00
|
|
|
#include <QskGraphicIO.h>
|
2017-07-25 07:24:27 +02:00
|
|
|
#include <QskGraphicLabel.h>
|
|
|
|
#include <QskLinearBox.h>
|
|
|
|
#include <QskTextLabel.h>
|
|
|
|
|
|
|
|
#include <QDate>
|
2017-07-25 11:33:33 +02:00
|
|
|
#include <QImage>
|
2017-07-25 07:24:27 +02:00
|
|
|
|
2020-12-13 19:38:46 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class Header : public ButtonBar
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Header()
|
|
|
|
{
|
|
|
|
addIndicator( "bluetooth" );
|
|
|
|
addIndicator( "location" );
|
|
|
|
addIndicator( "phone" );
|
|
|
|
|
|
|
|
( void ) new QskTextLabel( QDate::currentDate().toString(), this );
|
|
|
|
|
|
|
|
addIndicator( "user" );
|
|
|
|
addIndicator( "bookmark" );
|
|
|
|
addIndicator( "menu" );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class Footer : public ButtonBar
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Footer()
|
|
|
|
{
|
|
|
|
addIndicator( "cloud" );
|
|
|
|
addIndicator( "man" );
|
|
|
|
addIndicator( "bus" );
|
|
|
|
addIndicator( "plane" );
|
|
|
|
addIndicator( "train" );
|
|
|
|
|
|
|
|
addStretch( 10 );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2018-04-10 17:11:42 +02:00
|
|
|
|
|
|
|
MainWindow::MainWindow()
|
2017-07-25 11:33:33 +02:00
|
|
|
{
|
2020-12-13 19:38:46 +01:00
|
|
|
setAutoLayoutChildren( true );
|
|
|
|
|
2018-04-05 11:23:38 +02:00
|
|
|
const QImage image( QStringLiteral( ":/images/background.jpg" ) );
|
2017-07-25 07:24:27 +02:00
|
|
|
|
2017-07-25 10:39:32 +02:00
|
|
|
auto backgroundImage = new QskGraphicLabel( contentItem() );
|
|
|
|
backgroundImage->setGraphic( QskGraphic::fromImage( image ) );
|
|
|
|
backgroundImage->setFillMode( QskGraphicLabel::Stretch );
|
|
|
|
|
2020-12-13 19:38:46 +01:00
|
|
|
auto header = new Header();
|
|
|
|
auto speedoDisplay = new SpeedometerDisplay();
|
|
|
|
auto footer = new Footer();
|
2017-07-25 11:33:33 +02:00
|
|
|
|
2018-04-10 17:11:42 +02:00
|
|
|
auto layout = new QskLinearBox( Qt::Vertical, contentItem() );
|
|
|
|
|
|
|
|
layout->addItem( header );
|
|
|
|
layout->setStretchFactor( header, 1 );
|
2017-07-25 21:34:27 +02:00
|
|
|
|
2020-12-13 19:38:46 +01:00
|
|
|
layout->addItem( speedoDisplay );
|
|
|
|
layout->setStretchFactor( speedoDisplay, 8 );
|
2017-07-25 21:34:27 +02:00
|
|
|
|
2018-04-10 17:11:42 +02:00
|
|
|
layout->addItem( footer );
|
|
|
|
layout->setStretchFactor( footer, 1 );
|
2017-07-25 07:24:27 +02:00
|
|
|
}
|