# # # patch "guitone.pro" # from [f0157effd2dd01ba25b9eb05f7eb2637b511d530] # to [3398f8b8839ebabc995723c11b7878166f5ecb8e] # # patch "res/i18n/guitone_de.ts" # from [08a5e81afec464b691ca3f9ed9b646d40ee2b408] # to [649e71aef7978bb7db4c33620a9977923ff333ab] # # patch "src/Guitone.cpp" # from [53f0f6999f12e2ee3ffb89b6f74acc0dbdcfc753] # to [1a9d4af5358b813497cfab222ae2e857df360c95] # # patch "src/main.cpp" # from [8f6e734d3a814023ea66e767ffc611e536bd7329] # to [e36e3f6a9adf493840944a11b718bf25abe079de] # # patch "src/model/Attributes.cpp" # from [99a5f6a0ae7ff03705241fece2714d36708e9678] # to [aebaba821284e215181dd48f905cca2a112040f7] # # patch "src/model/Certs.cpp" # from [e0b1c11a280650a9e8170c0d5b7ff1988168b796] # to [0158c7df5e847ce46b6b56557ea7647d5b423b52] # # patch "src/model/ContentDiff.cpp" # from [744ac8b8ee03f8cbb890061fd48f9d9c96ec3a24] # to [af2b8ba1408305c6413d2b0900bc9f7d1e76cb3c] # # patch "src/model/GetFile.cpp" # from [05345e2aaf9b1a8ed333ab590da9cadf24da21af] # to [5151a9eccdcf6f92a140dc662d5c845f79484c34] # # patch "src/model/GetRevision.cpp" # from [cbb4647d0b6e8b29fd1943ea473af6a984ff03ce] # to [a953b589dc8091738c22564d6c18ff070eb48211] # # patch "src/model/Inventory.cpp" # from [11326d99834f514d3a2619061715d37d89d9ffbd] # to [8de0c627ef63a50a8d4641fafb59863cf614ea55] # # patch "src/model/InventoryItem.cpp" # from [b63f1a30057e78e09cf0043ef7ee665a7a93954e] # to [439c5422abaf9736f91c1b462d16e200e0e1d721] # # patch "src/model/Keys.cpp" # from [d8a57d13743b4f443bc249db66d09d67da2ded67] # to [9d8302773f28fa012ce8550b4afc166f5318790b] # # patch "src/model/Manifest.cpp" # from [d2f9630459f1cd73b5de8c64efb704a923e4552b] # to [2fbdb523819234d538fa763d4affeb9d81a9af6f] # # patch "src/model/Tags.cpp" # from [8ddf2a8f16672cf70c49dbefdbdd33cd23ae38e6] # to [031fb14119fc2c97d0eee5a32b46e0acff4fbf7b] # # patch "src/model/Toposort.cpp" # from [2433a2796f929d4fe2d46cc72a4d83d92b9d0eca] # to [f2df41ab4bc3950601b11a5614806d707e5df180] # # patch "src/monotone/FileExporter.cpp" # from [0f009d4134447bb847670ccbd8cab2c12b5e9923] # to [69943651783b092d180d1b8c350f1665bed145e4] # # patch "src/monotone/Monotone.cpp" # from [a3f588aa9e112d4eddfa892a14d91fa23cec4ea1] # to [1285419124e2890c245641a81ad25d75a5271ee4] # # patch "src/monotone/MonotoneDelegate.cpp" # from [84dbd3a0dff4a0ffddf39e6a7e25d1735d3b5f14] # to [ad54da748affdc935bcfd2d6cd2f4242ff734a34] # # patch "src/monotone/WorkspaceCommitter.cpp" # from [24c20dd54d53c980f930dc569ffd8ef77838f12d] # to [976aad817f2bb63cbb6c0220e0f30cf6bd8f6517] # # patch "src/monotone/WorkspaceCreator.cpp" # from [6f9f1276279c82fbaa33892c3615f500c103dd7b] # to [3fd1f85c4f61d7665f2986f71279a0873531ada6] # # patch "src/util/BasicIOParser.cpp" # from [b0c5cce7021156332b90b152bca8a07e4ae1a0d5] # to [41c485e6ae2759a0084019bf94663f20b0730949] # # patch "src/util/DebugLog.cpp" # from [48df0a25b859ada3a174c3a8dbf1f98e83c8629d] # to [ebbb4ff026ff490147e9c81f53f3c1b23c82febf] # # patch "src/util/DiffParser.cpp" # from [f7ac523f4b9ade1887d3c5e3debd202e9d34c49e] # to [e98a52a2c7bee64b13376f3cf71b47629a213a7d] # # patch "src/util/Platform.cpp" # from [18fcb3ef0533eea227a1997a1761dd53ef52ff91] # to [ed200bdda30465773d562b61f58477280adb197c] # # patch "src/util/Settings.cpp" # from [23ac3899da46d0555b39a375b966dc69322cdb20] # to [f7018e2041710b4e9759f18b27ac9dab49363956] # # patch "src/util/SignalWaiter.cpp" # from [464b7cd7092c07111abebf3ee114bb955d4dda6d] # to [d9179faf3f72dc87e7de72d6806b1d9618cc1cda] # # patch "src/util/StdioParser.cpp" # from [11abb9ad35cfb907becb27762f3119d2775fb4a8] # to [8717de07c9d5404df76f6e789edda3f5b17d4824] # # patch "src/view/InventoryView.cpp" # from [9ab95e9d6627610fb2567709fb8a912e93eeb281] # to [bb051af5d94c6e995a1b33658b5d529b87b2df95] # # patch "src/view/MainWindow.cpp" # from [2df1db606ed6d15edf3587a46c721bacd2917328] # to [c485c30152a7f43a73d96c33e13054771c5f0250] # # patch "src/view/dialogs/ApplicationUpdate.cpp" # from [eaf85075d1a7efa6517061e099a28b4b90beb22a] # to [657e32e685ffe01b8465d0ac18891348c4ae73b7] # # patch "src/view/dialogs/CheckoutRevision.cpp" # from [d1f8bb32050e9348c9b692e9a028a28a680d1f89] # to [2f1434555459a66f555c07212473d891f4faf3a6] # # patch "src/view/dialogs/Dialog.cpp" # from [961d379997e820b54efd31f638161d2ea84e5558] # to [926c311a65c0a2eeea6cae03256a56b8adbb7087] # # patch "src/view/dialogs/FileDiff.cpp" # from [d50964c71c13049a79af8271ed4a8a0c98112d73] # to [3dae40899816900fb362793fef3deda6d2809e5c] # # patch "src/view/dialogs/KeyManagement.cpp" # from [6bd966da10b90fc08e9f663d44e0e3b0446942de] # to [1a77eaf7d6772c2fca16d0ecc28a3fabcca92131] # # patch "src/view/dialogs/RevisionDiff.cpp" # from [63eb939175650c01c82ce8e7252f88f69c84fc80] # to [c1678eb933d4bffda44ca7fa412d1078172d8104] # # patch "src/view/dialogs/RevisionManifest.cpp" # from [1b26d9455f506e01ea7a6e240ca75f2529d482c9] # to [01451a2aff2dac00dc1026aa90a11c469f41e2e4] # # patch "src/view/dialogs/SelectRevision.cpp" # from [a53559f75c0a42111e1789d2f37a4453eb5522d9] # to [96088db0e2bc3328ff13e1faa50aac6aa7d36ddf] # # patch "src/view/dialogs/UpdateWorkspace.cpp" # from [b0e31a4d3c8e49ac88fcc05ffa27c5203b94a840] # to [1b20d2af62d2df7ba3bcb05062fa7679cf0adbfd] # # patch "src/vocab.h" # from [514f8d7e143232a98175232e2133efe326200cc5] # to [730458ed6d6da5ca10f18524006a99fdf60f1830] # ============================================================ --- guitone.pro f0157effd2dd01ba25b9eb05f7eb2637b511d530 +++ guitone.pro 3398f8b8839ebabc995723c11b7878166f5ecb8e @@ -1,11 +1,11 @@ # # Common configuration # -GUITONE_VERSION = "0.6" +GUITONE_VERSION = "0.6.1" TEMPLATE = app TARGET = guitone -CONFIG += qt debug +CONFIG = qt release !macx { QT += xml network } @@ -155,9 +155,6 @@ DEFINES += GUITONE_VERSION=\\\"$${GU DEFINES += GUITONE_VERSION=\\\"$${GUITONE_VERSION}\\\" -CONFIG(debug) : DEFINES += DEBUG - - PRECOMPILED_HEADER = src/stable.h # is that needed? ============================================================ --- res/i18n/guitone_de.ts 08a5e81afec464b691ca3f9ed9b646d40ee2b408 +++ res/i18n/guitone_de.ts 649e71aef7978bb7db4c33620a9977923ff333ab @@ -722,72 +722,72 @@ In jedem Fall sollte der derzeitige Arbe InventoryItem - + File Datei - + Status Status - + Rename Source Quelle für Umbenennen - + Rename Target Ziel für Umbenennen - + Added hinzugefügt - + Dropped entfernt - + Missing fehlend - + Unchanged unverändert - + Unknown unbekannt - + Ignored ignoriert - + Modified verändert - + Additional info Zusätzliche Informationen - + new name: %1 neuer Name: %1 - + old name: %1 alter Name: %1 ============================================================ --- src/Guitone.cpp 53f0f6999f12e2ee3ffb89b6f74acc0dbdcfc753 +++ src/Guitone.cpp 1a9d4af5358b813497cfab222ae2e857df360c95 @@ -138,7 +138,7 @@ bool Guitone::init() if (Settings::getBool("CheckForUpdates", true)) { #ifdef Q_WS_MACX - //CocoaUtil::initialize(); + CocoaUtil::initialize(); #else updateDialog = new ApplicationUpdate(NULL); if (updateDialog->updateAvailable()) @@ -187,8 +187,8 @@ Guitone::~Guitone() Guitone::~Guitone() { - Q_ASSERT(openWindows.size() == 0); - Q_ASSERT(monotoneInstances.size() == 0); + I(openWindows.size() == 0); + I(monotoneInstances.size() == 0); if (updateDialog) delete updateDialog; } @@ -312,16 +312,16 @@ MainWindow * Guitone::addWindow() openWindows.append(wnd); - D(QString("Added window %1").arg((int)wnd)); + D(QString("Added window %1").arg((qint64)wnd)); return wnd; } void Guitone::removeWindow(MainWindow * wnd) { - Q_ASSERT(wnd); + I(wnd); - D(QString("Removing window %1").arg((int)wnd)); + D(QString("Removing window %1").arg((qint64)wnd)); int i = openWindows.indexOf(wnd); if (i == -1) return; @@ -408,7 +408,7 @@ bool Guitone::addMonotoneInstance(MainWi bool Guitone::addMonotoneInstance(MainWindow * wnd) { - Q_ASSERT(wnd); + I(wnd); Monotone * mtn = new Monotone(wnd); @@ -441,20 +441,20 @@ bool Guitone::addMonotoneInstance(MainWi monotoneInstances.insert(wnd, mtn); - D(QString("Added monotone instance %1 for %2").arg((int)mtn).arg((int)wnd)); + D(QString("Added monotone instance %1 for %2").arg((qint64)mtn).arg((qint64)wnd)); return true; } bool Guitone::removeMonotoneInstance(MainWindow * wnd) { - Q_ASSERT(wnd); + I(wnd); if (!monotoneInstances.contains(wnd)) return false; Monotone * mtn = monotoneInstances.value(wnd); - D(QString("Removing monotone instance %1 for %2").arg((int)mtn).arg((int)wnd)); + D(QString("Removing monotone instance %1 for %2").arg((qint64)mtn).arg((qint64)wnd)); delete mtn; monotoneInstances.remove(wnd); @@ -470,7 +470,7 @@ MainWindow * Guitone::findMainWindow(QOb obj = obj->parent(); } while (obj); - Q_ASSERT(obj); + I(obj); MainWindow * wnd = qobject_cast(obj); return wnd; } @@ -478,8 +478,8 @@ Monotone * Guitone::getMonotoneInstance( Monotone * Guitone::getMonotoneInstance(QObject * obj) { MainWindow * wnd = findMainWindow(obj); - Q_ASSERT(wnd); - Q_ASSERT(monotoneInstances.contains(wnd)); + I(wnd); + I(monotoneInstances.contains(wnd)); return monotoneInstances.value(wnd); } ============================================================ --- src/main.cpp 8f6e734d3a814023ea66e767ffc611e536bd7329 +++ src/main.cpp e36e3f6a9adf493840944a11b718bf25abe079de @@ -55,8 +55,8 @@ int main(int argc, char** argv) if (!translator.load(transFileName, ":/i18n")) { - qWarning("Guitone::Guitone: Couldn't load translation file " - "for %s - using default", qPrintable(locale)); + W(QString("Couldn't load translation file for %1 - using default") + .arg(locale)); } Guitone app(argc, argv); ============================================================ --- src/model/Attributes.cpp 99a5f6a0ae7ff03705241fece2714d36708e9678 +++ src/model/Attributes.cpp aebaba821284e215181dd48f905cca2a112040f7 @@ -53,13 +53,13 @@ bool Attributes::readAttributes(const QM if (item->isRootDirectory() || item->isCdUp()) { - qDebug("Attributes::readAttributes: item is pseudo item (root or cdup)"); + D("item is pseudo item (root or cdup)"); return false; } if (item->hasStatus(InventoryItem::Dropped) || !item->isTracked()) { - qDebug("Attributes::readAttributes: item is not tracked or dropped"); + D("item is not tracked or dropped"); return false; } @@ -73,7 +73,7 @@ void Attributes::parseOutput() void Attributes::parseOutput() { BasicIOParser parser(AutomateCommand::data); - Q_ASSERT(parser.parse()); + I(parser.parse()); StanzaList list = parser.getStanzas(); for (int i=0, size = list.size(); i < size; ++i) @@ -92,11 +92,11 @@ void Attributes::parseOutput() { if (entry.sym != "format_version") { - qWarning("Attributes::parseOutput(): First entry in first stanza should be used format version."); + W("First entry in first stanza should be used format version."); } else if (entry.vals.at(0) != "1") { - qWarning("Attributes::parseOutput(): Format version is unequal to '1' - newer interface version?"); + W("Format version is unequal to '1' - newer interface version?"); } break; } @@ -108,7 +108,7 @@ void Attributes::parseOutput() if (entry.sym == "attr") { - Q_ASSERT(entry.vals.size() == 2); + I(entry.vals.size() == 2); attr.key = entry.vals.at(0); attr.value = entry.vals.at(1); continue; @@ -116,7 +116,7 @@ void Attributes::parseOutput() if (entry.sym == "state") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); QString state = entry.vals.at(0); if (state == "added") attr.state = Attribute::Added; @@ -124,14 +124,11 @@ void Attributes::parseOutput() else if (state == "changed") attr.state = Attribute::Changed; else if (state == "unchanged") attr.state = Attribute::Unchanged; else - qWarning( - "Attributes::parseOutput(): Unknown attribute state '%s'.", - qPrintable(state) - ); - + W(QString("Unknown attribute state '%1'.").arg(state)); + continue; } - qWarning("Attributes::parseOutput(): Unknown symbol %s.", qPrintable(entry.sym)); + W(QString("Unknown symbol %1.").arg(entry.sym)); } // check if we really processed an item entry ============================================================ --- src/model/Certs.cpp e0b1c11a280650a9e8170c0d5b7ff1988168b796 +++ src/model/Certs.cpp 0158c7df5e847ce46b6b56557ea7647d5b423b52 @@ -54,7 +54,7 @@ void Certs::parseOutput() void Certs::parseOutput() { BasicIOParser parser(AutomateCommand::data); - Q_ASSERT(parser.parse()); + I(parser.parse()); StanzaList list = parser.getStanzas(); for (int i=0, size = list.size(); i < size; ++i) @@ -76,59 +76,53 @@ void Certs::parseOutput() if (entry.sym == "key") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); cert.key = entry.vals.at(0); continue; } if (entry.sym == "name") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); cert.name = entry.vals.at(0); continue; } if (entry.sym == "value") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); cert.value = entry.vals.at(0); continue; } if (entry.sym == "signature") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); QString sig = entry.vals.at(0); if (sig == "ok") cert.signature = Cert::Ok; else if (sig == "bad") cert.signature = Cert::Bad; else if (sig == "unknown") cert.signature = Cert::Unknown; else - qWarning( - "Certs::parseOutput(): Unknown cert signature state '%s'.", - qPrintable(sig) - ); - + W(QString("Unknown cert signature state '%1'.").arg(sig)); + continue; } if (entry.sym == "trust") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); QString trust = entry.vals.at(0); if (trust == "trusted") cert.trust = Cert::Trusted; else if (trust == "untrusted") cert.trust = Cert::Untrusted; else - qWarning( - "Certs::parseOutput(): Unknown cert trust '%s'.", - qPrintable(trust) - ); + W(QString("Unknown cert trust '%1'.").arg(trust)); continue; } - qWarning("Certs::parseOutput(): Unknown symbol %s.", qPrintable(entry.sym)); + W(QString("Unknown symbol %1.").arg(entry.sym)); } // check if we really processed an item entry ============================================================ --- src/model/ContentDiff.cpp 744ac8b8ee03f8cbb890061fd48f9d9c96ec3a24 +++ src/model/ContentDiff.cpp af2b8ba1408305c6413d2b0900bc9f7d1e76cb3c @@ -158,7 +158,7 @@ QVariant ContentDiff::data(const QModelI case 1: return QVariant(line->secondColumn); } - Q_ASSERT(false); + I(false); } if (role == Qt::FontRole && col == 1) ============================================================ --- src/model/GetFile.cpp 05345e2aaf9b1a8ed333ab590da9cadf24da21af +++ src/model/GetFile.cpp 5151a9eccdcf6f92a140dc662d5c845f79484c34 @@ -71,7 +71,7 @@ void GetFile::parseOutput() if (rx.indexIn(AutomateCommand::data) != -1) { // FIXME: signal this anywhere... - qDebug("GetFile::parseOutput: File is binary"); + W("File is binary"); return; } @@ -116,7 +116,7 @@ void GetFile::applyDiff(Diff * diff) continue; } - Q_ASSERT(line->state == DiffLine::Added); + I(line->state == DiffLine::Added); fileContents.insert( lineStart - 1, @@ -153,7 +153,7 @@ QVariant GetFile::data(const QModelIndex { case 0: return QVariant(row + 1); case 1: return QVariant(line->content); - default: Q_ASSERT(false); + default: I(false); } } else ============================================================ --- src/model/GetRevision.cpp cbb4647d0b6e8b29fd1943ea473af6a984ff03ce +++ src/model/GetRevision.cpp a953b589dc8091738c22564d6c18ff070eb48211 @@ -55,7 +55,7 @@ void GetRevision::parseOutput() void GetRevision::parseOutput() { BasicIOParser parser(AutomateCommand::data); - Q_ASSERT(parser.parse()); + I(parser.parse()); StanzaList list = parser.getStanzas(); QString currentRevision; @@ -74,25 +74,25 @@ void GetRevision::parseOutput() { if (entry.sym != "format_version") { - qWarning("GetRevision::parseOutput(): First entry in first stanza should be used format version."); + W("First entry in first stanza should be used format version."); } else if (entry.vals.at(0) != "1") { - qWarning("GetRevision::parseOutput(): Format version is unequal to '1' - newer interface version?"); + W("Format version is unequal to '1' - newer interface version?"); } break; } if (j == 0 && entry.sym == "new_manifest") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); revision.new_manifest = entry.vals.at(0); break; } if (entry.sym == "old_revision") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); currentRevision = entry.vals.at(0); QList changelist; revision.changesAgainstParent.insert(currentRevision, changelist); @@ -103,7 +103,7 @@ void GetRevision::parseOutput() if (entry.sym == "delete") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); change.type = Delete; change.stanza = stanza; break; @@ -111,7 +111,7 @@ void GetRevision::parseOutput() if (entry.sym == "rename") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); change.type = Rename; change.stanza = stanza; break; @@ -119,7 +119,7 @@ void GetRevision::parseOutput() if (entry.sym == "add_dir") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); change.type = AddDir; change.stanza = stanza; break; @@ -127,7 +127,7 @@ void GetRevision::parseOutput() if (entry.sym == "add_file") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); change.type = AddFile; change.stanza = stanza; break; @@ -135,7 +135,7 @@ void GetRevision::parseOutput() if (entry.sym == "patch") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); change.type = Patch; change.stanza = stanza; break; @@ -143,7 +143,7 @@ void GetRevision::parseOutput() if (entry.sym == "clear") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); change.type = AttrClear; change.stanza = stanza; break; @@ -151,7 +151,7 @@ void GetRevision::parseOutput() if (entry.sym == "set") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); change.type = AttrSet; change.stanza = stanza; break; @@ -159,12 +159,12 @@ void GetRevision::parseOutput() found_change = false; - qWarning("GetRevision::parseOutput(): Unknown symbol %s.", qPrintable(entry.sym)); + W(QString("Unknown symbol %1.").arg(entry.sym)); } // check if we really processed an item entry if (!found_change) continue; - Q_ASSERT(revision.changesAgainstParent.contains(currentRevision)); + I(revision.changesAgainstParent.contains(currentRevision)); revision.changesAgainstParent[currentRevision].append(change); } @@ -200,7 +200,7 @@ QVariant GetRevision::data(const QModelI { case 0: return QVariant(change.getTypeString()); case 1: return QVariant(change.getDisplayData()); - default: Q_ASSERT(false); + default: I(false); } } else @@ -262,7 +262,7 @@ QModelIndex GetRevision::index(int row, if (row >= revision.changesAgainstParent[changesAgainstParent].size()) return QModelIndex(); - return createIndex(row, column, NULL); + return createIndex(row, column); } QModelIndex GetRevision::parent(const QModelIndex& index) const ============================================================ --- src/model/Inventory.cpp 11326d99834f514d3a2619061715d37d89d9ffbd +++ src/model/Inventory.cpp 8de0c627ef63a50a8d4641fafb59863cf614ea55 @@ -317,7 +317,7 @@ bool Inventory::parseInventoryLine( { if (regex->indexIn(inputString) == -1) { - qWarning("Couldn't parse inventory line %s", qPrintable(inputString)); + W(QString("Couldn't parse inventory line %1").arg(inputString)); return false; } @@ -336,7 +336,7 @@ bool Inventory::parseInventoryLine( else if (list[1].compare(" ") != 0) { - qWarning("Unknown status first tripel %s", qPrintable(list[1])); + W(QString("Unknown status first tripel %1").arg(list[1])); } @@ -352,7 +352,7 @@ bool Inventory::parseInventoryLine( else if (list[2].compare(" ") != 0) { - qWarning("Unknown status second tripel %s", qPrintable(list[2])); + W(QString("Unknown status second tripel %1").arg(list[2])); } // the third match @@ -379,10 +379,10 @@ bool Inventory::parseInventoryLine( } else { - qWarning("Unknown status third tripel %s", qPrintable(list[3])); + W(QString("Unknown status third tripel %1").arg(list[3])); } - Q_ASSERT(InventoryItem::ValidStates.contains(status)); + I(InventoryItem::ValidStates.contains(status)); // now determine if the file has been renamed from_id = list[4].toInt(); ============================================================ --- src/model/InventoryItem.cpp b63f1a30057e78e09cf0043ef7ee665a7a93954e +++ src/model/InventoryItem.cpp 439c5422abaf9736f91c1b462d16e200e0e1d721 @@ -19,6 +19,7 @@ ***************************************************************************/ #include "InventoryItem.h" +#include "vocab.h" #include #include @@ -193,7 +194,7 @@ QString InventoryItem::getRelativePath(c QString InventoryItem::getRelativePath(const QString & part) const { int partLen = part.length(); - Q_ASSERT(path.left(partLen).compare(part) == 0); + I(path.left(partLen).compare(part) == 0); return path.right(path.length() - partLen); } @@ -302,14 +303,14 @@ QString InventoryItem::getRenameInfo() c if (hasStatus(RenamedFrom)) { InventoryItem * item = getRenamedTo(); - Q_ASSERT(item); + I(item); strings << tr("new name: %1").arg(item->getPath()); } if (hasStatus(RenamedTo)) { InventoryItem * item = getRenamedFrom(); - Q_ASSERT(item); + I(item); strings << tr("old name: %1").arg(item->getPath()); } return strings.join(", "); ============================================================ --- src/model/Keys.cpp d8a57d13743b4f443bc249db66d09d67da2ded67 +++ src/model/Keys.cpp 9d8302773f28fa012ce8550b4afc166f5318790b @@ -49,7 +49,7 @@ void Keys::parseOutput() void Keys::parseOutput() { BasicIOParser parser(AutomateCommand::data); - Q_ASSERT(parser.parse()); + I(parser.parse()); StanzaList list = parser.getStanzas(); for (int i=0, size = list.size(); i < size; ++i) @@ -70,21 +70,21 @@ void Keys::parseOutput() if (entry.sym == "name") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); key.name = entry.vals.at(0); continue; } if (entry.sym == "public_hash") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); key.public_hash = entry.vals.at(0); continue; } if (entry.sym == "private_hash") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); key.private_hash = entry.vals.at(0); continue; } @@ -105,10 +105,7 @@ void Keys::parseOutput() continue; } - qWarning( - "Keys::parseOutput(): Unknown key location '%s'.", - qPrintable(entry.vals.at(k)) - ); + W(QString("Unknown key location '%1'.").arg(entry.vals.at(k))); } continue; } @@ -129,15 +126,12 @@ void Keys::parseOutput() continue; } - qWarning( - "Keys::parseOutput(): Unknown key location '%s'.", - qPrintable(entry.vals.at(k)) - ); + W(QString("Unknown key location '%1'.").arg(entry.vals.at(k))); } continue; } - qWarning("Keys::parseOutput(): Unknown symbol %s.", qPrintable(entry.sym)); + W(QString("Unknown symbol %1.").arg(entry.sym)); } // check if we really processed an item entry ============================================================ --- src/model/Manifest.cpp d2f9630459f1cd73b5de8c64efb704a923e4552b +++ src/model/Manifest.cpp 2fbdb523819234d538fa763d4affeb9d81a9af6f @@ -48,7 +48,7 @@ void Manifest::parseOutput() void Manifest::parseOutput() { BasicIOParser parser(AutomateCommand::data); - Q_ASSERT(parser.parse()); + I(parser.parse()); StanzaList list = parser.getStanzas(); QMap directoryMap; @@ -69,18 +69,18 @@ void Manifest::parseOutput() mEntry = new ManifestEntry(); } - Q_ASSERT(mEntry); + I(mEntry); if (entry.sym == "dir") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); mEntry->path = entry.vals.at(0); mEntry->is_directory = true; // check if this is the root entry if (mEntry->path == "") { - Q_ASSERT(!root); + I(!root); root = mEntry; } @@ -89,7 +89,7 @@ void Manifest::parseOutput() if (entry.sym == "file") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); mEntry->path = entry.vals.at(0); mEntry->is_directory = false; } @@ -104,7 +104,7 @@ void Manifest::parseOutput() { basePath = mEntry->path.left(pos); } - Q_ASSERT(directoryMap.contains(basePath)); + I(directoryMap.contains(basePath)); ManifestEntry * parent = directoryMap.value(basePath); mEntry->parent = parent; parent->children.append(mEntry); @@ -114,23 +114,23 @@ void Manifest::parseOutput() if (entry.sym == "content") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); mEntry->hash = entry.vals.at(0); continue; } if (entry.sym == "attr") { - Q_ASSERT(entry.vals.size() == 2); + I(entry.vals.size() == 2); mEntry->attributes.insert(entry.vals.at(0), entry.vals.at(1)); continue; } - qWarning("Manifest::parseOutput(): Unknown symbol %s.", qPrintable(entry.sym)); + W(QString("Unknown symbol %1.").arg(entry.sym)); } } - Q_ASSERT(root); + I(root); // reset any connected view(s) reset(); ============================================================ --- src/model/Tags.cpp 8ddf2a8f16672cf70c49dbefdbdd33cd23ae38e6 +++ src/model/Tags.cpp 031fb14119fc2c97d0eee5a32b46e0acff4fbf7b @@ -52,7 +52,7 @@ void Tags::parseOutput() tags->clear(); BasicIOParser parser(AutomateCommand::data); - Q_ASSERT(parser.parse()); + I(parser.parse()); StanzaList list = parser.getStanzas(); for (int i=0, size = list.size(); i < size; ++i) @@ -74,21 +74,21 @@ void Tags::parseOutput() if (entry.sym == "tag") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); tag.name = entry.vals.at(0); continue; } if (entry.sym == "revision") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); tag.revision = entry.vals.at(0); continue; } if (entry.sym == "signer") { - Q_ASSERT(entry.vals.size() == 1); + I(entry.vals.size() == 1); tag.signer = entry.vals.at(0); continue; } @@ -99,7 +99,7 @@ void Tags::parseOutput() continue; } - qWarning("Tags::parseOutput(): Unknown symbol %s.", qPrintable(entry.sym)); + W(QString("Unknown symbol %1.").arg(entry.sym)); } // check if we really processed an item entry ============================================================ --- src/model/Toposort.cpp 2433a2796f929d4fe2d46cc72a4d83d92b9d0eca +++ src/model/Toposort.cpp f2df41ab4bc3950601b11a5614806d707e5df180 @@ -64,7 +64,7 @@ bool Toposort::lessThan(const QModelInde if (!ordRevisions->contains(leftRev) || !ordRevisions->contains(leftRev)) { - qDebug("Toposort::lessThan: one or both revisions not found,"); + D("One or both revisions not found."); return false; } @@ -92,7 +92,7 @@ void Toposort::sortModel() QModelIndex current = sourceModel()->index(row,0); if (!current.isValid()) { - qDebug("Toposort::sortModel: no items found in source model"); + D("No items found in source model"); return; } @@ -116,7 +116,7 @@ void Toposort::sortModel() if (!mtnDelegate->triggerCommand(cmd)) { - qDebug("Toposort::sortModel: cannot trigger toposort command"); + D("Cannot trigger toposort command"); } } @@ -132,7 +132,7 @@ void Toposort::parseOutput() filterChanged(); clear(); - qDebug("Toposort:parseOutput: sorting finished"); + D("Sorting finished"); // signal that we've finished (whoever listens to that) emit sortingFinished(); ============================================================ --- src/monotone/FileExporter.cpp 0f009d4134447bb847670ccbd8cab2c12b5e9923 +++ src/monotone/FileExporter.cpp 69943651783b092d180d1b8c350f1665bed145e4 @@ -28,7 +28,7 @@ FileExporter::FileExporter(QObject * par : QObject(parent), revision(rev) { rootDir = dir; - Q_ASSERT(rootDir.exists()); + I(rootDir.exists()); } FileExporter::~FileExporter() @@ -102,7 +102,7 @@ bool FileExporter::exportFile(const File return false; } - Q_ASSERT(file.write(mtn->getRawData(commandNumber))); + I(file.write(mtn->getRawData(commandNumber))); file.close(); return true; ============================================================ --- src/monotone/Monotone.cpp a3f588aa9e112d4eddfa892a14d91fa23cec4ea1 +++ src/monotone/Monotone.cpp 1285419124e2890c245641a81ad25d75a5271ee4 @@ -211,7 +211,7 @@ bool Monotone::setupNewProcess() bool Monotone::setupNewProcess() { - Q_ASSERT(mtnBinaryPath.size() > 0); + I(mtnBinaryPath.size() > 0); shutdownCurrentProcess(); @@ -433,7 +433,7 @@ int Monotone::writeStdin(const ByteArray if (options.size() > 0) { // currently mtn can only understand key => value option pairs - Q_ASSERT(options.size() % 2 == 0); + I(options.size() % 2 == 0); streamCmdLine << "o"; for (int i=0, c=options.size(); i 0); + I(command.size() > 0); streamCmdLine << "l"; for (int i=0, c=command.size(); i(cmdModel); - Q_ASSERT(obj); + I(obj); Monotone * mtn = MTN(obj); connect( @@ -56,7 +56,7 @@ void MonotoneDelegate::commandFinished() void MonotoneDelegate::commandFinished() { QObject * obj = dynamic_cast(cmdModel); - Q_ASSERT(obj); + I(obj); Monotone * mtn = MTN(obj); // check if this is the command which is interesting for us @@ -79,7 +79,7 @@ void MonotoneDelegate::commandFinished() { if (!cmdModel->handleError(returnCode)) { - qCritical("MonotoneDelegate::commandFinished: couldn't handle error %d", returnCode); + C(QString("Couldn't handle error %1").arg(returnCode)); } } @@ -94,7 +94,7 @@ QString MonotoneDelegate::getBaseWorkspa if (!mtn->executeCommand(QStringList() << "get_base_revision_id", commandNumber) || mtn->getReturnCode(commandNumber) > 0) { - qWarning("Could not execute get_base_revision_id"); + W("Could not execute get_base_revision_id"); return false; } @@ -114,8 +114,7 @@ QString MonotoneDelegate::getOption(QObj if (mtn->getReturnCode(cmdNum) > 0) { - qCritical("Couldn't retrieve option %s: %s", - qPrintable(opt), qPrintable(data)); + C(QString("Couldn't retrieve option %1: %2").arg(opt).arg(data)); return QString(); } @@ -166,8 +165,7 @@ QStringList MonotoneDelegate::resolveSel if (mtn->getReturnCode(cmdNum) > 0) { - qCritical("Couldn't resolve selector %s: %s", - qPrintable(selector), qPrintable(data)); + C(QString("Couldn't resolve selector %1: %2").arg(selector).arg(data)); return QStringList(); } @@ -187,15 +185,14 @@ RevisionCerts MonotoneDelegate::getRevis if (mtn->getReturnCode(cmdNum) > 0) { - qCritical("Couldn't query revision certs for %s: %s", - qPrintable(revision), qPrintable(data)); + C(QString("Couldn't query revision certs for %1: %2").arg(revision).arg(data)); return certs; } BasicIOParser parser(data); if (!parser.parse()) { - qCritical("Could not parse basic_io."); + C("Could not parse basic_io."); return certs; } @@ -216,7 +213,7 @@ RevisionCerts MonotoneDelegate::getRevis cert.second = en.vals.at(0); } } - Q_ASSERT(!cert.first.isEmpty() && !cert.second.isEmpty()); + I(!cert.first.isEmpty() && !cert.second.isEmpty()); certs.append(cert); } return certs; @@ -233,7 +230,7 @@ QString MonotoneDelegate::getDatabaseFil path = getOption(obj, "database"); } - Q_ASSERT(!path.isEmpty()); + I(!path.isEmpty()); return path; } @@ -249,15 +246,14 @@ FileEntryList MonotoneDelegate::getRevis if (mtn->getReturnCode(cmdNum) > 0) { - qCritical("Couldn't query manifest entries for %s: %s", - qPrintable(revision), qPrintable(data)); + C(QString("Couldn't query manifest entries for %1: %2").arg(revision).arg(data)); return entries; } BasicIOParser parser(data); if (!parser.parse()) { - qCritical("Could not parse basic_io."); + C("Could not parse basic_io."); return entries; } @@ -270,7 +266,7 @@ FileEntryList MonotoneDelegate::getRevis FileEntry entry; entry.first = en.vals.at(0); - Q_ASSERT(en.sym == "dir" || en.sym == "file"); + I(en.sym == "dir" || en.sym == "file"); entry.second = en.sym == "dir"; entries.append(entry); @@ -292,14 +288,14 @@ QStringList MonotoneDelegate::getPrivate if (mtn->getReturnCode(cmdNum) > 0) { - qCritical("Couldn't query keys: %s", qPrintable(data)); + C(QString("Couldn't query keys: %1").arg(data)); return keys; } BasicIOParser parser(data); if (!parser.parse()) { - qCritical("Could not parse basic_io."); + C("Could not parse basic_io."); return keys; } @@ -317,7 +313,7 @@ QStringList MonotoneDelegate::getPrivate if (en.sym == "private_location") { - Q_ASSERT(!lastKey.isEmpty()); + I(!lastKey.isEmpty()); keys.append(lastKey); break; } ============================================================ --- src/monotone/WorkspaceCommitter.cpp 24c20dd54d53c980f930dc569ffd8ef77838f12d +++ src/monotone/WorkspaceCommitter.cpp 976aad817f2bb63cbb6c0220e0f30cf6bd8f6517 @@ -39,7 +39,7 @@ WorkspaceCommitter::WorkspaceCommitter(Q QDateTime::currentDateTime().toUTC().toString(Qt::ISODate)); workspaceDir = QDir(MTN(this)->getNormalizedWorkspacePath()); - Q_ASSERT(workspaceDir.exists()); + I(workspaceDir.exists()); } WorkspaceCommitter::~WorkspaceCommitter() @@ -99,7 +99,7 @@ bool WorkspaceCommitter::run() if (isPatch && en.sym == "from") { - Q_ASSERT(!pair.first.isEmpty()); + I(!pair.first.isEmpty()); pair.second = en.vals.at(0); fileChanges.append(pair); break; ============================================================ --- src/monotone/WorkspaceCreator.cpp 6f9f1276279c82fbaa33892c3615f500c103dd7b +++ src/monotone/WorkspaceCreator.cpp 3fd1f85c4f61d7665f2986f71279a0873531ada6 @@ -87,7 +87,7 @@ bool WorkspaceCreator::run() return false; } - Q_ASSERT(rootDir.cd("_MTN")); + I(rootDir.cd("_MTN")); // _MTN/revision QFile revfile(rootDir.filePath("revision")); @@ -99,7 +99,7 @@ bool WorkspaceCreator::run() QString rev = QString("format_version \"1\"\n\n" "new_manifest [0000000000000000000000000000000000000000]\n\n" "old_revision [%1]\n").arg(revision); - Q_ASSERT(revfile.write(rev.toLatin1())); + I(revfile.write(rev.toLatin1())); revfile.close(); // _MTN/format @@ -109,7 +109,7 @@ bool WorkspaceCreator::run() C("Can't open format for writing"); return false; } - Q_ASSERT(formatfile.write(QString("2\n").toLatin1())); + I(formatfile.write(QString("2\n").toLatin1())); formatfile.close(); // _MTN/log (initally empty) @@ -133,11 +133,11 @@ bool WorkspaceCreator::run() QString options = QString("database \"%1\"\nbranch \"%2\"\n") .arg(MonotoneDelegate::getDatabaseFilePath(this)) .arg(selectedBranch); - Q_ASSERT(optfile.write(options.toLatin1())); + I(optfile.write(options.toLatin1())); optfile.close(); // change back to the root dir - Q_ASSERT(rootDir.cdUp()); + I(rootDir.cdUp()); return FileExporter::run(entries); } ============================================================ --- src/util/BasicIOParser.cpp b0c5cce7021156332b90b152bca8a07e4ae1a0d5 +++ src/util/BasicIOParser.cpp 41c485e6ae2759a0084019bf94663f20b0730949 @@ -19,6 +19,7 @@ ***************************************************************************/ #include "BasicIOParser.h" +#include "vocab.h" BasicIOParser::BasicIOParser(const QString & input) : AbstractParser(input) {} @@ -47,7 +48,7 @@ Stanza BasicIOParser::getStanza() entry.sym = getSymbol(); if (entry.sym.size() == 0) { - qWarning("BasicIOParser::getStanza(): Couldn't get symbol."); + W("Couldn't get symbol."); } QString hash(getHash()); // was this a hash? @@ -75,7 +76,7 @@ Stanza BasicIOParser::getStanza() char cur = getNext(); if (cur != '\n') { - qWarning("BasicIOParser::getStanza(): expected '\\n', got '%c'", cur); + W(QString("Expected '\\n', got '%1'").arg(cur)); } } @@ -113,7 +114,7 @@ QString BasicIOParser::getValue() while (true) { char cur = getNext(); - Q_ASSERT(cur != '\0'); + I(cur != '\0'); // string end? if (cur == '"' && last != '\\') break; last = cur; @@ -150,7 +151,7 @@ QString BasicIOParser::getHash() } else { - qWarning("BasicIOParser::getHash(): expected ], got %c", ch); + W(QString("Expected ], got '%1'").arg(ch)); } return ret; } ============================================================ --- src/util/DebugLog.cpp 48df0a25b859ada3a174c3a8dbf1f98e83c8629d +++ src/util/DebugLog.cpp ebbb4ff026ff490147e9c81f53f3c1b23c82febf @@ -97,7 +97,7 @@ void DebugLog::log(Type t, QString msg) errors[2] = "warning"; errors[3] = "debug"; - // do not use Q_ASSERT here since this calls qFatal and results in + // do not use I here since this calls qFatal and results in // an endless loop assert(t <= errors.size()); ============================================================ --- src/util/DiffParser.cpp f7ac523f4b9ade1887d3c5e3debd202e9d34c49e +++ src/util/DiffParser.cpp e98a52a2c7bee64b13376f3cf71b47629a213a7d @@ -19,6 +19,7 @@ ***************************************************************************/ #include "DiffParser.h" +#include "vocab.h" #include #include @@ -53,7 +54,7 @@ void DiffParser::parse(const QString & i for (int i=0, s=lines.size(); i 0); + I(line.length() > 0); QChar curChar = line.at(0); // @@ -61,7 +62,7 @@ void DiffParser::parse(const QString & i // if (curChar == '=') { - Q_ASSERT(i < (s-1)); + I(i < (s-1)); // straightly go to the next line QString nextGroup(lines.at(++i)); @@ -80,7 +81,7 @@ void DiffParser::parse(const QString & i { // then this should be a normal file diff rx = QRegExp("^---\\s([^\\t]+)\\t\\w{40}"); - Q_ASSERT(rx.indexIn(nextGroup) > -1); + I(rx.indexIn(nextGroup) > -1); curFile = rx.cap(1); curDiff->is_binary = false; // skip the next line as we don't care about renames @@ -93,7 +94,7 @@ void DiffParser::parse(const QString & i continue; } - Q_ASSERT(curDiff); + I(curDiff); // // parse hunk lines, setup new hunk object @@ -101,9 +102,9 @@ void DiffParser::parse(const QString & i if (curChar == '@') { QRegExp rx = QRegExp("^@@\\s+\\-(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))\\s+@@"); - Q_ASSERT(rx.indexIn(line) > -1); + I(rx.indexIn(line) > -1); QStringList list = rx.capturedTexts(); - Q_ASSERT(list.size() >= 2); + I(list.size() >= 2); // create a new Hunk curHunk = new DiffHunk(); @@ -125,7 +126,7 @@ void DiffParser::parse(const QString & i continue; } - Q_ASSERT(curHunk); + I(curHunk); DiffLine * diffLine = new DiffLine(); curHunk->lines.push_back(diffLine); @@ -134,13 +135,13 @@ void DiffParser::parse(const QString & i if (curChar == '+') diffLine->state = DiffLine::Added; else if (curChar == '-') diffLine->state = DiffLine::Removed; else if (curChar == ' ') diffLine->state = DiffLine::Unchanged; - else Q_ASSERT(false); + else I(false); } } Diff* DiffParser::getDiff(const QString & filename) { - Q_ASSERT(fileDiffs.contains(filename)); + I(fileDiffs.contains(filename)); return fileDiffs.value(filename); } ============================================================ --- src/util/Platform.cpp 18fcb3ef0533eea227a1997a1761dd53ef52ff91 +++ src/util/Platform.cpp ed200bdda30465773d562b61f58477280adb197c @@ -19,6 +19,7 @@ ***************************************************************************/ #include "Platform.h" +#include "vocab.h" #include @@ -58,7 +59,7 @@ bool Platform::openFile(QWidget *widget, // gives us back (its always 1!) if (system("which kfmclient >/dev/null 2>&1") == 0) { - qDebug("Platform::openFile: using kfmclient"); + D("Using kfmclient"); string s("kfmclient exec \""); s += filename.toUtf8().data(); s += "\""; @@ -69,7 +70,7 @@ bool Platform::openFile(QWidget *widget, else if (system("which gnome-open >/dev/null 2>&1") == 0) { - qDebug("Platform::openFile: using gnome-open"); + D("Using gnome-open"); string s("gnome-open \""); s += filename.toUtf8().data(); s += "\""; @@ -77,7 +78,7 @@ bool Platform::openFile(QWidget *widget, } else { - qDebug("Platform::openFile: neither kfmclient nor gnome-open found"); + C("Neither kfmclient nor gnome-open found"); } #endif @@ -144,7 +145,7 @@ QString Platform::getUsername() username = QString::fromAscii(getenv("USER")); #endif - qDebug("Platform::getUsername: found username %s", qPrintable(username)); + D(QString("Found username %1").arg(username)); return username; } ============================================================ --- src/util/Settings.cpp 23ac3899da46d0555b39a375b966dc69322cdb20 +++ src/util/Settings.cpp f7018e2041710b4e9759f18b27ac9dab49363956 @@ -19,6 +19,7 @@ ***************************************************************************/ #include "Settings.h" +#include "vocab.h" Settings* Settings::instance = 0; @@ -130,7 +131,7 @@ void Settings::restoreHeaderViewState(QH { QStringList parts = cols.at(i).split(":", QString::SkipEmptyParts); - Q_ASSERT(parts.size() == 2); + I(parts.size() == 2); view->resizeSection(i, parts.at(0).toInt()); view->moveSection(view->visualIndex(i), parts.at(1).toInt()); ============================================================ --- src/util/SignalWaiter.cpp 464b7cd7092c07111abebf3ee114bb955d4dda6d +++ src/util/SignalWaiter.cpp d9179faf3f72dc87e7de72d6806b1d9618cc1cda @@ -21,13 +21,15 @@ ***************************************************************************/ #include "SignalWaiter.h" +#include "vocab.h" + #include #include SignalWaiter::SignalWaiter(const QObject* sender, const char* signal) : QObject(0) { - Q_ASSERT(sender && signal); + I(sender && signal); connect(sender, signal, this, SLOT(signalCaught())); } ============================================================ --- src/util/StdioParser.cpp 11abb9ad35cfb907becb27762f3119d2775fb4a8 +++ src/util/StdioParser.cpp 8717de07c9d5404df76f6e789edda3f5b17d4824 @@ -19,6 +19,7 @@ ***************************************************************************/ #include "StdioParser.h" +#include "vocab.h" StdioParser::StdioParser(const QByteArray & input) : AbstractParser(input) {} @@ -28,14 +29,14 @@ bool StdioParser::parse() // chunk format: :::: commandNumber = getNumber(); - Q_ASSERT(getNext() == ':'); + I(getNext() == ':'); errorCode = getNumber(); - Q_ASSERT(getNext() == ':'); + I(getNext() == ':'); chunkType = getNext(); - Q_ASSERT(chunkType == 'm' || chunkType == 'l'); - Q_ASSERT(getNext() == ':'); + I(chunkType == 'm' || chunkType == 'l'); + I(getNext() == ':'); chunkSize = getNumber(); - Q_ASSERT(getNext() == ':'); + I(getNext() == ':'); int charsLeft = input.size(); if (chunkSize > charsLeft) @@ -59,7 +60,7 @@ int StdioParser::getNumber() if (ch < '0' || ch > '9') { // ensure that we've read at least one char - Q_ASSERT(processedChars > 0); + I(processedChars > 0); break; } number *= 10; ============================================================ --- src/view/InventoryView.cpp 9ab95e9d6627610fb2567709fb8a912e93eeb281 +++ src/view/InventoryView.cpp bb051af5d94c6e995a1b33658b5d529b87b2df95 @@ -25,6 +25,7 @@ #include "Monotone.h" #include "FileDiff.h" #include "RevisionDiff.h" +#include "vocab.h" #include "Guitone.h" #include @@ -62,7 +63,7 @@ void InventoryView::setType(Type t) void InventoryView::setType(Type t) { // ensure that a model is already set, otherwise the app crashes - Q_ASSERT(model()); + I(model()); type = t; @@ -111,7 +112,7 @@ void InventoryView::setModel(QAbstractIt // ensure that we only accept sortfilterproxymodels void InventoryView::setModel(QAbstractItemModel * model) { - Q_ASSERT(false); + I(false); } void InventoryView::setModel(QSortFilterProxyModel * newModel) @@ -136,7 +137,8 @@ void InventoryView::delegateModelReset() void InventoryView::delegateModelReset() { // give the view another event cycle to reload the new indices - QTimer::singleShot(0, this, SLOT(modelReset())); + //QTimer::singleShot(0, this, SLOT(modelReset())); + modelReset(); } void InventoryView::modelReset() @@ -144,7 +146,7 @@ void InventoryView::modelReset() QModelIndex index = model()->index(0, 0, QModelIndex()); if (!index.isValid()) { - qCritical("InventoryView::modelReset: index invalid, aborting..."); + C("Index invalid, aborting..."); return; } @@ -162,7 +164,7 @@ void InventoryView::slotContextMenuReque // since not all actions may apply on all items void InventoryView::slotContextMenuRequested(const QModelIndexList & indexList, const QPoint & pos) { - qDebug("Selected indexes: %d", indexList.size()); + D(QString("Selected indexes: %1").arg(indexList.size())); QMenu menu(this); @@ -405,7 +407,7 @@ void InventoryView::slotChdir() { QItemSelectionModel *selectionModel = this->selectionModel(); QList list(selectionModel->selectedIndexes()); - Q_ASSERT(list.size() > 0); + I(list.size() > 0); emit directoryChanged(list[0]); changeDirectory(list[0]); @@ -480,27 +482,27 @@ void InventoryView::slotAdd(void) void InventoryView::slotAdd(void) { - qDebug("InventoryView::slotAdd!!!"); + C("Not implemented."); } void InventoryView::slotRemove(void) { - qDebug("InventoryView::slotRemove!!!"); + C("Not implemented."); } void InventoryView::slotCommit(void) { - qDebug("InventoryView::slotCommit!!!"); + C("Not implemented."); } void InventoryView::slotRevert(void) { - qDebug("InventoryView::slotRevert!!!"); + C("Not implemented."); } void InventoryView::slotRename(void) { - qDebug("InventoryView::slotRename!!!"); + C("Not implemented."); } // @@ -511,12 +513,12 @@ void InventoryView::slotIgnore(void) // void InventoryView::slotIgnore(void) { - qDebug("InventoryView::slotIgnore!!!"); + C("Not implemented."); } void InventoryView::slotUnignore(void) { - qDebug("InventoryView::slotUnignore!!!"); + C("Not implemented."); } void InventoryView::slotFileDiff(void) @@ -528,7 +530,7 @@ void InventoryView::slotFileDiff(void) if (item->isDirectory() || !item->hasStatus(InventoryItem::Patched)) { - qDebug("InventoryView::slotFileDiff: File is a directory or not patched/unknown."); + D("File is a directory or not patched/unknown."); return; } @@ -559,13 +561,13 @@ QModelIndex InventoryView::getSingleSele if (list.size() == 0) { - qDebug("InventoryView::getSingleSelection: No item selected."); + D("No item selected."); return QModelIndex(); } if (list.size() > 1) { - qDebug("InventoryView::getSingleSelection: Multiple items selected, only returning the first."); + D("Multiple items selected, only returning the first."); } if (!mapToSource) return list[0]; ============================================================ --- src/view/MainWindow.cpp 2df1db606ed6d15edf3587a46c721bacd2917328 +++ src/view/MainWindow.cpp c485c30152a7f43a73d96c33e13054771c5f0250 @@ -212,7 +212,7 @@ void MainWindow::closeEvent(QCloseEvent void MainWindow::closeEvent(QCloseEvent * event) { - Q_ASSERT(closeCounter >= 0); + I(closeCounter >= 0); // ignore the close event if there are still open dialog windows if (closeCounter > 0) @@ -290,7 +290,7 @@ void MainWindow::switchMode(Mode m) if (curIdx > 0) { MainWindow * prevWnd = openWindows.at(curIdx - 1); - Q_ASSERT(prevWnd); + I(prevWnd); QDesktopWidget * desk = APP->desktop(); @@ -347,7 +347,7 @@ void MainWindow::switchMode(Mode m) } else { - Q_ASSERT(false); + I(false); } emit modeChanged(mode); @@ -375,7 +375,7 @@ void MainWindow::on_menuShow_triggered(Q // disable any previous action and check the new action entry QList assocWidgets = act->associatedWidgets(); - Q_ASSERT(assocWidgets.size() > 0); + I(assocWidgets.size() > 0); // we assume that this action is only assigned to one widget and that // is the QMenu widget we need to find out all the other actions QList list = assocWidgets[0]->actions(); @@ -649,7 +649,7 @@ void MainWindow::enableClosing() // should be fixed someday... void MainWindow::enableClosing() { - Q_ASSERT(closeCounter > 0); + I(closeCounter > 0); closeCounter--; } ============================================================ --- src/view/dialogs/ApplicationUpdate.cpp eaf85075d1a7efa6517061e099a28b4b90beb22a +++ src/view/dialogs/ApplicationUpdate.cpp 657e32e685ffe01b8465d0ac18891348c4ae73b7 @@ -59,7 +59,7 @@ ApplicationUpdate::ApplicationUpdate(QWi } QDomElement channel = doc.documentElement().firstChild().toElement(); - Q_ASSERT(!channel.isNull()); + I(!channel.isNull()); QDomNodeList items = channel.elementsByTagName("item"); @@ -79,15 +79,15 @@ ApplicationUpdate::ApplicationUpdate(QWi "http://www.andymatuschak.org/xml-namespaces/sparkle", "version", "not-found" ); - Q_ASSERT(version != "not-found"); + I(version != "not-found"); if (Monotone::versionCompare(version, latest.first) > 0) { latest.first = version; QDomNodeList descs = item.elementsByTagName("description"); - Q_ASSERT(descs.size() == 1); + I(descs.size() == 1); QDomElement desc = descs.item(0).toElement(); - Q_ASSERT(!desc.isNull()); + I(!desc.isNull()); latest.second = desc.text(); } } ============================================================ --- src/view/dialogs/CheckoutRevision.cpp d1f8bb32050e9348c9b692e9a028a28a680d1f89 +++ src/view/dialogs/CheckoutRevision.cpp 2f1434555459a66f555c07212473d891f4faf3a6 @@ -228,9 +228,8 @@ void CheckoutRevision::accept() selectedRevisionId = revList.at(0); selectedCheckoutDirectory = checkoutDir; - qDebug("selected %s to be checked out to %s", - qPrintable(selectedRevisionId), - qPrintable(selectedCheckoutDirectory.absolutePath()) + D(QString("Selected %1 to be checked out to %2").arg(selectedRevisionId) + .arg(selectedCheckoutDirectory.absolutePath()) ); done(0); } ============================================================ --- src/view/dialogs/Dialog.cpp 961d379997e820b54efd31f638161d2ea84e5558 +++ src/view/dialogs/Dialog.cpp 926c311a65c0a2eeea6cae03256a56b8adbb7087 @@ -22,6 +22,7 @@ #include "Settings.h" #include "SignalWaiter.h" #include "MainWindow.h" +#include "vocab.h" #include @@ -67,9 +68,9 @@ int Dialog::execDocumentModal() { // ensure that this is only called from top level windows QWidget * parent = parentWidget(); - Q_ASSERT(parent && parent->inherits("QMainWindow")); + I(parent && parent->inherits("QMainWindow")); MainWindow * wnd = qobject_cast(parent); - Q_ASSERT(wnd); + I(wnd); // disable the close button's functionality in the MainWindow wnd->disableClosing(); ============================================================ --- src/view/dialogs/FileDiff.cpp d50964c71c13049a79af8271ed4a8a0c98112d73 +++ src/view/dialogs/FileDiff.cpp 3dae40899816900fb362793fef3deda6d2809e5c @@ -84,12 +84,12 @@ void FileDiff::init(QString fileName) } else { - qDebug("diffWaiter timed out"); + C("diffWaiter timed out"); } } else { - qDebug("fileWaiter timed out"); + C("fileWaiter timed out"); } } ============================================================ --- src/view/dialogs/KeyManagement.cpp 6bd966da10b90fc08e9f663d44e0e3b0446942de +++ src/view/dialogs/KeyManagement.cpp 1a77eaf7d6772c2fca16d0ecc28a3fabcca92131 @@ -134,6 +134,7 @@ void KeyManagement::copyPubkeyDataToClip void KeyManagement::copyPubkeyDataToClipboard() { - qDebug("KeyManagement::copyPubkeyDataToClipboard: stub: no automate pubkey available!"); + // FIXME: no automate pubkey available yet + C("Not implemented"); } ============================================================ --- src/view/dialogs/RevisionDiff.cpp 63eb939175650c01c82ce8e7252f88f69c84fc80 +++ src/view/dialogs/RevisionDiff.cpp c1678eb933d4bffda44ca7fa412d1078172d8104 @@ -69,7 +69,7 @@ void RevisionDiff::init(QString path, QS // FIXME: proper error handling here if (!diffModel->readDiff(path, leftRevision, rightRevision)) { - qDebug("RevisionDiff::init: couldn't execute readDiff"); + C("Couldn't execute readDiff"); done(1); } } ============================================================ --- src/view/dialogs/RevisionManifest.cpp 1b26d9455f506e01ea7a6e240ca75f2529d482c9 +++ src/view/dialogs/RevisionManifest.cpp 01451a2aff2dac00dc1026aa90a11c469f41e2e4 @@ -62,7 +62,7 @@ RevisionManifest::RevisionManifest(QWidg if (!manifestModel->readManifest(revision)) { - qCritical("RevisionManifest: couldn't execute readManifest"); + C("Couldn't execute readManifest"); // FIXME: proper error handling here } } @@ -90,7 +90,7 @@ void RevisionManifest::openFile(const QM if (!mtn->executeCommand(cmd, commandNumber) || mtn->getReturnCode(commandNumber) > 0) { - qCritical("RevisionManifest::openFile: cannot execute get_file"); + C("Cannot execute get_file"); return; } @@ -107,7 +107,7 @@ void RevisionManifest::openFile(const QM QFileInfo path(tempPath); if (!path.isDir() && !QDir().mkpath(tempPath)) { - qCritical("RevisionManifest::openFile: Could not create temporary guitone directory"); + C("Could not create temporary guitone directory"); return; } tempPath.append(QDir::separator()).append(entry->filename()); @@ -117,7 +117,7 @@ void RevisionManifest::openFile(const QM if (!file.open(QIODevice::WriteOnly)) { - qCritical("RevisionManifest::openFile: can't open temporary file for writing"); + C("Can't open temporary file for writing"); return; } ============================================================ --- src/view/dialogs/SelectRevision.cpp a53559f75c0a42111e1789d2f37a4453eb5522d9 +++ src/view/dialogs/SelectRevision.cpp 96088db0e2bc3328ff13e1faa50aac6aa7d36ddf @@ -306,7 +306,7 @@ void SelectRevision::setFirstRevision() void SelectRevision::setFirstRevision() { - Q_ASSERT(currentRevision.size() > 0); + I(currentRevision.size() > 0); if (currentRevision == secondRevision) return; firstRevision = currentRevision; if (secondRevision.size() > 0) showDiff->setEnabled(true); @@ -315,7 +315,7 @@ void SelectRevision::setSecondRevision() void SelectRevision::setSecondRevision() { - Q_ASSERT(currentRevision.size() > 0); + I(currentRevision.size() > 0); if (currentRevision == firstRevision) return; secondRevision = currentRevision; if (firstRevision.size() > 0) showDiff->setEnabled(true); @@ -332,7 +332,7 @@ void SelectRevision::showDiffDialog() void SelectRevision::showDiffDialog() { - Q_ASSERT(firstRevision.size() > 0 && secondRevision.size() > 0); + I(firstRevision.size() > 0 && secondRevision.size() > 0); RevisionDiff dlg(this); dlg.init(".", firstRevision, secondRevision); @@ -347,7 +347,7 @@ void SelectRevision::readCerts(const QMo if (!certsModel->readCerts(rev)) { - qCritical("SelectRevision::readCerts: couldn't read certs for %s", qPrintable(rev)); + C(QString("Couldn't read certs for %1").arg(rev)); } } ============================================================ --- src/view/dialogs/UpdateWorkspace.cpp b0e31a4d3c8e49ac88fcc05ffa27c5203b94a840 +++ src/view/dialogs/UpdateWorkspace.cpp 1b20d2af62d2df7ba3bcb05062fa7679cf0adbfd @@ -167,7 +167,7 @@ void UpdateWorkspace::accept() } selectedRevisionId = revList.at(0); - qDebug("selected %s as update revision", qPrintable(selectedRevisionId)); + D(QString("Selected %1 as update revision").arg(selectedRevisionId)); done(0); } ============================================================ --- src/vocab.h 514f8d7e143232a98175232e2133efe326200cc5 +++ src/vocab.h 730458ed6d6da5ca10f18524006a99fdf60f1830 @@ -17,13 +17,16 @@ class Guitone; #endif */ -#define D(arg) qDebug("%s:%s:%d: %s", __FILE__, __FUNCTION__, __LINE__, qPrintable(QString(arg))) -#ifndef DEBUG +#ifdef QT_NO_DEBUG #define D(arg) void() +#else +#define D(arg) qDebug("%s:%s:%d: %s", __FILE__, __FUNCTION__, __LINE__, qPrintable(QString(arg))) #endif + #define W(arg) qWarning("%s:%s:%d: %s", __FILE__, __FUNCTION__, __LINE__, qPrintable(QString(arg))) #define C(arg) qCritical("%s:%s:%d: %s", __FILE__, __FUNCTION__, __LINE__, qPrintable(QString(arg))) #define F(arg) qFatal("%s:%s:%d: %s", __FILE__, __FUNCTION__, __LINE__, qPrintable(QString(arg))) +#define I(arg) if (!(arg)) qFatal("%s:%s:%d: invariant '"#arg"' violated", __FILE__, __FUNCTION__, __LINE__) // // type definitions