Exemple #1
0
void KNGlobal::initialInfrastrcture()
{
    //Initial storage unit.
    initialStorageUnit();
    //Initial the default path.
    initialDefaultDirPath();
    //Initial the global pixmaps.
    initialBrushes();

    //Initial the configure manager.
    //Set the configure folder path.
    //-- Q: Why set configure path here?
    //   A: Because we won't change the configure path.
    //Because KNConfigureManager will automatically reload the configure, so we
    //don't need to load the configure here.
    knConf->setFolderPath(m_dirPath[UserDataDir]+"/Configure");
    //Get the global configure.
    m_globalConfigure=userConfigure()->getConfigure("Global");

    //Initial the font manager.
    //Set the font resource folder.
    knFont->loadCustomFontFolder(m_dirPath[ResourceDir]+"/Fonts");
    //Set the default font.
    knFont->setGlobalFont("WenQuanYi Micro Hei");

    //Initial the locale manager.
    //Load the language in language folder.
#ifdef Q_OS_LINUX
    //Thanks for Sou Bunnbu:
    //For Linux, we should also find langauges at /usr/share/Kreogist/mu, here's
    //the default package resource provide place.
    knI18n->loadLanguageFiles("/usr/share/Kreogist/mu/Language");
#else
    knI18n->loadLanguageFiles(m_dirPath[ResourceDir]+"/Language");
#endif
    //Load the current language file.
    //We will load the langauge file twice, for the first time, we have to load
    //the default language according to the system locale settings.
    knI18n->setDefaultLanguage();
    //Load the language stored in the configure file.
    knI18n->setLanguage(m_globalConfigure->data("Language").toString());

    //Initial the theme manager.
    //Load the theme in theme folder. It's familiar with the language folder.
#ifdef Q_OS_LINUX
    knTheme->loadThemeFiles("/usr/share/Kreogist/mu/Theme");
#else
    knTheme->loadThemeFiles(m_dirPath[ResourceDir]+"/Theme");
#endif
    //Load the current theme file.
    //Like the language, we will load theme twice. Default first, user next.
    knTheme->setTheme(0);
    //Load the theme in the configure file.
    knTheme->setTheme(m_globalConfigure->data("Theme").toString());

    //Update infrastructure, update the path of the library directory.
    updateInfrastructure();
}
Exemple #2
0
inline void KNGlobal::initialInfrastrcture()
{
    //Initial storage unit.
    initialStorageUnit();
    //Initial the default path.
    initialDefaultDirPath();
    //Initial the global pixmaps.
    initialBrushes();
#ifdef Q_OS_UNIX
    //Check out the desktop environment.
    initialDesktopEnvironment();
#endif

    //Initial the configure manager.
    //Set the configure folder path.
    //-- Q: Why set configure path here?
    //   A: Because we won't change the configure path.
    //Because KNConfigureManager will automatically reload the configure, so we
    //don't need to load the configure here.
    knConf->setFolderPath(m_dirPath[UserDataDir]+"/Configure",
                          m_dirPath[AccountDir]);
    //Get the global configure.
    m_globalConfigure=userConfigure()->getConfigure("Global");

    //Initial the font manager.
    //Set the font resource folder.
    knFont->loadCustomFontFolder(m_dirPath[ResourceDir]+"/Fonts");
    //Set the default font.
    knFont->loadDefaultFont();

    //Initial the locale manager.
    //Load the language in language folder.
#ifdef Q_OS_LINUX
    //Thanks for Sou Bunnbu, amazingfate:
    //For Linux, we should also find langauges at /usr/share/Kreogist/mu.
    knI18n->addLanguageDirectory("/usr/share/Kreogist/mu/Language");
    //And the user installed languages, thanks for 1dot75cm.
    knI18n->addLanguageDirectory(m_dirPath[UserDataDir]+"/Language");
    knI18n->loadLanguageFiles();
#else
    //For Windows and Mac OS X, we can simply check the resource folder and
    //application dir.
    knI18n->addLanguageDirectory(m_dirPath[ResourceDir]+"/Language");
    knI18n->addLanguageDirectory(qApp->applicationDirPath()+"/Language");
    knI18n->loadLanguageFiles();
#endif
    //Load the current language file.
    //We will load the langauge file twice, for the first time, we have to load
    //the default language according to the system locale settings.
    knI18n->setDefaultLanguage();
    //Load the language stored in the configure file.
    knI18n->setLanguage(m_globalConfigure->data("Language").toString());

    //Initial the theme manager.
    //Load the theme in theme folder. It's familiar with the language folder.
#ifdef Q_OS_LINUX
    knTheme->loadThemeFiles("/usr/share/Kreogist/mu/Theme");
#else
    knTheme->loadThemeFiles(m_dirPath[ResourceDir]+"/Theme");
#endif
    //Load the current theme file.
    //Like the language, we will load theme twice. Default first, user next.
    knTheme->setTheme(0);
    //Load the theme in the configure file.
    knTheme->setTheme(m_globalConfigure->data("Theme").toString());

    //Set the configure.
    knAccount->setCacheConfigure(accountConfigure());
    //Initial the account system.
    knAccount->setWorkingThread(m_accountThread);
    //Link the account.
    connect(this, &KNGlobal::startWorking, knAccount, &KNAccount::startToWork,
            Qt::QueuedConnection);
    //Start account working thread.
    m_accountThread->start();

    //Update infrastructure, update the path of the library directory.
    updateInfrastructure();
}