mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 13:55:26 +00:00
Add shortcut to refresh visible DockWidgets
+ Fix some warnings
This commit is contained in:
parent
e968479be1
commit
a7b70dbf8f
@ -52,7 +52,28 @@ static void registerCustomFonts()
|
|||||||
MainWindow::MainWindow(QWidget *parent, QRCore *kore) :
|
MainWindow::MainWindow(QWidget *parent, QRCore *kore) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
core(kore),
|
core(kore),
|
||||||
|
asmDock(nullptr),
|
||||||
|
calcDock(nullptr),
|
||||||
|
omnibar(nullptr),
|
||||||
|
memoryDock(nullptr),
|
||||||
|
notepadDock(nullptr),
|
||||||
|
sideBar(nullptr),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
|
highlighter(nullptr),
|
||||||
|
hex_highlighter(nullptr),
|
||||||
|
graphicsBar(nullptr),
|
||||||
|
functionsDock(nullptr),
|
||||||
|
importsDock(nullptr),
|
||||||
|
symbolsDock(nullptr),
|
||||||
|
relocsDock(nullptr),
|
||||||
|
commentsDock(nullptr),
|
||||||
|
stringsDock(nullptr),
|
||||||
|
flagsDock(nullptr),
|
||||||
|
dashboardDock(nullptr),
|
||||||
|
gotoEntry(nullptr),
|
||||||
|
sdbDock(nullptr),
|
||||||
|
sidebar_action(nullptr),
|
||||||
|
sectionsDock(nullptr),
|
||||||
webserverThread(core, this)
|
webserverThread(core, this)
|
||||||
{
|
{
|
||||||
this->start_web_server();
|
this->start_web_server();
|
||||||
@ -223,6 +244,9 @@ MainWindow::MainWindow(QWidget *parent, QRCore *kore) :
|
|||||||
connect(commands_shortcut, SIGNAL(activated()), this->omnibar, SLOT(showCommands()));
|
connect(commands_shortcut, SIGNAL(activated()), this->omnibar, SLOT(showCommands()));
|
||||||
|
|
||||||
connect(&webserverThread, SIGNAL(finished()), this, SLOT(webserverThreadFinished()));
|
connect(&webserverThread, SIGNAL(finished()), this, SLOT(webserverThreadFinished()));
|
||||||
|
|
||||||
|
QShortcut *refresh_shortcut = new QShortcut(QKeySequence(QKeySequence::Refresh), this);
|
||||||
|
connect(refresh_shortcut, SIGNAL(activated()), this, SLOT(refreshVisibleDockWidgets()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -263,14 +287,15 @@ void MainWindow::appendRow(QTreeWidget *tw, const QString &str, const QString &s
|
|||||||
// Fill dummy hidden column
|
// Fill dummy hidden column
|
||||||
tempItem->setText(0, "0");
|
tempItem->setText(0, "0");
|
||||||
tempItem->setText(1, str);
|
tempItem->setText(1, str);
|
||||||
if (str2 != NULL)
|
if (!str2.isNull())
|
||||||
tempItem->setText(2, str2);
|
tempItem->setText(2, str2);
|
||||||
if (str3 != NULL)
|
if (!str3.isNull())
|
||||||
tempItem->setText(3, str3);
|
tempItem->setText(3, str3);
|
||||||
if (str4 != NULL)
|
if (!str4.isNull())
|
||||||
tempItem->setText(4, str4);
|
tempItem->setText(4, str4);
|
||||||
if (str5 != NULL)
|
if (!str5.isNull())
|
||||||
tempItem->setText(5, str5);
|
tempItem->setText(5, str5);
|
||||||
|
|
||||||
tw->insertTopLevelItem(0, tempItem);
|
tw->insertTopLevelItem(0, tempItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +486,7 @@ void MainWindow::updateFrames()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
refreshMem("");
|
refreshMem();
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshFlagspaces();
|
refreshFlagspaces();
|
||||||
@ -695,8 +720,8 @@ void MainWindow::on_actionMem_triggered()
|
|||||||
this->dockList << newMemDock;
|
this->dockList << newMemDock;
|
||||||
newMemDock->setAttribute(Qt::WA_DeleteOnClose);
|
newMemDock->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
this->tabifyDockWidget(this->memoryDock, newMemDock);
|
this->tabifyDockWidget(this->memoryDock, newMemDock);
|
||||||
newMemDock->refreshDisasm("");
|
newMemDock->refreshDisasm();
|
||||||
newMemDock->refreshHexdump("");
|
newMemDock->refreshHexdump();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionFunctions_triggered()
|
void MainWindow::on_actionFunctions_triggered()
|
||||||
@ -898,7 +923,7 @@ void MainWindow::setup_mem()
|
|||||||
this->memoryDock->setFcnName(off);
|
this->memoryDock->setFcnName(off);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshMem(QString off)
|
void MainWindow::refreshMem(const QString &offset)
|
||||||
{
|
{
|
||||||
//add_debug_output("Refreshing to: " + off);
|
//add_debug_output("Refreshing to: " + off);
|
||||||
//graphicsBar->refreshColorBar();
|
//graphicsBar->refreshColorBar();
|
||||||
@ -908,8 +933,8 @@ void MainWindow::refreshMem(QString off)
|
|||||||
this->memoryDock->create_graph(off);
|
this->memoryDock->create_graph(off);
|
||||||
*/
|
*/
|
||||||
this->memoryDock->updateViews();
|
this->memoryDock->updateViews();
|
||||||
this->memoryDock->get_refs_data(off);
|
this->memoryDock->get_refs_data(offset);
|
||||||
this->memoryDock->setFcnName(off);
|
this->memoryDock->setFcnName(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_backButton_clicked()
|
void MainWindow::on_backButton_clicked()
|
||||||
@ -1098,7 +1123,7 @@ void MainWindow::on_actionRun_Script_triggered()
|
|||||||
|
|
||||||
qDebug() << "Meow: " + fileName;
|
qDebug() << "Meow: " + fileName;
|
||||||
this->core->cmd(". " + fileName);
|
this->core->cmd(". " + fileName);
|
||||||
this->refreshMem("");
|
this->refreshMem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionDark_Theme_triggered()
|
void MainWindow::on_actionDark_Theme_triggered()
|
||||||
@ -1192,3 +1217,29 @@ void MainWindow::on_actionQuit_triggered()
|
|||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::refreshVisibleDockWidgets()
|
||||||
|
{
|
||||||
|
// There seems to be no convenience function to check if a QDockWidget
|
||||||
|
// is really visible or hidden in a tabbed dock. So:
|
||||||
|
auto isDockVisible = [](const QDockWidget * const pWidget) {
|
||||||
|
return pWidget != nullptr && !pWidget->visibleRegion().isEmpty();
|
||||||
|
};
|
||||||
|
|
||||||
|
//TODO: not used/set atm
|
||||||
|
// if (isDockVisible(asmDock)) { asmDock->update(); }
|
||||||
|
// if (isDockVisible(calcDock)) { calcDock->update(); }
|
||||||
|
|
||||||
|
if (isDockVisible(memoryDock)) { memoryDock->updateViews(); }
|
||||||
|
// TODO: if (isDockVisible(notepadDock)) { eprint("notepadDock visible"); }
|
||||||
|
if (isDockVisible(functionsDock)) { functionsDock->refreshTree(); }
|
||||||
|
if (isDockVisible(importsDock)) { importsDock->fillImports(); }
|
||||||
|
if (isDockVisible(symbolsDock)) { symbolsDock->fillSymbols(); }
|
||||||
|
// TODO: update/refresh function if (isDockVisible(relocsDock)) { eprint("relocsDock visible"); }
|
||||||
|
if (isDockVisible(commentsDock)) { commentsDock->refreshTree(); }
|
||||||
|
// TODO: update/refresh function if (isDockVisible(stringsDock)) { eprint("stringsDock visible"); }
|
||||||
|
// TODO: update/refresh function if (isDockVisible(flagsDock)) { eprint("flagsDock visible"); }
|
||||||
|
if (isDockVisible(dashboardDock)) { dashboardDock->updateContents(); }
|
||||||
|
// TODO: update/refresh function if (isDockVisible(sdbDock)) { eprint("sdbDock visible"); }
|
||||||
|
// TODO: update/refresh function if (isDockVisible(sectionsDock)) { eprint("sectionsDock visible"); }
|
||||||
|
}
|
||||||
|
@ -76,8 +76,8 @@ public:
|
|||||||
void add_debug_output(QString msg);
|
void add_debug_output(QString msg);
|
||||||
void send_to_notepad(QString txt);
|
void send_to_notepad(QString txt);
|
||||||
void adjustColumns(QTreeWidget *tw);
|
void adjustColumns(QTreeWidget *tw);
|
||||||
void appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = NULL,
|
void appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(),
|
||||||
const QString &str3 = NULL, const QString &str4 = NULL, const QString &str5 = NULL);
|
const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString());
|
||||||
|
|
||||||
void setWebServerState(bool start);
|
void setWebServerState(bool start);
|
||||||
|
|
||||||
@ -189,19 +189,19 @@ private slots:
|
|||||||
|
|
||||||
void on_actionQuit_triggered();
|
void on_actionQuit_triggered();
|
||||||
|
|
||||||
|
void refreshVisibleDockWidgets();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refreshFlagspaces();
|
void refreshFlagspaces();
|
||||||
bool doLock;
|
bool doLock;
|
||||||
void refreshMem(QString off);
|
void refreshMem(const QString &offset = QString());
|
||||||
void setup_mem();
|
void setup_mem();
|
||||||
ut64 hexdumpTopOffset;
|
ut64 hexdumpTopOffset;
|
||||||
ut64 hexdumpBottomOffset;
|
ut64 hexdumpBottomOffset;
|
||||||
QString filename;
|
QString filename;
|
||||||
QList<QDockWidget *> dockList;
|
QList<QDockWidget *> dockList;
|
||||||
QLabel *logo;
|
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
Highlighter *highlighter;
|
Highlighter *highlighter;
|
||||||
Highlighter *highlighter_5;
|
|
||||||
AsciiHighlighter *hex_highlighter;
|
AsciiHighlighter *hex_highlighter;
|
||||||
GraphicsBar *graphicsBar;
|
GraphicsBar *graphicsBar;
|
||||||
FunctionsWidget *functionsDock;
|
FunctionsWidget *functionsDock;
|
||||||
|
Loading…
Reference in New Issue
Block a user