mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:10:05 +00:00
Initial setup wizard contents
This commit is contained in:
parent
388abb05bf
commit
411d2a3832
8 changed files with 102 additions and 0 deletions
BIN
scwx-qt/res/icons/scwx-64.png
Normal file
BIN
scwx-qt/res/icons/scwx-64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
|
|
@ -18,6 +18,7 @@
|
||||||
<file>res/fonts/din1451alt.ttf</file>
|
<file>res/fonts/din1451alt.ttf</file>
|
||||||
<file>res/fonts/din1451alt_g.ttf</file>
|
<file>res/fonts/din1451alt_g.ttf</file>
|
||||||
<file>res/fonts/Inconsolata-Regular.ttf</file>
|
<file>res/fonts/Inconsolata-Regular.ttf</file>
|
||||||
|
<file>res/icons/scwx-64.png</file>
|
||||||
<file>res/icons/scwx-256.ico</file>
|
<file>res/icons/scwx-256.ico</file>
|
||||||
<file>res/icons/scwx-256.png</file>
|
<file>res/icons/scwx-256.png</file>
|
||||||
<file>res/icons/font-awesome-6/angle-down-solid.svg</file>
|
<file>res/icons/font-awesome-6/angle-down-solid.svg</file>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include <scwx/qt/manager/radar_product_manager.hpp>
|
#include <scwx/qt/manager/radar_product_manager.hpp>
|
||||||
#include <scwx/qt/manager/resource_manager.hpp>
|
#include <scwx/qt/manager/resource_manager.hpp>
|
||||||
#include <scwx/qt/manager/settings_manager.hpp>
|
#include <scwx/qt/manager/settings_manager.hpp>
|
||||||
|
#include <scwx/qt/ui/setup/setup_wizard.hpp>
|
||||||
#include <scwx/network/cpr.hpp>
|
#include <scwx/network/cpr.hpp>
|
||||||
#include <scwx/util/logger.hpp>
|
#include <scwx/util/logger.hpp>
|
||||||
#include <scwx/util/threads.hpp>
|
#include <scwx/util/threads.hpp>
|
||||||
|
|
@ -70,6 +71,16 @@ int main(int argc, char* argv[])
|
||||||
// Initialize application
|
// Initialize application
|
||||||
scwx::qt::config::RadarSite::Initialize();
|
scwx::qt::config::RadarSite::Initialize();
|
||||||
scwx::qt::manager::SettingsManager::Instance().Initialize();
|
scwx::qt::manager::SettingsManager::Instance().Initialize();
|
||||||
|
|
||||||
|
// Run initial setup if required
|
||||||
|
if (scwx::qt::ui::setup::SetupWizard::IsSetupRequired())
|
||||||
|
{
|
||||||
|
scwx::qt::ui::setup::SetupWizard w;
|
||||||
|
w.show();
|
||||||
|
a.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run further application initialization
|
||||||
scwx::qt::manager::ResourceManager::Initialize();
|
scwx::qt::manager::ResourceManager::Initialize();
|
||||||
|
|
||||||
// Run Qt main loop
|
// Run Qt main loop
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
#include <scwx/qt/ui/setup/finish_page.hpp>
|
#include <scwx/qt/ui/setup/finish_page.hpp>
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
|
|
@ -14,11 +17,27 @@ class FinishPage::Impl
|
||||||
public:
|
public:
|
||||||
explicit Impl() = default;
|
explicit Impl() = default;
|
||||||
~Impl() = default;
|
~Impl() = default;
|
||||||
|
|
||||||
|
QVBoxLayout* layout_ {nullptr};
|
||||||
|
QLabel* finishLabel_ {nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
FinishPage::FinishPage(QWidget* parent) :
|
FinishPage::FinishPage(QWidget* parent) :
|
||||||
QWizardPage(parent), p {std::make_shared<Impl>()}
|
QWizardPage(parent), p {std::make_shared<Impl>()}
|
||||||
{
|
{
|
||||||
|
setTitle(tr("Setup Complete"));
|
||||||
|
setSubTitle(tr("Supercell Wx setup is complete!"));
|
||||||
|
|
||||||
|
p->finishLabel_ =
|
||||||
|
new QLabel(tr("Supercell Wx setup is now complete and ready for use. "
|
||||||
|
"Additional settings may be configured after startup. For "
|
||||||
|
"further information, please see the User Manual from the "
|
||||||
|
"Help menu, or join the Discord server for help."));
|
||||||
|
p->finishLabel_->setWordWrap(true);
|
||||||
|
|
||||||
|
p->layout_ = new QVBoxLayout(this);
|
||||||
|
p->layout_->addWidget(p->finishLabel_);
|
||||||
|
setLayout(p->layout_);
|
||||||
}
|
}
|
||||||
|
|
||||||
FinishPage::~FinishPage() = default;
|
FinishPage::~FinishPage() = default;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ public:
|
||||||
MapPage::MapPage(QWidget* parent) :
|
MapPage::MapPage(QWidget* parent) :
|
||||||
QWizardPage(parent), p {std::make_shared<Impl>()}
|
QWizardPage(parent), p {std::make_shared<Impl>()}
|
||||||
{
|
{
|
||||||
|
setTitle(tr("Map Configuration"));
|
||||||
|
setSubTitle(tr("Configure the Supercell Wx map provider and basic layout."));
|
||||||
}
|
}
|
||||||
|
|
||||||
MapPage::~MapPage() = default;
|
MapPage::~MapPage() = default;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,11 @@
|
||||||
#include <scwx/qt/ui/setup/setup_wizard.hpp>
|
#include <scwx/qt/ui/setup/setup_wizard.hpp>
|
||||||
|
#include <scwx/qt/ui/setup/finish_page.hpp>
|
||||||
|
#include <scwx/qt/ui/setup/map_page.hpp>
|
||||||
|
#include <scwx/qt/ui/setup/welcome_page.hpp>
|
||||||
|
#include <scwx/qt/settings/general_settings.hpp>
|
||||||
|
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
|
|
@ -19,10 +26,45 @@ public:
|
||||||
SetupWizard::SetupWizard(QWidget* parent) :
|
SetupWizard::SetupWizard(QWidget* parent) :
|
||||||
QWizard(parent), p {std::make_shared<Impl>()}
|
QWizard(parent), p {std::make_shared<Impl>()}
|
||||||
{
|
{
|
||||||
|
setWindowTitle(tr("Supercell Wx Setup"));
|
||||||
|
setPixmap(QWizard::LogoPixmap, QPixmap(":/res/icons/scwx-64.png"));
|
||||||
|
|
||||||
|
setOption(QWizard::WizardOption::IndependentPages);
|
||||||
|
setOption(QWizard::WizardOption::NoBackButtonOnStartPage);
|
||||||
|
setOption(QWizard::WizardOption::NoCancelButton);
|
||||||
|
setOption(QWizard::WizardOption::HaveHelpButton);
|
||||||
|
|
||||||
|
setPage(static_cast<int>(Page::Welcome), new WelcomePage(this));
|
||||||
|
setPage(static_cast<int>(Page::Map), new MapPage(this));
|
||||||
|
setPage(static_cast<int>(Page::Finish), new FinishPage(this));
|
||||||
|
|
||||||
|
#if !defined(Q_OS_MAC)
|
||||||
|
setWizardStyle(QWizard::WizardStyle::ModernStyle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
connect(this,
|
||||||
|
&QWizard::helpRequested,
|
||||||
|
this,
|
||||||
|
[]() {
|
||||||
|
QDesktopServices::openUrl(
|
||||||
|
QUrl {"https://supercell-wx.readthedocs.io/"});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupWizard::~SetupWizard() = default;
|
SetupWizard::~SetupWizard() = default;
|
||||||
|
|
||||||
|
bool SetupWizard::IsSetupRequired()
|
||||||
|
{
|
||||||
|
auto& generalSettings = settings::GeneralSettings::Instance();
|
||||||
|
|
||||||
|
std::string mapboxApiKey = generalSettings.mapbox_api_key().GetValue();
|
||||||
|
std::string maptilerApiKey = generalSettings.maptiler_api_key().GetValue();
|
||||||
|
|
||||||
|
// Setup is required if either API key is empty, or contains a single
|
||||||
|
// character ("?")
|
||||||
|
return (mapboxApiKey.size() <= 1 && maptilerApiKey.size() <= 1);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace setup
|
} // namespace setup
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,18 @@ namespace setup
|
||||||
class SetupWizard : public QWizard
|
class SetupWizard : public QWizard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum class Page : int
|
||||||
|
{
|
||||||
|
Welcome = 0,
|
||||||
|
Map,
|
||||||
|
Finish
|
||||||
|
};
|
||||||
|
|
||||||
explicit SetupWizard(QWidget* parent = nullptr);
|
explicit SetupWizard(QWidget* parent = nullptr);
|
||||||
~SetupWizard();
|
~SetupWizard();
|
||||||
|
|
||||||
|
static bool IsSetupRequired();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
std::shared_ptr<Impl> p;
|
std::shared_ptr<Impl> p;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
#include <scwx/qt/ui/setup/welcome_page.hpp>
|
#include <scwx/qt/ui/setup/welcome_page.hpp>
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
|
|
@ -14,11 +17,26 @@ class WelcomePage::Impl
|
||||||
public:
|
public:
|
||||||
explicit Impl() = default;
|
explicit Impl() = default;
|
||||||
~Impl() = default;
|
~Impl() = default;
|
||||||
|
|
||||||
|
QVBoxLayout* layout_ {nullptr};
|
||||||
|
QLabel* welcomeLabel_ {nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
WelcomePage::WelcomePage(QWidget* parent) :
|
WelcomePage::WelcomePage(QWidget* parent) :
|
||||||
QWizardPage(parent), p {std::make_shared<Impl>()}
|
QWizardPage(parent), p {std::make_shared<Impl>()}
|
||||||
{
|
{
|
||||||
|
setTitle(tr("Introduction"));
|
||||||
|
setSubTitle(tr("Welcome to Supercell Wx!"));
|
||||||
|
|
||||||
|
p->welcomeLabel_ =
|
||||||
|
new QLabel(tr("Welcome to Supercell Wx. This wizard will guide you "
|
||||||
|
"through configuring Supercell Wx for initial use, as well "
|
||||||
|
"as introduce you to any new features."));
|
||||||
|
p->welcomeLabel_->setWordWrap(true);
|
||||||
|
|
||||||
|
p->layout_ = new QVBoxLayout(this);
|
||||||
|
p->layout_->addWidget(p->welcomeLabel_);
|
||||||
|
setLayout(p->layout_);
|
||||||
}
|
}
|
||||||
|
|
||||||
WelcomePage::~WelcomePage() = default;
|
WelcomePage::~WelcomePage() = default;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue