Add status bar and display items count (#779)

* Add status bar and display items count
This commit is contained in:
smhaziq 2018-10-10 20:34:46 +08:00 committed by xarkes
parent 8d3e8a65e1
commit 7c7cb4083c
23 changed files with 189 additions and 14 deletions

View File

@ -173,6 +173,7 @@ SOURCES += \
dialogs/R2PluginsDialog.cpp \ dialogs/R2PluginsDialog.cpp \
widgets/CutterDockWidget.cpp \ widgets/CutterDockWidget.cpp \
widgets/CutterSeekableWidget.cpp \ widgets/CutterSeekableWidget.cpp \
widgets/CutterTreeWidget.cpp \
widgets/GraphWidget.cpp \ widgets/GraphWidget.cpp \
utils/JsonTreeItem.cpp \ utils/JsonTreeItem.cpp \
utils/JsonModel.cpp \ utils/JsonModel.cpp \
@ -266,6 +267,7 @@ HEADERS += \
utils/NestedIPyKernel.h \ utils/NestedIPyKernel.h \
dialogs/R2PluginsDialog.h \ dialogs/R2PluginsDialog.h \
widgets/CutterDockWidget.h \ widgets/CutterDockWidget.h \
widgets/CutterTreeWidget.h \
widgets/CutterSeekableWidget.h \ widgets/CutterSeekableWidget.h \
widgets/GraphWidget.h \ widgets/GraphWidget.h \
utils/JsonTreeItem.h \ utils/JsonTreeItem.h \

View File

@ -217,10 +217,14 @@ bool CommentsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &ri
CommentsWidget::CommentsWidget(MainWindow *main, QAction *action) : CommentsWidget::CommentsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::CommentsWidget), ui(new Ui::CommentsWidget),
main(main) main(main),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
commentsModel = new CommentsModel(&comments, &nestedComments, this); commentsModel = new CommentsModel(&comments, &nestedComments, this);
commentsProxyModel = new CommentsProxyModel(commentsModel, this); commentsProxyModel = new CommentsProxyModel(commentsModel, this);
ui->commentsTreeView->setModel(commentsProxyModel); ui->commentsTreeView->setModel(commentsProxyModel);
@ -240,6 +244,10 @@ CommentsWidget::CommentsWidget(MainWindow *main, QAction *action) :
commentsProxyModel, SLOT(setFilterWildcard(const QString &))); commentsProxyModel, SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->commentsTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->commentsTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(commentsProxyModel->rowCount());
});
setScrollMode(); setScrollMode();
ui->actionHorizontal->setChecked(true); ui->actionHorizontal->setChecked(true);
@ -327,6 +335,8 @@ void CommentsWidget::refreshTree()
commentsModel->endResetModel(); commentsModel->endResetModel();
qhelpers::adjustColumns(ui->commentsTreeView, 3, 0); qhelpers::adjustColumns(ui->commentsTreeView, 3, 0);
tree->showItemsNumber(commentsProxyModel->rowCount());
} }
void CommentsWidget::setScrollMode() void CommentsWidget::setScrollMode()

View File

@ -7,6 +7,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h"
class MainWindow; class MainWindow;
class QTreeWidgetItem; class QTreeWidgetItem;
@ -88,6 +89,7 @@ private:
CommentsModel *commentsModel; CommentsModel *commentsModel;
CommentsProxyModel *commentsProxyModel; CommentsProxyModel *commentsProxyModel;
CutterTreeWidget *tree;
QList<CommentDescription> comments; QList<CommentDescription> comments;
QMap<QString, QList<CommentDescription>> nestedComments; QMap<QString, QList<CommentDescription>> nestedComments;

View File

@ -0,0 +1,26 @@
#include "CutterTreeWidget.h"
#include "MainWindow.h"
CutterTreeWidget::CutterTreeWidget(QObject *parent) :
QObject(parent),
bar(nullptr)
{}
void CutterTreeWidget::addStatusBar(QVBoxLayout *pos)
{
if(!bar) {
bar = new QStatusBar;
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
bar->setSizePolicy(sizePolicy);
pos->addWidget(bar);
}
}
void CutterTreeWidget::showItemsNumber(int count)
{
if(bar){
bar->showMessage(tr("%1 Items").arg(count));
}
}
CutterTreeWidget::~CutterTreeWidget() {}

View File

@ -0,0 +1,24 @@
#ifndef CUTTERTREEWIDGET_H
#define CUTTERTREEWIDGET_H
#include <QStatusBar>
#include <QVBoxLayout>
class MainWindow;
class CutterTreeWidget : public QObject
{
Q_OBJECT
public:
explicit CutterTreeWidget(QObject *parent = nullptr);
~CutterTreeWidget();
void addStatusBar(QVBoxLayout *pos);
void showItemsNumber(int count);
private:
QStatusBar *bar;
};
#endif // CUTTERTREEWIDGET_H

View File

@ -113,10 +113,14 @@ bool ExportsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &rig
ExportsWidget::ExportsWidget(MainWindow *main, QAction *action) : ExportsWidget::ExportsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::ExportsWidget) ui(new Ui::ExportsWidget),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
exportsModel = new ExportsModel(&exports, this); exportsModel = new ExportsModel(&exports, this);
exportsProxyModel = new ExportsProxyModel(exportsModel, this); exportsProxyModel = new ExportsProxyModel(exportsModel, this);
ui->exportsTreeView->setModel(exportsProxyModel); ui->exportsTreeView->setModel(exportsProxyModel);
@ -136,6 +140,10 @@ ExportsWidget::ExportsWidget(MainWindow *main, QAction *action) :
exportsProxyModel, SLOT(setFilterWildcard(const QString &))); exportsProxyModel, SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->exportsTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->exportsTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(exportsProxyModel->rowCount());
});
setScrollMode(); setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshExports())); connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshExports()));
@ -150,6 +158,8 @@ void ExportsWidget::refreshExports()
exportsModel->endResetModel(); exportsModel->endResetModel();
qhelpers::adjustColumns(ui->exportsTreeView, 3, 0); qhelpers::adjustColumns(ui->exportsTreeView, 3, 0);
tree->showItemsNumber(exportsProxyModel->rowCount());
} }

View File

@ -5,6 +5,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h"
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -70,6 +71,7 @@ private:
ExportsModel *exportsModel; ExportsModel *exportsModel;
ExportsProxyModel *exportsProxyModel; ExportsProxyModel *exportsProxyModel;
QList<ExportDescription> exports; QList<ExportDescription> exports;
CutterTreeWidget *tree;
void setScrollMode(); void setScrollMode();
}; };

View File

@ -114,10 +114,14 @@ bool FlagsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn
FlagsWidget::FlagsWidget(MainWindow *main, QAction *action) : FlagsWidget::FlagsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::FlagsWidget), ui(new Ui::FlagsWidget),
main(main) main(main),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
flags_model = new FlagsModel(&flags, this); flags_model = new FlagsModel(&flags, this);
flags_proxy_model = new FlagsSortFilterProxyModel(flags_model, this); flags_proxy_model = new FlagsSortFilterProxyModel(flags_model, this);
connect(ui->filterLineEdit, SIGNAL(textChanged(const QString &)), flags_proxy_model, connect(ui->filterLineEdit, SIGNAL(textChanged(const QString &)), flags_proxy_model,
@ -141,6 +145,10 @@ FlagsWidget::FlagsWidget(MainWindow *main, QAction *action) :
}); });
clearShortcut->setContext(Qt::WidgetWithChildrenShortcut); clearShortcut->setContext(Qt::WidgetWithChildrenShortcut);
connect(ui->filterLineEdit, &QLineEdit::textChanged, this, [this] {
tree->showItemsNumber(flags_proxy_model->rowCount());
});
setScrollMode(); setScrollMode();
ui->flagsTreeView->setContextMenuPolicy(Qt::CustomContextMenu); ui->flagsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
@ -238,6 +246,7 @@ void FlagsWidget::refreshFlags()
qhelpers::adjustColumns(ui->flagsTreeView, 2, 0); qhelpers::adjustColumns(ui->flagsTreeView, 2, 0);
tree->showItemsNumber(flags_proxy_model->rowCount());
// TODO: this is not a very good place for the following: // TODO: this is not a very good place for the following:
QStringList flagNames; QStringList flagNames;

View File

@ -8,6 +8,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h"
class MainWindow; class MainWindow;
class QTreeWidgetItem; class QTreeWidgetItem;
@ -78,11 +79,12 @@ private slots:
private: private:
std::unique_ptr<Ui::FlagsWidget> ui; std::unique_ptr<Ui::FlagsWidget> ui;
MainWindow *main; MainWindow *main;
FlagsModel *flags_model; FlagsModel *flags_model;
FlagsSortFilterProxyModel *flags_proxy_model; FlagsSortFilterProxyModel *flags_proxy_model;
QList<FlagDescription> flags; QList<FlagDescription> flags;
CutterTreeWidget *tree;
void refreshFlags(); void refreshFlags();
void setScrollMode(); void setScrollMode();

View File

@ -411,10 +411,14 @@ bool FunctionSortFilterProxyModel::lessThan(const QModelIndex &left, const QMode
FunctionsWidget::FunctionsWidget(MainWindow *main, QAction *action) : FunctionsWidget::FunctionsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::FunctionsWidget) ui(new Ui::FunctionsWidget),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
// Radare core found in: // Radare core found in:
this->main = main; this->main = main;
@ -445,6 +449,10 @@ FunctionsWidget::FunctionsWidget(MainWindow *main, QAction *action) :
SLOT(setFilterWildcard(const QString &))); SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->functionsTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->functionsTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(functionProxyModel->rowCount());
});
setScrollMode(); setScrollMode();
// Set Functions context menu // Set Functions context menu
@ -492,6 +500,8 @@ void FunctionsWidget::refreshTree()
// resize offset and size columns // resize offset and size columns
qhelpers::adjustColumns(ui->functionsTreeView, 3, 0); qhelpers::adjustColumns(ui->functionsTreeView, 3, 0);
tree->showItemsNumber(functionProxyModel->rowCount());
}); });
Core()->getAsyncTaskManager()->start(task); Core()->getAsyncTaskManager()->start(task);
} }

View File

@ -8,6 +8,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h"
class MainWindow; class MainWindow;
class QTreeWidgetItem; class QTreeWidgetItem;
@ -122,7 +123,7 @@ protected:
private: private:
std::unique_ptr<Ui::FunctionsWidget> ui; std::unique_ptr<Ui::FunctionsWidget> ui;
MainWindow *main; MainWindow *main;
QSharedPointer<FunctionsTask> task; QSharedPointer<FunctionsTask> task;
@ -133,6 +134,8 @@ private:
FunctionModel *functionModel; FunctionModel *functionModel;
FunctionSortFilterProxyModel *functionProxyModel; FunctionSortFilterProxyModel *functionProxyModel;
CutterTreeWidget *tree;
void setScrollMode(); void setScrollMode();
}; };

View File

@ -127,10 +127,14 @@ ImportsWidget::ImportsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::ImportsWidget), ui(new Ui::ImportsWidget),
importsModel(new ImportsModel(&imports, this)), importsModel(new ImportsModel(&imports, this)),
importsProxyModel(new ImportsProxyModel(importsModel, this)) importsProxyModel(new ImportsProxyModel(importsModel, this)),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
ui->importsTreeView->setModel(importsProxyModel); ui->importsTreeView->setModel(importsProxyModel);
ui->importsTreeView->sortByColumn(ImportsModel::NameColumn, Qt::AscendingOrder); ui->importsTreeView->sortByColumn(ImportsModel::NameColumn, Qt::AscendingOrder);
@ -148,6 +152,10 @@ ImportsWidget::ImportsWidget(MainWindow *main, QAction *action) :
importsProxyModel, SLOT(setFilterWildcard(const QString &))); importsProxyModel, SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->importsTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->importsTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(importsProxyModel->rowCount());
});
setScrollMode(); setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshImports())); connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshImports()));
@ -161,6 +169,8 @@ void ImportsWidget::refreshImports()
imports = Core()->getAllImports(); imports = Core()->getAllImports();
importsModel->endResetModel(); importsModel->endResetModel();
qhelpers::adjustColumns(ui->importsTreeView, 4, 0); qhelpers::adjustColumns(ui->importsTreeView, 4, 0);
tree->showItemsNumber(importsProxyModel->rowCount());
} }
void ImportsWidget::setScrollMode() void ImportsWidget::setScrollMode()

View File

@ -11,6 +11,7 @@
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "Cutter.h" #include "Cutter.h"
#include "CutterTreeWidget.h"
class MainWindow; class MainWindow;
class QTreeWidget; class QTreeWidget;
@ -84,9 +85,11 @@ private slots:
private: private:
std::unique_ptr<Ui::ImportsWidget> ui; std::unique_ptr<Ui::ImportsWidget> ui;
ImportsModel *importsModel; ImportsModel *importsModel;
ImportsProxyModel *importsProxyModel; ImportsProxyModel *importsProxyModel;
QList<ImportDescription> imports; QList<ImportDescription> imports;
CutterTreeWidget *tree;
void highlightUnsafe(); void highlightUnsafe();
void setScrollMode(); void setScrollMode();

View File

@ -103,10 +103,14 @@ bool RegisterRefProxyModel::lessThan(const QModelIndex &left, const QModelIndex
RegisterRefsWidget::RegisterRefsWidget(MainWindow *main, QAction *action) : RegisterRefsWidget::RegisterRefsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::RegisterRefsWidget) ui(new Ui::RegisterRefsWidget),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
registerRefModel = new RegisterRefModel(&registerRefs, this); registerRefModel = new RegisterRefModel(&registerRefs, this);
registerRefProxyModel = new RegisterRefProxyModel(registerRefModel, this); registerRefProxyModel = new RegisterRefProxyModel(registerRefModel, this);
ui->registerRefTreeView->setModel(registerRefProxyModel); ui->registerRefTreeView->setModel(registerRefProxyModel);
@ -135,6 +139,10 @@ RegisterRefsWidget::RegisterRefsWidget(MainWindow *main, QAction *action) :
ui->registerRefTreeView->setContextMenuPolicy(Qt::CustomContextMenu); ui->registerRefTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->registerRefTreeView, SIGNAL(customContextMenuRequested(const QPoint &)), connect(ui->registerRefTreeView, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showRegRefContextMenu(const QPoint &))); this, SLOT(showRegRefContextMenu(const QPoint &)));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(registerRefProxyModel->rowCount());
});
} }
RegisterRefsWidget::~RegisterRefsWidget() {} RegisterRefsWidget::~RegisterRefsWidget() {}
@ -148,6 +156,8 @@ void RegisterRefsWidget::refreshRegisterRef()
ui->registerRefTreeView->resizeColumnToContents(0); ui->registerRefTreeView->resizeColumnToContents(0);
ui->registerRefTreeView->resizeColumnToContents(1); ui->registerRefTreeView->resizeColumnToContents(1);
ui->registerRefTreeView->resizeColumnToContents(2); ui->registerRefTreeView->resizeColumnToContents(2);
tree->showItemsNumber(registerRefProxyModel->rowCount());
} }
void RegisterRefsWidget::setScrollMode() void RegisterRefsWidget::setScrollMode()

View File

@ -4,6 +4,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h"
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -80,5 +81,6 @@ private:
QList<RegisterRefDescription> registerRefs; QList<RegisterRefDescription> registerRefs;
QAction *actionCopyValue; QAction *actionCopyValue;
QAction *actionCopyRef; QAction *actionCopyRef;
CutterTreeWidget *tree;
void setScrollMode(); void setScrollMode();
}; };

View File

@ -104,10 +104,14 @@ RelocsWidget::RelocsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::RelocsWidget), ui(new Ui::RelocsWidget),
relocsModel(new RelocsModel(&relocs, this)), relocsModel(new RelocsModel(&relocs, this)),
relocsProxyModel(new RelocsProxyModel(relocsModel, this)) relocsProxyModel(new RelocsProxyModel(relocsModel, this)),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
ui->relocsTreeView->setModel(relocsProxyModel); ui->relocsTreeView->setModel(relocsProxyModel);
ui->relocsTreeView->sortByColumn(RelocsModel::NameColumn, Qt::AscendingOrder); ui->relocsTreeView->sortByColumn(RelocsModel::NameColumn, Qt::AscendingOrder);
@ -125,6 +129,10 @@ RelocsWidget::RelocsWidget(MainWindow *main, QAction *action) :
relocsProxyModel, SLOT(setFilterWildcard(const QString &))); relocsProxyModel, SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->relocsTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->relocsTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(relocsProxyModel->rowCount());
});
setScrollMode(); setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshRelocs())); connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshRelocs()));
@ -146,6 +154,8 @@ void RelocsWidget::refreshRelocs()
relocs = Core()->getAllRelocs(); relocs = Core()->getAllRelocs();
relocsModel->endResetModel(); relocsModel->endResetModel();
qhelpers::adjustColumns(ui->relocsTreeView, 3, 0); qhelpers::adjustColumns(ui->relocsTreeView, 3, 0);
tree->showItemsNumber(relocsProxyModel->rowCount());
} }
void RelocsWidget::setScrollMode() void RelocsWidget::setScrollMode()

View File

@ -7,6 +7,7 @@
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "Cutter.h" #include "Cutter.h"
#include "CutterTreeWidget.h"
class MainWindow; class MainWindow;
class RelocsWidget; class RelocsWidget;
@ -63,9 +64,11 @@ private slots:
private: private:
std::unique_ptr<Ui::RelocsWidget> ui; std::unique_ptr<Ui::RelocsWidget> ui;
RelocsModel *relocsModel; RelocsModel *relocsModel;
RelocsProxyModel *relocsProxyModel; RelocsProxyModel *relocsProxyModel;
QList<RelocDescription> relocs; QList<RelocDescription> relocs;
CutterTreeWidget *tree;
void setScrollMode(); void setScrollMode();
}; };

View File

@ -122,10 +122,14 @@ bool StringsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModel
StringsWidget::StringsWidget(MainWindow *main, QAction *action) : StringsWidget::StringsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::StringsWidget) ui(new Ui::StringsWidget),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
qhelpers::setVerticalScrollMode(ui->stringsTreeView); qhelpers::setVerticalScrollMode(ui->stringsTreeView);
// Ctrl-F to show/hide the filter entry // Ctrl-F to show/hide the filter entry
@ -147,6 +151,10 @@ StringsWidget::StringsWidget(MainWindow *main, QAction *action) :
SLOT(setFilterWildcard(const QString &))); SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->stringsTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->stringsTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(proxy_model->rowCount());
});
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshStrings())); connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshStrings()));
} }
@ -183,5 +191,7 @@ void StringsWidget::stringSearchFinished(const QList<StringDescription> &strings
if (ui->stringsTreeView->columnWidth(1) > 300) if (ui->stringsTreeView->columnWidth(1) > 300)
ui->stringsTreeView->setColumnWidth(1, 300); ui->stringsTreeView->setColumnWidth(1, 300);
tree->showItemsNumber(proxy_model->rowCount());
task = nullptr; task = nullptr;
} }

View File

@ -6,6 +6,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "utils/StringsTask.h" #include "utils/StringsTask.h"
#include "CutterTreeWidget.h"
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -77,6 +78,7 @@ private:
StringsModel *model; StringsModel *model;
StringsSortFilterProxyModel *proxy_model; StringsSortFilterProxyModel *proxy_model;
QList<StringDescription> strings; QList<StringDescription> strings;
CutterTreeWidget *tree;
}; };
#endif // STRINGSWIDGET_H #endif // STRINGSWIDGET_H

View File

@ -102,10 +102,14 @@ bool SymbolsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &rig
SymbolsWidget::SymbolsWidget(MainWindow *main, QAction *action) : SymbolsWidget::SymbolsWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::SymbolsWidget) ui(new Ui::SymbolsWidget),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
symbolsModel = new SymbolsModel(&symbols, this); symbolsModel = new SymbolsModel(&symbols, this);
symbolsProxyModel = new SymbolsProxyModel(symbolsModel, this); symbolsProxyModel = new SymbolsProxyModel(symbolsModel, this);
ui->symbolsTreeView->setModel(symbolsProxyModel); ui->symbolsTreeView->setModel(symbolsProxyModel);
@ -125,6 +129,10 @@ SymbolsWidget::SymbolsWidget(MainWindow *main, QAction *action) :
symbolsProxyModel, SLOT(setFilterWildcard(const QString &))); symbolsProxyModel, SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->symbolsTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->symbolsTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(symbolsProxyModel->rowCount());
});
setScrollMode(); setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshSymbols())); connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshSymbols()));
@ -149,6 +157,8 @@ void SymbolsWidget::refreshSymbols()
symbolsModel->endResetModel(); symbolsModel->endResetModel();
qhelpers::adjustColumns(ui->symbolsTreeView, SymbolsModel::ColumnCount, 0); qhelpers::adjustColumns(ui->symbolsTreeView, SymbolsModel::ColumnCount, 0);
tree->showItemsNumber(symbolsProxyModel->rowCount());
} }
void SymbolsWidget::setScrollMode() void SymbolsWidget::setScrollMode()

View File

@ -7,6 +7,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h"
class MainWindow; class MainWindow;
class QTreeWidgetItem; class QTreeWidgetItem;
@ -66,9 +67,11 @@ private slots:
private: private:
std::unique_ptr<Ui::SymbolsWidget> ui; std::unique_ptr<Ui::SymbolsWidget> ui;
QList<SymbolDescription> symbols; QList<SymbolDescription> symbols;
SymbolsModel *symbolsModel; SymbolsModel *symbolsModel;
SymbolsProxyModel *symbolsProxyModel; SymbolsProxyModel *symbolsProxyModel;
CutterTreeWidget *tree;
void setScrollMode(); void setScrollMode();
}; };

View File

@ -128,10 +128,14 @@ bool VTableSortFilterProxyModel::filterAcceptsRow(int source_row,
VTablesWidget::VTablesWidget(MainWindow *main, QAction *action) : VTablesWidget::VTablesWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action), CutterDockWidget(main, action),
ui(new Ui::VTablesWidget) ui(new Ui::VTablesWidget),
tree(new CutterTreeWidget(this))
{ {
ui->setupUi(this); ui->setupUi(this);
// Add Status Bar footer
tree->addStatusBar(ui->verticalLayout);
model = new VTableModel(&vtables, this); model = new VTableModel(&vtables, this);
proxy = new VTableSortFilterProxyModel(model); proxy = new VTableSortFilterProxyModel(model);
@ -151,6 +155,10 @@ VTablesWidget::VTablesWidget(MainWindow *main, QAction *action) :
SLOT(setFilterWildcard(const QString &))); SLOT(setFilterWildcard(const QString &)));
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->vTableTreeView, SLOT(setFocus())); connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->vTableTreeView, SLOT(setFocus()));
connect(ui->quickFilterView, &QuickFilterView::filterTextChanged, this, [this] {
tree->showItemsNumber(proxy->rowCount());
});
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshVTables())); connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshVTables()));
} }
@ -167,6 +175,8 @@ void VTablesWidget::refreshVTables()
qhelpers::adjustColumns(ui->vTableTreeView, 3, 0); qhelpers::adjustColumns(ui->vTableTreeView, 3, 0);
ui->vTableTreeView->setColumnWidth(0, 200); ui->vTableTreeView->setColumnWidth(0, 200);
tree->showItemsNumber(proxy->rowCount());
} }
void VTablesWidget::on_vTableTreeView_doubleClicked(const QModelIndex &index) void VTablesWidget::on_vTableTreeView_doubleClicked(const QModelIndex &index)

View File

@ -8,6 +8,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "CutterDockWidget.h" #include "CutterDockWidget.h"
#include "CutterTreeWidget.h"
namespace Ui { namespace Ui {
class VTablesWidget; class VTablesWidget;
@ -68,6 +69,7 @@ private:
VTableModel *model; VTableModel *model;
QSortFilterProxyModel *proxy; QSortFilterProxyModel *proxy;
QList<VTableDescription> vtables; QList<VTableDescription> vtables;
CutterTreeWidget *tree;
}; };
#endif // VTABLESWIDGET_H #endif // VTABLESWIDGET_H