Ref T673, incognito flag/menu

This commit is contained in:
Klaus Basan
2019-06-22 00:07:37 +02:00
committed by Mat Sutcliffe
parent 3a98a40964
commit 235508ec98
5 changed files with 52 additions and 8 deletions

View File

@@ -245,6 +245,21 @@ namespace BlackCore
return m_shutdown;
}
bool CApplication::isIncognito() const
{
return m_incognito;
}
void CApplication::setIncognito(bool incognito)
{
m_incognito = incognito;
}
void CApplication::toggleIncognito()
{
m_incognito = !m_incognito;
}
const QString &CApplication::getApplicationNameAndVersion() const
{
static const QString s(m_applicationName % u" " % CBuildConfig::getVersionString());

View File

@@ -106,7 +106,7 @@ namespace BlackCore
CApplication(const QString &applicationName = executable(), BlackMisc::CApplicationInfo::Application application = BlackMisc::CApplicationInfo::Unknown, bool init = true);
//! Destructor
virtual ~CApplication();
virtual ~CApplication() override;
//! Information about all running apps (including this one only if exec() has already been called)
static BlackMisc::CApplicationInfoList getRunningApplications();
@@ -124,6 +124,18 @@ namespace BlackCore
//! \threadsafe
bool isShuttingDown() const;
//! Is incognito mode?
//! \threadsafe
bool isIncognito() const;
//! Set incognito mode
//! \threadsafe
void setIncognito(bool incognito);
//! Toggle incognito mode
//! \threadsafe
void toggleIncognito();
//! swift application running
const BlackMisc::CApplicationInfo &getApplicationInfo() const { return m_applicationInfo; }
@@ -405,9 +417,9 @@ namespace BlackCore
// ------------------------- network -----------------------------------------------
static constexpr int NoRedirects = -1; //!< network request not allowing redirects
static constexpr int NoLogRequestId = -1; //!< network request without logging
static constexpr int DefaultMaxRedirects = 2; //!< network request, default for max.redirects
static constexpr int NoRedirects = -1; //!< network request not allowing redirects
static constexpr int NoLogRequestId = -1; //!< network request without logging
static constexpr int DefaultMaxRedirects = 2; //!< network request, default for max.redirects
//! The network reply callback when request is completed
using CallbackSlot = BlackMisc::CSlot<void(QNetworkReply *)>;
@@ -605,11 +617,12 @@ namespace BlackCore
QCommandLineOption m_cmdClearCache {"clearcache"}; //!< Clear cache
QCommandLineOption m_cmdTestCrashpad {"testcrashpad"}; //!< Test a crasphpad upload
QCommandLineOption m_cmdSkipSingleApp {"skipsa"}; //!< Skip test for single application
bool m_parsed = false; //!< Parsing accomplished?
bool m_started = false; //!< Started with success?
bool m_parsed = false; //!< Parsing accomplished?
bool m_started = false; //!< Started with success?
bool m_singleApplication = true; //!< Only one instance of that application
bool m_alreadyRunning = false; //!< Application already running
std::atomic_bool m_shutdown { false }; //!< Is being shutdown?
bool m_alreadyRunning = false; //!< Application already running
std::atomic_bool m_shutdown { false }; //!< Is being shutdown?
std::atomic_bool m_incognito { false }; //!< Incognito mode?
std::atomic_bool m_shutdownInProgress { false }; //!< shutdown in progress?
private:

View File

@@ -280,6 +280,7 @@
</property>
<addaction name="menu_MovingMap"/>
<addaction name="menu_AutoPublish"/>
<addaction name="menu_ToggleIncognito"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Window"/>
@@ -510,6 +511,11 @@
<string>Auto-publish</string>
</property>
</action>
<action name="menu_ToggleIncognito">
<property name="text">
<string>Toggle incognito mode</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@@ -224,6 +224,8 @@ void SwiftGuiStd::initGuiSignals()
connect(ui->menu_InternalsPage, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked);
connect(ui->menu_AutoPublish, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked);
connect(ui->menu_MovingMap, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked);
connect(ui->menu_ToggleIncognito, &QAction::triggered, this, &SwiftGuiStd::onMenuClicked);
connect(m_navigator.data(), &CNavigatorDialog::navigatorClosed, this, &SwiftGuiStd::onNavigatorClosed, Qt::QueuedConnection);
// settings (GUI component), styles

View File

@@ -86,6 +86,14 @@ void SwiftGuiStd::onMenuClicked()
{
this->autoPublishDialog();
}
else if (sender == ui->menu_ToggleIncognito)
{
if (sGui)
{
sGui->toggleIncognito();
this->displayInOverlayWindow(QStringLiteral("Incognito mode is %1").arg(boolToOnOff(sGui->isIncognito())), 5000);
}
}
else if (sender == ui->menu_MovingMap && sGui && !sGui->getGlobalSetup().getSwiftMapUrls().isEmpty())
{
const CUrlList urls = sGui->getGlobalSetup().getSwiftMapUrls();