Initial commit

This commit is contained in:
Вячеслав Штейбезандт 2025-03-11 11:02:50 +03:00 committed by Вячеслав Штейбезандт
commit aa4b6b9fb5
32 changed files with 405 additions and 0 deletions

58
.gitignore vendored Normal file
View File

@ -0,0 +1,58 @@
# ---> Qt
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
*_qmlcache.qrc
!/Dependencies/
!/ExampleDLLs/

31
CetHub/CetHub.pro Normal file
View File

@ -0,0 +1,31 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
hubmainwidget.cpp
HEADERS += \
hubmainwidget.h
FORMS += \
hubmainwidget.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

109
CetHub/hubmainwidget.cpp Normal file
View File

@ -0,0 +1,109 @@
#include "hubmainwidget.h"
#include "ui_hubmainwidget.h"
#include "QtNetwork/QNetworkReply"
HubMainWidget::HubMainWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::HubMainWidget)
{
ui->setupUi(this);
connect(&sysTimer, &QTimer::timeout, this, [this]()
{
ui->dateTimeEdit->setTime(QTime::currentTime());
ui->dateTimeEdit->setDate(QDate::currentDate());
});
sysTimer.start(1000);
getModules(nullptr);
}
bool HubMainWidget::getModules(QNetworkReply *reply)
{
reply->readAll();
dllInfo LineRingerLib;
LineRingerLib.libName = "LineRingerLib";
LineRingerLib.initFuncName = "init";
LineRingerLib.adr = "https://git.arktika.cyou/";
connectLibrary(LineRingerLib);
dllInfo M3KTE_TERM;
M3KTE_TERM.fileName = "M3KTE_TERM";
M3KTE_TERM.initFuncName = "init";
M3KTE_TERM.adr = "https://git.arktika.cyou/Tenocha/M3KTE_TERM/releases/download/Pre-release/M3KTETERM.rar";
connectLibrary(M3KTE_TERM);
}
bool HubMainWidget::connectLibrary(dllInfo modul)
{
QLibrary myLib(modul.fileName);
myLib.load();
unsigned newRow = ui->libraryTable->rowCount();
ui->libraryTable->insertRow(newRow);
QTableWidgetItem *item = new QTableWidgetItem();
ui->libraryTable->setItem(newRow, 0, new QTableWidgetItem(modul.libName));
QLabel *url = new QLabel();
url->setText(tr("<a href=\"%1\">Source</a>").arg(modul.adr.toString()));
url->setTextFormat(Qt::RichText);
url->setTextInteractionFlags(Qt::TextBrowserInteraction);
url->setOpenExternalLinks(true);
ui->libraryTable->setCellWidget(newRow, 2, url);
//ui->libraryTable->setItem(newRow, 2, new QTableWidgetItem(modul.adr));
if(myLib.isLoaded())
{
typedef QWidget* (*LR_Init_Function)(QWidget*);
LR_Init_Function LR_Init = (LR_Init_Function) myLib.resolve(modul.initFuncName.toUtf8());
if(LR_Init)
{
item->setCheckState(Qt::Checked);
ui->libraryTable->setItem(newRow, 1, item);
modul.widget = LR_Init(nullptr);
connectedModules.append(modul);
ui->appBox->addItem(modul.libName);
return true;
}
}
else
{
item->setCheckState(Qt::Unchecked);
ui->libraryTable->setItem(newRow, 1, item);
connectedModules.append(modul);
ui->appBox->addItem(modul.libName);
}
return false;
}
HubMainWidget::~HubMainWidget()
{
delete ui;
}
void HubMainWidget::on_openOrDownloadButton_clicked()
{
if(ui->appBox->count()!=0)
{
if(connectedModules.at(ui->appBox->currentIndex()).widget != nullptr)
{
connectedModules.at(ui->appBox->currentIndex()).widget->show();
}
else
{
QDesktopServices::openUrl(connectedModules.at(ui->appBox->currentIndex()).adr);
}
}
}
void HubMainWidget::on_appBox_currentIndexChanged(int index)
{
if(connectedModules.at(index).widget == nullptr)
{
ui->openOrDownloadButton->setText("Скачать");
}
else
{
ui->openOrDownloadButton->setText("Открыть");
}
}

50
CetHub/hubmainwidget.h Normal file
View File

@ -0,0 +1,50 @@
#ifndef HUBMAINWIDGET_H
#define HUBMAINWIDGET_H
#include <QWidget>
#include <QTime>
#include <QTimer>
#include <QLibrary>
#include <QUrl>
#include <QLabel>
#include <QDesktopServices>
#include "QtNetwork/QNetworkAccessManager"
QT_BEGIN_NAMESPACE
namespace Ui { class HubMainWidget; }
QT_END_NAMESPACE
class HubMainWidget : public QWidget
{
Q_OBJECT
public:
HubMainWidget(QWidget *parent = nullptr);
~HubMainWidget();
private slots:
void on_openOrDownloadButton_clicked();
void on_appBox_currentIndexChanged(int index);
private:
QTimer sysTimer;
struct dllInfo
{
QWidget* widget = nullptr;
QString libName;
QString fileName;
QString initFuncName;
QUrl adr;
QUrl downloadAdr;
};
QVector<dllInfo>connectedModules;
bool getModules(QNetworkReply *reply);
bool connectLibrary(dllInfo modul);
Ui::HubMainWidget *ui;
};
#endif // HUBMAINWIDGET_H

123
CetHub/hubmainwidget.ui Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HubMainWidget</class>
<widget class="QWidget" name="HubMainWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>327</height>
</rect>
</property>
<property name="windowTitle">
<string>HubMainWidget</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QComboBox" name="appBox"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="openOrDownloadButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QDateTimeEdit" name="dateTimeEdit">
<property name="minimumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>25</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QTableWidget" name="libraryTable">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Modul</string>
</property>
</column>
<column>
<property name="text">
<string>Finded</string>
</property>
</column>
<column>
<property name="text">
<string>Link</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

11
CetHub/main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "hubmainwidget.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
HubMainWidget w;
w.show();
return a.exec();
}

21
Debug/.qmake.stash Normal file
View File

@ -0,0 +1,21 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 7
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++ \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/x86_64-w64-mingw32 \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/backward \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include-fixed \
C:/Qt/Qt5.14.2/Tools/mingw730_64/x86_64-w64-mingw32/include
QMAKE_CXX.LIBDIRS = \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0 \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc \
C:/Qt/Qt5.14.2/Tools/mingw730_64/x86_64-w64-mingw32/lib \
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib

BIN
Debug/debug/CetHub.exe Normal file

Binary file not shown.

BIN
Dependencies/Qt5Core.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/Qt5Gui.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/Qt5Network.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/Qt5SerialBus.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/Qt5SerialPort.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/Qt5Svg.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/Qt5Widgets.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/libgcc_s_seh-1.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/libstdc++-6.dll vendored Normal file

Binary file not shown.

BIN
Dependencies/libwinpthread-1.dll vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ExampleDLLs/M3KTE_TERM.dll Normal file

Binary file not shown.

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# CetHub