mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
Ref T203, renamed to update settings
This commit is contained in:
51
src/blackcore/application/updatesettings.h
Normal file
51
src/blackcore/application/updatesettings.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_APPLICATION_UPDATESETTINGS_H
|
||||
#define BLACKCORE_APPLICATION_UPDATESETTINGS_H
|
||||
|
||||
#include "blackcore/application.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackmisc/platform.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include <QStringList>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Application
|
||||
{
|
||||
//! Update info settings, QStringList with 2 values: channel/platform
|
||||
struct TUpdatePreferences : public BlackMisc::TSettingTrait<QStringList>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "updatepreferences"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static const QStringList &defaultValue()
|
||||
{
|
||||
// guessing / preset-ing some default values
|
||||
static const QStringList d = (sApp && !sApp->getUpdateInfo().isEmpty()) ?
|
||||
sApp->getUpdateInfo().anticipateMyDefaultChannelAndPlatform() : // from cached or loaded update info
|
||||
QStringList({ "STABLE", BlackMisc::CPlatform::currentPlatform().getPlatformName()});
|
||||
return d;
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable()
|
||||
{
|
||||
static const QString name("Updates channel/platform");
|
||||
return name;
|
||||
}
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user