mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: update the file
This commit is contained in:
parent
48d60c9124
commit
91188ba7f6
@ -247,3 +247,13 @@ void Application::showSplashScreenMessage(const QString &msg)
|
||||
splashScreen->showMessage(msg, Qt::AlignBottom | Qt::AlignLeft, Qt::white);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
QString Application::left2rightTips() const
|
||||
{
|
||||
return tr("Transfer rx bytes with right page");
|
||||
}
|
||||
|
||||
QString Application::right2leftTips() const
|
||||
{
|
||||
return tr("Transfer rx bytes with left page");
|
||||
}
|
||||
@ -45,4 +45,7 @@ public:
|
||||
|
||||
QSplashScreen *splashScreen();
|
||||
void showSplashScreenMessage(const QString &msg);
|
||||
|
||||
QString left2rightTips() const;
|
||||
QString right2leftTips() const;
|
||||
};
|
||||
|
||||
@ -24,9 +24,10 @@ int main(int argc, char *argv[])
|
||||
MainWindow window;
|
||||
QSplashScreen *splash = app.splashScreen();
|
||||
splash->finish(&window);
|
||||
window.resize(1366, 768);
|
||||
window.resize(620 * 1.732, 620);
|
||||
window.show();
|
||||
window.load();
|
||||
window.moveToCenter();
|
||||
|
||||
int ret = app.exec();
|
||||
Application::uninstallLog();
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QProcess>
|
||||
#include <QScreen>
|
||||
#include <QScrollBar>
|
||||
#include <QStyle>
|
||||
#include <QStyleFactory>
|
||||
@ -192,6 +193,19 @@ void MainWindow::updateGrid(WindowGrid grid)
|
||||
xApp->settings()->setValue(m_settingsKey.windowGrid, static_cast<int>(grid));
|
||||
}
|
||||
|
||||
void MainWindow::moveToCenter()
|
||||
{
|
||||
QRect screenRect = QApplication::primaryScreen()->geometry();
|
||||
bool tooWidth = (width() > screenRect.width());
|
||||
bool tooHeight = (height() > screenRect.height());
|
||||
if (tooWidth || tooHeight) {
|
||||
showMaximized();
|
||||
qInfo() << "The screen is too small.";
|
||||
} else {
|
||||
move((screenRect.width() - width()) / 2, (screenRect.height() - height()) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
save();
|
||||
|
||||
@ -26,6 +26,7 @@ public:
|
||||
void load(const QString& fileName = QString()) const;
|
||||
void save(const QString& fileName = QString()) const;
|
||||
void updateGrid(WindowGrid grid);
|
||||
void moveToCenter();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
@ -266,7 +266,7 @@ QToolButton *Page::presetToolButton()
|
||||
|
||||
void Page::inputBytes(const QByteArray &bytes)
|
||||
{
|
||||
if (m_deviceController->device() && m_deviceController->device()->isRunning()) {
|
||||
if (m_deviceController->device()) {
|
||||
m_deviceController->device()->writeBytes(bytes);
|
||||
}
|
||||
}
|
||||
@ -296,6 +296,17 @@ void Page::hideTransferWidgets()
|
||||
ui->tabTransfers->hide();
|
||||
}
|
||||
|
||||
void Page::removeTestDevices()
|
||||
{
|
||||
for (int i = 0; i < ui->comboBoxDeviceTypes->count(); i++) {
|
||||
int type = ui->comboBoxDeviceTypes->itemData(i).toInt();
|
||||
if (type == static_cast<int>(DeviceType::ChartsTest)) {
|
||||
ui->comboBoxDeviceTypes->removeItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Page::initUi()
|
||||
{
|
||||
#if 0
|
||||
|
||||
@ -54,6 +54,7 @@ public:
|
||||
void appendOutputControl(QWidget *widget);
|
||||
void hideChartsWidgets();
|
||||
void hideTransferWidgets();
|
||||
void removeTestDevices();
|
||||
|
||||
signals:
|
||||
void bytesWritten(const QByteArray &bytes, const QString &to);
|
||||
|
||||
1
xapps/xassistant/res/icons/left_blue.svg
Normal file
1
xapps/xassistant/res/icons/left_blue.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741754559003" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2610" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8c-16.4 12.8-16.4 37.5 0 50.3l450.8 352.1c5.3 4.1 12.9 0.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" p-id="2611" fill="#1296db"></path></svg>
|
||||
|
After Width: | Height: | Size: 563 B |
1
xapps/xassistant/res/icons/left_gray.svg
Normal file
1
xapps/xassistant/res/icons/left_gray.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741754559003" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2610" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8c-16.4 12.8-16.4 37.5 0 50.3l450.8 352.1c5.3 4.1 12.9 0.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" p-id="2611" fill="#515151"></path></svg>
|
||||
|
After Width: | Height: | Size: 563 B |
1
xapps/xassistant/res/icons/right_blue.svg
Normal file
1
xapps/xassistant/res/icons/right_blue.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741754580970" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M765.7 486.8L314.9 134.7c-5.3-4.1-12.9-0.4-12.9 6.3v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1c16.4-12.8 16.4-37.6 0-50.4z" p-id="3731" fill="#1296db"></path></svg>
|
||||
|
After Width: | Height: | Size: 566 B |
1
xapps/xassistant/res/icons/right_gray.svg
Normal file
1
xapps/xassistant/res/icons/right_gray.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741754580970" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M765.7 486.8L314.9 134.7c-5.3-4.1-12.9-0.4-12.9 6.3v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1c16.4-12.8 16.4-37.6 0-50.4z" p-id="3731" fill="#515151"></path></svg>
|
||||
|
After Width: | Height: | Size: 566 B |
@ -24,10 +24,11 @@ int main(int argc, char *argv[])
|
||||
xAssistant window;
|
||||
QSplashScreen *splash = app.splashScreen();
|
||||
splash->finish(&window);
|
||||
window.resize(620 * 1.732, 620);
|
||||
window.resize(1280, 620);
|
||||
window.show();
|
||||
window.load();
|
||||
window.updateGrid(MainWindow::WindowGrid::Grid1x2);
|
||||
window.moveToCenter();
|
||||
|
||||
int ret = app.exec();
|
||||
Application::uninstallLog();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2024 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
* Copyright 2024-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of eTools project.
|
||||
*
|
||||
@ -8,71 +8,78 @@
|
||||
**************************************************************************************************/
|
||||
#include "pipe.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include "application.h"
|
||||
#include "device/device.h"
|
||||
#include "page/page.h"
|
||||
|
||||
Pipeline::Pipeline(Page *leftPage, Page *rightPage, QObject *parent)
|
||||
Pipe::Pipe(Page *leftPage, Page *rightPage, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_leftPage(leftPage)
|
||||
, m_rightPage(rightPage)
|
||||
{
|
||||
// QToolButton *leftPageLeftButton = m_leftPage->outputPanel()->leftButton();
|
||||
// m_left2rightButton = m_leftPage->outputPanel()->rightButton();
|
||||
// m_right2leftButton = m_rightPage->outputPanel()->leftButton();
|
||||
// QToolButton *rightPageRightButton = m_rightPage->outputPanel()->rightButton();
|
||||
// leftPageLeftButton->setVisible(false);
|
||||
// rightPageRightButton->setVisible(false);
|
||||
// m_left2rightButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
// m_right2leftButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
// m_left2rightButton->setCheckable(true);
|
||||
// m_right2leftButton->setCheckable(true);
|
||||
// m_left2rightButton->setIcon(QIcon(":/Resource/Icons/RightGray.svg"));
|
||||
// m_right2leftButton->setIcon(QIcon(":/Resource/Icons/LeftGray.svg"));
|
||||
// m_left2rightButton->setToolTip(tr("Transmit the data received by the right page"));
|
||||
// m_right2leftButton->setToolTip(tr("Transmit the data received by the left page"));
|
||||
// connect(m_left2rightButton, &QToolButton::clicked, this, &Pipeline::onLeft2RightButtonClicked);
|
||||
// connect(m_right2leftButton, &QToolButton::clicked, this, &Pipeline::onRight2LeftButtonClicked);
|
||||
m_leftButton = new QToolButton();
|
||||
m_rightButton = new QToolButton();
|
||||
m_leftButton->setCheckable(true);
|
||||
m_rightButton->setCheckable(true);
|
||||
m_leftButton->setToolTip(xApp->left2rightTips());
|
||||
m_rightButton->setToolTip(xApp->right2leftTips());
|
||||
leftPage->appendOutputControl(m_leftButton);
|
||||
rightPage->prependOutputControl(m_rightButton);
|
||||
|
||||
// connect(m_leftPage, &Page::bytesRead, this, &Pipeline::onLeftPageBytesRead);
|
||||
// connect(m_rightPage, &Page::bytesRead, this, &Pipeline::onRightPageBytesRead);
|
||||
connect(m_leftButton, &QToolButton::clicked, this, &Pipe::onLeftButtonClicked);
|
||||
connect(m_rightButton, &QToolButton::clicked, this, &Pipe::onRightButtonClicked);
|
||||
|
||||
connect(leftPage, &Page::bytesRead, this, &Pipe::onLeftPageBytesRead);
|
||||
connect(rightPage, &Page::bytesRead, this, &Pipe::onRightPageBytesRead);
|
||||
|
||||
QSettings *settings = xApp->settings();
|
||||
bool left2right = settings->value(m_keys.left2right, false).toBool();
|
||||
bool right2left = settings->value(m_keys.right2left, false).toBool();
|
||||
m_leftButton->setChecked(left2right);
|
||||
m_rightButton->setChecked(right2left);
|
||||
|
||||
onLeftButtonClicked();
|
||||
onRightButtonClicked();
|
||||
}
|
||||
|
||||
Pipeline::~Pipeline() {}
|
||||
Pipe::~Pipe() {}
|
||||
|
||||
void Pipeline::onLeft2RightButtonClicked()
|
||||
void Pipe::onLeftButtonClicked()
|
||||
{
|
||||
if (m_left2rightButton->isChecked()) {
|
||||
m_left2rightButton->setIcon(QIcon(":/Resource/Icons/RightGreen.svg"));
|
||||
if (m_leftButton->isChecked()) {
|
||||
m_leftButton->setIcon(QIcon(":/res/icons/right_gray.svg"));
|
||||
} else {
|
||||
m_left2rightButton->setIcon(QIcon(":/Resource/Icons/RightGray.svg"));
|
||||
}
|
||||
m_leftButton->setIcon(QIcon(":/res/icons/right_blue.svg"));
|
||||
}
|
||||
|
||||
void Pipeline::onRight2LeftButtonClicked()
|
||||
xApp->settings()->setValue(m_keys.left2right, m_leftButton->isChecked());
|
||||
}
|
||||
|
||||
void Pipe::onRightButtonClicked()
|
||||
{
|
||||
if (m_right2leftButton->isChecked()) {
|
||||
m_right2leftButton->setIcon(QIcon(":/Resource/Icons/LeftGreen.svg"));
|
||||
if (m_rightButton->isChecked()) {
|
||||
m_rightButton->setIcon(QIcon(":/res/icons/left_gray.svg"));
|
||||
} else {
|
||||
m_right2leftButton->setIcon(QIcon(":/Resource/Icons/LeftGray.svg"));
|
||||
m_rightButton->setIcon(QIcon(":/res/icons/left_blue.svg"));
|
||||
}
|
||||
|
||||
xApp->settings()->setValue(m_keys.right2left, m_rightButton->isChecked());
|
||||
}
|
||||
|
||||
void Pipe::onLeftPageBytesRead(const QByteArray &bytes, const QString &from)
|
||||
{
|
||||
Q_UNUSED(from);
|
||||
if (m_leftButton->isChecked()) {
|
||||
m_rightPage->inputBytes(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
void Pipeline::onLeftPageBytesRead(const QByteArray &bytes)
|
||||
void Pipe::onRightPageBytesRead(const QByteArray &bytes, const QString &from)
|
||||
{
|
||||
// if (m_left2rightButton->isChecked()) {
|
||||
// Device *device = m_leftPage->device();
|
||||
// if (device) {
|
||||
// device->writeBytes(bytes);
|
||||
// }
|
||||
// }
|
||||
Q_UNUSED(from);
|
||||
if (m_rightButton->isChecked()) {
|
||||
m_leftPage->inputBytes(bytes);
|
||||
}
|
||||
|
||||
void Pipeline::onRightPageBytesRead(const QByteArray &bytes)
|
||||
{
|
||||
// if (m_right2leftButton->isChecked()) {
|
||||
// Device *device = m_rightPage->device();
|
||||
// if (device) {
|
||||
// device->writeBytes(bytes);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@ -12,23 +12,30 @@
|
||||
#include <QToolButton>
|
||||
|
||||
class Page;
|
||||
class Pipeline : public QObject
|
||||
class Pipe : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Pipeline(Page *leftPage, Page *rightPage, QObject *parent = nullptr);
|
||||
~Pipeline();
|
||||
Pipe(Page *leftPage, Page *rightPage, QObject *parent = nullptr);
|
||||
~Pipe();
|
||||
|
||||
private:
|
||||
Page *m_leftPage;
|
||||
Page *m_rightPage;
|
||||
QToolButton *m_left2rightButton;
|
||||
QToolButton *m_right2leftButton;
|
||||
QToolButton *m_leftButton;
|
||||
QToolButton *m_rightButton;
|
||||
|
||||
private:
|
||||
void onLeft2RightButtonClicked();
|
||||
void onRight2LeftButtonClicked();
|
||||
struct
|
||||
{
|
||||
const QString left2right{"MainWindow/left2right"};
|
||||
const QString right2left{"MainWindow/right2left"};
|
||||
} m_keys;
|
||||
|
||||
void onLeftPageBytesRead(const QByteArray &bytes);
|
||||
void onRightPageBytesRead(const QByteArray &bytes);
|
||||
private:
|
||||
void onLeftButtonClicked();
|
||||
void onRightButtonClicked();
|
||||
|
||||
void onLeftPageBytesRead(const QByteArray &bytes, const QString &from);
|
||||
void onRightPageBytesRead(const QByteArray &bytes, const QString &from);
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2018-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
@ -11,6 +11,7 @@
|
||||
#include <QMenuBar>
|
||||
|
||||
#include "page/page.h"
|
||||
#include "pipe.h"
|
||||
|
||||
xAssistant::xAssistant(QWidget* parent)
|
||||
: MainWindow(parent)
|
||||
@ -42,6 +43,14 @@ xAssistant::xAssistant(QWidget* parent)
|
||||
m_iopage01->hideChartsWidgets();
|
||||
m_iopage10->hideChartsWidgets();
|
||||
m_iopage11->hideChartsWidgets();
|
||||
|
||||
m_iopage00->removeTestDevices();
|
||||
m_iopage01->removeTestDevices();
|
||||
m_iopage10->removeTestDevices();
|
||||
m_iopage11->removeTestDevices();
|
||||
|
||||
Pipe* pipe = new Pipe(m_iopage00, m_iopage01, this);
|
||||
Q_UNUSED(pipe);
|
||||
}
|
||||
|
||||
xAssistant::~xAssistant() {}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2018-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
class Page;
|
||||
class xAssistant : public MainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -5,6 +5,7 @@ endif()
|
||||
file(GLOB_RECURSE X_ASSISTANT_SOURCES ${CMAKE_CURRENT_LIST_DIR}/src/*.*)
|
||||
list(APPEND X_ASSISTANT_SOURCES ${X_APPS_SOURCES})
|
||||
list(APPEND X_ASSISTANT_SOURCES ${CMAKE_CURRENT_LIST_DIR}/xAssistant.rc)
|
||||
list(APPEND X_ASSISTANT_SOURCES ${CMAKE_CURRENT_LIST_DIR}/xAssistant.qrc)
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
|
||||
|
||||
set(bin ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}/xAssistant)
|
||||
|
||||
8
xapps/xassistant/xAssistant.qrc
Normal file
8
xapps/xassistant/xAssistant.qrc
Normal file
@ -0,0 +1,8 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>res/icons/left_blue.svg</file>
|
||||
<file>res/icons/left_gray.svg</file>
|
||||
<file>res/icons/right_blue.svg</file>
|
||||
<file>res/icons/right_gray.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Loading…
Reference in New Issue
Block a user