+ save/restore custom icon paths
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5035 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
# include <QPalette>
|
||||
# include <QSvgRenderer>
|
||||
# include <QStyleOption>
|
||||
# include <sstream>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
@@ -88,6 +89,7 @@ void BitmapFactoryInst::destruct (void)
|
||||
BitmapFactoryInst::BitmapFactoryInst()
|
||||
{
|
||||
d = new BitmapFactoryInstP;
|
||||
restoreCustomPaths();
|
||||
}
|
||||
|
||||
BitmapFactoryInst::~BitmapFactoryInst()
|
||||
@@ -95,6 +97,26 @@ BitmapFactoryInst::~BitmapFactoryInst()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void BitmapFactoryInst::addCustomPath(const QString& path)
|
||||
{
|
||||
Base::Reference<ParameterGrp> group = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Bitmaps");
|
||||
std::vector<std::string> paths = group->GetASCIIs("CustomPath");
|
||||
std::stringstream str;
|
||||
str << "CustomPath" << paths.size();
|
||||
group->SetASCII(str.str().c_str(), (const char*)path.toUtf8());
|
||||
}
|
||||
|
||||
void BitmapFactoryInst::restoreCustomPaths()
|
||||
{
|
||||
Base::Reference<ParameterGrp> group = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Bitmaps");
|
||||
std::vector<std::string> paths = group->GetASCIIs("CustomPath");
|
||||
for (std::vector<std::string>::iterator it = paths.begin(); it != paths.end(); ++it) {
|
||||
addPath(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void BitmapFactoryInst::addPath(const QString& path)
|
||||
{
|
||||
d->paths.push_back(path);
|
||||
|
||||
Reference in New Issue
Block a user