mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
Added a splash screen on startup
This commit is contained in:
parent
082aa77f06
commit
1873f3f6f0
@ -40,6 +40,7 @@ set(sdrgui_SOURCES
|
||||
gui/samplingdevicecontrol.cpp
|
||||
gui/samplingdevicedialog.cpp
|
||||
gui/scaleengine.cpp
|
||||
gui/sdrangelsplash.cpp
|
||||
gui/tickedslider.cpp
|
||||
gui/transverterbutton.cpp
|
||||
gui/transverterdialog.cpp
|
||||
@ -105,6 +106,7 @@ set(sdrgui_HEADERS
|
||||
gui/samplingdevicecontrol.h
|
||||
gui/samplingdevicedialog.h
|
||||
gui/scaleengine.h
|
||||
gui/sdrangelsplash.h
|
||||
gui/tickedslider.h
|
||||
gui/transverterbutton.h
|
||||
gui/transverterdialog.h
|
||||
|
49
sdrgui/gui/sdrangelsplash.cpp
Normal file
49
sdrgui/gui/sdrangelsplash.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||
// //
|
||||
// Swagger server adapter interface //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "sdrangelsplash.h"
|
||||
|
||||
SDRangelSplash::SDRangelSplash(const QPixmap& pixmap)
|
||||
{
|
||||
QSplashScreen::setPixmap(pixmap);
|
||||
};
|
||||
|
||||
SDRangelSplash::~SDRangelSplash()
|
||||
{
|
||||
};
|
||||
|
||||
void SDRangelSplash::drawContents(QPainter *painter)
|
||||
{
|
||||
QPixmap textPix = QSplashScreen::pixmap();
|
||||
painter->setPen(this->color);
|
||||
painter->drawText(this->rect, this->alignement, this->message);
|
||||
};
|
||||
|
||||
void SDRangelSplash::showStatusMessage(const QString &message, const QColor &color)
|
||||
{
|
||||
this->message = message;
|
||||
this->color = color;
|
||||
this->showMessage(this->message, this->alignement, this->color);
|
||||
};
|
||||
|
||||
void SDRangelSplash::setMessageRect(QRect rect, int alignement)
|
||||
{
|
||||
this->rect = rect;
|
||||
this->alignement = alignement;
|
||||
};
|
41
sdrgui/gui/sdrangelsplash.h
Normal file
41
sdrgui/gui/sdrangelsplash.h
Normal file
@ -0,0 +1,41 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||
// //
|
||||
// Swagger server adapter interface //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRGUI_SDRANGELSPLASH_H
|
||||
#define SDRGUI_SDRANGELSPLASH_H
|
||||
|
||||
#include <QSplashScreen>
|
||||
#include <QPainter>
|
||||
|
||||
class SDRangelSplash : public QSplashScreen
|
||||
{
|
||||
public:
|
||||
SDRangelSplash(const QPixmap& pixmap);
|
||||
~SDRangelSplash();
|
||||
virtual void drawContents(QPainter *painter);
|
||||
void showStatusMessage(const QString &message, const QColor &color = Qt::black);
|
||||
void setMessageRect(QRect rect, int alignment = Qt::AlignLeft);
|
||||
private:
|
||||
QString message;
|
||||
int alignement;
|
||||
QColor color;
|
||||
QRect rect;
|
||||
};
|
||||
|
||||
#endif // SDRGUI_SDRANGELSPLASHSCREEN_H
|
@ -48,6 +48,7 @@
|
||||
#include "gui/audiodialog.h"
|
||||
#include "gui/loggingdialog.h"
|
||||
#include "gui/samplingdevicecontrol.h"
|
||||
#include "gui/sdrangelsplash.h"
|
||||
#include "gui/mypositiondialog.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
@ -73,6 +74,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <QDebug>
|
||||
#include <QSplashScreen>
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(MainWindow::MsgLoadPreset, Message)
|
||||
MESSAGE_CLASS_DEFINITION(MainWindow::MsgSavePreset, Message)
|
||||
@ -102,7 +104,6 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
||||
qDebug() << "MainWindow::MainWindow: start";
|
||||
|
||||
m_instance = this;
|
||||
m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
|
||||
|
||||
QFontDatabase::addApplicationFont(":/LiberationSans-Regular.ttf");
|
||||
QFontDatabase::addApplicationFont(":/LiberationMono-Regular.ttf");
|
||||
@ -111,6 +112,14 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
||||
font.setPointSize(9);
|
||||
qApp->setFont(font);
|
||||
|
||||
QPixmap logoPixmap(":/sdrangel_logo.png");
|
||||
SDRangelSplash *splash = new SDRangelSplash(logoPixmap);
|
||||
splash->setMessageRect(QRect(10, 80, 350, 12));
|
||||
splash->show();
|
||||
splash->showStatusMessage("starting...", Qt::white);
|
||||
|
||||
m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
|
||||
|
||||
ui->setupUi(this);
|
||||
createStatusBar();
|
||||
|
||||
@ -166,33 +175,40 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
||||
|
||||
m_masterTimer.start(50);
|
||||
|
||||
splash->showStatusMessage("load settings...", Qt::white);
|
||||
qDebug() << "MainWindow::MainWindow: load settings...";
|
||||
|
||||
loadSettings();
|
||||
|
||||
splash->showStatusMessage("load plugins...", Qt::white);
|
||||
qDebug() << "MainWindow::MainWindow: load plugins...";
|
||||
|
||||
m_pluginManager = new PluginManager(this);
|
||||
m_pluginManager->loadPlugins(QString("plugins"));
|
||||
|
||||
qDebug() << "MainWindow::MainWindow: select SampleSource from settings or default (file source) ...";
|
||||
splash->showStatusMessage("load file source...", Qt::white);
|
||||
qDebug() << "MainWindow::MainWindow: select SampleSource from settings or default (file source)...";
|
||||
|
||||
int deviceIndex = DeviceEnumerator::instance()->getRxSamplingDeviceIndex(m_settings.getSourceDeviceId(), m_settings.getSourceIndex());
|
||||
addSourceDevice(deviceIndex); // add the first device set with file source device as default if device in settings is not enumerated
|
||||
m_deviceUIs.back()->m_deviceAPI->setBuddyLeader(true); // the first device is always the leader
|
||||
|
||||
splash->showStatusMessage("load current preset settings...", Qt::white);
|
||||
qDebug() << "MainWindow::MainWindow: load current preset settings...";
|
||||
|
||||
loadPresetSettings(m_settings.getWorkingPreset(), 0);
|
||||
|
||||
splash->showStatusMessage("apply settings...", Qt::white);
|
||||
qDebug() << "MainWindow::MainWindow: apply settings...";
|
||||
|
||||
applySettings();
|
||||
|
||||
splash->showStatusMessage("update preset controls...", Qt::white);
|
||||
qDebug() << "MainWindow::MainWindow: update preset controls...";
|
||||
|
||||
updatePresetControls();
|
||||
|
||||
splash->showStatusMessage("finishing...", Qt::white);
|
||||
connect(ui->tabInputsView, SIGNAL(currentChanged(int)), this, SLOT(tabInputViewIndexChanged()));
|
||||
|
||||
QString applicationDirPath = qApp->applicationDirPath();
|
||||
@ -217,6 +233,8 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
||||
|
||||
m_dspEngine->setMIMOSupport(parser.getMIMOSupport());
|
||||
|
||||
delete splash;
|
||||
|
||||
qDebug() << "MainWindow::MainWindow: end";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user