2017-07-25 07:24:27 +02:00
|
|
|
#include "MainWindow.h"
|
2017-07-26 17:54:25 +02:00
|
|
|
#include "ButtonBar.h"
|
2017-07-25 07:24:27 +02:00
|
|
|
#include "SoundControl.h"
|
2017-07-26 17:54:25 +02:00
|
|
|
#include "SkinFactory.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
|
|
|
|
2017-07-25 10:39:32 +02:00
|
|
|
MainWindow::MainWindow()
|
2017-07-25 11:33:33 +02:00
|
|
|
{
|
2017-07-25 10:39:32 +02:00
|
|
|
const QImage image( ":/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 );
|
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
auto header = headerBar();
|
|
|
|
auto content = mainContent();
|
|
|
|
auto footer = footerBar();
|
|
|
|
|
|
|
|
auto layout = new QskLinearBox( Qt::Vertical, contentItem() );
|
2017-07-25 07:24:27 +02:00
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
layout->addItem( header );
|
2017-07-25 21:34:27 +02:00
|
|
|
layout->setStretchFactor( header, 1 );
|
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
layout->addItem( content );
|
2017-07-25 21:34:27 +02:00
|
|
|
layout->setStretchFactor( content, 10 );
|
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
layout->addItem( footer );
|
2017-07-25 21:34:27 +02:00
|
|
|
layout->setStretchFactor( footer, 1 );
|
|
|
|
|
|
|
|
setAutoLayoutChildren( true );
|
2017-07-25 07:24:27 +02:00
|
|
|
}
|
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
QQuickItem* MainWindow::headerBar() const
|
2017-07-25 07:24:27 +02:00
|
|
|
{
|
2017-07-25 11:33:33 +02:00
|
|
|
auto* header = new ButtonBar();
|
2017-07-26 17:54:25 +02:00
|
|
|
header->addIndicator( "bluetooth" );
|
|
|
|
header->addIndicator( "location" );
|
|
|
|
header->addIndicator( "phone" );
|
2017-07-25 11:33:33 +02:00
|
|
|
|
2017-07-26 17:54:25 +02:00
|
|
|
(void) new QskTextLabel( QDate::currentDate().toString(), header );
|
2017-07-25 07:24:27 +02:00
|
|
|
|
2017-07-26 17:54:25 +02:00
|
|
|
header->addIndicator( "user" );
|
|
|
|
header->addIndicator( "bookmark" );
|
|
|
|
header->addIndicator( "menu" );
|
2017-07-25 11:33:33 +02:00
|
|
|
|
|
|
|
return header;
|
2017-07-25 07:24:27 +02:00
|
|
|
}
|
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
QQuickItem* MainWindow::mainContent() const
|
2017-07-25 07:24:27 +02:00
|
|
|
{
|
2017-07-25 11:33:33 +02:00
|
|
|
return new SoundControl();
|
2017-07-25 07:24:27 +02:00
|
|
|
}
|
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
QQuickItem* MainWindow::footerBar() const
|
2017-07-25 07:24:27 +02:00
|
|
|
{
|
2017-07-25 11:33:33 +02:00
|
|
|
auto* footer = new ButtonBar();
|
|
|
|
|
2017-07-26 17:54:25 +02:00
|
|
|
footer->addIndicator( "cloud" );
|
|
|
|
footer->addIndicator( "man" );
|
|
|
|
footer->addIndicator( "bus" );
|
|
|
|
footer->addIndicator( "plane" );
|
|
|
|
footer->addIndicator( "train" );
|
2017-07-25 21:34:27 +02:00
|
|
|
|
2017-07-25 11:33:33 +02:00
|
|
|
footer->addStretch( 10 );
|
|
|
|
|
|
|
|
return footer;
|
2017-07-25 07:24:27 +02:00
|
|
|
}
|