Skip to content

Commit

Permalink
修改UI内容
Browse files Browse the repository at this point in the history
  • Loading branch information
MingYueRuYa committed Oct 9, 2024
1 parent e80beca commit 5679525
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 48 deletions.
59 changes: 23 additions & 36 deletions WindbgIFEO/WindbgIFEO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ WindbgIFEO::WindbgIFEO(QWidget* parent)

WindbgIFEO::~WindbgIFEO() {
_stop_enum_process = true;

std::vector<std::unique_ptr<std::thread>*> thr_ptr = {&_query_windbg_ptr,
&_enum_process_ptr};
for (auto& item : thr_ptr) {
Expand Down Expand Up @@ -369,10 +368,11 @@ void WindbgIFEO::_query_windbg_path() {

void WindbgIFEO::_enum_process_name() {
auto func = [this]() {
while (!this->_stop_enum_process) {
// while (!this->_stop_enum_process) {
{
ProcessHelper::process_map proc_map = ProcessHelper::EnumAllProcess();
this->_add_proc_info(proc_map);
std::this_thread::sleep_for(std::chrono::seconds(1));
// std::this_thread::sleep_for(std::chrono::seconds(1));
}
};
_enum_process_ptr = std::make_unique<std::thread>(func);
Expand Down Expand Up @@ -447,11 +447,19 @@ void WindbgIFEO::_location_reg_path(const QString& reg_path) {
this->log_info(reg_path, LOG_TYPE::INFO);
}

void WindbgIFEO::_remove_combo_item(QComboBox* combo) {
int item_count = combo->count();
for (int i = 0; i < item_count; i++) {
combo->removeItem(i);
}
}

void WindbgIFEO::_init_ui() {
this->setAttribute(Qt::WA_TranslucentBackground, true);
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
//_frame_less_helper = new NcFramelessHelper();
//_frame_less_helper->activeOnWithChildWidget(this, ui.widget_title);
_frame_less_helper = new NcFramelessHelper();
_frame_less_helper->activeOnWithChildWidget(this, ui.widget_title);
_frame_less_helper->setWidgetResizable(false);
std::string lang = this->_settings.get_lang();
if (lang == "zh_CN") {
this->ui.chb_chinese->setChecked(true);
Expand Down Expand Up @@ -503,7 +511,12 @@ void WindbgIFEO::on_update_windbg_path() {
this->log_info(QString(tr("filter arm version windbg path:%1"))
.arg(windbg_path));
} else {
this->ui.comboBox_windbg_path->addItem(value.second);
QPixmap pixmap(1, 20);
pixmap.fill(Qt::transparent);
QIcon icon(pixmap);
this->ui.comboBox_windbg_path->setIconSize(QSize(1, 20));
this->ui.comboBox_windbg_path->addItem(icon, value.second);
// this->ui.comboBox_windbg_path->addItem(value.second);
this->log_info(value.second);
}
});
Expand All @@ -525,7 +538,8 @@ void WindbgIFEO::on_update_process_info() {
}
for (auto& item : vec_com) {
item->blockSignals(true);
item->clear();
// item->clear();
this->_remove_combo_item(item);
item->addItems(process_list);
item->blockSignals(false);
}
Expand All @@ -547,7 +561,7 @@ void WindbgIFEO::on_btn_close_clicked() {
void WindbgIFEO::on_btn_mini_clicked() {
QPoint pos = QCursor::pos();
QCursor::setPos(pos + QPoint(0, 30)); // 设置鼠标位置
this->showMinimized();
QTimer::singleShot(100, [this]() { this->showMinimized(); });
}

void WindbgIFEO::changeEvent(QEvent* ev) {
Expand All @@ -556,31 +570,4 @@ void WindbgIFEO::changeEvent(QEvent* ev) {
ui.retranslateUi(this);
}
QWidget::changeEvent(ev);
}

// void WindbgIFEO::showEvent(QShowEvent* ev) {
// setAttribute(Qt::WA_Mapped);
// QWidget::showEvent(ev);
//}

// void WindbgIFEO::mousePressEvent(QMouseEvent* event) {
// if ((event->button() == Qt::LeftButton)) {
// mouse_press = true;
// mousePoint = event->globalPos() - this->pos();
// // event->accept();
// } else if (event->button() == Qt::RightButton) {
// //如果是右键
// this->close();
// }
//}
// void WindbgIFEO::mouseMoveEvent(QMouseEvent* event) {
// // if(event->buttons() == Qt::LeftButton){
// // //如果这里写这行代码,拖动会有点问题
// if (mouse_press) {
// move(event->globalPos() - mousePoint);
// // event->accept();
// }
//}
// void WindbgIFEO::mouseReleaseEvent(QMouseEvent* event) {
// mouse_press = false;
//}
}
11 changes: 1 addition & 10 deletions WindbgIFEO/WindbgIFEO.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ class WindbgIFEO : public QWidget {

protected:
virtual void changeEvent(QEvent* ev) override;
//virtual void showEvent(QShowEvent* ev) override;

// protected:
// void mouseMoveEvent(QMouseEvent* event);
// void mousePressEvent(QMouseEvent* event);
// void mouseReleaseEvent(QMouseEvent* event);

// private:
// QPoint mousePoint;
// bool mouse_press;

private:
void _init_ui();
Expand All @@ -102,6 +92,7 @@ class WindbgIFEO : public QWidget {
QString _get_arch_reg(const QString& windbg_path);
void _start_reg_edit_proc();
void _location_reg_path(const QString& reg_path);
void _remove_combo_item(QComboBox* combo);

private:
Ui::WindbgIFEOClass ui;
Expand Down
45 changes: 45 additions & 0 deletions WindbgIFEO/WindbgIFEO.ui
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,54 @@ QPushButton:pressed{border-image: url(&quot;:/WindbgConfig/images/close_pressed.
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QComboBox{
border: 1px solid #C7C7C7;
border-radius: 5px;
font-size:14px;
background-color:white;
padding-right:10px;
}


QComboBox::drop-down{
width:19px;
height:8px;
subcontrol-position:right center;
image: url(:/WindbgConfig/images/select.png);
padding-right: 11px;
}

QComboBox::hover{
background:#F2F2F2;
}

QComboBox::on{
border: 1px solid blue;
}

QComboBox {combobox-popup: 0;}


QComboBox::item:selected {
background-color: black;
}</string>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>1</width>
<height>50</height>
</size>
</property>
<property name="frame">
<bool>true</bool>
</property>
Expand Down
4 changes: 2 additions & 2 deletions WindbgIFEO/WindbgIFEO.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
<Import Project="$(QtMsBuild)\qt_defaults.props" />
</ImportGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtInstall>5.15.11.mt_static</QtInstall>
<QtInstall>5.15.11_x64_static</QtInstall>
<QtModules>core;gui;widgets</QtModules>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtInstall>5.15.11.mt_static</QtInstall>
<QtInstall>5.15.11_x64_static</QtInstall>
<QtModules>core;gui;widgets</QtModules>
</PropertyGroup>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
Expand Down
1 change: 1 addition & 0 deletions WindbgIFEO/resource/WindbgIFEO.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<file>images/close.png</file>
<file>images/close_hover.png</file>
<file>images/close_pressed.png</file>
<file>images/select.png</file>
</qresource>
</RCC>

0 comments on commit 5679525

Please sign in to comment.