# # # patch "src/view/dialogs/FileHistory.cpp" # from [86e856616418ed7875cbd92515116b406947abc4] # to [4cec258337e27b4ccd187dbc8535c3a65ddb330e] # # patch "src/view/dialogs/FileHistory.h" # from [ed76ac56e2b114a67196d38bae14c01b8b9fda63] # to [7ff3d34cb83e8dcdce65238fdd82fddade923a4a] # ============================================================ --- src/view/dialogs/FileHistory.cpp 86e856616418ed7875cbd92515116b406947abc4 +++ src/view/dialogs/FileHistory.cpp 4cec258337e27b4ccd187dbc8535c3a65ddb330e @@ -19,57 +19,57 @@ ***************************************************************************/ #include "FileHistory.h" -#include "FileDiff.h" -FileHistory::FileHistory(QWidget * parent, const QString & fileName) - : Dialog(parent) +FileHistory::FileHistory(QWidget * parent, const DatabaseFile & databaseFile, + const QString & fileName, const QString & startRevision) + : Dialog(parent) { setupUi(this); Dialog::init(); - + // OSX sheet-alike dialog setWindowFlags(Qt::Sheet); - + splitter->init(); - - changeModel = new GetContentChanged(this); - certsModel = new Certs(this); - + + changeModel = new GetContentChanged(this, databaseFile); + certsModel = new Certs(this, databaseFile); + // assign the models to the views revisionFileList->setModel(changeModel); certList->setModel(certsModel); - + // display the certs of a selected revision on click connect( revisionFileList, SIGNAL(clicked(const QModelIndex &)), this, SLOT(readCerts(const QModelIndex &)) ); - + connect( selectFirst, SIGNAL(clicked()), this, SLOT(setFirstRevision()) ); - + connect( selectSecond, SIGNAL(clicked()), this, SLOT(setSecondRevision()) ); - + connect( showDiff, SIGNAL(clicked()), this, SLOT(showDiffDialog()) ); - + connect( revisionFileList, SIGNAL(clicked(const QModelIndex &)), this, SLOT(revisionFileListClicked(const QModelIndex &)) ); - + QString title = windowTitle(); setWindowTitle(title.arg(fileName)); - + // read the changes - I(changeModel->readChanges(fileName)); + changeModel->readChanges(fileName, startRevision); } FileHistory::~FileHistory() @@ -81,14 +81,11 @@ void FileHistory::readCerts(const QModel void FileHistory::readCerts(const QModelIndex & index) { if (!index.isValid()) return; - + QModelIndex revIdx = changeModel->index(index.row(), 0, QModelIndex()); QString rev(revIdx.data().toString()); - - if (!certsModel->readCerts(rev)) - { - C(QString("Couldn't read certs for %1").arg(rev)); - } + + certsModel->readCerts(rev); } void FileHistory::setFirstRevision() @@ -96,12 +93,12 @@ void FileHistory::setFirstRevision() QModelIndex revIdx = changeModel->index(curRow, 0, QModelIndex()); QModelIndex fileIdx = changeModel->index(curRow, 1, QModelIndex()); I(revIdx.isValid() && fileIdx.isValid()); - + firstRevision = revIdx.data().toString(); fileName = fileIdx.data().toString(); - + if (secondRevision.size() > 0) showDiff->setEnabled(true); - + selectFirst->setText(tr("First: %1...").arg(firstRevision.left(12))); } @@ -109,20 +106,20 @@ void FileHistory::setSecondRevision() { QModelIndex revIdx = changeModel->index(curRow, 0, QModelIndex()); I(revIdx.isValid()); - + secondRevision = revIdx.data().toString(); - + if (firstRevision.size() > 0) showDiff->setEnabled(true); - + selectSecond->setText(tr("Second: %1...").arg(secondRevision.left(12))); } void FileHistory::revisionFileListClicked(const QModelIndex & index) { if (!index.isValid()) return; - + curRow = index.row(); - + // make sure both button are enabled selectFirst->setEnabled(true); selectSecond->setEnabled(true); @@ -131,9 +128,6 @@ void FileHistory::showDiffDialog() void FileHistory::showDiffDialog() { I(firstRevision.size() > 0 && secondRevision.size() > 0); - - FileDiff dlg(this); - dlg.init(fileName, firstRevision, secondRevision); - dlg.exec(); + emit fileHistory(fileName, firstRevision, secondRevision); } ============================================================ --- src/view/dialogs/FileHistory.h ed76ac56e2b114a67196d38bae14c01b8b9fda63 +++ src/view/dialogs/FileHistory.h 7ff3d34cb83e8dcdce65238fdd82fddade923a4a @@ -28,21 +28,23 @@ class FileHistory : public Dialog, priva class FileHistory : public Dialog, private Ui::FileHistoryDialog { - Q_OBJECT + Q_OBJECT +public: + FileHistory(QWidget *, const DatabaseFile &, const QString &, const QString &); + ~FileHistory(); -public: - FileHistory(QWidget *, const QString &); - ~FileHistory(); - +signals: + void fileHistory(const QString & fileName, const QString & firstRevision, + const QString & secondRevision); private: GetContentChanged * changeModel; Certs * certsModel; - + int curRow; QString firstRevision; QString secondRevision; QString fileName; - + private slots: void readCerts(const QModelIndex &); void setFirstRevision(); @@ -50,5 +52,5 @@ private slots: void revisionFileListClicked(const QModelIndex &); void showDiffDialog(); }; - + #endif