initial commit
This commit is contained in:
+269
-34
@@ -4,59 +4,107 @@
|
||||
#include "cmeteostat.h"
|
||||
#include "cmeteodata.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QSettings>
|
||||
#include <QStandardItem>
|
||||
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
cMainWindow::cMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::cMainWindow)
|
||||
cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::cMainWindow),
|
||||
m_lpSplashScreen(lpSplashScreen)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initUI();
|
||||
createActions();
|
||||
|
||||
cMeteoStat meteoStat("Q1H5Feca");
|
||||
cMeteoDataList list = meteoStat.getHistoricalData(QDate(2020, 1, 16), QDate(2020, 1, 16), 11035);
|
||||
QClipboard* clipboard = QGuiApplication::clipboard();
|
||||
QString text = "";
|
||||
m_lpSeriesTemperature = new QLineSeries();
|
||||
m_lpSeriesPressure = new QLineSeries();
|
||||
m_lpSeriesHumidity = new QLineSeries();
|
||||
|
||||
for(int x = 0;x < list.count();x++)
|
||||
{
|
||||
cMeteoData* lpData = list[x];
|
||||
m_lpChart = new QChart();
|
||||
|
||||
text.append(lpData->dateTime().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
m_lpAxisX = new QDateTimeAxis;
|
||||
m_lpAxisX->setTickCount(10);
|
||||
m_lpAxisX->setFormat("dd.MM.yyyy hh:mm");
|
||||
m_lpAxisX->setTitleText("Date");
|
||||
m_lpChart->addAxis(m_lpAxisX, Qt::AlignBottom);
|
||||
|
||||
text.append("\t");
|
||||
text.append(lpData->dateTimeLocal().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
m_lpChart->addSeries(m_lpSeriesTemperature);
|
||||
m_lpAxisYTemperature = new QValueAxis;
|
||||
m_lpAxisYTemperature->setLabelFormat("%i");
|
||||
m_lpAxisYTemperature->setTitleText("Temperature");
|
||||
m_lpChart->addAxis(m_lpAxisYTemperature, Qt::AlignLeft);
|
||||
m_lpSeriesTemperature->attachAxis(m_lpAxisYTemperature);
|
||||
m_lpSeriesTemperature->attachAxis(m_lpAxisX);
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->temperature()));
|
||||
m_lpChart->addSeries(m_lpSeriesPressure);
|
||||
m_lpAxisYPressure = new QValueAxis;
|
||||
m_lpAxisYPressure->setLabelFormat("%i");
|
||||
m_lpAxisYPressure->setTitleText("Pressure");
|
||||
m_lpChart->addAxis(m_lpAxisYPressure, Qt::AlignLeft);
|
||||
m_lpSeriesPressure->attachAxis(m_lpAxisYPressure);
|
||||
m_lpSeriesPressure->attachAxis(m_lpAxisX);
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->dewpoint()));
|
||||
m_lpChart->addSeries(m_lpSeriesHumidity);
|
||||
m_lpAxisYHumidity = new QValueAxis;
|
||||
m_lpAxisYHumidity->setLabelFormat("%i");
|
||||
m_lpAxisYHumidity->setTitleText("Humidity");
|
||||
m_lpChart->addAxis(m_lpAxisYHumidity, Qt::AlignLeft);
|
||||
m_lpSeriesHumidity->attachAxis(m_lpAxisYHumidity);
|
||||
m_lpSeriesHumidity->attachAxis(m_lpAxisX);
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->humidity()));
|
||||
m_lpChart->legend()->show();
|
||||
m_lpChart->setTitle("Weather");
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->windspeed()));
|
||||
ui->m_lpChart->setChart(m_lpChart);
|
||||
ui->m_lpChart->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->peakgust()));
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->winddirection()));
|
||||
// cMeteoStat meteoStat("Q1H5Feca");
|
||||
// cMeteoDataList list = meteoStat.getHistoricalData(QDate(2020, 1, 16), QDate(2020, 1, 16), 11035);
|
||||
// QClipboard* clipboard = QGuiApplication::clipboard();
|
||||
// QString text = "";
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->pressure()));
|
||||
// for(int x = 0;x < list.count();x++)
|
||||
// {
|
||||
// cMeteoData* lpData = list[x];
|
||||
|
||||
text.append("\t");
|
||||
text.append(QString::number(lpData->condition()));
|
||||
// text.append(lpData->dateTime().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
|
||||
text.append("\n");
|
||||
}
|
||||
// text.append("\t");
|
||||
// text.append(lpData->dateTimeLocal().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
|
||||
clipboard->setText(text);
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->temperature()));
|
||||
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->dewpoint()));
|
||||
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->humidity()));
|
||||
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->windspeed()));
|
||||
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->peakgust()));
|
||||
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->winddirection()));
|
||||
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->pressure()));
|
||||
|
||||
// text.append("\t");
|
||||
// text.append(QString::number(lpData->condition()));
|
||||
|
||||
// text.append("\n");
|
||||
// }
|
||||
|
||||
// clipboard->setText(text);
|
||||
}
|
||||
|
||||
cMainWindow::~cMainWindow()
|
||||
@@ -64,3 +112,190 @@ cMainWindow::~cMainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("main/width", QVariant::fromValue(size().width()));
|
||||
settings.setValue("main/height", QVariant::fromValue(size().height()));
|
||||
settings.setValue("main/x", QVariant::fromValue(x()));
|
||||
settings.setValue("main/y", QVariant::fromValue(y()));
|
||||
if(this->isMaximized())
|
||||
settings.setValue("main/maximized", QVariant::fromValue(true));
|
||||
else
|
||||
settings.setValue("main/maximized", QVariant::fromValue(false));
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void cMainWindow::initUI()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
// m_lpFileListModel = new QStandardItemModel;
|
||||
// ui->m_lpFileList->setModel(m_lpFileListModel);
|
||||
|
||||
if(!settings.value("main/maximized").toBool())
|
||||
{
|
||||
qint32 iX = settings.value("main/x", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iY = settings.value("main/y", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iWidth = settings.value("main/width", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iHeight = settings.value("main/height", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
}
|
||||
|
||||
// QStringList headerLabels = QStringList() << tr("icon") << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
|
||||
// m_lpFileListModel->setHorizontalHeaderLabels(headerLabels);
|
||||
|
||||
ui->m_lpDateFrom->setDate(QDate::currentDate().addDays(-1));
|
||||
ui->m_lpDateTo->setDate(QDate::currentDate().addDays(-1));
|
||||
|
||||
m_lpListModel = new QStandardItemModel;
|
||||
ui->m_lpList->setModel(m_lpListModel);
|
||||
|
||||
QStringList headerLabels = QStringList() << tr("Date") << tr("Temperature") << tr("Pressure") << tr("Humidity") << tr("Windspeed") << tr("Winddirection");
|
||||
m_lpListModel->setHorizontalHeaderLabels(headerLabels);
|
||||
}
|
||||
|
||||
void cMainWindow::createActions()
|
||||
{
|
||||
// setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
|
||||
// createFileActions();
|
||||
// createContextActions();
|
||||
|
||||
// connect(ui->m_lpFileList, &cTreeView::deleteEntrys, this, &cMainWindow::onDeleteEntrys);
|
||||
// connect(ui->m_lpThumbnailSize, &QSlider::valueChanged, this, &cMainWindow::onThumbnailSize);
|
||||
|
||||
connect(ui->m_lpGo, &QPushButton::clicked, this, &cMainWindow::onGo);
|
||||
}
|
||||
|
||||
void cMainWindow::createContextActions()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::createFileActions()
|
||||
{
|
||||
// m_lpFileToolBar = addToolBar("file");
|
||||
|
||||
// const QIcon openIcon = QIcon::fromTheme("document-open");
|
||||
// m_lpOpenFileAction = m_lpFileToolBar->addAction(openIcon, tr("&Open..."), this, &cMainWindow::onAddFile);
|
||||
// m_lpOpenFileAction->setShortcut(QKeySequence::Open);
|
||||
|
||||
// const QIcon openDirectoryIcon = QIcon::fromTheme("folder");
|
||||
// m_lpOpenDirectoryAction = m_lpFileToolBar->addAction(openIcon, tr("&Open Folder..."), this, &cMainWindow::onAddFolder);
|
||||
|
||||
|
||||
// m_lpListToolBar = addToolBar("list");
|
||||
|
||||
// const QIcon deleteIcon = QIcon::fromTheme("edit-delete");
|
||||
// m_lpDeleteAction = m_lpListToolBar->addAction(deleteIcon, tr("&Delete"), this, &cMainWindow::onDeleteEntrys);
|
||||
// m_lpDeleteAction->setShortcut(QKeySequence::Delete);
|
||||
|
||||
// const QIcon clearIcon = QIcon::fromTheme("edit-clear");
|
||||
// m_lpClearAction = m_lpListToolBar->addAction(clearIcon, tr("&Clear"), this, &cMainWindow::onClearList);
|
||||
|
||||
|
||||
// m_lpActionToolBar = addToolBar("action");
|
||||
|
||||
// const QIcon convertIcon = QIcon::fromTheme("system-run");
|
||||
// m_lpConvertAction = m_lpActionToolBar->addAction(convertIcon, tr("&Convert"), this, &cMainWindow::onConvert);
|
||||
// m_lpConvertAction->setShortcut(QKeySequence::Delete);
|
||||
|
||||
// const QIcon stopIcon = QIcon::fromTheme("process-stop");
|
||||
// m_lpStopAction = m_lpActionToolBar->addAction(stopIcon, tr("&Stop"), this, &cMainWindow::onStop);
|
||||
}
|
||||
|
||||
void cMainWindow::onGo()
|
||||
{
|
||||
m_lpListModel->clear();
|
||||
|
||||
QStringList headerLabels = QStringList() << tr("Date") << tr("Temperature") << tr("Pressure") << tr("Humidity") << tr("Windspeed") << tr("Winddirection");
|
||||
m_lpListModel->setHorizontalHeaderLabels(headerLabels);
|
||||
|
||||
m_lpSeriesTemperature->clear();
|
||||
m_lpSeriesPressure->clear();
|
||||
m_lpSeriesHumidity->clear();
|
||||
|
||||
cMeteoStat meteoStat("Q1H5Feca");
|
||||
cMeteoDataList list = meteoStat.getHistoricalData(ui->m_lpDateFrom->date(), ui->m_lpDateTo->date(), 11035);
|
||||
|
||||
if(!list.count())
|
||||
return;
|
||||
|
||||
QDateTime minDate = list[0]->dateTime();
|
||||
QDateTime maxDate = list[0]->dateTime();
|
||||
qreal minTemperature = list[0]->temperature();
|
||||
qreal maxTemperature = list[0]->temperature();
|
||||
qreal minPressure = list[0]->pressure();
|
||||
qreal maxPressure = list[0]->pressure();
|
||||
qreal minHumidity = list[0]->humidity();
|
||||
qreal maxHumidity = list[0]->humidity();
|
||||
|
||||
QStandardItem* itemList[6];
|
||||
|
||||
for(int x = 0;x < list.count();x++)
|
||||
{
|
||||
cMeteoData* lpData = list[x];
|
||||
QList<QStandardItem*> itemList;
|
||||
|
||||
itemList << new QStandardItem(lpData->dateTime().toString("yyyy-MM-ss hh:mm"))
|
||||
<< new QStandardItem(QString::number(lpData->temperature()) + " °C")
|
||||
<< new QStandardItem(QString::number(lpData->pressure()) + " hPa")
|
||||
<< new QStandardItem(QString::number(lpData->humidity()) + " %")
|
||||
<< new QStandardItem(QString::number(lpData->windspeed()) + " km/h")
|
||||
<< new QStandardItem(QString::number(lpData->winddirection()) + " °");
|
||||
|
||||
itemList[1]->setTextAlignment(Qt::AlignRight);
|
||||
itemList[2]->setTextAlignment(Qt::AlignRight);
|
||||
itemList[3]->setTextAlignment(Qt::AlignRight);
|
||||
itemList[4]->setTextAlignment(Qt::AlignRight);
|
||||
|
||||
m_lpListModel->appendRow(itemList);
|
||||
|
||||
m_lpSeriesTemperature->append(lpData->dateTime().toMSecsSinceEpoch(), lpData->temperature());
|
||||
m_lpSeriesPressure->append(lpData->dateTime().toMSecsSinceEpoch(), lpData->pressure());
|
||||
m_lpSeriesHumidity->append(lpData->dateTime().toMSecsSinceEpoch(), lpData->humidity());
|
||||
|
||||
if(lpData->dateTime() < minDate)
|
||||
minDate = lpData->dateTime();
|
||||
|
||||
if(lpData->dateTime() > maxDate)
|
||||
maxDate = lpData->dateTime();
|
||||
|
||||
if(lpData->temperature() < minTemperature)
|
||||
minTemperature = lpData->temperature();
|
||||
|
||||
if(lpData->temperature() > maxTemperature)
|
||||
maxTemperature = lpData->temperature();
|
||||
|
||||
if(lpData->pressure() < minPressure)
|
||||
minPressure = lpData->pressure();
|
||||
|
||||
if(lpData->pressure() > maxPressure)
|
||||
maxPressure = lpData->pressure();
|
||||
|
||||
if(lpData->humidity() < minHumidity)
|
||||
minHumidity = lpData->humidity();
|
||||
|
||||
if(lpData->humidity() > maxHumidity)
|
||||
maxHumidity = lpData->humidity();
|
||||
}
|
||||
|
||||
m_lpAxisX->setRange(minDate, maxDate);
|
||||
m_lpAxisYTemperature->setRange(minTemperature, maxTemperature);
|
||||
m_lpAxisYPressure->setRange(minPressure, maxPressure);
|
||||
m_lpAxisYHumidity->setRange(minHumidity, maxHumidity);
|
||||
|
||||
ui->m_lpList->resizeColumnToContents(0);
|
||||
ui->m_lpList->resizeColumnToContents(1);
|
||||
ui->m_lpList->resizeColumnToContents(2);
|
||||
ui->m_lpList->resizeColumnToContents(3);
|
||||
ui->m_lpList->resizeColumnToContents(4);
|
||||
ui->m_lpList->resizeColumnToContents(5);
|
||||
}
|
||||
|
||||
+41
-2
@@ -1,21 +1,60 @@
|
||||
#ifndef CMAINWINDOW_H
|
||||
#define CMAINWINDOW_H
|
||||
|
||||
|
||||
#include "csplashscreen.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <QtCharts/QChartView>
|
||||
#include <QtCharts/QLineSeries>
|
||||
#include <QtCharts/QDateTimeAxis>
|
||||
#include <QtCharts/QValueAxis>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class cMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
QT_CHARTS_USE_NAMESPACE
|
||||
|
||||
|
||||
class cMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cMainWindow(QWidget *parent = nullptr);
|
||||
cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent = nullptr);
|
||||
~cMainWindow();
|
||||
|
||||
private:
|
||||
Ui::cMainWindow *ui;
|
||||
Ui::cMainWindow* ui;
|
||||
cSplashScreen* m_lpSplashScreen;
|
||||
|
||||
QStandardItemModel* m_lpListModel;
|
||||
|
||||
QChart* m_lpChart;
|
||||
QLineSeries* m_lpSeriesTemperature;
|
||||
QLineSeries* m_lpSeriesPressure;
|
||||
QLineSeries* m_lpSeriesHumidity;
|
||||
QDateTimeAxis* m_lpAxisX;
|
||||
QValueAxis* m_lpAxisYTemperature;
|
||||
QValueAxis* m_lpAxisYPressure;
|
||||
QValueAxis* m_lpAxisYHumidity;
|
||||
|
||||
void initUI();
|
||||
void createActions();
|
||||
void createFileActions();
|
||||
void createContextActions();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
private slots:
|
||||
void onGo();
|
||||
};
|
||||
#endif // CMAINWINDOW_H
|
||||
|
||||
+91
-5
@@ -6,17 +6,103 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
<width>1008</width>
|
||||
<height>700</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>cMainWindow</string>
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar"/>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>From:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="m_lpDateFrom"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>To:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="m_lpDateTo"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_lpLocation"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpGo">
|
||||
<property name="text">
|
||||
<string>go</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="m_lpSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QTreeView" name="m_lpList"/>
|
||||
<widget class="QChartView" name="m_lpChart"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1008</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QChartView</class>
|
||||
<extends>QGraphicsView</extends>
|
||||
<header location="global">QtCharts/QChartView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
\file csplashscreen.cpp
|
||||
|
||||
*/
|
||||
|
||||
#include "csplashscreen.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <QStyleOptionProgressBar>
|
||||
|
||||
|
||||
cSplashScreen::cSplashScreen(const QPixmap& pixmap, QFont& font) :
|
||||
QSplashScreen(pixmap),
|
||||
m_iMax(100),
|
||||
m_iProgress(0)
|
||||
{
|
||||
setFont(font);
|
||||
m_textDocument.setDefaultFont(font);
|
||||
}
|
||||
|
||||
void cSplashScreen::setMax(qint32 max)
|
||||
{
|
||||
m_iMax = max;
|
||||
}
|
||||
|
||||
void cSplashScreen::drawContents(QPainter *painter)
|
||||
{
|
||||
painter->translate(m_rect.topLeft());
|
||||
m_textDocument.setHtml(m_szMessage);
|
||||
m_textDocument.drawContents(painter);
|
||||
|
||||
QStyleOptionProgressBar pbstyle;
|
||||
pbstyle.initFrom(this);
|
||||
pbstyle.state = QStyle::State_Enabled;
|
||||
pbstyle.textVisible = false;
|
||||
pbstyle.minimum = 0;
|
||||
pbstyle.maximum = m_iMax;
|
||||
pbstyle.progress = m_iProgress;
|
||||
pbstyle.invertedAppearance = false;
|
||||
pbstyle.rect = QRect(0, 330, 390, 10); // Where is it.
|
||||
|
||||
// Draw it...
|
||||
style()->drawControl(QStyle::CE_ProgressBar, &pbstyle, painter, this);
|
||||
}
|
||||
|
||||
void cSplashScreen::showStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage = message;
|
||||
showMessage(m_szMessage);
|
||||
}
|
||||
|
||||
void cSplashScreen::addStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage.append(message);
|
||||
showMessage(m_szMessage);
|
||||
}
|
||||
|
||||
void cSplashScreen::setMessageRect(QRect rect)
|
||||
{
|
||||
m_rect = rect;
|
||||
m_textDocument.setTextWidth(rect.width());
|
||||
}
|
||||
|
||||
void cSplashScreen::setProgress(int value)
|
||||
{
|
||||
m_iProgress = value;
|
||||
update();
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*!
|
||||
\file csplashscreen.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CSPLASHSCREEN_H
|
||||
#define CSPLASHSCREEN_H
|
||||
|
||||
|
||||
#include <QSplashScreen>
|
||||
#include <QPainter>
|
||||
#include <QTextDocument>
|
||||
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cSplashScreen csplashscreen.h "csplashscreen.h"
|
||||
*/
|
||||
class cSplashScreen : public QSplashScreen
|
||||
{
|
||||
public:
|
||||
cSplashScreen(const QPixmap& pixmap, QFont &font);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn drawContents
|
||||
\param painter
|
||||
*/
|
||||
virtual void drawContents(QPainter *painter);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn showStatusMessage
|
||||
\param message
|
||||
*/
|
||||
void showStatusMessage(const QString &message);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn addStatusMessage
|
||||
\param message
|
||||
*/
|
||||
void addStatusMessage(const QString &message);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setMessageRect
|
||||
\param rect
|
||||
*/
|
||||
void setMessageRect(QRect rect);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setMax
|
||||
\param max
|
||||
*/
|
||||
void setMax(qint32 max);
|
||||
|
||||
private:
|
||||
QTextDocument m_textDocument; /*!< TODO: describe */
|
||||
QString m_szMessage; /*!< TODO: describe */
|
||||
QRect m_rect; /*!< TODO: describe */
|
||||
qint32 m_iMax; /*!< TODO: describe */
|
||||
qint32 m_iProgress; /*!< TODO: describe */
|
||||
public slots:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setProgress
|
||||
\param value
|
||||
*/
|
||||
void setProgress(int value);
|
||||
};
|
||||
|
||||
#endif // CSPLASHSCREEN_H
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -2,10 +2,44 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QSettings>
|
||||
|
||||
#include "csplashscreen.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
cMainWindow w;
|
||||
w.show();
|
||||
|
||||
a.setApplicationVersion(APP_VERSION);
|
||||
a.setApplicationDisplayName("weatherData");
|
||||
a.setOrganizationName("WIN-DESIGN");
|
||||
a.setOrganizationDomain("windesign.at");
|
||||
a.setApplicationName("weatherData");
|
||||
|
||||
QSettings settings;
|
||||
|
||||
QPixmap pixmap(":/images/splash.png");
|
||||
QFont splashFont;
|
||||
cSplashScreen* lpSplash = new cSplashScreen(pixmap, splashFont);
|
||||
|
||||
lpSplash->show();
|
||||
a.processEvents();
|
||||
|
||||
lpSplash->showStatusMessage(QObject::tr("<center>initializing...</denter>"));
|
||||
|
||||
cMainWindow w(lpSplash);
|
||||
|
||||
|
||||
if(settings.value("main/maximized").toBool())
|
||||
w.showMaximized();
|
||||
else
|
||||
w.show();
|
||||
|
||||
lpSplash->finish(&w);
|
||||
delete lpSplash;
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file alias="sun">../../../../../dev/Qt/Examples/Qt-5.14.0/charts/datetimeaxis/sun_spots.txt</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
+37
-2
@@ -1,14 +1,42 @@
|
||||
QT += core gui network sql
|
||||
VERSION = 0.0.1.0
|
||||
QMAKE_TARGET_COMPANY = WIN-DESIGN
|
||||
QMAKE_TARGET_PRODUCT = weatherData
|
||||
QMAKE_TARGET_DESCRIPTION = weatherData
|
||||
QMAKE_TARGET_COPYRIGHT = (c) 2020 WIN-DESIGN
|
||||
|
||||
QT += core gui network sql charts
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
win32-msvc* {
|
||||
contains(QT_ARCH, i386) {
|
||||
message("msvc 32-bit")
|
||||
} else {
|
||||
message("msvc 64-bit")
|
||||
}
|
||||
}
|
||||
|
||||
win32-g++ {
|
||||
message("mingw")
|
||||
# INCLUDEPATH += C:\dev\3rdParty\exiv2\include C:\dev\3rdParty\libraw C:\dev\3rdParty\libjpeg\include C:\dev\3rdParty\opencv\include dng
|
||||
# LIBS += -LC:\dev\3rdParty\exiv2\lib -lexiv2.dll -LC:\dev\3rdParty\libraw\lib -LC:\dev\3rdParty\opencv\x64\mingw\lib -lraw -lws2_32 -lz -lopencv_core412.dll -lopencv_imgproc412.dll
|
||||
}
|
||||
|
||||
unix {
|
||||
message("*nix")
|
||||
# LIBS += -lraw -lexiv2
|
||||
}
|
||||
|
||||
#QMAKE_CXXFLAGS += -DLIBRAW_NODLL -DLIBRAW_NOTHREADS
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
@@ -18,13 +46,17 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
SOURCES += \
|
||||
cmeteodata.cpp \
|
||||
cmeteostat.cpp \
|
||||
common.cpp \
|
||||
csplashscreen.cpp \
|
||||
main.cpp \
|
||||
cmainwindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
cmainwindow.h \
|
||||
cmeteodata.h \
|
||||
cmeteostat.h
|
||||
cmeteostat.h \
|
||||
common.h \
|
||||
csplashscreen.h
|
||||
|
||||
FORMS += \
|
||||
cmainwindow.ui
|
||||
@@ -36,3 +68,6 @@ TRANSLATIONS += \
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
RESOURCES += \
|
||||
weatherdata.qrc
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>images/splash.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Reference in New Issue
Block a user