diff --git a/ChangeLog b/ChangeLog index 4be7d24..f8ec372 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +V0.3.2 +--------- + * Added a workaround for the low performance of QMimeDatabase. Loading of heavy archives is much faster now. + V0.3.1 --------- * Fixed archiving of files from different folders. diff --git a/NEWS b/NEWS index 1bc43e9..3ec2191 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ Latest version: - 25 Oct 2019, V0.3.1 + 18 Dec 2019, V0.4 See "ChangeLog" for changes. diff --git a/backends.cpp b/backends.cpp index 58d74a1..43be3a4 100644 --- a/backends.cpp +++ b/backends.cpp @@ -53,9 +53,19 @@ Backend::~Backend() { } QString Backend::getMimeType(const QString &fname) { - QMimeDatabase mimeDatabase; - QMimeType mimeType = mimeDatabase.mimeTypeForFile(QFileInfo(fname)); - return mimeType.name(); + QString mimeType, suffix; + int left = fname.indexOf(QLatin1Char('.')); + if (left != -1) { + suffix = fname.right(fname.size() - left - 1); + mimeType = mimeTypes_.value(suffix); + } + if (mimeType.isEmpty()) { + QMimeDatabase mimeDatabase; + mimeType = mimeDatabase.mimeTypeForFile(QFileInfo(fname)).name(); + if (!suffix.isEmpty()) + mimeTypes_.insert(suffix, mimeType); + } + return mimeType; } void Backend::loadFile(const QString& path, bool withPassword) { diff --git a/backends.h b/backends.h index 7104384..0b482ff 100644 --- a/backends.h +++ b/backends.h @@ -109,6 +109,8 @@ private slots: QProcess proc_; + QHash mimeTypes_; // to speed up mime type search + QString filepath_, tmpfilepath_, arqiverDir_; QStringList fileArgs_; /* "keyArgs_" is used, instead of QProcess::arguments(), to exlude file/item names diff --git a/data/translations/arqiver.ts b/data/translations/arqiver.ts index c2be3f1..e27a0ac 100644 --- a/data/translations/arqiver.ts +++ b/data/translations/arqiver.ts @@ -12,37 +12,37 @@ Arqiver::Backend - - + + Could not read archive - - + + Archive Loaded - - + + Modification Finished - - + + Extraction Finished - - + + Extraction Failed - + %1 is missing from your system. Please install it for this kind of archive! @@ -477,33 +477,33 @@ Do you want to continue? - + A simple Qt archive manager - + based on libarchive, gzip and 7z - + Author - + aka. - - + + About Arqiver - + Translators diff --git a/data/translations/arqiver_eo.ts b/data/translations/arqiver_eo.ts index 58c357b..8faef61 100644 --- a/data/translations/arqiver_eo.ts +++ b/data/translations/arqiver_eo.ts @@ -12,37 +12,37 @@ Arqiver::Backend - - + + Could not read archive La arkivo ne legeblis - - + + Archive Loaded Arkivo Ŝargita - - + + Modification Finished Modifado Farita - - + + Extraction Finished Ekstraktado Farita - - + + Extraction Failed Ekstraktado Malsukcesis - + %1 is missing from your system. Please install it for this kind of archive! %1 mankas al via sistemo. @@ -482,33 +482,33 @@ Do you want to continue? Ligilo Al %1 - + A simple Qt archive manager Simpla Qt-Arkivilo - + based on libarchive, gzip and 7z bazita sur libarchive, gzip kaj 7z - + Author Verkinto - + aka. akk. - - + + About Arqiver Pri Arqiver - + Translators Tradukintoj diff --git a/data/translations/arqiver_nl.ts b/data/translations/arqiver_nl.ts index b3e0201..a46ed90 100644 --- a/data/translations/arqiver_nl.ts +++ b/data/translations/arqiver_nl.ts @@ -12,37 +12,37 @@ Arqiver::Backend - - + + Could not read archive Kan archief niet uitlezen - - + + Archive Loaded Archief geladen - - + + Modification Finished Bewerking voltooid - - + + Extraction Finished Uitpakken voltooid - - + + Extraction Failed - + %1 is missing from your system. Please install it for this kind of archive! %1 is niet geïnstalleerd. @@ -479,33 +479,33 @@ Do you want to continue? Link naar: %1 - + A simple Qt archive manager Een eenvoudige Qt-archiefbeheerder - + based on libarchive, gzip and 7z gebaseerd op libarchive, gzip en 7z - + Author Maker - + aka. ook bekend als - - + + About Arqiver Over Arqiver - + Translators Vertalers diff --git a/data/translations/arqiver_pl.ts b/data/translations/arqiver_pl.ts index bc45b04..0d27a24 100644 --- a/data/translations/arqiver_pl.ts +++ b/data/translations/arqiver_pl.ts @@ -12,37 +12,37 @@ Arqiver::Backend - - + + Could not read archive Nie udało się odczytać archiwum - - + + Archive Loaded Załadowano archiwum - - + + Modification Finished Zakończono modyfikowanie - - + + Extraction Finished Zakończono rozpakowywanie - - + + Extraction Failed - + %1 is missing from your system. Please install it for this kind of archive! W Twoim systemie brakuje %1. @@ -479,33 +479,33 @@ Do you want to continue? Odnośnik do: %1 - + A simple Qt archive manager Prosty menedżer archiwum Qt - + based on libarchive, gzip and 7z oparty o libarchive, gzip i 7z - + Author Autor - + aka. aka. - - + + About Arqiver O Arqiver - + Translators Tłumacze diff --git a/data/translations/arqiver_pt_BR.ts b/data/translations/arqiver_pt_BR.ts index 2a6eda6..07f399b 100644 --- a/data/translations/arqiver_pt_BR.ts +++ b/data/translations/arqiver_pt_BR.ts @@ -12,37 +12,37 @@ Arqiver::Backend - - + + Could not read archive Não foi possível ler o arquivo - - + + Archive Loaded Arquivo Carregado - - + + Modification Finished Modificação Concluída - - + + Extraction Finished Extração Concluída - - + + Extraction Failed Extração Falhou - + %1 is missing from your system. Please install it for this kind of archive! %1 está ausente do seu sistema. @@ -479,33 +479,33 @@ Deseja continuar? Link Para: %1 - + A simple Qt archive manager Um simples gerenciador de arquivos Qt - + based on libarchive, gzip and 7z baseado em libarchive, gzip e 7z - + Author Autor - + aka. aka. - - + + About Arqiver Sobre Arqiver - + Translators Tradutores diff --git a/main.cpp b/main.cpp index 7bab660..d1d9bf3 100644 --- a/main.cpp +++ b/main.cpp @@ -38,7 +38,7 @@ void handleQuitSignals(const std::vector& quitSignals) { int main(int argc, char **argv) { const QString name = "Arqiver"; - const QString version = "0.3.1"; + const QString version = "0.3.2"; const QString option = QString::fromUtf8(argv[1]); if (option == "--help" || option == "-h") { QTextStream out (stdout); diff --git a/mainWin.cpp b/mainWin.cpp index e9be758..523a830 100644 --- a/mainWin.cpp +++ b/mainWin.cpp @@ -1113,7 +1113,10 @@ void mainWin::updateTree() { else parentItem = thisParent; // already handled } - parentItem->addChild(it); + if (parentItem) + parentItem->addChild(it); + else + ui->tree_contents->addTopLevelItem(it); } } } diff --git a/svgicons.cpp b/svgicons.cpp index d37ae4d..c784013 100644 --- a/svgicons.cpp +++ b/svgicons.cpp @@ -55,17 +55,7 @@ class symbolicIconEngine : public QIconEngine QColor col; if (mode == QIcon::Disabled) - { - /* With disabled icons, neither reducing the painter opacity nor the method - used in QCommonStyle::generatedIconPixmap() works fine with all styles. - Instead, we choose a disabled color that's good enough everywhere. */ - int g = qGray (QApplication::palette().windowText().color().rgb()); - if (g < 130) - g += 120; - else - g -= 110; - col = QColor (g, g, g); - } + col = QApplication::palette().color (QPalette::Disabled, QPalette::WindowText); else if (mode == QIcon::Selected) col = QApplication::palette().highlightedText().color(); else @@ -85,7 +75,7 @@ class symbolicIconEngine : public QIconEngine QFile f (fileName); QByteArray bytes; if (f.open (QIODevice::ReadOnly)) - bytes= f.readAll(); + bytes = f.readAll(); if (!bytes.isEmpty()) bytes.replace ("#000", col.name().toLatin1()); renderer.load (bytes);