diff --git a/sdrgui/CMakeLists.txt b/sdrgui/CMakeLists.txt index 5c2c609b1..d825c6a72 100644 --- a/sdrgui/CMakeLists.txt +++ b/sdrgui/CMakeLists.txt @@ -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 diff --git a/sdrgui/gui/sdrangelsplash.cpp b/sdrgui/gui/sdrangelsplash.cpp new file mode 100644 index 000000000..f0fc4f5c4 --- /dev/null +++ b/sdrgui/gui/sdrangelsplash.cpp @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#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; +}; \ No newline at end of file diff --git a/sdrgui/gui/sdrangelsplash.h b/sdrgui/gui/sdrangelsplash.h new file mode 100644 index 000000000..7e6c0eae6 --- /dev/null +++ b/sdrgui/gui/sdrangelsplash.h @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef SDRGUI_SDRANGELSPLASH_H +#define SDRGUI_SDRANGELSPLASH_H + +#include +#include + +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 \ No newline at end of file diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index d161d6b42..5ce6f9844 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -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 #include +#include 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"; }