fix plugin manager; load flag was not restored

This commit is contained in:
ws 2013-02-15 18:16:43 +01:00
parent 0b3e4fa71b
commit bbbe067045
4 changed files with 35 additions and 32 deletions

View file

@ -797,7 +797,7 @@ Shortcut Shortcut::sc[] = {
QT_TRANSLATE_NOOP("action","Decrescendo")
),
Shortcut(
STATE_NORMAL | STATE_NOTE_ENTRY | STATE_EDIT | STATE_TEXT_EXIT | STATE_LYRICS_EDIT
STATE_NORMAL | STATE_NOTE_ENTRY | STATE_EDIT | STATE_TEXT_EDIT | STATE_LYRICS_EDIT
| STATE_PLAY | STATE_SEARCH | STATE_FOTO,
0,
"escape",

View file

@ -38,41 +38,20 @@ PluginManager::PluginManager(QWidget* parent)
foreach(const Shortcut* s, Shortcut::shortcuts())
localShortcuts[s->key()] = new Shortcut(*s);
shortcutsChanged = false;
updateValues();
}
//---------------------------------------------------------
// apply
//---------------------------------------------------------
prefs.updatePluginList();
void PluginManager::accept()
{
printf("pluginManager::apply()\n");
if (shortcutsChanged) {
shortcutsChanged = false;
foreach(const Shortcut* s, localShortcuts) {
Shortcut* os = Shortcut::getShortcut(s->key());
if (os) {
if (!os->compareKeys(*s))
os->setKeys(s->keys());
// update "load" flag
for (int n = 0; n < preferences.pluginList.size(); ++n) {
PluginDescription& d = preferences.pluginList[n];
for (int k = 0; k < prefs.pluginList.size(); ++k) {
PluginDescription& dd = prefs.pluginList[k];
if (d.path == dd.path) {
dd.load = d.load;
break;
}
}
Shortcut::dirty = true;
}
QDialog::accept();
}
//---------------------------------------------------------
// updateValues
//---------------------------------------------------------
void PluginManager::updateValues()
{
//
// update plugin manager
//
prefs.updatePluginList();
pluginList->clear();
int n = prefs.pluginList.size();
for (int i = 0; i < n; ++i) {
@ -84,8 +63,28 @@ void PluginManager::updateValues()
pluginList->setCurrentRow(0);
pluginListItemChanged(pluginList->item(0), 0);
}
}
//---------------------------------------------------------
// apply
//---------------------------------------------------------
void PluginManager::accept()
{
if (shortcutsChanged) {
shortcutsChanged = false;
foreach(const Shortcut* s, localShortcuts) {
Shortcut* os = Shortcut::getShortcut(s->key());
if (os) {
if (!os->compareKeys(*s))
os->setKeys(s->keys());
}
}
Shortcut::dirty = true;
}
preferences = prefs;
preferences.write();
QDialog::accept();
}
//---------------------------------------------------------

View file

@ -31,7 +31,6 @@ class PluginManager : public QDialog, public Ui::PluginManager {
Preferences prefs;
virtual void closeEvent(QCloseEvent*);
void updateValues();
virtual void accept();
private slots:

View file

@ -574,6 +574,11 @@ void Preferences::read()
s.endGroup();
readPluginList();
int n = pluginList.size();
for (int i = 0; i < n; ++i) {
const PluginDescription& d = pluginList[i];
printf("read plugin %d %s %d\n", i, qPrintable(d.path), d.load);
}
}
//---------------------------------------------------------