1
0
Fork 0

More detailed description of menu actions in status bar + about Qt

This commit is contained in:
torusrxxx 2021-09-13 17:25:33 +08:00
parent c113a6ae1c
commit 51d92b3b56
No known key found for this signature in database
GPG Key ID: A795C73A0F1CFADD
5 changed files with 48 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#include "LogStatusLabel.h"
#include <QTextDocument>
#include <QApplication>
#include <QStatusBar>
LogStatusLabel::LogStatusLabel(QStatusBar* parent) : QLabel(parent)
{
@ -20,7 +21,6 @@ void LogStatusLabel::logUpdate(QString message)
labelText += message.replace("\r\n", "\n");
QStringList lineList = labelText.split('\n');
labelText = lineList.last(); //if the last character is a newline this will be an empty string
QString finalLabel;
for(int i = 0; i < lineList.length(); i++)
{
const QString & line = lineList[lineList.size() - i - 1];
@ -79,3 +79,14 @@ void LogStatusLabel::getActiveView(ACTIVEVIEW* active)
strncpy_s(active->className, className(now, active->classHwnd).toUtf8().constData(), _TRUNCATE);
Bridge::getBridge()->setResult(BridgeResult::GetActiveView);
}
void LogStatusLabel::showMessage(const QString & message)
{
statusTip = message;
if(statusTip.isEmpty())
setText(finalLabel);
else
{
setText(statusTip);
}
}

View File

@ -2,9 +2,10 @@
#define LOGSTATUSLABEL_H
#include <QLabel>
#include <QStatusBar>
#include "Bridge.h"
class QStatusBar;
class LogStatusLabel : public QLabel
{
Q_OBJECT
@ -16,9 +17,13 @@ public slots:
void logUpdateUtf8(QByteArray message);
void focusChanged(QWidget* old, QWidget* now);
void getActiveView(ACTIVEVIEW* active);
// show status tip
void showMessage(const QString & message);
private:
QString finalLabel;
QString labelText;
QString statusTip;
};
#endif // LOGSTATUSLABEL_H

View File

@ -6,6 +6,7 @@
#include <QFileDialog>
#include <QMimeData>
#include <QDesktopServices>
#include <QStatusTipEvent>
#include "Configuration.h"
#include "SettingsDialog.h"
#include "AppearanceDialog.h"
@ -1078,6 +1079,12 @@ bool MainWindow::event(QEvent* event)
{
mTabWidget->setCurrentIndex(mTabWidget->currentIndex());
}
else if(event->type() == QEvent::StatusTip)
{
QStatusTipEvent* tip = dynamic_cast<QStatusTipEvent*>(event);
mLastLogLabel->showMessage(tip->tip());
return true;
}
return QMainWindow::event(event);
}
@ -2064,7 +2071,7 @@ void MainWindow::clickFavouriteTool()
auto format = toolPath.mid(sfStart + 2, sfEnd - sfStart - 2);
toolPath.replace(sfStart, sfEnd - sfStart + 2, stringFormatInline(format));
}
mLastLogLabel->setText(toolPath);
GuiAddLogMessage(tr("Starting tool %1\n").arg(toolPath).toUtf8().constData());
PROCESS_INFORMATION procinfo;
STARTUPINFO startupinfo;
memset(&procinfo, 0, sizeof(PROCESS_INFORMATION));
@ -2104,6 +2111,7 @@ void MainWindow::chooseLanguage()
{
QDir translationsDir(QString("%1/../translations/").arg(QCoreApplication::applicationDirPath()));
QFile file(translationsDir.absoluteFilePath(QString("x64dbg_%1.qm").arg(localeName)));
// A translation file less than 0.5KB is probably not useful
if(file.size() < 512)
{
QMessageBox msg(this);
@ -2371,6 +2379,11 @@ void MainWindow::on_actionDefaultTheme_triggered()
updateDarkTitleBar();
}
void MainWindow::on_actionAbout_Qt_triggered()
{
QMessageBox::aboutQt(this);
}
void MainWindow::updateStyle()
{
// Set configured link color

View File

@ -287,6 +287,7 @@ private slots:
void on_actionPlugins_triggered();
void on_actionCheckUpdates_triggered();
void on_actionDefaultTheme_triggered();
void on_actionAbout_Qt_triggered();
};
#endif // MAINWINDOW_H

View File

@ -159,6 +159,7 @@
<addaction name="actionManual"/>
<addaction name="actionFaq"/>
<addaction name="actionAbout"/>
<addaction name="actionAbout_Qt"/>
<addaction name="separator"/>
<addaction name="actionCrashDump"/>
</widget>
@ -316,6 +317,9 @@
<property name="text">
<string>&amp;Open</string>
</property>
<property name="statusTip">
<string>Run the file and start debugging.</string>
</property>
</action>
<action name="actionExit">
<property name="icon">
@ -352,6 +356,9 @@
<property name="text">
<string>Re&amp;start</string>
</property>
<property name="statusTip">
<string>Stop the debuggee and restart it, or restart the last debugged file.</string>
</property>
</action>
<action name="actionClose">
<property name="icon">
@ -1263,6 +1270,14 @@
<string>&amp;Clear database</string>
</property>
</action>
<action name="actionAbout_Qt">
<property name="text">
<string>About Qt</string>
</property>
<property name="statusTip">
<string>Display information about Qt</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>