# # # patch "guitone/src/model/Inventory.cpp" # from [1af9a8899413850895713e97f1dbce9bc77840fb] # to [0148aa9cddac6881602f0b5d9cac11b15e2a70a1] # # patch "guitone/src/model/InventoryItem.cpp" # from [9eb81493b6092c46b528a522164a675de9fef054] # to [82987546c67f7ecb2d9e01cb4a5d925b1f83f7d3] # # patch "guitone/src/model/InventoryItem.h" # from [464d95ea5c0e49c0eed7c07353de955bc69ef26f] # to [7ca548cdb224d240876d5cb8654dc2b6548f5c20] # # patch "guitone/src/util/IconProvider.cpp" # from [50ba2d05db08f898c0f401fe1f740ed431f3a8a3] # to [168e44a98258d5faf4aae43c1f10b9fa9676af61] # ============================================================ --- guitone/src/model/Inventory.cpp 1af9a8899413850895713e97f1dbce9bc77840fb +++ guitone/src/model/Inventory.cpp 0148aa9cddac6881602f0b5d9cac11b15e2a70a1 @@ -142,7 +142,6 @@ QList Inventory::buildTr InventoryItem * cdUp = new InventoryItem(true); cdUp->setParent(parentItem); cdUp->setPath(parentPath + QString("/..")); - cdUp->setStatus(parentStatus); items.prepend(cdUp); @@ -360,7 +359,6 @@ bool Inventory::parseInventoryLine( if (list[1].compare(" ") != 0) { qWarning("Unknown status first tripel %s", qPrintable(list[1])); - return false; } @@ -377,7 +375,6 @@ bool Inventory::parseInventoryLine( if (list[2].compare(" ") != 0) { qWarning("Unknown status second tripel %s", qPrintable(list[2])); - return false; } // the third match @@ -396,19 +393,27 @@ bool Inventory::parseInventoryLine( if (list[3].compare("I") == 0) { status |= InventoryItem::Ignored; - } else + } + else + if (list[3].compare(" ") == 0) { - // if nothing is outputted, the file is unchanged status |= InventoryItem::Unchanged; + } + else + { + qWarning("Unknown status third tripel %s", qPrintable(list[3])); } - + + Q_ASSERT(InventoryItem::ValidStates.contains(status)); + // now determine if the file has been renamed from_id = list[4].toInt(); to_id = list[5].toInt(); // remove trailing slash path = list[6].trimmed(); - isDirectory = false; + + isDirectory = false; if (path.endsWith('/')) { isDirectory = true; ============================================================ --- guitone/src/model/InventoryItem.cpp 9eb81493b6092c46b528a522164a675de9fef054 +++ guitone/src/model/InventoryItem.cpp 82987546c67f7ecb2d9e01cb4a5d925b1f83f7d3 @@ -33,6 +33,35 @@ const int InventoryItem::Ignored = 256; const int InventoryItem::Unknown = 128; const int InventoryItem::Ignored = 256; +// +// initialize the array with all 24 valid states (out of 45 possible) +// +const QList InventoryItem::ValidStates = QList() + << InventoryItem::Unchanged // ' ' + << InventoryItem::Patched // ' P' + << InventoryItem::Unknown // ' U' + << InventoryItem::Ignored // ' I' + << InventoryItem::Missing // ' M' + << ( InventoryItem::Added | InventoryItem::Patched ) // ' AP' + << ( InventoryItem::Added | InventoryItem::Missing ) // ' AM' + << ( InventoryItem::RenamedTo | InventoryItem::Unchanged ) // ' R ' + << ( InventoryItem::RenamedTo | InventoryItem::Patched ) // ' RP' + << ( InventoryItem::RenamedTo | InventoryItem::Missing ) // ' RM' + << ( InventoryItem::Dropped | InventoryItem::Unchanged ) // 'D ' + << ( InventoryItem::Dropped | InventoryItem::Unknown ) // 'D U' + << ( InventoryItem::Dropped | InventoryItem::Added | InventoryItem::Patched ) // 'DAP' + << ( InventoryItem::Dropped | InventoryItem::Added | InventoryItem::Missing ) // 'DAM' + << ( InventoryItem::Dropped | InventoryItem::RenamedTo | InventoryItem::Unchanged ) // 'DR ' + << ( InventoryItem::Dropped | InventoryItem::RenamedTo | InventoryItem::Patched ) // 'DRP' + << ( InventoryItem::Dropped | InventoryItem::RenamedTo | InventoryItem::Missing ) // 'DRM' + << ( InventoryItem::RenamedFrom | InventoryItem::Unchanged ) // 'R ' + << ( InventoryItem::RenamedFrom | InventoryItem::Unknown ) // 'R U' + << ( InventoryItem::RenamedFrom | InventoryItem::Added | InventoryItem::Patched ) // 'RAP' + << ( InventoryItem::RenamedFrom | InventoryItem::Added | InventoryItem::Missing ) // 'RAM' + << ( InventoryItem::RenamedFrom | InventoryItem::RenamedTo | InventoryItem::Unchanged )// 'RR ' + << ( InventoryItem::RenamedFrom | InventoryItem::RenamedTo | InventoryItem::Patched ) // 'RRP' + << ( InventoryItem::RenamedFrom | InventoryItem::RenamedTo | InventoryItem::Missing ); // 'RRM' + InventoryItem::InventoryItem(bool isDir /* =false */, bool isRoot /* =false */) { parentItem = this; @@ -263,12 +292,16 @@ QString InventoryItem::getRenameInfo() c QStringList strings; if (hasStatus(RenamedFrom)) { - strings << tr("new name: %1").arg(getRenamedTo()->getPath()); + InventoryItem * item = getRenamedTo(); + Q_ASSERT(item); + strings << tr("new name: %1").arg(item->getPath()); } if (hasStatus(RenamedTo)) { - strings << tr("old name: %1").arg(getRenamedFrom()->getPath()); + InventoryItem * item = getRenamedFrom(); + Q_ASSERT(item); + strings << tr("old name: %1").arg(item->getPath()); } return strings.join(", "); } ============================================================ --- guitone/src/model/InventoryItem.h 464d95ea5c0e49c0eed7c07353de955bc69ef26f +++ guitone/src/model/InventoryItem.h 7ca548cdb224d240876d5cb8654dc2b6548f5c20 @@ -84,6 +84,8 @@ public: static const int Unchanged; static const int Unknown; static const int Ignored; + + static const QList ValidStates; private: QString getItemName(void) const; ============================================================ --- guitone/src/util/IconProvider.cpp 50ba2d05db08f898c0f401fe1f740ed431f3a8a3 +++ guitone/src/util/IconProvider.cpp 168e44a98258d5faf4aae43c1f10b9fa9676af61 @@ -28,8 +28,8 @@ const int IconProvider::CdUp = -1; const int IconProvider::CdUp = -1; /** - * There are 45 possible status combinations, some of them are invalid - * We only provide for a bunch of these own icons + * There are 45 possible status combinations, of which 21 are invalid. + * We only provide for the 24 valid ones own icons * (more info: http://venge.net/monotone/docs/Automation.html#Automation) * * Basic codes @@ -57,52 +57,31 @@ const int IconProvider::CdUp = -1; * ' I': ignored.png * ' M': missing.png * - * ' A ': added.png (invalid) * ' AP': added.png - * ' AU': added.png (invalid) - * ' AI': added.png (invalid?) * ' AM': added_missing.png * * ' R ': rename_target.png * ' RP': rename_target.png - * ' RU': rename_target.png (invalid) - * ' RI': rename_target.png (invalid?) * ' RM': rename_target_missing.png * * 'D ': dropped.png - * 'D P': dropped.png (invalid) * 'D U': dropped_unknown.png - * 'D I': dropped.png (invalid?) - * 'D M': dropped.png (invalid) * - * 'DA ': dropped_added.png (invalid) * 'DAP': dropped_added.png - * 'DAU': dropped_added.png (invalid) - * 'DAI': dropped_added.png (invalid?) * 'DAM': dropped_added_missing.png * * 'DR ': dropped_rename_target.png * 'DRP': dropped_rename_target.png - * 'DRU': dropped_rename_target.png (invalid) - * 'DRI': dropped_rename_target.png (invalid) * 'DRM': dropped_rename_target_missing.png * * 'R ': rename_source.png - * 'R P': rename_source.png (invalid) * 'R U': rename_source_unknown.png - * 'R I': rename_source_unknown.png (invalid?) - * 'R M': rename_source_unknown.png (invalid) * - * 'RA ': rename_source_added.png (invalid) * 'RAP': rename_source_added.png - * 'RAU': rename_source_added_missing.png (invalid) - * 'RAI': rename_source_added_missing.png (invalid?) * 'RAM': rename_source_added_missing.png * * 'RR ': rename_source_target.png * 'RRP': rename_source_target.png - * 'RRU': rename_source_target_missing.png (invalid) - * 'RRI': rename_source_target_missing.png (invalid?) * 'RRM': rename_source_target_missing.png */ @@ -119,7 +98,6 @@ IconProvider::IconProvider(void) // // assign possible item states to the appropriate overlay - // we currently have 21 icons for roughly 45 states // QMap states; states[InventoryItem::Unchanged] = QString(":/overlays/unchanged.png"); @@ -128,52 +106,31 @@ IconProvider::IconProvider(void) states[InventoryItem::Ignored] = QString(":/overlays/ignored.png"); states[InventoryItem::Missing] = QString(":/overlays/missing.png"); - states[InventoryItem::Added|InventoryItem::Unchanged] = QString(":/overlays/added.png"); states[InventoryItem::Added|InventoryItem::Patched] = QString(":/overlays/added.png"); - states[InventoryItem::Added|InventoryItem::Unknown] = QString(":/overlays/added.png"); - states[InventoryItem::Added|InventoryItem::Ignored] = QString(":/overlays/added.png"); states[InventoryItem::Added|InventoryItem::Missing] = QString(":/overlays/added_missing.png"); states[InventoryItem::RenamedTo|InventoryItem::Unchanged] = QString(":/overlays/rename_target.png"); states[InventoryItem::RenamedTo|InventoryItem::Patched] = QString(":/overlays/rename_target.png"); - states[InventoryItem::RenamedTo|InventoryItem::Unknown] = QString(":/overlays/rename_target.png"); - states[InventoryItem::RenamedTo|InventoryItem::Ignored] = QString(":/overlays/rename_target.png"); states[InventoryItem::RenamedTo|InventoryItem::Missing] = QString(":/overlays/rename_target_missing.png"); states[InventoryItem::Dropped|InventoryItem::Unchanged] = QString(":/overlays/dropped.png"); - states[InventoryItem::Dropped|InventoryItem::Patched] = QString(":/overlays/dropped.png"); states[InventoryItem::Dropped|InventoryItem::Unknown] = QString(":/overlays/dropped_unknown.png"); - states[InventoryItem::Dropped|InventoryItem::Ignored] = QString(":/overlays/dropped.png"); - states[InventoryItem::Dropped|InventoryItem::Missing] = QString(":/overlays/dropped.png"); - - states[InventoryItem::Dropped|InventoryItem::Added|InventoryItem::Unchanged] = QString(":/overlays/dropped_added.png"); + states[InventoryItem::Dropped|InventoryItem::Added|InventoryItem::Patched] = QString(":/overlays/dropped_added.png"); - states[InventoryItem::Dropped|InventoryItem::Added|InventoryItem::Unknown] = QString(":/overlays/dropped_added.png"); - states[InventoryItem::Dropped|InventoryItem::Added|InventoryItem::Ignored] = QString(":/overlays/dropped_added.png"); states[InventoryItem::Dropped|InventoryItem::Added|InventoryItem::Missing] = QString(":/overlays/dropped_added_missing.png"); states[InventoryItem::Dropped|InventoryItem::RenamedTo|InventoryItem::Unchanged] = QString(":/overlays/dropped_rename_target.png"); states[InventoryItem::Dropped|InventoryItem::RenamedTo|InventoryItem::Patched] = QString(":/overlays/dropped_rename_target.png"); - states[InventoryItem::Dropped|InventoryItem::RenamedTo|InventoryItem::Unknown] = QString(":/overlays/dropped_rename_target.png"); - states[InventoryItem::Dropped|InventoryItem::RenamedTo|InventoryItem::Ignored] = QString(":/overlays/dropped_rename_target.png"); states[InventoryItem::Dropped|InventoryItem::RenamedTo|InventoryItem::Missing] = QString(":/overlays/dropped_rename_target_missing.png"); states[InventoryItem::RenamedFrom|InventoryItem::Unchanged] = QString(":/overlays/rename_source.png"); - states[InventoryItem::RenamedFrom|InventoryItem::Patched] = QString(":/overlays/rename_source.png"); states[InventoryItem::RenamedFrom|InventoryItem::Unknown] = QString(":/overlays/rename_source_unknown.png"); - states[InventoryItem::RenamedFrom|InventoryItem::Ignored] = QString(":/overlays/rename_source_unknown.png"); - states[InventoryItem::RenamedFrom|InventoryItem::Missing] = QString(":/overlays/rename_source_unknown.png"); - - states[InventoryItem::RenamedFrom|InventoryItem::Added|InventoryItem::Unchanged] = QString(":/overlays/rename_source_added.png"); + states[InventoryItem::RenamedFrom|InventoryItem::Added|InventoryItem::Patched] = QString(":/overlays/rename_source_added.png"); - states[InventoryItem::RenamedFrom|InventoryItem::Added|InventoryItem::Unknown] = QString(":/overlays/rename_source_added_missing.png"); - states[InventoryItem::RenamedFrom|InventoryItem::Added|InventoryItem::Ignored] = QString(":/overlays/rename_source_added_missing.png"); states[InventoryItem::RenamedFrom|InventoryItem::Added|InventoryItem::Missing] = QString(":/overlays/rename_source_added_missing.png"); states[InventoryItem::RenamedFrom|InventoryItem::RenamedTo|InventoryItem::Unchanged] = QString(":/overlays/rename_source_target.png"); states[InventoryItem::RenamedFrom|InventoryItem::RenamedTo|InventoryItem::Patched] = QString(":/overlays/rename_source_target.png"); - states[InventoryItem::RenamedFrom|InventoryItem::RenamedTo|InventoryItem::Unknown] = QString(":/overlays/rename_source_target_missing.png"); - states[InventoryItem::RenamedFrom|InventoryItem::RenamedTo|InventoryItem::Ignored] = QString(":/overlays/rename_source_target_missing.png"); states[InventoryItem::RenamedFrom|InventoryItem::RenamedTo|InventoryItem::Missing] = QString(":/overlays/rename_source_target_missing.png"); // some special icon overlays