-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add network profiler view in debug tools.
- Loading branch information
Showing
8 changed files
with
147 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* SPDX-License-Identifier: GPL-3.0-or-later | ||
* Copyright © 2014-2019 by The qTox Project Contributors | ||
* Copyright © 2024 The TokTok team. | ||
*/ | ||
|
||
#include "debugnetprof.h" | ||
#include "ui_debugnetprof.h" | ||
|
||
#include "src/model/debug/debuglogmodel.h" | ||
#include "src/persistence/paths.h" | ||
#include "src/widget/style.h" | ||
#include "src/widget/translator.h" | ||
|
||
#include <tox/tox.h> | ||
|
||
#include <QTimer> | ||
|
||
#include <memory> | ||
|
||
DebugNetProfForm::DebugNetProfForm(Style& style, QWidget* parent) | ||
: GenericForm{QPixmap(":/img/settings/general.png"), style, parent} | ||
, ui_{std::make_unique<Ui::DebugNetProf>()} | ||
, reloadTimer_{new QTimer(this)} | ||
{ | ||
ui_->setupUi(this); | ||
|
||
// Reload logs every 5 seconds | ||
reloadTimer_->start(5000); | ||
|
||
Translator::registerHandler(std::bind(&DebugNetProfForm::retranslateUi, this), this); | ||
} | ||
|
||
DebugNetProfForm::~DebugNetProfForm() | ||
{ | ||
Translator::unregister(this); | ||
} | ||
|
||
/** | ||
* @brief Retranslate all elements in the form. | ||
*/ | ||
void DebugNetProfForm::retranslateUi() | ||
{ | ||
ui_->retranslateUi(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* SPDX-License-Identifier: GPL-3.0-or-later | ||
* Copyright © 2024 The TokTok team. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "src/widget/form/settings/genericsettings.h" | ||
|
||
#include <memory> | ||
|
||
class Paths; | ||
class QTimer; | ||
class Style; | ||
|
||
namespace Ui { | ||
class DebugNetProf; | ||
} | ||
|
||
class DebugNetProfForm : public GenericForm | ||
{ | ||
Q_OBJECT | ||
public: | ||
DebugNetProfForm(Style& style, QWidget* parent); | ||
~DebugNetProfForm(); | ||
QString getFormName() final | ||
{ | ||
return tr("Network Profiler"); | ||
} | ||
|
||
private: | ||
void retranslateUi(); | ||
|
||
private: | ||
std::unique_ptr<Ui::DebugNetProf> ui_; | ||
QTimer* reloadTimer_; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>DebugNetProf</class> | ||
<widget class="QWidget" name="DebugNetProf"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>530</width> | ||
<height>553</height> | ||
</rect> | ||
</property> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="windowTitle"> | ||
<string notr="true">Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0"> | ||
<item> | ||
<widget class="QGroupBox" name="netProfGroup"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>1</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="title"> | ||
<string>Network Profile</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0"> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<widget class="QCheckBox" name="cbAutoReload"> | ||
<property name="text"> | ||
<string>Auto-reload</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<widget class="QTableView" name="netProf"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters