KVIrc 5.2.0
Developer APIs
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
KviDefaultScriptManager Class Reference

The manager who handles the restoring of the default script. More...

#include <KviDefaultScript.h>

+ Inheritance diagram for KviDefaultScriptManager:

Public Member Functions

unsigned int count () const
 Returns the number of instances of the class.
 
bool isDefscriptUpToDate ()
 Checks if the local defscript is up to date.
 
 KviDefaultScriptManager ()
 Constructs the default script manager.
 
void load (const QString &szConfigFile)
 Loads the configuration of the default script.
 
void loadEmptyConfig ()
 Initializes an empty configuration.
 
void restore ()
 Restores the default script.
 
void save (const QString &szConfigFile)
 Saves the configuration of the default script.
 
 ~KviDefaultScriptManager ()
 Destroys the default script manager.
 

Static Public Member Functions

static void done ()
 Destroys the class instance.
 
static void init ()
 Initializes the class instance.
 
static KviDefaultScriptManagerinstance ()
 Returns the instance of the class.
 

Private Member Functions

bool compareVersions (QString &szConfig, QString *pszError)
 Compares versions between global and personal data.
 
void loadInternal (KviConfigurationFile *pCfg)
 Loads the configuration of the default script.
 
void restoreInternal ()
 Restores the default script.
 
void saveInternal (KviConfigurationFile *pCfg)
 Saves the configuration of the default script.
 

Private Attributes

bool m_bConfigFileMissing = false
 
bool m_bNoNeedToRestore = false
 
KviDefaultScriptDialogm_pDialog = nullptr
 
QString m_szAction
 
QString m_szAddon
 
QString m_szAlias
 
QString m_szClass
 
QString m_szDate
 
QString m_szEvent
 
QString m_szPopup
 
QString m_szRaw
 
QString m_szToolbar
 
QString m_szVersion
 

Static Private Attributes

static KviDefaultScriptManagerm_pSelf = nullptr
 
static unsigned int m_uCount = 0
 

Detailed Description

The manager who handles the restoring of the default script.

Constructor & Destructor Documentation

◆ KviDefaultScriptManager()

KviDefaultScriptManager::KviDefaultScriptManager ( )

◆ ~KviDefaultScriptManager()

KviDefaultScriptManager::~KviDefaultScriptManager ( )
default

Destroys the default script manager.

Member Function Documentation

◆ compareVersions()

bool KviDefaultScriptManager::compareVersions ( QString &  szConfig,
QString *  pszError 
)
private

Compares versions between global and personal data.

Parameters
szConfigThe global configuration file
pszErrorThe buffer containing errors
Returns
bool

References __tr2qs, CHECK, m_bNoNeedToRestore, m_szAction, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, m_szVersion, KviConfigurationFile::Read, and KviConfigurationFile::readEntry().

Referenced by restore().

◆ count()

unsigned int KviDefaultScriptManager::count ( ) const
inline

Returns the number of instances of the class.

Returns
unsigned int

Referenced by done(), and init().

◆ done()

void KviDefaultScriptManager::done ( )
static

Destroys the class instance.

Returns
void

References count(), m_pSelf, and m_uCount.

Referenced by KviApplication::~KviApplication().

◆ init()

void KviDefaultScriptManager::init ( )
static

Initializes the class instance.

Returns
void

References count(), KviDefaultScriptManager(), m_pSelf, and m_uCount.

Referenced by KviApplication::setup().

◆ instance()

static KviDefaultScriptManager * KviDefaultScriptManager::instance ( )
inlinestatic

◆ isDefscriptUpToDate()

bool KviDefaultScriptManager::isDefscriptUpToDate ( )

◆ load()

void KviDefaultScriptManager::load ( const QString &  szConfigFile)

Loads the configuration of the default script.

This is an external helper to the real function

Parameters
szConfigFileThe file where to load
Returns
void

References loadInternal(), and KviConfigurationFile::Read.

Referenced by KviApplication::setup().

◆ loadEmptyConfig()

void KviDefaultScriptManager::loadEmptyConfig ( )

Initializes an empty configuration.

Returns
void

References m_szAction, m_szAddon, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, and m_szVersion.

Referenced by KviApplication::setup().

◆ loadInternal()

void KviDefaultScriptManager::loadInternal ( KviConfigurationFile pCfg)
private

Loads the configuration of the default script.

This is the real function

Parameters
pCfgThe configuration file
Returns
void

References IS_EMPTY, m_szAction, m_szAddon, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, m_szVersion, and KviConfigurationFile::readEntry().

Referenced by load().

◆ restore()

void KviDefaultScriptManager::restore ( )

Restores the default script.

If this function is suggested by KVIrc, the default script will be wiped out and then it will be reloaded. Otherwise, when the user wants to restore it, he can choose which part of the default script have to be restored

This is an external helper to the real function

Returns
void

References __tr2qs, compareVersions(), KviApplication::DefScript, g_pApp, KviApplication::getGlobalKvircDirectory(), m_bNoNeedToRestore, m_pDialog, and restoreInternal().

Referenced by KviApplication::restoreDefaultScript().

◆ restoreInternal()

void KviDefaultScriptManager::restoreInternal ( )
private

◆ save()

void KviDefaultScriptManager::save ( const QString &  szConfigFile)

Saves the configuration of the default script.

This is an external helper to the real function

Parameters
szConfigFileThe file to save
Returns
void

References KviConfigurationFile::clear(), saveInternal(), and KviConfigurationFile::Write.

Referenced by KviApplication::saveDefaultScripts().

◆ saveInternal()

void KviDefaultScriptManager::saveInternal ( KviConfigurationFile pCfg)
private

Saves the configuration of the default script.

This is the real function

Parameters
pCfgThe configuration file
Returns
void

References m_szAction, m_szAddon, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, m_szVersion, and KviConfigurationFile::writeEntry().

Referenced by save().

Member Data Documentation

◆ m_bConfigFileMissing

bool KviDefaultScriptManager::m_bConfigFileMissing = false
private

◆ m_bNoNeedToRestore

bool KviDefaultScriptManager::m_bNoNeedToRestore = false
private

Referenced by compareVersions(), and restore().

◆ m_pDialog

KviDefaultScriptDialog* KviDefaultScriptManager::m_pDialog = nullptr
private

Referenced by restore(), and restoreInternal().

◆ m_pSelf

KviDefaultScriptManager * KviDefaultScriptManager::m_pSelf = nullptr
staticprivate

Referenced by done(), and init().

◆ m_szAction

QString KviDefaultScriptManager::m_szAction
private

◆ m_szAddon

QString KviDefaultScriptManager::m_szAddon
private

◆ m_szAlias

QString KviDefaultScriptManager::m_szAlias
private

◆ m_szClass

QString KviDefaultScriptManager::m_szClass
private

◆ m_szDate

QString KviDefaultScriptManager::m_szDate
private

◆ m_szEvent

QString KviDefaultScriptManager::m_szEvent
private

◆ m_szPopup

QString KviDefaultScriptManager::m_szPopup
private

◆ m_szRaw

QString KviDefaultScriptManager::m_szRaw
private

◆ m_szToolbar

QString KviDefaultScriptManager::m_szToolbar
private

◆ m_szVersion

QString KviDefaultScriptManager::m_szVersion
private

◆ m_uCount

unsigned int KviDefaultScriptManager::m_uCount = 0
staticprivate

Referenced by done(), and init().


The documentation for this class was generated from the following files: