Commit 0cfa4495 authored by Urs Fleisch's avatar Urs Fleisch

Action to unload all tags and free their used memory.

parent 70098a18
......@@ -3593,6 +3593,16 @@ spezifiziert. Die Kid3 Schnittstelle hat die folgenden Methoden:
<para>Wenn OK wird true zurückgegeben.</para>
</sect2>
<sect2 id="dbus-unloadAllTags">
<title>Entlade die Tags aller nicht selektierten oder modifizierten Dateien</title>
<funcsynopsis>
<funcprototype>
<funcdef><function>unloadAllTags</function></funcdef>
<void/>
</funcprototype>
</funcsynopsis>
</sect2>
<sect2 id="dbus-save">
<title>Speichere alle veränderten Dateien</title>
<funcsynopsis>
......@@ -4593,6 +4603,7 @@ die dortige Beschreibung verwiesen.
<programlisting>
app.openDirectory(path): Verzeichnis öffnen
app.unloadAllTags(): Entlade alle Tags
app.saveDirectory(): Speichern
app.revertFileModifications(): Zuletzt gespeicherte Fassung
app.importTags(tag, path, fmtIdx): Datei importieren
......
......@@ -3406,6 +3406,16 @@ following methods:
<para>Returns true if OK.</para>
</sect2>
<sect2 id="dbus-unloadAllTags">
<title>Unload the tags of all files which are not modified or selected</title>
<funcsynopsis>
<funcprototype>
<funcdef><function>unloadAllTags</function></funcdef>
<void/>
</funcprototype>
</funcsynopsis>
</sect2>
<sect2 id="dbus-save">
<title>Save all modified files</title>
<funcsynopsis>
......@@ -4394,6 +4404,7 @@ details, refer to the respective notes.
<programlisting>
app.openDirectory(path): Open directory
app.unloadAllTags(): Unload all tags
app.saveDirectory(): Save directory
app.revertFileModifications(): Revert
app.importTags(tag, path, fmtIdx): Import file
......
......@@ -302,6 +302,9 @@ msgstr "O&bnovit"
msgid "Reload directory"
msgstr "Obnovit adresář"
msgid "Unload"
msgstr "Uvolnit"
msgid "&Import..."
msgstr "&Zavést..."
......
......@@ -297,6 +297,9 @@ msgstr "Ge&nindlæs"
msgid "Reload directory"
msgstr "Genindlæs liste"
msgid "Unload"
msgstr "Fjern"
msgid "&Import..."
msgstr "&Importér..."
......
......@@ -302,6 +302,9 @@ msgstr "&Neu laden"
msgid "Reload directory"
msgstr "Verzeichnis neu einlesen"
msgid "Unload"
msgstr "Entladen"
msgid "&Import..."
msgstr "&Importieren..."
......
......@@ -302,6 +302,9 @@ msgstr "Recar&gar"
msgid "Reload directory"
msgstr "Recargar directorio"
msgid "Unload"
msgstr "Descargar"
msgid "&Import..."
msgstr "&Importar..."
......
......@@ -303,6 +303,9 @@ msgstr "Laadi &uuesti"
msgid "Reload directory"
msgstr "Uuendada käesoleva kausta sisu"
msgid "Unload"
msgstr "Eemalda"
msgid "&Import..."
msgstr "&Impordi..."
......
......@@ -303,6 +303,9 @@ msgstr "Lataa uu&delleen"
msgid "Reload directory"
msgstr "Lataa nykyinen kansio uudelleen"
msgid "Unload"
msgstr "Poista"
msgid "&Import..."
msgstr "T&uo..."
......
......@@ -302,6 +302,9 @@ msgstr "Rechar&ger"
msgid "Reload directory"
msgstr "Recharger le répertoire"
msgid "Unload"
msgstr "Décharger"
msgid "&Import..."
msgstr "&Importer..."
......
......@@ -302,6 +302,9 @@ msgstr "&Ricarica"
msgid "Reload directory"
msgstr "Ricarica cartella"
msgid "Unload"
msgstr "Scarica"
msgid "&Import..."
msgstr "&Importa..."
......
......@@ -299,6 +299,9 @@ msgstr ""
msgid "Reload directory"
msgstr ""
msgid "Unload"
msgstr ""
msgid "&Import..."
msgstr ""
......
......@@ -302,6 +302,9 @@ msgstr "Her&laden"
msgid "Reload directory"
msgstr "Map herladen"
msgid "Unload"
msgstr "Ontladen"
msgid "&Import..."
msgstr "&Importeren..."
......
......@@ -303,6 +303,9 @@ msgstr "O&dśwież"
msgid "Reload directory"
msgstr "Ponownie wczytaj katalog"
msgid "Unload"
msgstr "Wyłącz"
msgid "&Import..."
msgstr "&Importuj..."
......
......@@ -303,6 +303,9 @@ msgstr "О&бновить"
msgid "Reload directory"
msgstr "Обновить каталог"
msgid "Unload"
msgstr "Выгрузить"
msgid "&Import..."
msgstr "&Импорт..."
......
......@@ -301,6 +301,9 @@ msgstr "&Освежи"
msgid "Reload directory"
msgstr "Поново учитај списак"
msgid "Unload"
msgstr "Унлоад"
msgid "&Import..."
msgstr "&Увези..."
......
......@@ -301,6 +301,9 @@ msgstr "&Учитај поново"
msgid "Reload directory"
msgstr "Поново учитај списак"
msgid "Unload"
msgstr "Унлоад"
msgid "&Import..."
msgstr "&Увези..."
......
......@@ -301,6 +301,9 @@ msgstr "&Učitaj ponovo"
msgid "Reload directory"
msgstr "Ponovo učitaj spisak"
msgid "Unload"
msgstr "Unload"
msgid "&Import..."
msgstr "&Uvezi..."
......
......@@ -301,6 +301,9 @@ msgstr "&Učitaj ponovo"
msgid "Reload directory"
msgstr "Ponovo učitaj spisak"
msgid "Unload"
msgstr "Unload"
msgid "&Import..."
msgstr "&Uvezi..."
......
......@@ -302,6 +302,9 @@ msgstr "Y&eniden Yükle"
msgid "Reload directory"
msgstr "Geçerli dizini yenile"
msgid "Unload"
msgstr "Kaldır"
msgid "&Import..."
msgstr "A&l..."
......
......@@ -301,6 +301,9 @@ msgstr "重新装入(&L)"
msgid "Reload directory"
msgstr "重载当前文件夹"
msgid "Unload"
msgstr "卸载"
msgid "&Import..."
msgstr "导入(&I)..."
......
......@@ -305,6 +305,9 @@ msgstr "重新載入(&L)"
msgid "Reload directory"
msgstr "重新載入目錄"
msgid "Unload"
msgstr "卸載"
msgid "&Import..."
msgstr "匯入(&I)..."
......
......@@ -193,6 +193,10 @@ void KdeMainWindow::initActions()
connect(action, &QAction::triggered,
impl(), &BaseMainWindowImpl::slotFileReload);
action = new QAction(tr("Unload"), this);
collection->addAction(QLatin1String("unload"), action);
connect(action, &QAction::triggered, app(), &Kid3Application::unloadAllTags);
action = new QAction(QIcon::fromTheme(QLatin1String("document-import")),
tr("&Import..."), this);
action->setStatusTip(tr("Import from file or clipboard"));
......
......@@ -154,6 +154,15 @@ void Kid3MainWindow::initActions()
connect(fileReload, &QAction::triggered,
impl(), &BaseMainWindowImpl::slotFileReload);
fileMenu->addAction(fileReload);
auto fileUnload = new QAction(this);
fileUnload->setText(tr("Unload"));
fileUnload->setObjectName(QLatin1String("unload"));
m_shortcutsModel->registerAction(fileUnload, menuTitle);
connect(fileUnload, &QAction::triggered,
app(), &Kid3Application::unloadAllTags);
addAction(fileUnload);
fileMenu->addSeparator();
auto fileSave = new QAction(this);
......
......@@ -853,6 +853,24 @@ void Kid3Application::onDirectoryLoaded()
onDirectoryOpened();
}
/**
* Unload all tags.
* The tags of all files which are not modified or selected are freed to
* reclaim their memory.
*/
void Kid3Application::unloadAllTags()
{
TaggedFileIterator it(m_fileProxyModelRootIndex);
while (it.hasNext()) {
TaggedFile* taggedFile = it.next();
if (taggedFile->isTagInformationRead() && !taggedFile->isChanged() &&
!m_fileSelectionModel->isSelected(taggedFile->getIndex())) {
taggedFile->clearTags(false);
taggedFile->closeFileHandle();
}
}
}
/**
* Get directory path of opened directory.
* @return directory path.
......
......@@ -912,6 +912,13 @@ public slots:
*/
void openDropUrls(const QList<QUrl>& urlList);
/**
* Unload all tags.
* The tags of all files which are not modified or selected are freed to
* reclaim their memory.
*/
void unloadAllTags();
/**
* Revert file modifications.
* Acts on selected files or all files if no file is selected.
......
......@@ -5,6 +5,8 @@
<arg type="b" direction="out"/>
<arg name="path" type="s" direction="in"/>
</method>
<method name="unloadAllTags">
</method>
<method name="save">
<arg type="b" direction="out"/>
</method>
......@@ -19,6 +21,11 @@
<arg name="path" type="s" direction="in"/>
<arg name="fmtIdx" type="i" direction="in"/>
</method>
<method name="importFromTags">
<arg name="tagMask" type="i" direction="in"/>
<arg name="source" type="s" direction="in"/>
<arg name="extraction" type="s" direction="in"/>
</method>
<method name="batchImport">
<arg type="b" direction="out"/>
<arg name="tagMask" type="i" direction="in"/>
......@@ -37,6 +44,15 @@
<method name="createPlaylist">
<arg type="b" direction="out"/>
</method>
<method name="getPlaylistItems">
<arg type="as" direction="out"/>
<arg name="path" type="s" direction="in"/>
</method>
<method name="setPlaylistItems">
<arg type="b" direction="out"/>
<arg name="path" type="s" direction="in"/>
<arg name="items" type="as" direction="in"/>
</method>
<method name="quit">
</method>
<method name="selectAll">
......
......@@ -66,6 +66,16 @@ bool ScriptInterface::openDirectory(const QString& path)
return m_app->openDirectory({path}, true);
}
/**
* Unload all tags.
* The tags of all files which are not modified or selected are freed to
* reclaim their memory.
*/
void ScriptInterface::unloadAllTags()
{
m_app->unloadAllTags();
}
/**
* Save all modified files.
*
......
......@@ -66,6 +66,13 @@ public slots:
*/
bool openDirectory(const QString& path);
/**
* Unload all tags.
* The tags of all files which are not modified or selected are freed to
* reclaim their memory.
*/
void unloadAllTags();
/**
* Save all modified files.
*
......
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