commit aa4b6b9fb58c38333e6568ffc9a351878efb8d8c Author: Вячеслав Штейбезандт Date: Tue Mar 11 11:02:50 2025 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..220b2cb --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/CetHub/CetHub.pro b/CetHub/CetHub.pro new file mode 100644 index 0000000..3ca28b3 --- /dev/null +++ b/CetHub/CetHub.pro @@ -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 diff --git a/CetHub/hubmainwidget.cpp b/CetHub/hubmainwidget.cpp new file mode 100644 index 0000000..ee7811d --- /dev/null +++ b/CetHub/hubmainwidget.cpp @@ -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("Source").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("Открыть"); + } +} diff --git a/CetHub/hubmainwidget.h b/CetHub/hubmainwidget.h new file mode 100644 index 0000000..4cf022b --- /dev/null +++ b/CetHub/hubmainwidget.h @@ -0,0 +1,50 @@ +#ifndef HUBMAINWIDGET_H +#define HUBMAINWIDGET_H + +#include +#include +#include +#include +#include +#include +#include +#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; + }; + + QVectorconnectedModules; + + bool getModules(QNetworkReply *reply); + bool connectLibrary(dllInfo modul); + + Ui::HubMainWidget *ui; +}; +#endif // HUBMAINWIDGET_H diff --git a/CetHub/hubmainwidget.ui b/CetHub/hubmainwidget.ui new file mode 100644 index 0000000..74e6a06 --- /dev/null +++ b/CetHub/hubmainwidget.ui @@ -0,0 +1,123 @@ + + + HubMainWidget + + + + 0 + 0 + 399 + 327 + + + + HubMainWidget + + + + + + + + + + + + + + 100 + 25 + + + + + 100 + 25 + + + + PushButton + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 25 + + + + + 100 + 25 + + + + true + + + QAbstractSpinBox::NoButtons + + + + + + + + + true + + + QAbstractScrollArea::AdjustIgnored + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + false + + + + Modul + + + + + Finded + + + + + Link + + + + + + + + + diff --git a/CetHub/main.cpp b/CetHub/main.cpp new file mode 100644 index 0000000..c287a6b --- /dev/null +++ b/CetHub/main.cpp @@ -0,0 +1,11 @@ +#include "hubmainwidget.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + HubMainWidget w; + w.show(); + return a.exec(); +} diff --git a/Debug/.qmake.stash b/Debug/.qmake.stash new file mode 100644 index 0000000..4f433cb --- /dev/null +++ b/Debug/.qmake.stash @@ -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 diff --git a/Debug/debug/CetHub.exe b/Debug/debug/CetHub.exe new file mode 100644 index 0000000..9ff19c3 Binary files /dev/null and b/Debug/debug/CetHub.exe differ diff --git a/Dependencies/Qt5Core.dll b/Dependencies/Qt5Core.dll new file mode 100644 index 0000000..5ec58e1 Binary files /dev/null and b/Dependencies/Qt5Core.dll differ diff --git a/Dependencies/Qt5Gui.dll b/Dependencies/Qt5Gui.dll new file mode 100644 index 0000000..d75c183 Binary files /dev/null and b/Dependencies/Qt5Gui.dll differ diff --git a/Dependencies/Qt5Network.dll b/Dependencies/Qt5Network.dll new file mode 100644 index 0000000..d80278e Binary files /dev/null and b/Dependencies/Qt5Network.dll differ diff --git a/Dependencies/Qt5SerialBus.dll b/Dependencies/Qt5SerialBus.dll new file mode 100644 index 0000000..95278e2 Binary files /dev/null and b/Dependencies/Qt5SerialBus.dll differ diff --git a/Dependencies/Qt5SerialPort.dll b/Dependencies/Qt5SerialPort.dll new file mode 100644 index 0000000..286dac1 Binary files /dev/null and b/Dependencies/Qt5SerialPort.dll differ diff --git a/Dependencies/Qt5Svg.dll b/Dependencies/Qt5Svg.dll new file mode 100644 index 0000000..4087736 Binary files /dev/null and b/Dependencies/Qt5Svg.dll differ diff --git a/Dependencies/Qt5Widgets.dll b/Dependencies/Qt5Widgets.dll new file mode 100644 index 0000000..84511cc Binary files /dev/null and b/Dependencies/Qt5Widgets.dll differ diff --git a/Dependencies/libgcc_s_seh-1.dll b/Dependencies/libgcc_s_seh-1.dll new file mode 100644 index 0000000..4ec945b Binary files /dev/null and b/Dependencies/libgcc_s_seh-1.dll differ diff --git a/Dependencies/libstdc++-6.dll b/Dependencies/libstdc++-6.dll new file mode 100644 index 0000000..8e55acc Binary files /dev/null and b/Dependencies/libstdc++-6.dll differ diff --git a/Dependencies/libwinpthread-1.dll b/Dependencies/libwinpthread-1.dll new file mode 100644 index 0000000..d9f4e1a Binary files /dev/null and b/Dependencies/libwinpthread-1.dll differ diff --git a/Dependencies/plugins/imageformats/qgif.dll b/Dependencies/plugins/imageformats/qgif.dll new file mode 100644 index 0000000..fe72ce3 Binary files /dev/null and b/Dependencies/plugins/imageformats/qgif.dll differ diff --git a/Dependencies/plugins/imageformats/qicns.dll b/Dependencies/plugins/imageformats/qicns.dll new file mode 100644 index 0000000..1c5ab4f Binary files /dev/null and b/Dependencies/plugins/imageformats/qicns.dll differ diff --git a/Dependencies/plugins/imageformats/qico.dll b/Dependencies/plugins/imageformats/qico.dll new file mode 100644 index 0000000..4f12ab9 Binary files /dev/null and b/Dependencies/plugins/imageformats/qico.dll differ diff --git a/Dependencies/plugins/imageformats/qjpeg.dll b/Dependencies/plugins/imageformats/qjpeg.dll new file mode 100644 index 0000000..6dbeeb2 Binary files /dev/null and b/Dependencies/plugins/imageformats/qjpeg.dll differ diff --git a/Dependencies/plugins/imageformats/qsvg.dll b/Dependencies/plugins/imageformats/qsvg.dll new file mode 100644 index 0000000..6717ba4 Binary files /dev/null and b/Dependencies/plugins/imageformats/qsvg.dll differ diff --git a/Dependencies/plugins/imageformats/qtga.dll b/Dependencies/plugins/imageformats/qtga.dll new file mode 100644 index 0000000..bfe4295 Binary files /dev/null and b/Dependencies/plugins/imageformats/qtga.dll differ diff --git a/Dependencies/plugins/imageformats/qtiff.dll b/Dependencies/plugins/imageformats/qtiff.dll new file mode 100644 index 0000000..4cbf358 Binary files /dev/null and b/Dependencies/plugins/imageformats/qtiff.dll differ diff --git a/Dependencies/plugins/imageformats/qwbmp.dll b/Dependencies/plugins/imageformats/qwbmp.dll new file mode 100644 index 0000000..6d93968 Binary files /dev/null and b/Dependencies/plugins/imageformats/qwbmp.dll differ diff --git a/Dependencies/plugins/imageformats/qwebp.dll b/Dependencies/plugins/imageformats/qwebp.dll new file mode 100644 index 0000000..f783616 Binary files /dev/null and b/Dependencies/plugins/imageformats/qwebp.dll differ diff --git a/Dependencies/plugins/platforms/qwindows.dll b/Dependencies/plugins/platforms/qwindows.dll new file mode 100644 index 0000000..b02c018 Binary files /dev/null and b/Dependencies/plugins/platforms/qwindows.dll differ diff --git a/Dependencies/plugins/styles/qwindowsvistastyle.dll b/Dependencies/plugins/styles/qwindowsvistastyle.dll new file mode 100644 index 0000000..9f5b283 Binary files /dev/null and b/Dependencies/plugins/styles/qwindowsvistastyle.dll differ diff --git a/ExampleDLLs/LineRingerLib.dll b/ExampleDLLs/LineRingerLib.dll new file mode 100644 index 0000000..c30038c Binary files /dev/null and b/ExampleDLLs/LineRingerLib.dll differ diff --git a/ExampleDLLs/M3KTE_TERM.dll b/ExampleDLLs/M3KTE_TERM.dll new file mode 100644 index 0000000..01097c3 Binary files /dev/null and b/ExampleDLLs/M3KTE_TERM.dll differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..9d3ba32 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# CetHub +