summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Sitter <sitter@kde.org>2015-11-24 15:05:36 (GMT)
committerHarald Sitter <sitter@kde.org>2015-11-25 12:01:47 (GMT)
commitce6e43e4f339590772589fda91fc4c5309021604 (patch)
treef4b4743adf33cbdcc66a199f9b4dc4b848926e91
parentd318a2ecc6d9268ac0af4ccb82fc2f98df958771 (diff)
turn qt4x11 source mapping into generic mapping
-rw-r--r--src/DebugFinder.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/DebugFinder.cpp b/src/DebugFinder.cpp
index a1ca596..8bf6d03 100644
--- a/src/DebugFinder.cpp
+++ b/src/DebugFinder.cpp
@@ -35,18 +35,29 @@ DebugFinder::DebugFinder(QObject *parent) :
m_backend->init();
}
+struct PackageMapEntryStruct
+{
+ QString src;
+ QString tgt;
+};
+
QApt::Package *DebugFinder::getDbgPkg(QApt::Package *package)
{
if (!package) {
- return 0;
+ return nullptr;
}
- QString srcPkg;
- // TODO: map package names for Qt
- if (package->sourcePackage() == "qt4-x11") {
- srcPkg = "libqt4";
- } else {
- srcPkg = package->sourcePackage();
+ QString srcPkg = package->sourcePackage();
+
+ static const struct { QString src; QString tgt; } sourceMap[] = {
+ { QStringLiteral("qt4-x11"), QStringLiteral("libqt4") },
+ };
+ for (unsigned i = 0; i < sizeof sourceMap / sizeof *sourceMap; ++i) {
+ auto m = sourceMap[i];
+ if (m.src == package->sourcePackage()) {
+ srcPkg = m.tgt;
+ break;
+ }
}
QApt::Package *dbgPkg = 0;
@@ -66,7 +77,8 @@ QApt::Package *DebugFinder::getDbgPkg(QApt::Package *package)
return dbgPkg;
}
- return 0;
+
+ return nullptr;
}
void DebugFinder::find(const QString &file)
@@ -76,7 +88,6 @@ void DebugFinder::find(const QString &file)
}
QApt::Package *package = m_backend->packageForFile(file);
-
QApt::Package *dbgPkg = getDbgPkg(package);
if (!dbgPkg) {
emit foundNoDbgPkg(file);