Mercurial > hg > easyhg
diff mainwindow.cpp @ 287:3fbafca196e4 status_outside_tabs
Move work-folder state area outside tabs widget
author | Chris Cannam |
---|---|
date | Mon, 21 Feb 2011 11:07:21 +0000 |
parents | a68801b31ceb |
children | d40294e164da |
line wrap: on
line diff
--- a/mainwindow.cpp Mon Feb 21 09:13:33 2011 +0000 +++ b/mainwindow.cpp Mon Feb 21 11:07:21 2011 +0000 @@ -44,6 +44,7 @@ #include "incomingdialog.h" #include "settingsdialog.h" #include "version.h" +#include "workstatuswidget.h" MainWindow::MainWindow(QString myDirPath) : @@ -88,20 +89,21 @@ QWidget *central = new QWidget(this); setCentralWidget(central); - m_hgTabs = new HgTabWidget(central, m_remoteRepoPath, m_workFolderPath); - connectTabsSignals(); - - // Instead of setting the tab widget as our central widget - // directly, put it in a layout, so that we can have some space - // around it on the Mac where it looks very strange without - QGridLayout *cl = new QGridLayout(central); - cl->addWidget(m_hgTabs, 0, 0); + int row = 0; #ifndef Q_OS_MAC cl->setMargin(0); #endif + m_workStatus = new WorkStatusWidget(this); + cl->addWidget(m_workStatus, row++, 0); + + m_hgTabs = new HgTabWidget(central, m_workFolderPath); + connectTabsSignals(); + + cl->addWidget(m_hgTabs, row++, 0); + connect(m_hgTabs, SIGNAL(selectionChanged()), this, SLOT(enableDisableActions())); connect(m_hgTabs, SIGNAL(showAllChanged(bool)), @@ -260,7 +262,7 @@ // We have to do this here, because commandCompleted won't be called MultiChoiceDialog::addRecentArgument("local", m_workFolderPath); MultiChoiceDialog::addRecentArgument("remote", m_remoteRepoPath); - m_hgTabs->setWorkFolderAndRepoNames(m_workFolderPath, m_remoteRepoPath); + updateWorkFolderAndRepoNames(); hgQueryBranch(); return; @@ -815,7 +817,7 @@ params << "clone" << m_remoteRepoPath << m_workFolderPath; - m_hgTabs->setWorkFolderAndRepoNames(m_workFolderPath, m_remoteRepoPath); + updateWorkFolderAndRepoNames(); m_hgTabs->updateWorkFolderFileList(""); m_runner->requestAction(HgAction(ACT_CLONEFROMREMOTE, m_workFolderPath, params)); @@ -1776,7 +1778,7 @@ } MultiChoiceDialog::addRecentArgument("local", m_workFolderPath); MultiChoiceDialog::addRecentArgument("remote", m_remoteRepoPath); - m_hgTabs->setWorkFolderAndRepoNames(m_workFolderPath, m_remoteRepoPath); + updateWorkFolderAndRepoNames(); break; } @@ -2239,34 +2241,34 @@ if (m_stateUnknown) { if (m_workFolderPath == "") { - m_hgTabs->setState(tr("No repository open")); + m_workStatus->setState(tr("No repository open")); } else { - m_hgTabs->setState(tr("(Examining repository)")); + m_workStatus->setState(tr("(Examining repository)")); } } else if (emptyRepo) { - m_hgTabs->setState(tr("Nothing committed to this repository yet")); + m_workStatus->setState(tr("Nothing committed to this repository yet")); } else if (noWorkingCopy) { - m_hgTabs->setState(tr("No working copy yet: consider updating")); + m_workStatus->setState(tr("No working copy yet: consider updating")); } else if (canMerge) { - m_hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); + m_workStatus->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); } else if (!m_hgTabs->getAllUnresolvedFiles().empty()) { - m_hgTabs->setState(tr("Have unresolved files following merge on %1").arg(branchText)); + m_workStatus->setState(tr("Have unresolved files following merge on %1").arg(branchText)); } else if (haveMerge) { - m_hgTabs->setState(tr("Have merged but not yet committed on %1").arg(branchText)); + m_workStatus->setState(tr("Have merged but not yet committed on %1").arg(branchText)); } else if (newBranch) { - m_hgTabs->setState(tr("On %1. New branch: has not yet been committed").arg(branchText)); + m_workStatus->setState(tr("On %1. New branch: has not yet been committed").arg(branchText)); } else if (canUpdate) { if (m_hgTabs->haveChangesToCommit()) { // have uncommitted changes - m_hgTabs->setState(tr("On %1. Not at the head of the branch").arg(branchText)); + m_workStatus->setState(tr("On %1. Not at the head of the branch").arg(branchText)); } else { // no uncommitted changes - m_hgTabs->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText)); + m_workStatus->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText)); } } else if (m_currentBranchHeads > 1) { - m_hgTabs->setState(tr("At one of %n heads of %1", "", m_currentBranchHeads).arg(branchText)); + m_workStatus->setState(tr("At one of %n heads of %1", "", m_currentBranchHeads).arg(branchText)); } else { - m_hgTabs->setState(tr("At the head of %1").arg(branchText)); + m_workStatus->setState(tr("At the head of %1").arg(branchText)); } } @@ -2413,14 +2415,19 @@ } } +void MainWindow::updateWorkFolderAndRepoNames() +{ + m_hgTabs->setLocalPath(m_workFolderPath); + + m_workStatus->setLocalPath(m_workFolderPath); + m_workStatus->setRemoteURL(m_remoteRepoPath); +} + void MainWindow::createStatusBar() { statusBar()->showMessage(tr("Ready")); } - -//!!! review these: - void MainWindow::readSettings() { QDir workFolder; @@ -2438,12 +2445,10 @@ QSize size = settings.value("size", QSize(400, 400)).toSize(); m_firstStart = settings.value("firststart", QVariant(true)).toBool(); -//!!! initialFileTypesBits = (unsigned char) settings.value("viewFileTypes", QVariant(DEFAULT_HG_STAT_BITS)).toInt(); resize(size); move(pos); } - void MainWindow::writeSettings() { QSettings settings; @@ -2452,7 +2457,6 @@ settings.setValue("remoterepopath", m_remoteRepoPath); settings.setValue("workfolderpath", m_workFolderPath); settings.setValue("firststart", m_firstStart); - //!!!settings.setValue("viewFileTypes", m_hgTabs -> getFileTypesBits()); }