mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-24 17:58:45 +00:00
Added: #1193 Added recursive search paths settings page.
This commit is contained in:
parent
b5e9f37690
commit
3c49ee36e9
3 changed files with 29 additions and 9 deletions
|
@ -61,12 +61,14 @@ bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr
|
||||||
bool success = m_mainWindow->initialize(errorString);
|
bool success = m_mainWindow->initialize(errorString);
|
||||||
|
|
||||||
GeneralSettingsPage *generalSettings = new GeneralSettingsPage(this);
|
GeneralSettingsPage *generalSettings = new GeneralSettingsPage(this);
|
||||||
CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(this);
|
CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(false, this);
|
||||||
|
CSearchPathsSettingsPage *recureseSearchPathPage = new CSearchPathsSettingsPage(true, this);
|
||||||
|
|
||||||
generalSettings->applyGeneralSettings();
|
generalSettings->applyGeneralSettings();
|
||||||
searchPathPage->applySearchPaths();
|
searchPathPage->applySearchPaths();
|
||||||
addAutoReleasedObject(generalSettings);
|
addAutoReleasedObject(generalSettings);
|
||||||
addAutoReleasedObject(searchPathPage);
|
addAutoReleasedObject(searchPathPage);
|
||||||
|
addAutoReleasedObject(recureseSearchPathPage);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,9 @@ namespace Core
|
||||||
|
|
||||||
QString lastDir = ".";
|
QString lastDir = ".";
|
||||||
|
|
||||||
CSearchPathsSettingsPage::CSearchPathsSettingsPage(QObject *parent)
|
CSearchPathsSettingsPage::CSearchPathsSettingsPage(bool recurse, QObject *parent)
|
||||||
: IOptionsPage(parent),
|
: IOptionsPage(parent),
|
||||||
|
m_recurse(recurse),
|
||||||
m_page(0)
|
m_page(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -45,12 +46,18 @@ CSearchPathsSettingsPage::~CSearchPathsSettingsPage()
|
||||||
|
|
||||||
QString CSearchPathsSettingsPage::id() const
|
QString CSearchPathsSettingsPage::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String("search_paths");
|
if (m_recurse)
|
||||||
|
return QLatin1String("search_recurse_paths");
|
||||||
|
else
|
||||||
|
return QLatin1String("search_paths");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSearchPathsSettingsPage::trName() const
|
QString CSearchPathsSettingsPage::trName() const
|
||||||
{
|
{
|
||||||
return tr("Search Paths");
|
if (m_recurse)
|
||||||
|
return tr("Search Recurse Paths");
|
||||||
|
else
|
||||||
|
return tr("Search Paths");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CSearchPathsSettingsPage::category() const
|
QString CSearchPathsSettingsPage::category() const
|
||||||
|
@ -95,7 +102,11 @@ void CSearchPathsSettingsPage::applySearchPaths()
|
||||||
QStringList paths, remapExt;
|
QStringList paths, remapExt;
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
if (m_recurse)
|
||||||
|
paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
|
||||||
|
else
|
||||||
|
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
||||||
|
|
||||||
remapExt = settings->value(Core::Constants::REMAP_EXTENSIONS).toStringList();
|
remapExt = settings->value(Core::Constants::REMAP_EXTENSIONS).toStringList();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
|
@ -104,7 +115,7 @@ void CSearchPathsSettingsPage::applySearchPaths()
|
||||||
|
|
||||||
Q_FOREACH(QString path, paths)
|
Q_FOREACH(QString path, paths)
|
||||||
{
|
{
|
||||||
NLMISC::CPath::addSearchPath(path.toStdString(), false, false);
|
NLMISC::CPath::addSearchPath(path.toStdString(), m_recurse, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +170,10 @@ void CSearchPathsSettingsPage::readSettings()
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
if (m_recurse)
|
||||||
|
paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
|
||||||
|
else
|
||||||
|
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
Q_FOREACH(QString path, paths)
|
Q_FOREACH(QString path, paths)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +192,10 @@ void CSearchPathsSettingsPage::writeSettings()
|
||||||
|
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
settings->setValue(Core::Constants::SEARCH_PATHS, paths);
|
if (m_recurse)
|
||||||
|
paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
|
||||||
|
else
|
||||||
|
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class CSearchPathsSettingsPage : public Core::IOptionsPage
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSearchPathsSettingsPage(QObject *parent = 0);
|
explicit CSearchPathsSettingsPage(bool recurse, QObject *parent = 0);
|
||||||
~CSearchPathsSettingsPage();
|
~CSearchPathsSettingsPage();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
|
@ -63,6 +63,7 @@ private:
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
void checkEnabledButton();
|
void checkEnabledButton();
|
||||||
|
|
||||||
|
bool m_recurse;
|
||||||
QWidget *m_page;
|
QWidget *m_page;
|
||||||
Ui::CSearchPathsSettingsPage m_ui;
|
Ui::CSearchPathsSettingsPage m_ui;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue