Chris@57: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@57: Chris@57: /* Chris@57: EasyMercurial Chris@57: Chris@57: Based on HgExplorer by Jari Korhonen Chris@57: Copyright (c) 2010 Jari Korhonen Chris@57: Copyright (c) 2010 Chris Cannam Chris@57: Copyright (c) 2010 Queen Mary, University of London Chris@57: Chris@57: This program is free software; you can redistribute it and/or Chris@57: modify it under the terms of the GNU General Public License as Chris@57: published by the Free Software Foundation; either version 2 of the Chris@57: License, or (at your option) any later version. See the file Chris@57: COPYING included with this distribution for more information. Chris@57: */ jtkorhonen@0: jtkorhonen@0: #include "hgexpwidget.h" jtkorhonen@0: #include "common.h" Chris@43: #include "logparser.h" Chris@43: #include "changeset.h" Chris@43: #include "changesetitem.h" Chris@44: #include "grapher.h" cannam@45: #include "panner.h" cannam@45: #include "panned.h" Chris@88: #include "filestatuswidget.h" Chris@44: Chris@50: #include Chris@50: #include Chris@50: #include Chris@50: Chris@44: #include jtkorhonen@0: jtkorhonen@0: #define REMOTE_REPO_STR "Remote repository: " jtkorhonen@0: #define LOCAL_REPO_STR "Local repository: " jtkorhonen@0: #define WORKFOLDER_STR "Working folder: " jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: const char hgStatViewOptions[NUM_STAT_FILE_TYPES] = {'m','a','r','d','u','c','i'}; jtkorhonen@0: jtkorhonen@0: const char *statFilesStr[NUM_STAT_FILE_TYPES] = { "M: Modified", jtkorhonen@0: "A: To be added on next commit", jtkorhonen@0: "R: To be removed on next commit", jtkorhonen@0: "!: Tracked, locally deleted", jtkorhonen@0: "?: Unknown, not yet tracked", jtkorhonen@0: "C: Clean (not changed)", jtkorhonen@0: "I: Ignored (via .hgignore file)"}; jtkorhonen@0: jtkorhonen@0: Chris@88: HgExpWidget::HgExpWidget(QWidget *parent, QString remoteRepo, Chris@88: QString workFolderPath, Chris@88: unsigned char viewFileTypesBits) : Chris@88: QTabWidget(parent) jtkorhonen@0: { jtkorhonen@0: //Work page jtkorhonen@0: //Work page jtkorhonen@0: //Work page jtkorhonen@0: jtkorhonen@0: //Remote repo jtkorhonen@0: grpRemoteRepo = new QGroupBox(tr(REMOTE_REPO_STR) + remoteRepo); jtkorhonen@0: grpRemoteRepo -> setMinimumHeight(24); jtkorhonen@0: jtkorhonen@0: //Local Repo jtkorhonen@0: grpLocalRepo = new QGroupBox(tr(LOCAL_REPO_STR) + workFolderPath + getHgDirName()); jtkorhonen@0: parentsLabel = new QLabel(tr("Working folder parent(s):")); jtkorhonen@0: localRepoHgParentsList = new QListWidget; jtkorhonen@0: localRepoHgParentsList -> setSelectionMode(QAbstractItemView::NoSelection); jtkorhonen@0: parentsLayout = new QVBoxLayout; jtkorhonen@0: parentsLayout -> addWidget(parentsLabel); jtkorhonen@0: parentsLayout -> addWidget(localRepoHgParentsList); jtkorhonen@0: grpLocalRepo -> setLayout(parentsLayout); jtkorhonen@32: copyCommentAct = new QAction("Copy comment", localRepoHgParentsList); jtkorhonen@32: userListMenu = new QMenu(localRepoHgParentsList); jtkorhonen@32: userListMenu -> addAction(copyCommentAct); jtkorhonen@32: connect(copyCommentAct, SIGNAL(triggered()), this, SLOT(copyComment())); jtkorhonen@0: jtkorhonen@0: //Workfolder jtkorhonen@0: grpWorkFolder = new QGroupBox(tr(WORKFOLDER_STR) + workFolderPath); jtkorhonen@0: workFolderLayout = new QHBoxLayout; jtkorhonen@0: workFolderFileList = new QListWidget; jtkorhonen@19: workFolderFileList -> setSelectionMode(QAbstractItemView::ExtendedSelection); jtkorhonen@0: grpViewFileTypes = new QGroupBox; jtkorhonen@0: fileTypesLayout = new QVBoxLayout; jtkorhonen@0: jtkorhonen@0: for(int i = 0; i < NUM_STAT_FILE_TYPES; i++) jtkorhonen@0: { jtkorhonen@0: chkViewFileTypes[i] = new QCheckBox(statFilesStr[i]); jtkorhonen@0: if ((1U << i) & viewFileTypesBits) jtkorhonen@0: { jtkorhonen@0: chkViewFileTypes[i]->setChecked(true); jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: chkViewFileTypes[i]->setChecked(false); jtkorhonen@0: } jtkorhonen@0: connect(chkViewFileTypes[i], SIGNAL(stateChanged(int)), this, SIGNAL(workFolderViewTypesChanged())); jtkorhonen@0: fileTypesLayout -> addWidget(chkViewFileTypes[i]); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: grpViewFileTypes -> setLayout(fileTypesLayout); jtkorhonen@0: workFolderLayout->addWidget(workFolderFileList, 3); jtkorhonen@0: workFolderLayout->addWidget(grpViewFileTypes, 1); jtkorhonen@0: grpWorkFolder -> setLayout(workFolderLayout); jtkorhonen@0: jtkorhonen@0: workPageWidget = new QWidget; jtkorhonen@0: mainLayout = new QVBoxLayout(workPageWidget); jtkorhonen@0: mainLayout -> addWidget(grpRemoteRepo, 1); jtkorhonen@0: mainLayout -> addWidget(grpLocalRepo, 8); jtkorhonen@0: mainLayout -> addWidget(grpWorkFolder, 12); Chris@89: //!!! addTab(workPageWidget, tr("My work")); jtkorhonen@0: Chris@88: // New work page Chris@88: fileStatusWidget = new FileStatusWidget; Chris@89: fileStatusWidget->setLocalPath(workFolderPath); Chris@89: fileStatusWidget->setRemoteURL(remoteRepo); Chris@89: addTab(fileStatusWidget, tr("My work")); Chris@88: Chris@43: // History graph page cannam@45: historyGraphPageWidget = new QWidget; cannam@45: Panned *panned = new Panned; cannam@45: Panner *panner = new Panner; cannam@45: historyGraphWidget = panned; cannam@45: historyGraphPanner = panner; cannam@45: QGridLayout *layout = new QGridLayout; cannam@45: layout->addWidget(historyGraphWidget, 0, 0); cannam@45: layout->addWidget(historyGraphPanner, 0, 1); cannam@45: panner->setMaximumWidth(80); cannam@45: panner->connectToPanned(panned); cannam@45: historyGraphPageWidget->setLayout(layout); Chris@58: addTab(historyGraphPageWidget, tr("History")); Chris@43: Chris@43: jtkorhonen@0: //History page jtkorhonen@0: //History page jtkorhonen@0: //History page jtkorhonen@0: historyPageWidget = new QWidget; jtkorhonen@0: localRepoHgLogList = new QListWidget; jtkorhonen@0: localRepoHgLogList->setFont(QFont("Courier New")); jtkorhonen@0: localRepoHgLogList -> setSelectionMode(QAbstractItemView::ExtendedSelection); jtkorhonen@0: jtkorhonen@0: historyLayout = new QVBoxLayout(historyPageWidget); jtkorhonen@0: historyLayout->addWidget(localRepoHgLogList); Chris@58: //!!! addTab(historyPageWidget, tr("History (log)")); jtkorhonen@0: jtkorhonen@0: //Heads page jtkorhonen@0: //Heads page jtkorhonen@0: //Heads page jtkorhonen@0: headsPageWidget = new QWidget; jtkorhonen@0: localRepoHeadsList = new QListWidget; jtkorhonen@0: localRepoHeadsList -> setSelectionMode(QAbstractItemView::ExtendedSelection); jtkorhonen@0: jtkorhonen@0: headsLayout = new QVBoxLayout(headsPageWidget); jtkorhonen@0: headsLayout->addWidget(localRepoHeadsList); Chris@58: //!!! addTab(headsPageWidget, tr("Heads")); jtkorhonen@0: jtkorhonen@0: //Initially, only work page is active Chris@58: //!!! setTabEnabled(HEADSTAB, false); Chris@58: //!!! setTabEnabled(HISTORYTAB, false); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@32: void HgExpWidget::contextMenuEvent(QContextMenuEvent * event) jtkorhonen@32: { jtkorhonen@32: if (copyCommentAct -> isEnabled()) jtkorhonen@32: { jtkorhonen@32: QPoint topL; jtkorhonen@32: QPoint bottomR; jtkorhonen@32: jtkorhonen@32: topL = localRepoHgParentsList-> jtkorhonen@32: mapToGlobal(QPoint(0, 0)); jtkorhonen@32: bottomR = localRepoHgParentsList-> jtkorhonen@32: mapToGlobal(QPoint(localRepoHgParentsList -> width(), localRepoHgParentsList -> height())); jtkorhonen@32: jtkorhonen@32: if ((event -> globalPos().x() > topL.x()) && (event -> globalPos().x() < bottomR.x())) jtkorhonen@32: { jtkorhonen@32: if ((event -> globalPos().y() > topL.y()) && (event -> globalPos().y() < bottomR.y())) jtkorhonen@32: { jtkorhonen@32: userListMenu->exec(event -> globalPos()); jtkorhonen@32: } jtkorhonen@32: } jtkorhonen@32: } jtkorhonen@32: } jtkorhonen@32: jtkorhonen@32: void HgExpWidget::copyComment() jtkorhonen@32: { jtkorhonen@32: if (localRepoHgParentsList -> count() >= 1) jtkorhonen@32: { jtkorhonen@32: QListWidgetItem *it = localRepoHgParentsList -> item(0); jtkorhonen@32: QString tmp = it -> text(); jtkorhonen@32: int ind = tmp.indexOf("summary:"); jtkorhonen@32: if (ind != -1) jtkorhonen@32: { jtkorhonen@32: QString comment; jtkorhonen@32: ind += 11; //jump over word "summary:" jtkorhonen@32: jtkorhonen@32: comment = tmp.mid(ind); jtkorhonen@32: jtkorhonen@32: QClipboard *clipboard = QApplication::clipboard(); jtkorhonen@32: clipboard->setText(comment); jtkorhonen@32: } jtkorhonen@32: } jtkorhonen@32: } jtkorhonen@32: jtkorhonen@32: jtkorhonen@0: jtkorhonen@0: QString HgExpWidget::getStatFlags() jtkorhonen@0: { jtkorhonen@0: QString ret; jtkorhonen@0: jtkorhonen@0: for(int i = 0; i < NUM_STAT_FILE_TYPES; i++) jtkorhonen@0: { jtkorhonen@0: if (Qt::Checked == chkViewFileTypes[i]->checkState()) jtkorhonen@0: { jtkorhonen@0: ret += hgStatViewOptions[i]; jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: return ret; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: unsigned char HgExpWidget::getFileTypesBits() jtkorhonen@0: { jtkorhonen@0: unsigned char ret; jtkorhonen@0: jtkorhonen@0: ret = 0; jtkorhonen@0: jtkorhonen@0: for(int i = 0; i < NUM_STAT_FILE_TYPES; i++) jtkorhonen@0: { jtkorhonen@0: if (Qt::Checked == chkViewFileTypes[i]->checkState()) jtkorhonen@0: { jtkorhonen@0: ret |= (1U << i); jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: return ret; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: void HgExpWidget::updateWorkFolderFileList(QString fileList) jtkorhonen@0: { Chris@86: statParser = StatParser(fileList); Chris@86: Chris@89: fileStatusWidget->setStatParser(statParser); Chris@89: jtkorhonen@0: workFolderFileList-> clear(); jtkorhonen@0: workFolderFileList -> addItems(fileList.split("\n")); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: void HgExpWidget::updateLocalRepoHeadsList(QString headList) jtkorhonen@0: { jtkorhonen@0: localRepoHeadsList-> clear(); jtkorhonen@0: localRepoHeadsList -> addItems(splitChangeSets(headList)); jtkorhonen@0: jtkorhonen@0: //heads list is interesting only when we have 2 or more jtkorhonen@0: if (localRepoHeadsList-> count() < 2) jtkorhonen@0: { jtkorhonen@0: setTabEnabled(HEADSTAB, false); jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: setTabEnabled(HEADSTAB, true); jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: void HgExpWidget::clearLists() jtkorhonen@0: { jtkorhonen@0: localRepoHeadsList-> clear(); jtkorhonen@0: localRepoHgParentsList-> clear(); jtkorhonen@0: workFolderFileList-> clear(); jtkorhonen@0: localRepoHgLogList -> clear(); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: void HgExpWidget::updateLocalRepoParentsList(QString parentsList) jtkorhonen@0: { jtkorhonen@0: localRepoHgParentsList-> clear(); jtkorhonen@0: localRepoHgParentsList -> addItems(splitChangeSets(parentsList)); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: void HgExpWidget::updateLocalRepoHgLogList(QString hgLogList) jtkorhonen@0: { jtkorhonen@0: localRepoHgLogList -> clear(); jtkorhonen@0: localRepoHgLogList -> addItems(splitChangeSets(hgLogList)); jtkorhonen@0: Chris@43: //!!! cannam@45: Panned *panned = static_cast(historyGraphWidget); cannam@45: Panner *panner = static_cast(historyGraphPanner); Chris@43: QGraphicsScene *scene = new QGraphicsScene(); Chris@43: Changesets csets = parseChangeSets(hgLogList); Chris@44: if (csets.empty()) return; Chris@53: Grapher g(scene); Chris@44: try { Chris@53: g.layout(csets); Chris@44: } catch (std::string s) { Chris@44: std::cerr << "Internal error: Layout failed: " << s << std::endl; Chris@44: } Chris@87: QGraphicsScene *oldScene = panned->scene(); cannam@45: panned->setScene(scene); cannam@45: panner->setScene(scene); Chris@87: if (oldScene) delete oldScene; Chris@53: ChangesetItem *tipItem = g.getItemFor(csets[0]); Chris@53: if (tipItem) tipItem->ensureVisible(); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: Chris@43: jtkorhonen@0: int HgExpWidget::findLineStart(int nowIndex, QString str) jtkorhonen@0: { jtkorhonen@0: if (nowIndex < 0) jtkorhonen@0: { jtkorhonen@0: return -1; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: while(str.at(nowIndex) != '\n') jtkorhonen@0: { jtkorhonen@0: if (nowIndex == 0) jtkorhonen@0: { jtkorhonen@0: return nowIndex; jtkorhonen@0: } jtkorhonen@0: nowIndex--; jtkorhonen@0: } jtkorhonen@0: return nowIndex + 1; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: QStringList HgExpWidget::splitChangeSets(QString chgSetsStr) jtkorhonen@0: { Chris@43: return LogParser(chgSetsStr).split(); Chris@43: /* jtkorhonen@0: int currChgSet; jtkorhonen@0: int currChgSetLineStart; jtkorhonen@0: jtkorhonen@0: int prevChgSet; jtkorhonen@0: QStringList tmp; jtkorhonen@0: jtkorhonen@0: currChgSet = chgSetsStr.indexOf(CHGSET); jtkorhonen@0: currChgSetLineStart = findLineStart(currChgSet, chgSetsStr); jtkorhonen@0: prevChgSet = -1; jtkorhonen@0: while (currChgSet != -1) jtkorhonen@0: { jtkorhonen@0: if (prevChgSet != -1) jtkorhonen@0: { jtkorhonen@0: tmp.append(chgSetsStr.mid(prevChgSet, (currChgSetLineStart - prevChgSet - 1))); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: prevChgSet = currChgSetLineStart; jtkorhonen@0: jtkorhonen@0: currChgSet = chgSetsStr.indexOf(CHGSET, currChgSet + 1); jtkorhonen@0: currChgSetLineStart = findLineStart(currChgSet, chgSetsStr); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: if (prevChgSet != -1) jtkorhonen@0: { jtkorhonen@0: //Last changeset jtkorhonen@0: tmp.append(chgSetsStr.mid(prevChgSet)); jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: //Only changeset (if any) jtkorhonen@0: if (!chgSetsStr.isEmpty()) jtkorhonen@0: { jtkorhonen@0: tmp.append(chgSetsStr.mid(0)); jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: return tmp; Chris@43: */ Chris@43: } Chris@43: Chris@43: Changesets HgExpWidget::parseChangeSets(QString changeSetsStr) Chris@43: { Chris@43: Changesets csets; Chris@43: LogList log = LogParser(changeSetsStr).parse(); Chris@43: foreach (LogEntry e, log) { Chris@43: Changeset *cs = new Changeset(); Chris@43: foreach (QString key, e.keys()) { Chris@44: if (key == "parents") { Chris@44: QStringList parents = e.value(key).split Chris@44: (" ", QString::SkipEmptyParts); Chris@44: cs->setParents(parents); Chris@52: } else if (key == "timestamp") { Chris@52: cs->setTimestamp(e.value(key).split(" ")[0].toULongLong()); Chris@44: } else { Chris@44: cs->setProperty(key.toLocal8Bit().data(), e.value(key)); Chris@44: } Chris@43: } Chris@43: csets.push_back(cs); Chris@43: } Chris@44: for (int i = 0; i+1 < csets.size(); ++i) { Chris@44: Changeset *cs = csets[i]; Chris@44: if (cs->parents().empty()) { Chris@44: QStringList list; Chris@44: list.push_back(csets[i+1]->id()); Chris@44: cs->setParents(list); Chris@44: } Chris@44: } Chris@43: return csets; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: QString HgExpWidget::getCurrentFileListLine() jtkorhonen@0: { jtkorhonen@0: if (workFolderFileList -> currentItem() != NULL) jtkorhonen@0: { jtkorhonen@0: return workFolderFileList -> currentItem()->text(); jtkorhonen@0: } jtkorhonen@0: return ""; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: void HgExpWidget::setWorkFolderAndRepoNames(QString workFolderPath, QString remoteRepoPath) jtkorhonen@0: { jtkorhonen@0: grpRemoteRepo -> setTitle(tr(REMOTE_REPO_STR) + remoteRepoPath); jtkorhonen@0: grpLocalRepo -> setTitle(tr(LOCAL_REPO_STR) + workFolderPath + getHgDirName()); jtkorhonen@0: grpWorkFolder -> setTitle(tr(WORKFOLDER_STR) + workFolderPath); Chris@89: Chris@89: fileStatusWidget->setLocalPath(workFolderPath); Chris@89: fileStatusWidget->setRemoteURL(remoteRepoPath); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: #define MERC_SHA1_MARKER_LEN 12 jtkorhonen@0: QString HgExpWidget::findRev(QString itemText, QString & smallRev) jtkorhonen@0: { jtkorhonen@0: QString tmp(itemText); jtkorhonen@0: int i; jtkorhonen@0: int j; jtkorhonen@0: jtkorhonen@0: smallRev ="0"; jtkorhonen@0: jtkorhonen@0: i = tmp.indexOf(CHGSET); jtkorhonen@0: if (i != -1) jtkorhonen@0: { jtkorhonen@0: j = i + 10; jtkorhonen@0: i = tmp.indexOf(":", j); //xx:yyyyyy after changeset: jtkorhonen@0: jtkorhonen@0: if (i != -1) jtkorhonen@0: { jtkorhonen@0: smallRev = tmp.mid(j, (i-j)); jtkorhonen@0: return tmp.mid(i+1, MERC_SHA1_MARKER_LEN); jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: return ""; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: void HgExpWidget::getHistoryDiffRevisions(QString& revA, QString& revB) jtkorhonen@0: { jtkorhonen@0: QList histList = localRepoHgLogList->selectedItems(); jtkorhonen@0: QList headList = localRepoHeadsList->selectedItems(); jtkorhonen@0: jtkorhonen@0: QString revATmp; jtkorhonen@0: QString revBTmp; jtkorhonen@0: QString smallRevA; jtkorhonen@0: QString smallRevB; jtkorhonen@0: QString txtA; jtkorhonen@0: QString txtB; jtkorhonen@0: jtkorhonen@0: if (histList.count() == REQUIRED_CHGSET_DIFF_COUNT) jtkorhonen@0: { jtkorhonen@0: txtA = histList.last()->text(); jtkorhonen@0: txtB = histList.first()->text(); jtkorhonen@0: jtkorhonen@0: } jtkorhonen@0: else if (headList.count() == REQUIRED_CHGSET_DIFF_COUNT) jtkorhonen@0: { jtkorhonen@0: txtA = headList.last()->text(); jtkorhonen@0: txtB = headList.first()->text(); jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: revA = ""; jtkorhonen@0: revB = ""; jtkorhonen@0: return; jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: revATmp = findRev(txtA, smallRevA); jtkorhonen@0: revBTmp = findRev(txtB, smallRevB); jtkorhonen@0: jtkorhonen@0: //Switch order according to repo small revision number (user can select items from list in "wrong" order) jtkorhonen@0: if (smallRevB.toULongLong() > smallRevA.toULongLong()) jtkorhonen@0: { jtkorhonen@0: revA = revATmp; jtkorhonen@0: revB = revBTmp; jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: revA = revBTmp; jtkorhonen@0: revB = revATmp; jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: void HgExpWidget::getUpdateToRevRevision(QString& rev) jtkorhonen@0: { jtkorhonen@0: QList histList = localRepoHgLogList->selectedItems(); jtkorhonen@0: QString txt; jtkorhonen@0: QString smallRev; jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: if (histList.count() == 1) jtkorhonen@0: { jtkorhonen@0: txt = histList.first()->text(); jtkorhonen@0: rev = findRev(txt, smallRev); jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: rev = ""; jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: jtkorhonen@32: void HgExpWidget::enableDisableOtherTabs(int tabPage) jtkorhonen@32: { jtkorhonen@32: static int oldTabPage = -1; jtkorhonen@0: jtkorhonen@32: if (tabPage != oldTabPage) jtkorhonen@32: { jtkorhonen@32: oldTabPage = tabPage; jtkorhonen@32: if (tabPage == WORKTAB) jtkorhonen@32: { jtkorhonen@32: copyCommentAct -> setEnabled(true); jtkorhonen@32: } jtkorhonen@32: else jtkorhonen@32: { jtkorhonen@32: copyCommentAct -> setEnabled(false); jtkorhonen@32: } jtkorhonen@32: } jtkorhonen@32: jtkorhonen@0: //history list is only interesting when we have something in it ;-) jtkorhonen@0: if (localRepoHgLogList -> count() < 2) jtkorhonen@0: { jtkorhonen@0: setTabEnabled(HISTORYTAB, false); jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: setTabEnabled(HISTORYTAB, true); jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: //history list is only interesting when we have something in it ;-) jtkorhonen@0: if (localRepoHgLogList -> count() < 2) jtkorhonen@0: { jtkorhonen@0: setTabEnabled(HISTORYTAB, false); jtkorhonen@0: } jtkorhonen@0: else jtkorhonen@0: { jtkorhonen@0: setTabEnabled(HISTORYTAB, true); jtkorhonen@0: } jtkorhonen@0: } jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: