- fix: step into instruction and step over instruction not correctly disabled when cpu dialog is created
- enhancement: icons in cpu dialog auto change size with fonts
This commit is contained in:
parent
cec7511009
commit
3b7eb3b2da
|
@ -9,9 +9,6 @@ IconsManager* pIconsManager;
|
|||
IconsManager::IconsManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
mDefaultIcon = PIcon();
|
||||
//updateEditorGuttorIcons(24);
|
||||
mFolder = std::make_shared<QPixmap>(":/icons/images/newlook24/090-explorer.png");
|
||||
|
||||
}
|
||||
|
||||
void IconsManager::updateEditorGuttorIcons(const QString& iconSet,int size)
|
||||
|
@ -50,6 +47,7 @@ void IconsManager::updateParserIcons(const QString &iconSet, int size)
|
|||
void IconsManager::updateActionIcons(const QString iconSet, int size)
|
||||
{
|
||||
QString iconFolder = QString(":/icons/images/%1/").arg(iconSet);
|
||||
mActionIconSize = QSize(size,size);
|
||||
mIcons.insert(ACTION_MISC_BACK, createSVGIcon(iconFolder+"00Misc-01Back.svg",size,size));
|
||||
mIcons.insert(ACTION_MISC_FORWARD, createSVGIcon(iconFolder+"00Misc-02Forward.svg",size,size));
|
||||
mIcons.insert(ACTION_MISC_ADD, createSVGIcon(iconFolder+"00Misc-03Add.svg",size,size));
|
||||
|
@ -132,6 +130,8 @@ void IconsManager::updateActionIcons(const QString iconSet, int size)
|
|||
mIcons.insert(ACTION_PROBLEM_EDIT_SOURCE, createSVGIcon(iconFolder+"08Problem_04EditSource.svg",size,size));
|
||||
mIcons.insert(ACTION_PROBLEM_RUN_CASES, createSVGIcon(iconFolder+"08Problem_05RunCases.svg",size,size));
|
||||
|
||||
emit actionIconsUpdated();
|
||||
|
||||
}
|
||||
|
||||
IconsManager::PIcon IconsManager::getIcon(IconName iconName) const
|
||||
|
@ -139,11 +139,6 @@ IconsManager::PIcon IconsManager::getIcon(IconName iconName) const
|
|||
return mIcons.value(iconName, mDefaultIcon);
|
||||
}
|
||||
|
||||
const IconsManager::PIcon &IconsManager::folder() const
|
||||
{
|
||||
return mFolder;
|
||||
}
|
||||
|
||||
IconsManager::PIcon IconsManager::createSVGIcon(const QString &filename, int width, int height)
|
||||
{
|
||||
QSvgRenderer renderer(filename);
|
||||
|
@ -153,3 +148,8 @@ IconsManager::PIcon IconsManager::createSVGIcon(const QString &filename, int wid
|
|||
renderer.render(&painter,icon->rect());
|
||||
return icon;
|
||||
}
|
||||
|
||||
const QSize &IconsManager::actionIconSize() const
|
||||
{
|
||||
return mActionIconSize;
|
||||
}
|
||||
|
|
|
@ -126,13 +126,15 @@ public:
|
|||
|
||||
PIcon getIcon(IconName iconName) const;
|
||||
|
||||
const PIcon &folder() const;
|
||||
|
||||
PIcon createSVGIcon(const QString& filename, int width, int height);
|
||||
const QSize &actionIconSize() const;
|
||||
|
||||
signals:
|
||||
void actionIconsUpdated();
|
||||
private:
|
||||
QMap<IconName,PIcon> mIcons;
|
||||
PIcon mDefaultIcon;
|
||||
PIcon mFolder;
|
||||
QSize mActionIconSize;
|
||||
};
|
||||
|
||||
extern IconsManager* pIconsManager;
|
||||
|
|
|
@ -1869,7 +1869,7 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
|
|||
} else {
|
||||
QIcon icon = provider.icon(QFileIconProvider::Folder);
|
||||
if (icon.isNull())
|
||||
return *(pIconsManager->folder());
|
||||
return *(pIconsManager->getIcon(IconsManager::ACTION_MISC_FOLDER));
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../debugger.h"
|
||||
#include "../settings.h"
|
||||
#include "../colorscheme.h"
|
||||
#include "../iconsmanager.h"
|
||||
|
||||
CPUDialog::CPUDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -44,6 +45,10 @@ CPUDialog::CPUDialog(QWidget *parent) :
|
|||
size.setWidth(width()*qApp->desktop()->width()/1920);
|
||||
size.setHeight(height()*qApp->desktop()->height()/1080);
|
||||
setBaseSize(size);
|
||||
updateIcons();
|
||||
connect(pIconsManager,&IconsManager::actionIconsUpdated,
|
||||
this, &CPUDialog::updateIcons);
|
||||
updateButtonStates(false);
|
||||
}
|
||||
|
||||
CPUDialog::~CPUDialog()
|
||||
|
@ -134,3 +139,12 @@ void CPUDialog::on_btnStepIntoInstruction_clicked()
|
|||
pMainWindow->debugger()->sendCommand("-exec-step-instruction","");
|
||||
}
|
||||
|
||||
void CPUDialog::updateIcons()
|
||||
{
|
||||
QSize size = pIconsManager->actionIconSize();
|
||||
ui->btnStepIntoInstruction->setIconSize(size);
|
||||
ui->btnStepIntoInstruction->setIcon(QIcon(*pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_INTO_INSTRUCTION)));
|
||||
ui->btnStepOverInstruction->setIconSize(size);
|
||||
ui->btnStepOverInstruction->setIcon(QIcon(*pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_OVER_INSTRUCTION)));
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ private slots:
|
|||
void on_chkBlendMode_stateChanged(int arg1);
|
||||
void on_btnStepOverInstruction_clicked();
|
||||
void on_btnStepIntoInstruction_clicked();
|
||||
void updateIcons();
|
||||
};
|
||||
|
||||
#endif // CPUDIALOG_H
|
||||
|
|
|
@ -112,6 +112,9 @@
|
|||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnStepOverInstruction">
|
||||
<property name="toolTip">
|
||||
<string>Step over one machine instruction</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Step over one machine instruction</string>
|
||||
</property>
|
||||
|
@ -119,10 +122,16 @@
|
|||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/052-next.png</normaloff>:/icons/images/newlook24/052-next.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonIconOnly</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnStepIntoInstruction">
|
||||
<property name="toolTip">
|
||||
<string>Step into one machine instruction</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Step into one machine instruction</string>
|
||||
</property>
|
||||
|
|
Loading…
Reference in New Issue