Skip to content

Commit

Permalink
+ add more debugger relative
Browse files Browse the repository at this point in the history
  • Loading branch information
hazmi-e205 committed Jun 13, 2023
1 parent 226c3fd commit e1092aa
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 18 deletions.
7 changes: 1 addition & 6 deletions Src/devicebridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void DeviceBridge::ResetConnection()
{
bool is_exist = m_deviceList.find(m_currentUdid) != m_deviceList.end();
m_currentUdid.clear();
StopDebugging();

if(m_client)
{
Expand All @@ -83,12 +84,6 @@ void DeviceBridge::ResetConnection()
m_client = nullptr;
}

if (m_debugger)
{
debugserver_client_free(m_debugger);
m_debugger = nullptr;
}

if (m_screenshot)
{
screenshotr_client_free(m_screenshot);
Expand Down
16 changes: 11 additions & 5 deletions Src/devicebridge_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void DeviceBridge::StartDebugging(QString bundleId, bool detach_after_start, QSt
emit DebuggerReceived(
"Could not start com.apple.debugserver!\n"
"Please make sure to mount the developer disk image first:\n"
" 1) Go to Imagae Mounter in Toolbox.\n"
" 1) Go to Image Mounter in Toolbox.\n"
" 2) Choose closest image version to your iOS version.\n"
" 3) Click Download and Mount.", true);
return;
Expand Down Expand Up @@ -271,7 +271,7 @@ void DeviceBridge::StartDebugging(QString bundleId, bool detach_after_start, QSt
}
}
if (res >= 0) {
emit DebuggerReceived("Debugger stopped", true);
emit DebuggerReceived("Debugger stopped.", true);
CloseDebugger();
return;
}
Expand Down Expand Up @@ -313,14 +313,19 @@ void DeviceBridge::StartDebugging(QString bundleId, bool detach_after_start, QSt
response = NULL;
}
CloseDebugger();
quit_flag = 0;
emit DebuggerReceived("Debugger stopped", true);
emit DebuggerReceived("Debugger stopped..", true);
});
}

void DeviceBridge::StopDebugging()
{
quit_flag = 1;
if (m_debugger)
quit_flag = 1;

while (quit_flag == 1)
{
QThread::sleep(1);
}
}

void DeviceBridge::ClearDebugger()
Expand Down Expand Up @@ -355,6 +360,7 @@ void DeviceBridge::DebuggerReloadFilter()

void DeviceBridge::CloseDebugger()
{
quit_flag = 0;
if (m_debugger)
{
debugserver_client_free(m_debugger);
Expand Down
36 changes: 30 additions & 6 deletions Src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ MainWindow::MainWindow(QWidget *parent)
connect(DeviceBridge::Get(), SIGNAL(MessagesReceived(MessagesType,QString)), this, SLOT(OnMessagesReceived(MessagesType,QString)));
connect(ui->topSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(OnTopSplitterMoved(int,int)));
connect(ui->scrollCheck, SIGNAL(stateChanged(int)), this, SLOT(OnAutoScrollChecked(int)));
connect(ui->scrollDebugCheck, SIGNAL(stateChanged(int)), this, SLOT(OnAutoScrollChecked(int)));
connect(ui->scrollOutCheck, SIGNAL(stateChanged(int)), this, SLOT(OnAutoScrollChecked(int)));
connect(ui->saveOutputBtn, SIGNAL(pressed()), this, SLOT(OnSaveOutputClicked()));
connect(ui->clearOutputBtn, SIGNAL(pressed()), this, SLOT(OnClearOutputClicked()));
connect(ui->updateBtn, SIGNAL(pressed()), this, SLOT(OnUpdateClicked()));
Expand Down Expand Up @@ -102,7 +104,10 @@ MainWindow::MainWindow(QWidget *parent)
<< ui->provisionBtn
<< ui->codesignBtn
<< ui->clearOutputBtn
<< ui->saveOutputBtn);
<< ui->saveOutputBtn
<< ui->startDebugBtn
<< ui->saveDebugBtn
<< ui->clearDebugBtn);

MassStylesheet(STYLE_TYPE::ROUNDED_EDIT_LIGHT, QList<QWidget*>()
<< ui->UDID
Expand All @@ -116,14 +121,19 @@ MainWindow::MainWindow(QWidget *parent)
<< ui->excludeEdit
<< ui->originalBuildEdit
<< ui->privateKeyPasswordEdit
<< ui->provisionEdit);
<< ui->provisionEdit
<< ui->searchDbgEdit
<< ui->excludeDbgEdit
<< ui->envEdit
<< ui->argsEdit);

MassStylesheet(STYLE_TYPE::ROUNDED_COMBOBOX_LIGHT, QList<QWidget*>()
<< ui->bundleIds
<< ui->socketBox
<< ui->pidEdit
<< ui->privateKeyEdit
<< ui->provisionEdit);
<< ui->provisionEdit
<< ui->bundleEdit);

DecorateSplitter(ui->splitter, 1);
DecorateSplitter(ui->topSplitter, 1);
Expand Down Expand Up @@ -217,8 +227,22 @@ void MainWindow::OnClickedEvent(QObject* object)

void MainWindow::OnScrollTimerTick()
{
int max_value = m_table->verticalScrollBar()->maximum();
int value = m_table->verticalScrollBar()->value();
QPlainTextEdit *component = nullptr;
switch(ui->bottomWidget->currentIndex())
{
case 1:
component = ui->outputEdit;
break;
case 2:
component = ui->debuggerEdit;
break;
default:
component = m_table;
break;
}

int max_value = component->verticalScrollBar()->maximum();
int value = component->verticalScrollBar()->value();
if (max_value != value)
{
if (m_lastAutoScroll && (m_lastMaxScroll == max_value))
Expand All @@ -229,7 +253,7 @@ void MainWindow::OnScrollTimerTick()

if (ui->scrollCheck->isChecked())
{
m_table->verticalScrollBar()->setValue(max_value);
component->verticalScrollBar()->setValue(max_value);
m_lastAutoScroll = true;
}
}
Expand Down
15 changes: 14 additions & 1 deletion Src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3057,6 +3057,16 @@ color: rgb(255, 255, 255);</string>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="scrollOutCheck">
<property name="text">
<string>Auto scroll</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearOutputBtn">
<property name="text">
Expand Down Expand Up @@ -3148,10 +3158,13 @@ color: rgb(255, 255, 255);</string>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="scrollDebugCheck">
<property name="text">
<string>Auto scroll</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
Expand Down
3 changes: 3 additions & 0 deletions Src/mainwindow_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "ui_mainwindow.h"
#include "utils.h"
#include <QFile>
#include <QTextDocument>
#include <QTextBlock>

void MainWindow::SetupDebuggerUI()
{
Expand All @@ -24,6 +26,7 @@ void MainWindow::OnStartDebuggingClicked()
{
if (ui->startDebugBtn->text().contains("start", Qt::CaseInsensitive))
{
OnDebuggerClearClicked();
DeviceBridge::Get()->StartDebugging(ui->bundleEdit->currentText(), false, ui->envEdit->text(), ui->argsEdit->text());
ui->startDebugBtn->setText("Stop Debugging");
}
Expand Down
4 changes: 4 additions & 0 deletions Src/mainwindow_syslog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "ui_mainwindow.h"
#include "utils.h"
#include <QFile>
#include <QTextDocument>
#include <QTextBlock>

void MainWindow::SetupSyslogUI()
{
Expand All @@ -27,6 +29,8 @@ void MainWindow::SetupSyslogUI()
ui->maxShownLogs->setText(QString::number(m_maxCachedLogs));
ui->pidEdit->addItems(QStringList() << "By user apps only" << "Related to user apps");
ui->pidEdit->setCurrentIndex(0);
DeviceBridge::Get()->LogsFilterByString(ui->searchEdit->text());
DeviceBridge::Get()->LogsExcludeByString(ui->excludeEdit->text());
DeviceBridge::Get()->LogsFilterByPID(ui->pidEdit->currentText());
}

Expand Down

0 comments on commit e1092aa

Please sign in to comment.