Files
MI-38/s1000d/Converter_Source/splashform.cpp
2023-06-14 18:08:32 +03:00

47 lines
1.1 KiB
C++

#include "splashform.h"
#include "ui_splashform.h"
#include <QDesktopWidget>
#include <qdebug.h>
#include <QMessageBox>
SplashForm::SplashForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::SplashForm)
{
ui->setupUi(this);
QDesktopWidget desktop;
QRect rect = desktop.availableGeometry(this);
QPoint center = rect.center();
int x = center.x() - (width()/2);
int y = center.y() - (height()/2);
center.setX(x); center.setY(y);
this->move(center);
this->setWindowFlag(Qt::SplashScreen, true);
this->setWindowFlag(Qt::WindowStaysOnTopHint, true);
}
SplashForm::~SplashForm()
{
delete ui;
}
void SplashForm::Reset() {
ui->progressBar->setValue(100);
ui->lblTitle->setText("Задумались...");
}
void SplashForm::Step() {
if(ui->progressBar->value() >= 100)
ui->progressBar->setValue(0);
else
ui->progressBar->setValue(ui->progressBar->value()+1);
}
void SplashForm::SetTitle(QString title) {
ui->lblTitle->setText(title);
}
void SplashForm::ErrMessage(QString title, QString msg) {
QMessageBox::critical(this,title,msg,QMessageBox::Ok);
}