# # # patch "res/forms/changeset_browser.ui" # from [ac59737143d7aac046048608d14ed2dbdefd23b6] # to [11466b89073eda0acfd9e631774a5f3a43686d33] # # patch "src/model/Branches.cpp" # from [1eaf050a54f1f9cd2586212c4a0054fd28ac6b22] # to [ea39d230ea1aea5c8a629242985901757c9ecb4b] # # patch "src/model/ChangesetModel.cpp" # from [204808846cac0f1f953ca56688b2e7e3c38bdd76] # to [d08356e66c4fc19caea0268ab935fa348c40cb35] # # patch "src/model/ChangesetModel.h" # from [c573ec229b84ef887235ee087319736467925342] # to [c3965362dce73767641f74913b38e5cdd6a8a0c0] # # patch "src/view/dialogs/ChangesetBrowser.cpp" # from [2e6ebcbf9cf3c8557199cfd64215b449f470e8aa] # to [145b32ab0e2f9de4e54b00ba851979f896fa7dbb] # ============================================================ --- res/forms/changeset_browser.ui ac59737143d7aac046048608d14ed2dbdefd23b6 +++ res/forms/changeset_browser.ui 11466b89073eda0acfd9e631774a5f3a43686d33 @@ -5,8 +5,8 @@ 0 0 - 703 - 483 + 655 + 506 @@ -16,27 +16,15 @@ :/icons/guitone.png - - 9 - - - 6 - - - 0 - - - 6 - - + Qt::Horizontal - + Qt::Vertical @@ -45,31 +33,50 @@ true - - - true + + + Qt::Vertical - - QAbstractItemView::NoSelection - - - false - - - false - + + + + Courier + 11 + + + + QTextEdit::AutoAll + + + false + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + true + + + QAbstractItemView::NoSelection + + + false + + + false + + - - 0 - - - 6 - @@ -135,15 +142,16 @@ - Splitter - QSplitter -
Splitter.h
-
- TreeView QTreeView
TreeView.h
+ + Splitter + QSplitter +
Splitter.h
+ 1 +
============================================================ --- src/model/Branches.cpp 1eaf050a54f1f9cd2586212c4a0054fd28ac6b22 +++ src/model/Branches.cpp ea39d230ea1aea5c8a629242985901757c9ecb4b @@ -51,11 +51,27 @@ void Branches::processTaskResult(const M return; } + // + // The ToolTipRole is used in two regards here: + // + // a) if the branch model is displayed as tree of branches + // a user can hover over an individual branch part and see + // the complete branch name in the tooltip + // b) since we use a qstandarditemmodel internally to store the + // actual string data of each branch, we need to use some role + // anyways to store the full branch name internally to be able + // to use it for further processing, so we re-use the tooltip + // role there again to query these info + // + // Of course this will break badly as soon as we want to put more + // info into the tooltip than just the actual branch name... + // branches.setHorizontalHeaderItem(0, new QStandardItem(tr("Branches"))); if (tree) { QStandardItem * root = new QStandardItem(); root->setData("*", Qt::DisplayRole); + root->setData("*", Qt::ToolTipRole); branches.appendRow(root); builder = new TreeBuilder(root, this); @@ -69,6 +85,7 @@ void Branches::processTaskResult(const M { QStandardItem * item = new QStandardItem(); item->setData(branch, Qt::DisplayRole); + item->setData(branch, Qt::ToolTipRole); branches.appendRow(item); } } ============================================================ --- src/model/ChangesetModel.cpp 204808846cac0f1f953ca56688b2e7e3c38bdd76 +++ src/model/ChangesetModel.cpp d08356e66c4fc19caea0268ab935fa348c40cb35 @@ -19,7 +19,6 @@ ***************************************************************************/ #include "ChangesetModel.h" - #include ChangesetModel::ChangesetModel(QObject * parent, const DatabaseFile & db) @@ -63,7 +62,7 @@ void ChangesetModel::setBranch(const QSt if (branchLog) { disconnect( - branchLog, SIGNAL(commandDone(const QString &, const QStringList &)), + branchLog, SIGNAL(branchLogRead(const QString &, const QStringList &)), this, SLOT(branchLogRead(const QString &, const QStringList &)) ); delete branchLog; @@ -71,7 +70,7 @@ void ChangesetModel::setBranch(const QSt branchLog = new GetBranchLog(this, databaseFile, branch); connect( - branchLog, SIGNAL(commandDone(const QString &, const QStringList &)), + branchLog, SIGNAL(branchLogRead(const QString &, const QStringList &)), this, SLOT(branchLogRead(const QString &, const QStringList &)) ); } @@ -127,6 +126,15 @@ QVariant ChangesetModel::data(const QMod return QVariant(font); } + if (role == Qt::UserRole) + { + BranchInfo branchInfo = branchMap[currentBranch]; + int row = index.row(); + QString rev = branchInfo.revisions[row]; + if (!changesetMap.contains(rev)) return QVariant(); + return QVariant(changesetMap[rev].htmllog()); + } + if (role == Qt::DisplayRole) { BranchInfo branchInfo = branchMap[currentBranch]; @@ -146,11 +154,7 @@ QVariant ChangesetModel::data(const QMod case(1): return QVariant(changesetMap[rev].author); case(2): - // FIXME: we should make something snazzy here, i.e. - // expand the complete description if a user selects - // the row or at least display a multi-line tooltip, - // whatever works better - return QVariant(changesetMap[rev].changelog); + return QVariant(changesetMap[rev].plainlog()); case(3): return QVariant(rev); } ============================================================ --- src/model/ChangesetModel.h c573ec229b84ef887235ee087319736467925342 +++ src/model/ChangesetModel.h c3965362dce73767641f74913b38e5cdd6a8a0c0 @@ -25,6 +25,7 @@ #include "GetBranchLog.h" #include +#include struct BranchInfo { @@ -38,6 +39,20 @@ struct Changeset QDateTime date; QString author; QString changelog; + + QString htmllog() const + { + QString htmllog = changelog; + return htmllog.replace(QRegExp("([_*])(\\w+)$1"), "$2") + .replace(QRegExp("\\t"), "    ") + .replace(QRegExp("[\\r\\n]+"), "
"); + } + + QString plainlog() const + { + QString plainlog = changelog; + return plainlog.replace(QRegExp("\\s+"), " "); + } }; class ChangesetCerts : public Certs @@ -70,22 +85,23 @@ private slots: // key, i.e. accidential clean merges or multiple author certs for (int i=0, j=certs->size(); iat(i).key == "author") + if (certs->at(i).name == "author") { change.author = certs->at(i).value; continue; } - if (certs->at(i).key == "changelog") + if (certs->at(i).name == "changelog") { change.changelog = certs->at(i).value; continue; } - if (certs->at(i).key == "date") + if (certs->at(i).name == "date") { change.date = QDateTime::fromString(certs->at(i).value, "yyyy-MM-ddThh:mm:ss"); continue; } } + emit changesetReady(change); } ============================================================ --- src/view/dialogs/ChangesetBrowser.cpp 2e6ebcbf9cf3c8557199cfd64215b449f470e8aa +++ src/view/dialogs/ChangesetBrowser.cpp 145b32ab0e2f9de4e54b00ba851979f896fa7dbb @@ -29,9 +29,11 @@ ChangesetBrowser::ChangesetBrowser(QWidg this->setWindowFlags(this->windowFlags() | Qt::WindowMaximizeButtonHint); this->setWindowFlags(this->windowFlags() | Qt::WindowMinimizeButtonHint); - innerSplitter->init(); - outerSplitter->init(); + branchesSplitter->init(); + changesetsSplitter->init(); + changeLogSplitter->init(); + tree = Settings::getBool("ChangesetBrowserTree", false); displayBranchesAsTree->setText( !tree ? tr("display branches as tree") : tr("display branches flat") @@ -119,6 +121,7 @@ void ChangesetBrowser::changesetsClicked { QModelIndex revIdx = changesetModel->index(idx.row(), 3, QModelIndex()); QString revision = changesetModel->data(revIdx, Qt::DisplayRole).toString(); + changeLog->setHtml(changesetModel->data(revIdx, Qt::UserRole).toString()); revisionModel->readRevision(revision); }