M src/filestatuswidget.cpp +23 -3
@@ 18,6 18,7 @@
#include "filestatuswidget.h"
#include "debug.h"
#include "multichoicedialog.h"
+#include "findwidget.h"
#include <QLabel>
#include <QListWidget>
@@ 154,9 155,19 @@ FileStatusWidget::FileStatusWidget(QWidg
layout->addItem(new QSpacerItem(8, 8), ++row, 0);
- m_showAllFiles = new QCheckBox(tr("Show all files"), this);
+ QWidget *opts = new QWidget;
+ QGridLayout *optLayout = new QGridLayout(opts);
+ optLayout->setMargin(0);
+ layout->addWidget(opts, ++row, 0);
+
+ m_findWidget = new FindWidget(this);
+ optLayout->addWidget(m_findWidget, 0, 0, Qt::AlignLeft);
+ connect(m_findWidget, SIGNAL(findTextChanged(QString)),
+ this, SLOT(setSearchText(QString)));
+
+ m_showAllFiles = new QCheckBox(tr("Show all file states"), this);
m_showAllFiles->setEnabled(false);
- layout->addWidget(m_showAllFiles, ++row, 0, Qt::AlignLeft);
+ optLayout->addWidget(m_showAllFiles, 0, 1, Qt::AlignRight);
QSettings settings;
m_showAllFiles->setChecked(settings.value("showall", false).toBool());
@@ 209,7 220,16 @@ void FileStatusWidget::setNoModification
{
QSettings settings;
settings.beginGroup("Presentation");
- if (settings.value("showhelpfultext", true).toBool()) {
+
+ if (m_searchText != "") {
+ if (!m_showAllFiles->isChecked()) {
+ m_noModificationsLabel->setText
+ (tr("<qt><b>Nothing found</b><br>None of the modified files have matching filenames.<br>Select <b>Show all file states</b> to find matches among unmodified and untracked files as well.</qt>"));
+ } else {
+ m_noModificationsLabel->setText
+ (tr("<qt><b>Nothing found</b><br>No files have matching filenames.</qt>"));
+ }
+ } else if (settings.value("showhelpfultext", true).toBool()) {
m_noModificationsLabel->setText
(tr("<qt>This area will list files in your working folder that you have changed.<br><br>At the moment you have no uncommitted changes.<br><br>To see changes previously made to the repository,<br>switch to the History tab.<br><br>%1</qt>")
#if defined Q_OS_MAC
M src/filestatuswidget.h +2 -0
@@ 29,6 29,7 @@ class QListWidgetItem;
class QPushButton;
class QFileInfo;
class QCheckBox;
+class FindWidget;
class FileStatusWidget : public QWidget
{
@@ 89,6 90,7 @@ private:
QString m_localPath;
QLabel *m_noModificationsLabel;
+ FindWidget *m_findWidget;
QCheckBox *m_showAllFiles;
FileStates m_fileStates;
M src/findwidget.cpp +7 -5
@@ 26,25 26,26 @@ FindWidget::FindWidget(QWidget *parent)
QWidget(parent)
{
QGridLayout *layout = new QGridLayout;
+ layout->setMargin(0);
setLayout(layout);
QToolButton *button = new QToolButton();
layout->addWidget(button, 0, 0);
button->setText(tr("Find..."));
button->setToolButtonStyle(Qt::ToolButtonTextOnly);
- button->setAutoRaise(true);
+// button->setAutoRaise(true);
connect(button, SIGNAL(clicked()), this, SLOT(buttonPressed()));
-/*
- QLabel *label = new QLabel(tr("Find:"));
- layout->addWidget(label, 0, 0);
-*/
m_lineEdit = new QLineEdit();
layout->addWidget(m_lineEdit, 0, 1);
m_lineEdit->setFixedWidth(100);
m_lineEdit->hide();
+ int h = m_lineEdit->sizeHint().height();
+ int h0 = button->sizeHint().height();
+ if (h > h0) button->setFixedHeight(h);
+
connect(m_lineEdit, SIGNAL(textChanged(const QString &)),
this, SIGNAL(findTextChanged(QString)));
}
@@ 66,6 67,7 @@ FindWidget::buttonPressed()
}
} else {
m_lineEdit->show();
+ m_lineEdit->setFocus(Qt::OtherFocusReason);
button->setText(tr("Find:"));
if (m_lineEdit->text() != "") {
emit findTextChanged(m_lineEdit->text());
M src/historywidget.cpp +12 -1
@@ 23,6 23,7 @@
#include "grapher.h"
#include "debug.h"
#include "uncommitteditem.h"
+#include "findwidget.h"
#include <iostream>
@@ 55,11 56,21 @@ HistoryWidget::HistoryWidget() :
settings.beginGroup("Presentation");
bool showClosed = (settings.value("showclosedbranches", false).toBool());
+ QWidget *opts = new QWidget;
+ QGridLayout *optLayout = new QGridLayout(opts);
+ optLayout->setMargin(0);
+ layout->addWidget(opts, ++row, 0, 1, 2);
+
+ m_findWidget = new FindWidget(this);
+ optLayout->addWidget(m_findWidget, 0, 0, Qt::AlignLeft);
+ connect(m_findWidget, SIGNAL(findTextChanged(QString)),
+ this, SLOT(setSearchText(QString)));
+
m_showClosedBranches = new QCheckBox(tr("Show closed branches"), this);
m_showClosedBranches->setChecked(showClosed);
connect(m_showClosedBranches, SIGNAL(toggled(bool)),
this, SLOT(showClosedChanged(bool)));
- layout->addWidget(m_showClosedBranches, ++row, 0, Qt::AlignLeft);
+ optLayout->addWidget(m_showClosedBranches, 0, 1, Qt::AlignRight);
m_showClosedBranches->hide();
setLayout(layout);
M src/historywidget.h +2 -0
@@ 28,6 28,7 @@ class Panned;
class Panner;
class UncommittedItem;
class QGraphicsScene;
+class FindWidget;
class HistoryWidget : public QWidget
{
@@ 81,6 82,7 @@ private:
bool m_showUncommitted;
bool m_refreshNeeded;
+ FindWidget *m_findWidget;
Panned *m_panned;
Panner *m_panner;
QCheckBox *m_showClosedBranches;
M src/mainwindow.cpp +1 -13
@@ 53,7 53,6 @@
#include "hgignoredialog.h"
#include "versiontester.h"
#include "fswatcher.h"
-#include "findwidget.h"
MainWindow::MainWindow(QString myDirPath) :
@@ 108,12 107,7 @@ MainWindow::MainWindow(QString myDirPath
#endif
m_workStatus = new WorkStatusWidget(this);
- cl->addWidget(m_workStatus, row, 0);
-
- m_findWidget = new FindWidget(this);
- cl->addWidget(m_findWidget, row++, 1, Qt::AlignRight | Qt::AlignTop);
- connect(m_findWidget, SIGNAL(findTextChanged(QString)),
- this, SLOT(findTextChanged(QString)));
+ cl->addWidget(m_workStatus, row++, 0);
m_hgTabs = new HgTabWidget(central, m_workFolderPath);
connectTabsSignals();
@@ 232,12 226,6 @@ void MainWindow::showAllChanged()
hgQueryPaths();
}
-void MainWindow::findTextChanged(QString text)
-{
- std::cerr << "find: " << text << std::endl;
- m_hgTabs->setSearchText(text);
-}
-
void MainWindow::hgRefresh()
{
clearState();
M src/mainwindow.h +0 -3
@@ 36,7 36,6 @@ QT_END_NAMESPACE
class WorkStatusWidget;
class FsWatcher;
-class FindWidget;
class MainWindow : public QMainWindow
{
@@ 69,7 68,6 @@ private slots:
void startupDialog();
void clearSelections();
void showAllChanged();
- void findTextChanged(QString);
void hgTest();
void hgTestExtension();
@@ 183,7 181,6 @@ private:
WorkStatusWidget *m_workStatus;
HgTabWidget *m_hgTabs;
- FindWidget *m_findWidget;
QString m_remoteRepoPath;
QString m_workFolderPath;