resourceExplorer basics

This commit is contained in:
mrbesen 2023-01-08 22:13:26 +01:00
parent 04a4f4a9c7
commit a079802abb
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
8 changed files with 133 additions and 19 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ Makefile
.qmake.stash
.vscode/settings.json
qtdebugger
*.pro.user

View File

@ -24,6 +24,7 @@ public:
private slots:
void refresh();
void currentObjectChanged( QTreeWidgetItem* new_, QTreeWidgetItem* old );
void openResourceExplorer();
protected:
void resetStyleSheet();

View File

@ -0,0 +1,21 @@
#ifndef RESOURCEEXPLORER_H
#define RESOURCEEXPLORER_H
#include <QMainWindow>
namespace Ui {
class ResourceExplorer;
}
class ResourceExplorer : public QMainWindow {
Q_OBJECT
public:
explicit ResourceExplorer(QWidget *parent = nullptr);
~ResourceExplorer();
private:
Ui::ResourceExplorer *ui;
};
#endif // RESOURCEEXPLORER_H

View File

@ -29,13 +29,16 @@ INCLUDEPATH += $$PWD/include/
SOURCES += \
src/injector.cpp \
src/qtdebugger.cpp
src/qtdebugger.cpp \
src/resourceexplorer.cpp
HEADERS += \
include/qtdebugger.h
include/qtdebugger.h \
include/resourceexplorer.h
FORMS += \
ui/debugwindow.ui
ui/debugwindow.ui \
ui/resourceexplorer.ui
# main binary target
qtdebugger.depends = src/main.c

View File

@ -11,6 +11,8 @@
#include <functional>
#include <set>
#include "resourceexplorer.h"
QtDebugger::QtDebugger(QObject* parent) : QObject(parent), debugWindow( new QMainWindow() ), ui( new Ui::DebugWindow() ) {
this->ui->setupUi( debugWindow );
debugWindow->show();
@ -21,6 +23,7 @@ QtDebugger::QtDebugger(QObject* parent) : QObject(parent), debugWindow( new QMai
QObject::connect( this->ui->refreshButton, &QPushButton::clicked, this, &QtDebugger::refresh );
QObject::connect( this->ui->objectTree, &QTreeWidget::currentItemChanged, this, &QtDebugger::currentObjectChanged );
QObject::connect( this->ui->resourceExplorerButton, &QPushButton::clicked, this, &QtDebugger::openResourceExplorer );
this->refresh();
}
@ -70,6 +73,8 @@ void QtDebugger::refresh() {
}
void QtDebugger::currentObjectChanged( QTreeWidgetItem* new_, QTreeWidgetItem* old ) {
Q_UNUSED( old );
this->ui->propertiesTree->clear();
this->resetStyleSheet();
@ -125,6 +130,11 @@ void QtDebugger::currentObjectChanged( QTreeWidgetItem* new_, QTreeWidgetItem* o
readProperties( obj->metaObject() );
}
void QtDebugger::openResourceExplorer() {
ResourceExplorer* re = new ResourceExplorer( debugWindow );
re->show();
}
void QtDebugger::resetStyleSheet() {
// get currently selected item
QList<QTreeWidgetItem*> items = this->ui->objectTree->selectedItems();

16
src/resourceexplorer.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "resourceexplorer.h"
#include "ui_resourceexplorer.h"
#include <QFileSystemModel>
ResourceExplorer::ResourceExplorer(QWidget *parent) : QMainWindow( parent ), ui(new Ui::ResourceExplorer) {
this->ui->setupUi(this);
QFileSystemModel* model = new QFileSystemModel;
model->setRootPath( ":/" );
this->ui->treeView->setModel( model );
}
ResourceExplorer::~ResourceExplorer() {
delete this->ui;
}

View File

@ -20,22 +20,47 @@
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QPushButton" name="refreshButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>Refresh</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="refreshButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="resourceExplorerButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>Resource Explorer</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QTreeWidget" name="objectTree">
<property name="indentation">

37
ui/resourceexplorer.ui Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ResourceExplorer</class>
<widget class="QMainWindow" name="ResourceExplorer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Resource Explorer</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTreeView" name="treeView"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>