Commit 5a7b2628 authored by Jan Möbius's avatar Jan Möbius

Fixed Bug with non existing ini file

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8313 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 82e3d184
......@@ -69,28 +69,27 @@ FileOptionsDialog::FileOptionsDialog(std::vector<fileTypes>& _supportedTypes, QS
//load defaults from ini file
QString filename = OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.ini";
/// \todo Move to OpenFlipperSettings
INIFile ini;
if ( ! ini.connect(filename,false) ) {
std::cerr << (tr("Failed to connect to ini file %1").arg(filename)).toStdString() << std::endl;
return;
}
for (int i=0; i < boxes_.count(); i++){
QString pluginName;
if ( ini.get_entry(pluginName, "LoadSave" , "Extension_" + _extensions[i] ) ){
if ( ini.connect(filename,false) ) {
for (int i=0; i < boxes_.count(); i++){
QString pluginName;
for (int t=0; t < (boxes_[i])->count(); t++)
if ( (boxes_[i])->itemText(t) == pluginName ){
(boxes_[i])->setCurrentIndex(t);
break;
}
if ( ini.get_entry(pluginName, "LoadSave" , "Extension_" + _extensions[i] ) ){
for (int t=0; t < (boxes_[i])->count(); t++)
if ( (boxes_[i])->itemText(t) == pluginName ){
(boxes_[i])->setCurrentIndex(t);
break;
}
}
}
}
// close ini file
ini.disconnect();
// close ini file
ini.disconnect();
} else {
std::cerr << (tr("Failed to connect to ini file %1").arg(filename)).toStdString() << std::endl;
}
QGroupBox* group = new QGroupBox(tr("Extensions with multiple plugins"));
......
......@@ -72,7 +72,7 @@ LoadWidget::LoadWidget(std::vector<fileTypes>& _supportedTypes , QWidget *parent
//supported Types
optionsBox_ = new QCheckBox(tr("use defaults"), this);
optionsBox_->setChecked( defaultsSaved() );
optionsBox_->setChecked( OpenFlipperSettings().value("Core/File/UseDefaults",false).toBool() );
// add the options box to the bottom
gridLayout->addWidget( optionsBox_, gridLayout->rowCount() , 1 );
......@@ -403,28 +403,6 @@ void LoadWidget::slotSetPluginForExtension(QString _extension, int _pluginId ){
pluginForExtension_[ _extension ] = _pluginId;
}
bool LoadWidget::defaultsSaved(){
QString filename = OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.ini";
INIFile ini;
if ( ! ini.connect(filename,false) ) {
std::cerr << (tr("Failed to connect to ini file %1").arg(filename)).toStdString() << std::endl;
return false;
}
bool makeDefault = false;
ini.get_entry(makeDefault, "LoadSave" , "MakeDefault" );
// close ini file
ini.disconnect();
return makeDefault;
}
void LoadWidget::getPluginForExtensionINI(QStringList _extensions){
QString filename = OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.ini";
......
......@@ -73,7 +73,6 @@ class LoadWidget : public QFileDialog
std::vector<fileTypes>& supportedTypes_;
void getPluginForExtensionINI(QStringList _extensions);
bool defaultsSaved();
public:
int showLoad();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment