bool PatchView::doUpdate(bool force) { const RevFile* files = NULL; bool newFiles = false; if (st.isChanged(StateInfo::SHA) || force) { if (!isLinked()) { QString caption(git->getShortLog(st.sha())); if (caption.length() > 30) caption = caption.left(30 - 3).trimmed().append("..."); setTabCaption(caption); } on_updateRevDesc(); } if (st.isChanged(StateInfo::ANY & ~StateInfo::FILE_NAME) || force) { updatePatch(); patchTab->fileList->clear(); files = git->getFiles(st.sha(), st.diffToSha(), st.allMergeFiles()); newFiles = true; } // call always to allow a simple refresh patchTab->fileList->update(files, newFiles); if (st.isChanged() || force) patchTab->textEditDiff->centerOnFileHeader(st); return true; }
RevsView::RevsView(MainImpl* mi, Git* g, bool isMain) : Domain(mi, g, isMain) { revTab = new Ui_TabRev(); revTab->setupUi(container); tab()->listViewLog->setup(this, g); tab()->textBrowserDesc->setup(this); tab()->textEditDiff->setup(this, git); tab()->fileList->setup(this, git); m()->treeView->setup(this, git); // setTabLogDiffVisible(QGit::testFlag(QGit::LOG_DIFF_TAB_F)); // restore geometry QVector<QSplitter*> v; v << tab()->horizontalSplitter << tab()->verticalSplitter; QGit::restoreGeometrySetting(QGit::REV_GEOM_KEY, NULL, &v); connect(m(), SIGNAL(typeWriterFontChanged()), tab()->textEditDiff, SLOT(typeWriterFontChanged())); connect(git, SIGNAL(newRevsAdded(const FileHistory*, const QVector<ShaString>&)), this, SLOT(on_newRevsAdded(const FileHistory*, const QVector<ShaString>&))); connect(git, SIGNAL(loadCompleted(const FileHistory*, const QString&)), this, SLOT(on_loadCompleted(const FileHistory*, const QString&))); connect(m(), SIGNAL(changeFont(const QFont&)), tab()->listViewLog, SLOT(on_changeFont(const QFont&))); connect(m(), SIGNAL(updateRevDesc()), this, SLOT(on_updateRevDesc())); connect(tab()->listViewLog, SIGNAL(lanesContextMenuRequested(const QStringList&, const QStringList&)), this, SLOT(on_lanesContextMenuRequested (const QStringList&, const QStringList&))); connect(tab()->listViewLog, SIGNAL(revisionsDragged(const QStringList&)), m(), SLOT(revisionsDragged(const QStringList&))); connect(tab()->listViewLog, SIGNAL(revisionsDropped(const QStringList&)), m(), SLOT(revisionsDropped(const QStringList&))); connect(tab()->listViewLog, SIGNAL(contextMenu(const QString&, int)), this, SLOT(on_contextMenu(const QString&, int))); connect(m()->treeView, SIGNAL(contextMenu(const QString&, int)), this, SLOT(on_contextMenu(const QString&, int))); connect(tab()->fileList, SIGNAL(contextMenu(const QString&, int)), this, SLOT(on_contextMenu(const QString&, int))); connect(m(), SIGNAL(changeFont(const QFont&)), tab()->fileList, SLOT(on_changeFont(const QFont&))); connect(m(), SIGNAL(highlightPatch(const QString&, bool)), tab()->textEditDiff, SLOT(on_highlightPatch(const QString&, bool))); }
RevsView::RevsView(MainImpl* mi, Git* g, bool isMain) : Domain(mi, g, isMain) { revTab = new Ui_TabRev(); revTab->setupUi(container); tab()->listViewLog->setup(this, g); tab()->textBrowserDesc->setup(this); // restore geometry QVector<QSplitter*> v; v << tab()->horizontalSplitter << tab()->verticalSplitter; QGit::restoreGeometrySetting(QGit::REV_GEOM_KEY, NULL, &v); connect(git, SIGNAL(newRevsAdded(const FileHistory*, const QVector<ShaString>&)), this, SLOT(on_newRevsAdded(const FileHistory*, const QVector<ShaString>&))); connect(git, SIGNAL(loadCompleted(const FileHistory*, const QString&)), this, SLOT(on_loadCompleted(const FileHistory*, const QString&))); connect(m(), SIGNAL(changeFont(const QFont&)), tab()->listViewLog, SLOT(on_changeFont(const QFont&))); connect(m(), SIGNAL(updateRevDesc()), this, SLOT(on_updateRevDesc())); connect(tab()->listViewLog, SIGNAL(lanesContextMenuRequested(const QStringList&, const QStringList&)), this, SLOT(on_lanesContextMenuRequested (const QStringList&, const QStringList&))); connect(tab()->listViewLog, SIGNAL(revisionsDragged(const QStringList&)), m(), SLOT(revisionsDragged(const QStringList&))); connect(tab()->listViewLog, SIGNAL(revisionsDropped(const QStringList&)), m(), SLOT(revisionsDropped(const QStringList&))); connect(tab()->listViewLog, SIGNAL(contextMenu(const QString&, int)), this, SLOT(on_contextMenu(const QString&, int))); //FIXME: remove me /*connect(m()->treeView, SIGNAL(contextMenu(const QString&, int)), this, SLOT(on_contextMenu(const QString&, int)));*/ }
bool RevsView::doUpdate(bool force) { bool found = tab()->listViewLog->update(); if (!found && !st.sha().isEmpty()) { const QString tmp("Sorry, revision " + st.sha() + " has not been found in main view"); showStatusBarMessage(tmp); } else { // sha could be NULL if (st.isChanged(StateInfo::SHA) || force) { on_updateRevDesc(); showStatusBarMessage(git->getRevInfo(st.sha())); } const RevFile* files = NULL; bool newFiles = false; if (st.isChanged(StateInfo::ANY & ~StateInfo::FILE_NAME) || force) { // blocking call, could be slow in case of all merge files files = git->getFiles(st.sha(), st.diffToSha(), st.allMergeFiles()); newFiles = true; //TODO update diff here } if (st.selectItem()) { bool isDir = st.isDir(); m()->updateContextActions(st.sha(), st.fileName(), isDir, found); } if (st.isChanged() || force) /*TODO update diff here*/; } return (found || st.sha().isEmpty()); }