diff --git a/LedOK/Languages/zhCN.ts b/LedOK/Languages/zhCN.ts index 5f59588..1601cfb 100644 --- a/LedOK/Languages/zhCN.ts +++ b/LedOK/Languages/zhCN.ts @@ -9185,7 +9185,7 @@ Add app to firewall rule... Preview - 预览 + 播放 diff --git a/LedOK/LedOK.pro b/LedOK/LedOK.pro index af729a2..7e7d98f 100644 --- a/LedOK/LedOK.pro +++ b/LedOK/LedOK.pro @@ -69,6 +69,7 @@ SOURCES += \ LoUIClass/x_uimsgboxonlyclosebtn.cpp \ LoUIClass/x_uimsgboxyesnocancel.cpp \ ccrashstack.cpp \ + cfg.cpp \ communication/hpptclient.cpp \ communication/network.cpp \ communication/taserialthread.cpp \ @@ -85,8 +86,18 @@ SOURCES += \ mtitlebar.cpp \ mtabwidget.cpp \ mprogrammanager.cpp \ + player/digiclock.cpp \ + player/eleanaclock.cpp \ + player/elebase.cpp \ + player/elegif.cpp \ + player/eleimg.cpp \ + player/elemultipng.cpp \ + player/elescroll.cpp \ + player/elevideo.cpp \ + player/playwin.cpp \ publishform.cpp \ tipdialog.cpp \ + ttimer.cpp \ wDevicesManager/controladvparamwidget.cpp \ wDevicesManager/controlbrightnessautowidget.cpp \ wDevicesManager/controlbrightnessmanualwidget.cpp \ @@ -214,10 +225,12 @@ HEADERS += \ LoUIClass/x_uimsgboxonlyclosebtn.h \ LoUIClass/x_uimsgboxyesnocancel.h \ ccrashstack.h \ + cfg.h \ communication/hpptclient.h \ communication/network.h \ communication/taserialthread.h \ globaldefine.h \ + gqt.h \ jsondecoderloop.h \ loappconfig.h \ loapptools.h \ @@ -229,8 +242,18 @@ HEADERS += \ mtitlebar.h \ mtabwidget.h \ mprogrammanager.h \ + player/digiclock.h \ + player/eleanaclock.h \ + player/elebase.h \ + player/elegif.h \ + player/eleimg.h \ + player/elemultipng.h \ + player/elescroll.h \ + player/elevideo.h \ + player/playwin.h \ publishform.h \ tipdialog.h \ + ttimer.h \ wDevicesManager/controladvparamwidget.h \ wDevicesManager/controlbrightnessautowidget.h \ wDevicesManager/controlbrightnessmanualwidget.h \ @@ -470,8 +493,6 @@ include(./QSimpleUpdater/QSimpleUpdater.pri) #QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO #QMAKE_LFLAGS_RELEASE += /MAP /DEBUG /opt:ref /INCREMENTAL:NO #QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /DEBUG -#INCLUDEPATH +="G:\Dev\QT\LedOK-master\LedOK-master\ffmpeg\include" -#INCLUDEPATH +="G:\Dev\QT\LedOK-master\LedOK-master\sdl\include" #LIBS += -Lffmpeg/Lib/ffmpeg/lib -lavutil -lavformat -lavcodec -lavdevice -lavfilter -lpostproc -lswresample -lswscale #LIBS += -LG:\Dev\QT\LedOK-master\LedOK-master\ffmpeg\lib -lavutil -lavformat -lavcodec -lavdevice -lavfilter -lpostproc -lswresample -lswscale @@ -499,3 +520,4 @@ LIBS += -L$$PWD/../SDL2/lib/\ -lSDL2 INCLUDEPATH += $$PWD/../ffmpeg/include \ $$PWD/../SDL2/include + diff --git a/LedOK/LoUIClass/changepasswordform.cpp b/LedOK/LoUIClass/changepasswordform.cpp index 0570059..46ffcb5 100644 --- a/LedOK/LoUIClass/changepasswordform.cpp +++ b/LedOK/LoUIClass/changepasswordform.cpp @@ -3,7 +3,6 @@ #include #include "loappconfig.h" #include "x_uimsgboxok.h" -#include "LoUIClass/taesclass.h" #include "QTextCodec" ChangePasswordForm::ChangePasswordForm(QWidget *parent) : LoQDialog(parent), diff --git a/LedOK/LoUIClass/taesclass.cpp b/LedOK/LoUIClass/taesclass.cpp index 7af2aa5..8bf19c6 100644 --- a/LedOK/LoUIClass/taesclass.cpp +++ b/LedOK/LoUIClass/taesclass.cpp @@ -1,4 +1,4 @@ -#include "TAesClass.h" +#include "taesclass.h" Aes::~Aes() { diff --git a/LedOK/LoUIClass/taesclass.h b/LedOK/LoUIClass/taesclass.h index dd93304..6d69cd1 100644 --- a/LedOK/LoUIClass/taesclass.h +++ b/LedOK/LoUIClass/taesclass.h @@ -1,3 +1,5 @@ +#ifndef TAESCLASS_H +#define TAESCLASS_H #include #include #include @@ -20,110 +22,112 @@ typedef DWORD *PDWORD,*LPDWORD; #define Bits192 24 #define Bits256 32 -static unsigned char AesSbox[16*16]= +unsigned char AesSbox[16*16]= {// populate the Sbox matrix - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /*0*/ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - /*1*/ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - /*2*/ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - /*3*/ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - /*4*/ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - /*5*/ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - /*6*/ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - /*7*/ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - /*8*/ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - /*9*/ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - /*a*/ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - /*b*/ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - /*c*/ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - /*d*/ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - /*e*/ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - /*f*/ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + /*0*/ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + /*1*/ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + /*2*/ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + /*3*/ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + /*4*/ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + /*5*/ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + /*6*/ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + /*7*/ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + /*8*/ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + /*9*/ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + /*a*/ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + /*b*/ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + /*c*/ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + /*d*/ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + /*e*/ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + /*f*/ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; -static unsigned char AesiSbox[16*16]= +unsigned char AesiSbox[16*16]= { - // populate the iSbox matrix - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /*0*/ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, - /*1*/ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, - /*2*/ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, - /*3*/ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, - /*4*/ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, - /*5*/ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, - /*6*/ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, - /*7*/ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, - /*8*/ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, - /*9*/ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, - /*a*/ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, - /*b*/ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, - /*c*/ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, - /*d*/ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, - /*e*/ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, - /*f*/ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d + // populate the iSbox matrix + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ + /*0*/ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + /*1*/ 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + /*2*/ 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + /*3*/ 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + /*4*/ 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + /*5*/ 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + /*6*/ 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + /*7*/ 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + /*8*/ 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + /*9*/ 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + /*a*/ 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + /*b*/ 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + /*c*/ 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + /*d*/ 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + /*e*/ 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + /*f*/ 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d }; -static unsigned char AesRcon[11*4]= +unsigned char AesRcon[11*4]= { - 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, - 0x1b, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00 }; class Aes // Advanced Encryption Standard { public: - ~Aes(); - Aes(); - Aes(int keySize, unsigned char* keyBytes); - unsigned char State[4][4]; - void Cipher(unsigned char* input, unsigned char* output); // encipher 16-bit input - void InvCipher(unsigned char* input, unsigned char* output); // decipher 16-bit input + ~Aes(); + Aes(); + Aes(int keySize, unsigned char* keyBytes); + unsigned char State[4][4]; + void Cipher(unsigned char* input, unsigned char* output); // encipher 16-bit input + void InvCipher(unsigned char* input, unsigned char* output); // decipher 16-bit input private: - int Nb; // block size in 32-bit words. Always 4 for AES. (128 bits). - int Nk; // key size in 32-bit words. 4, 6, 8. (128, 192, 256 bits). - int Nr; // number of rounds. 10, 12, 14. + int Nb; // block size in 32-bit words. Always 4 for AES. (128 bits). + int Nk; // key size in 32-bit words. 4, 6, 8. (128, 192, 256 bits). + int Nr; // number of rounds. 10, 12, 14. - unsigned char key[32]; - unsigned char w[16*15]; + unsigned char key[32]; + unsigned char w[16*15]; + + void SetNbNkNr(int keySize); + void AddRoundKey(int round); //轮密钥加 + void SubBytes(); //S盒字节代换 + void InvSubBytes(); //逆S盒字节代换 + void ShiftRows(); //行移位 + void InvShiftRows(); + void MixColumns(); //列混淆 + void InvMixColumns(); + unsigned char gfmultby01(unsigned char b); + unsigned char gfmultby02(unsigned char b); + unsigned char gfmultby03(unsigned char b); + unsigned char gfmultby09(unsigned char b); + unsigned char gfmultby0b(unsigned char b); + unsigned char gfmultby0d(unsigned char b); + unsigned char gfmultby0e(unsigned char b); + void KeyExpansion(); //密钥扩展 + unsigned char* SubWord(unsigned char* word); //密钥S盒字代换 + unsigned char* RotWord(unsigned char* word); //密钥移位 - void SetNbNkNr(int keySize); - void AddRoundKey(int round); //轮密钥加 - void SubBytes(); //S盒字节代换 - void InvSubBytes(); //逆S盒字节代换 - void ShiftRows(); //行移位 - void InvShiftRows(); - void MixColumns(); //列混淆 - void InvMixColumns(); - unsigned char gfmultby01(unsigned char b); - unsigned char gfmultby02(unsigned char b); - unsigned char gfmultby03(unsigned char b); - unsigned char gfmultby09(unsigned char b); - unsigned char gfmultby0b(unsigned char b); - unsigned char gfmultby0d(unsigned char b); - unsigned char gfmultby0e(unsigned char b); - void KeyExpansion(); //密钥扩展 - unsigned char* SubWord(unsigned char* word); //密钥S盒字代换 - unsigned char* RotWord(unsigned char* word); //密钥移位 - }; class TAesClass { public: - TAesClass(); - ~TAesClass(); + TAesClass(); + ~TAesClass(); void InitializePrivateKey(DWORD KeySize,UCHAR *KeyBytes); //AES 密钥初始化 - DWORD OnAesEncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 加密数据 - DWORD OnAesUncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 解密数据 + DWORD OnAesEncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 加密数据 + DWORD OnAesUncrypt(LPVOID InBuffer,DWORD InLength,LPVOID OutBuffer); //AES 解密数据 private: - Aes * m_lpAes; + Aes * m_lpAes; }; + +#endif diff --git a/LedOK/ccrashstack.h b/LedOK/ccrashstack.h index 385109d..97af981 100644 --- a/LedOK/ccrashstack.h +++ b/LedOK/ccrashstack.h @@ -17,7 +17,6 @@ private: public: CCrashStack(PEXCEPTION_POINTERS pException); - QString GetExceptionInfo(); }; diff --git a/LedOK/cfg.cpp b/LedOK/cfg.cpp new file mode 100644 index 0000000..87938fa --- /dev/null +++ b/LedOK/cfg.cpp @@ -0,0 +1,9 @@ +#include "cfg.h" +void init(){ + +} + +Cfg::Cfg() +{ + +} diff --git a/LedOK/cfg.h b/LedOK/cfg.h new file mode 100644 index 0000000..1a8ba62 --- /dev/null +++ b/LedOK/cfg.h @@ -0,0 +1,12 @@ +#ifndef CFG_H +#define CFG_H + +void init(); + +class Cfg +{ +public: + Cfg(); +}; + +#endif // CFG_H diff --git a/LedOK/communication/network.cpp b/LedOK/communication/network.cpp index 0f2d6c6..dc9e69f 100644 --- a/LedOK/communication/network.cpp +++ b/LedOK/communication/network.cpp @@ -654,7 +654,7 @@ void NetComm::RestoreLedCardIpByUdpCmd() } } -void NetComm::RestoreLedCardIpToDhcpByUdpCmd(QString strNetworkName) +void NetComm::RestoreLedCardIpToDhcpByUdpCmd(QString) { if(m_iEnableQuitFlag==1) return; diff --git a/LedOK/communication/taserialthread.cpp b/LedOK/communication/taserialthread.cpp index 2cc73b0..d517cbc 100644 --- a/LedOK/communication/taserialthread.cpp +++ b/LedOK/communication/taserialthread.cpp @@ -140,10 +140,10 @@ void TA_SerialThread::SendDataBuf(uint8_t portIndex,const QByteArray &str) qDebug()<<"SendDataBuf port index is out of range!"; } -QByteArray TA_SerialThread::GetDataBuf(uint8_t portIndex) -{ - if(portIndex < portCnt) - return m_arrSerial[portIndex].readAll(); - else +QByteArray TA_SerialThread::GetDataBuf(uint8_t portIndex) { + if(portIndex < portCnt) return m_arrSerial[portIndex].readAll(); + else { qDebug()<<"GetDataBuf port index is out of range!"; + return nullptr; + } } diff --git a/LedOK/globaldefine.cpp b/LedOK/globaldefine.cpp index a2d1b81..def34e8 100644 --- a/LedOK/globaldefine.cpp +++ b/LedOK/globaldefine.cpp @@ -6,37 +6,22 @@ QString m_globalstrSavePath=""; bool m_globBoolFontantialiasing=false; bool m_globBoolGuangYingPin=false; -bool isTextValid(const QString &strIP) -{ - if(strIP.isEmpty()) - { - - } - else { +bool isTextValid(const QString &strIP){ + if(! strIP.isEmpty()) { QRegExp rx2("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); - if (!rx2.exactMatch(strIP)) - return false; - + if (!rx2.exactMatch(strIP)) return false; } return true; } -QString getRandomString(int length) -{ - qsrand(QDateTime::currentMSecsSinceEpoch()); - +QString getRandomString(int length){ const char ch[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int size = sizeof(ch); - char* str = new char[length + 1]; - int num = 0; - for (int i = 0; i < length; ++i) - { + for (int i = 0; i < length; ++i){ num = rand() % (size - 1); - str[i] = ch[num]; } - QString res(str); res=res.left(length); return res; diff --git a/LedOK/globaldefine.h b/LedOK/globaldefine.h index 35deb19..01f9c94 100644 --- a/LedOK/globaldefine.h +++ b/LedOK/globaldefine.h @@ -279,9 +279,6 @@ if(m_PostingDlg!=nullptr)\ }\ } -//delete m_PostingDlg;\ -//m_PostingDlg=nullptr;\ - #define MACRO_DEFINE_CONTROL_FUNC3 \ if(m_pLedlist!=nullptr)\ {\ @@ -320,19 +317,8 @@ if(m_PostingDlg!=nullptr)\ MYFONT.setStyleStrategy(QFont::PreferAntialias);\ } -#define MACRO_FAN_JUCHI(PAINT) \ -// if(m_globBoolFontantialiasing)\ -// {\ -// PAINT->setRenderHint(QPainter::TextAntialiasing, true);\ -// PAINT->setRenderHint(QPainter::SmoothPixmapTransform, true);\ -// PAINT->setRenderHint(QPainter::Antialiasing, true);\ -// }\ -// else \ -// {\ -// PAINT->setRenderHint(QPainter::TextAntialiasing, false);\ -// PAINT->setRenderHint(QPainter::SmoothPixmapTransform, false);\ -// PAINT->setRenderHint(QPainter::Antialiasing, false);\ -// } +#define MACRO_FAN_JUCHI(PAINT) + typedef struct _ST_ANSY_PROGRAM_PACKET { unsigned char SyncHead[3]; diff --git a/LedOK/gqt.h b/LedOK/gqt.h new file mode 100644 index 0000000..fc0ca4a --- /dev/null +++ b/LedOK/gqt.h @@ -0,0 +1,88 @@ +#ifndef GQT_H +#define GQT_H +#include +#include +#include + +template +class Wrp{ +public: + T *obj; + Wrp(T *obj = nullptr){ + this->obj = obj; + }; + inline Wrp& operator()(T *obj){ + this->obj = obj; + return *this; + } + inline Wrp& operator()(T *obj, QLayout *layout){ + this->obj = obj; + layout->addWidget(obj); + return *this; + } + inline Wrp& addTo(QLayout *layout){ + layout->addWidget(obj); + return *this; + } + inline Wrp& margin(int a){ + obj->setMargin(a); + return *this; + } + inline Wrp& font(const QFont &font){ + obj->setFont(font); + return *this; + } + inline Wrp& font(int size){ + QFont font = obj->font(); + font.setPointSize(size); + obj->setFont(font); + return *this; + } + + inline Wrp& width(int w){ + obj->setFixedWidth(w); + return *this; + } + inline Wrp& height(int h){ + obj->setFixedHeight(h); + return *this; + } + inline Wrp& padding(int wAdd, int hAdd, int minW = 32, int minH = 16){ + wAdd+=8; + hAdd+=8; + QSize size = obj->fontMetrics().size(Qt::TextShowMnemonic, obj->text()); + int &rwidth = size.rwidth(); + rwidth += wAdd; + if(rwidth < minW) rwidth = minW; + int &rheight = size.rheight(); + rheight += hAdd; + if(rheight < minH) rheight = minH; + obj->setFixedSize(size); + return *this; + } + + inline Wrp& alignC(){ + obj->setAlignment(Qt::AlignCenter); + return *this; + } + inline Wrp& alignR(){ + obj->setAlignment(Qt::AlignRight); + return *this; + } + + inline Wrp& connStart(){ + QObject::connect(obj, &QThread::finished, obj, &QThread::deleteLater); + obj->start(); + return *this; + } +}; + +template +inline QThread *ThreadStart(Func &&f) { + QThread* thread = QThread::create(f); + QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater); + thread->start(); + return thread; +} + +#endif diff --git a/LedOK/main.cpp b/LedOK/main.cpp index ecdc165..e098cf9 100644 --- a/LedOK/main.cpp +++ b/LedOK/main.cpp @@ -6,11 +6,9 @@ //#include "DbgHelp.h" #ifdef Q_OS_WIN -long __stdcall callback(_EXCEPTION_POINTERS* excp) -{ +long __stdcall callback(_EXCEPTION_POINTERS* excp){ CCrashStack crashStack(excp); QString sCrashInfo = crashStack.GetExceptionInfo(); - // TCHAR my_documents[MAX_PATH]; // SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, my_documents); // QString file_path = QString::fromWCharArray(my_documents); @@ -18,25 +16,17 @@ long __stdcall callback(_EXCEPTION_POINTERS* excp) QString file_path = dir.currentPath(); QDir *folder_path = new QDir; bool exist = folder_path->exists(file_path.append("\\MyApp")); - if(!exist) - { - folder_path->mkdir(file_path); - } + if(!exist) folder_path->mkdir(file_path); delete folder_path; folder_path = nullptr; - QString sFileName = "d:\\mycrash.log"; - - QFile file(sFileName); - if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) - { + QFile file("d:\\mycrash.log"); + if(file.open(QIODevice::WriteOnly|QIODevice::Truncate)){ file.write(sCrashInfo.toUtf8()); file.close(); } - QMessageBox::critical(NULL,"程式崩溃","
程序崩溃,请将d盘根目录下的mycrash.log文件发送到fyx@xixunled.com邮箱
"+ - QString("研发人员会尽快处理修改程序bug,并给出解决方案"), - QMessageBox::Ok); - return EXCEPTION_EXECUTE_HANDLER; + QMessageBox::critical(NULL,"程式崩溃","
程序崩溃,请将d盘根目录下的mycrash.log文件发送到fyx@xixunled.com邮箱
研发人员会尽快处理修改程序bug,并给出解决方案", QMessageBox::Ok); + return EXCEPTION_EXECUTE_HANDLER; } #endif @@ -71,9 +61,10 @@ long __stdcall callback(_EXCEPTION_POINTERS* excp) // return EXCEPTION_EXECUTE_HANDLER; //} //主程序入口 -int main(int argc, char *argv[]) -{ - SetUnhandledExceptionFilter(callback); +int main(int argc, char *argv[]){ + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + SetUnhandledExceptionFilter(callback); //步骤3: //通过qt命令行进入 执行命令: //objdump -S xxx.exe >aaa.asm diff --git a/LedOK/mainwindow.cpp b/LedOK/mainwindow.cpp index 2421d54..c1e59a1 100644 --- a/LedOK/mainwindow.cpp +++ b/LedOK/mainwindow.cpp @@ -1,14 +1,14 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include "LoUIClass/x_uimsgboxok.h" +#include "LoUIClass/x_uimsgboxokcancel.h" +#include "wDevicesManager/inputpassworddialog.h" +#include "tipdialog.h" #include #include #include -#include -#include -#include "LoUIClass/x_uimsgboxokcancel.h" -#include -#include -#include "QTextCodec" +#include +#include //主窗口 NetComm *p_globaNetComm=nullptr; static const QString FILE_NAME_TRANSLATOR{ "\\qt_zh_CN.qm" }; @@ -355,22 +355,6 @@ void MainWindow::onLanguageChanged(const QString &lan) #endif */ } -QSize MainWindow::GetScreenSize() - { - QDesktopWidget* desktopWidget = QApplication::desktop(); - //获取可用桌面大小 - QRect deskRect = desktopWidget->availableGeometry(); - //获取设备屏幕大小 - QRect screenRect = desktopWidget->screenGeometry(); - qDebug()<<"*********分辨率********"<screenCount(); -} void MainWindow::readSettings() { LoAppConfig *cfg = LoAppConfig::getInstance(); @@ -381,46 +365,8 @@ void MainWindow::readSettings() { } - else { - AddAppToFirewall(); - } - //QPoint pos = settings->value("posMainWindow", QPoint(-1, 0)).toPoint(); - QSize size = settings->value("sizeMainWindow", QSize(1024, 600)).toSize(); + else AddAppToFirewall(); setWindowState(Qt::WindowMaximized); - qDebug()<<"Qt::WindowMaximized"; -// if (iMaxFlag.toString() =="1")//是最大化状态 -// { -// setWindowState(Qt::WindowMaximized); -// } -// else -// { -// QSize itempDesktopSize=GetScreenSize(); -// this->setMaximumSize(itempDesktopSize); -// this->setMinimumSize(QSize(1024,600)); -// if(size.width()>itempDesktopSize.width()||size.height()>itempDesktopSize.height()) -// { -// resize(itempDesktopSize); -// } -// else { - -// resize(size); -// } - -// } - /*20201017 masked by alahover -s - m_strSelectNetName=settings->value("DirectlyConnectNetWork").toString(); - if(m_strSelectNetName.isEmpty()) - { - m_pOneKeyCheckCard->setEnabled(false); - } - else { - m_pSwitchDhcpControl->setCheckedStatus(true); - m_pSwitchDhcpControl->setEnabled(true); - m_pOneKeyCheckCard->setEnabled(true); - m_wDeviceManager->pNetComm->RestoreLedCardIpByUdpCmdBefore(m_strSelectNetName); - } - */ - } void MainWindow::writeSettings() diff --git a/LedOK/mainwindow.h b/LedOK/mainwindow.h index 67a1b92..9773d58 100644 --- a/LedOK/mainwindow.h +++ b/LedOK/mainwindow.h @@ -67,9 +67,7 @@ private: void readSettings(); void writeSettings(); void AddAppToFirewall(); - QSize GetScreenSize(); QString GetPasswordPro(); - }; #endif // MAINWINDOW_H diff --git a/LedOK/mdevicemanager.cpp b/LedOK/mdevicemanager.cpp index 8da1eda..dfa026b 100644 --- a/LedOK/mdevicemanager.cpp +++ b/LedOK/mdevicemanager.cpp @@ -1,12 +1,12 @@ #include "mdevicemanager.h" #include "ui_mdevicemanager.h" #include "communication/network.h" +#include "wDevicesManager/specialdlg.h" +#include "LoUIClass/x_uimsgboxok.h" #include -#include -#include #include -//#include #include +#include //设备管理响应页面 mDeviceManager::mDeviceManager(QWidget *parent) : QWidget(parent), @@ -96,57 +96,21 @@ mDeviceManager::mDeviceManager(QWidget *parent) : connect(ui->txtSearch,SIGNAL(textChanged(const QString &)),this,SLOT(FilterProgram(const QString &))); connect(this,SIGNAL(sigShowDevicesInfoOrControlWidget(int)),this,SLOT(ShowDevicesInfoOrControlWidget(int))); // connect(this,SIGNAL(sigShowDevicesInfoOrControlWidget(int)),this,SLOT(ShowDevicesInfoOrControlWidget(int))); - - //开始轮训查找局域网内的控制卡 pNetComm->StartUpdCheck(); - ui->wDeviceList->hideColumn(0); ui->wDeviceList->HideHeaderCheckBox(true); - } -mDeviceManager::~mDeviceManager() -{ +mDeviceManager::~mDeviceManager(){ pNetComm->StopAllCheck(); delete pNetComm; - delete ui; } -#include -int mDeviceManager::GetScreenWidth() - { - QDesktopWidget* desktopWidget = QApplication::desktop(); - //获取可用桌面大小 - // QRect deskRect = desktopWidget->availableGeometry(); - //获取设备屏幕大小 - //QRect screenRect = desktopWidget->screenGeometry();QGuiApplication::screens(); -// int iScreenNum=desktopWidget->screenNumber(); -// QList tempScreen=QGuiApplication::screens(); -// int ireturnwidth=3840; -// for(int i=0;iscreenGeometry(); - -// } -// const QRect screenGeometry(const QWidget *widget) const; -// const QRect availableGeometry(const QWidget *widget) const; - - - - - QRect screenRect = desktopWidget->screenGeometry(); - qDebug()<<"*********分辨率********"<screenCount(); +int mDeviceManager::GetScreenWidth() { + QRect screenRect = QGuiApplication::primaryScreen()->availableVirtualGeometry(); + return screenRect.width(); } void mDeviceManager::ShowDevicesInfoOrControlWidget(int index) { diff --git a/LedOK/mprogrammanager.cpp b/LedOK/mprogrammanager.cpp index 7b33ee8..19eeeb1 100644 --- a/LedOK/mprogrammanager.cpp +++ b/LedOK/mprogrammanager.cpp @@ -1,17 +1,16 @@ #include "mprogrammanager.h" #include "ui_mprogrammanager.h" - #include "tipdialog.h" #include "globaldefine.h" +#include "LoUIClass/x_uimsgboxok.h" +#include "LoUIClass/x_uimsgboxokcancel.h" #include -#include -#include #include -mProgramManager::mProgramManager(QWidget *parent) : - QWidget(parent), +mProgramManager::mProgramManager(QWidget *parent) : QWidget(parent), ui(new Ui::mProgramManager), m_strProgramItemPath("") { + qDebug()<<"mProgramManager"; setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); @@ -99,18 +98,16 @@ mProgramManager::mProgramManager(QWidget *parent) : // ui->wProgramList->header()->setSortIndicatorShown( true ); // 设置三角标识符可见 // ui->wProgramList->header()->setSectionsClickable( true ); // 设置标题栏单击响应使能 // connect( ui->wProgramList->header(), SIGNAL( sectionClicked(int) ), this, SLOT( OnClickColumn(int) ) ); -} -void mProgramManager::OnClickColumn(int iColumn) -{ - if(iColumn!=ENUM_PROGRAMLISTHEADERITEM_CHECK||iColumn!=ENUM_PROGRAMLISTHEADERITEM_SEND) - ui->wProgramList->sortByColumn(iColumn,ui->wProgramList->header()->sortIndicatorOrder()); - } mProgramManager::~mProgramManager() { writeSettings(); delete ui; } + +void mProgramManager::OnClickColumn(int iColumn) { + if(iColumn!=ENUM_PROGRAMLISTHEADERITEM_CHECK && iColumn!=ENUM_PROGRAMLISTHEADERITEM_SEND) ui->wProgramList->sortByColumn(iColumn,ui->wProgramList->header()->sortIndicatorOrder()); +} void mProgramManager::writeSettings() { LoAppConfig *cfg = LoAppConfig::getInstance(); diff --git a/LedOK/player/digiclock.cpp b/LedOK/player/digiclock.cpp new file mode 100644 index 0000000..3603203 --- /dev/null +++ b/LedOK/player/digiclock.cpp @@ -0,0 +1,244 @@ +#include "digiclock.h" +#include "gqt.h" +#include +#include +#include + +DigiClock::DigiClock(QString prefix, QJsonObject layer, QWidget *parent) : QWidget{parent} { + timeZone = QTimeZone(layer["timezone"].toString().toUtf8()); + QJsonArray pics = layer["arrayPics"].toArray(); + for(int i=0; isetAlignment(Qt::AlignCenter); + vBox->setContentsMargins(0,0,0,0); + vBox->setSpacing(0); + vBox->addStretch(); + QHBoxLayout *hBox = new QHBoxLayout(); + vBox->addLayout(hBox); + hBox->addStretch(); + addDate(dateStyle, layer, hBox); + hBox->addStretch(); + if(weekly) { + hBox = new QHBoxLayout(); + vBox->addLayout(hBox); + hBox->addStretch(); + hBox->addWidget((QWidget*)weekComp); + hBox->addStretch(); + } + hBox = new QHBoxLayout(); + vBox->addLayout(hBox); + hBox->addStretch(); + if(AmPm) { + hBox->addWidget((QWidget*)ampmComp); + hBox->addSpacing(digiWidth/2); + } + if(hour) { + hBox->addWidget((QWidget*)hourComps[0]); + hBox->addWidget((QWidget*)hourComps[1]); + } + if(hour&&min) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); + if(min) { + hBox->addWidget((QWidget*)minComps[0]); + hBox->addWidget((QWidget*)minComps[1]); + } + if(min&&sec) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); + if(sec) { + hBox->addWidget((QWidget*)secComps[0]); + hBox->addWidget((QWidget*)secComps[1]); + } + hBox->addStretch(); + vBox->addStretch(); + } else { + QHBoxLayout *hBox = new QHBoxLayout(this); + hBox->setContentsMargins(0,0,0,0); + hBox->setSpacing(0); + hBox->addStretch(); + addDate(dateStyle, layer, hBox); + if(hBox->count()>1) hBox->addSpacing(digiWidth); + if(weekly) { + hBox->addWidget((QWidget*)weekComp); + hBox->addSpacing(digiWidth); + } + if(AmPm) { + hBox->addWidget((QWidget*)ampmComp); + hBox->addSpacing(digiWidth/2); + } + if(hour) { + hBox->addWidget((QWidget*)hourComps[0]); + hBox->addWidget((QWidget*)hourComps[1]); + } + if(hour&&min) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); + if(min) { + hBox->addWidget((QWidget*)minComps[0]); + hBox->addWidget((QWidget*)minComps[1]); + } + if(min&&sec) hBox->addWidget((QWidget*)new ImgWgt(timeSep)); + if(sec) { + hBox->addWidget((QWidget*)secComps[0]); + hBox->addWidget((QWidget*)secComps[1]); + } + hBox->addStretch(); + } +} +void DigiClock::addDate(int dateStyle, QJsonObject layer, QHBoxLayout* tar) { + if(dateStyle==0 || dateStyle==1) { + addYear(layer, tar, imgs["YEAR"]); + if(layer["month"].toBool()) { + tar->addWidget((QWidget*)monthComps[0]); + tar->addWidget((QWidget*)monthComps[1]); + tar->addWidget((QWidget*)new ImgWgt(imgs["MONTH"])); + } + if(layer["day"].toBool()) { + tar->addWidget((QWidget*)dayComps[0]); + tar->addWidget((QWidget*)dayComps[1]); + tar->addWidget((QWidget*)new ImgWgt(imgs["DAY"])); + } + } else if(dateStyle==2 || dateStyle==3) { + QPixmap sep = imgs["xiegang"]; + if(layer["month"].toBool()) { + tar->addWidget((QWidget*)monthComps[0]); + tar->addWidget((QWidget*)monthComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget((QWidget*)dayComps[0]); + tar->addWidget((QWidget*)dayComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==4 || dateStyle==5) { + QPixmap sep = imgs["xiegang"]; + if(layer["day"].toBool()) { + tar->addWidget((QWidget*)dayComps[0]); + tar->addWidget((QWidget*)dayComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + if(layer["month"].toBool()) { + tar->addWidget((QWidget*)monthComps[0]); + tar->addWidget((QWidget*)monthComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==6 || dateStyle==7) { + QPixmap sep = imgs["xiegang"]; + addYear(layer, tar, sep); + if(layer["month"].toBool()) { + tar->addWidget((QWidget*)monthComps[0]); + tar->addWidget((QWidget*)monthComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget((QWidget*)dayComps[0]); + tar->addWidget((QWidget*)dayComps[1]); + } + } else if(dateStyle==8 || dateStyle==9) { + QPixmap sep = imgs["hengxian"]; + if(layer["month"].toBool()) { + tar->addWidget((QWidget*)monthComps[0]); + tar->addWidget((QWidget*)monthComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget((QWidget*)dayComps[0]); + tar->addWidget((QWidget*)dayComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==10 || dateStyle==11) { + QPixmap sep = imgs["hengxian"]; + if(layer["day"].toBool()) { + tar->addWidget((QWidget*)dayComps[0]); + tar->addWidget((QWidget*)dayComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + if(layer["month"].toBool()) { + tar->addWidget((QWidget*)monthComps[0]); + tar->addWidget((QWidget*)monthComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + addYear(layer, tar, QPixmap()); + } else if(dateStyle==12 || dateStyle==13) { + QPixmap sep = imgs["hengxian"]; + addYear(layer, tar, sep); + if(layer["month"].toBool()) { + tar->addWidget((QWidget*)monthComps[0]); + tar->addWidget((QWidget*)monthComps[1]); + tar->addWidget((QWidget*)new ImgWgt(sep)); + } + if(layer["day"].toBool()) { + tar->addWidget((QWidget*)dayComps[0]); + tar->addWidget((QWidget*)dayComps[1]); + } + } +} +void DigiClock::addYear(QJsonObject layer, QHBoxLayout* tar, QPixmap sep) { + if(layer["year"].toBool()) { + if(layer["fullYear"].toBool()) { + tar->addWidget((QWidget*)yearComps[0]); + tar->addWidget((QWidget*)yearComps[1]); + } + tar->addWidget((QWidget*)yearComps[2]); + tar->addWidget((QWidget*)yearComps[3]); + if(!sep.isNull()) tar->addWidget((QWidget*)new ImgWgt(sep)); + } +} +void DigiClock::cal() { + QDateTime dt = QDateTime::currentDateTime().toTimeZone(timeZone); + QTime time = dt.time(); + QString hms = time.toString(timeptn); + *ampmComp = imgs[time.hour()<12?"AM":"PM"]; + *hourComps[0] = imgs[hms.mid(0,1)]; + *hourComps[1] = imgs[hms.mid(1,1)]; + *minComps[0] = imgs[hms.mid(2,1)]; + *minComps[1] = imgs[hms.mid(3,1)]; + *secComps[0] = imgs[hms.mid(4,1)]; + *secComps[1] = imgs[hms.mid(5,1)]; + if(yearComps[0]->img.isNull() || (time.hour()==0 && time.second()==0)) { + QDate date = dt.date(); + if(weekly) *weekComp = imgs[weeks[date.dayOfWeek()-1]]; + QString ymd = date.toString("yyyyMMdd"); + *yearComps[0] = imgs[ymd.mid(0,1)]; + *yearComps[1] = imgs[ymd.mid(1,1)]; + *yearComps[2] = imgs[ymd.mid(2,1)]; + *yearComps[3] = imgs[ymd.mid(3,1)]; + QChar ch = ymd.at(4); + if(isSingleMonth && ch=='0') *monthComps[0] = QPixmap(); + else *monthComps[0] = imgs[ymd.mid(4,1)]; + *monthComps[1] = imgs[ymd.mid(5,1)]; + *dayComps[0] = imgs[ymd.mid(6,1)]; + *dayComps[1] = imgs[ymd.mid(7,1)]; + } +} +void DigiClock::showEvent(QShowEvent *) { + if(timerId==0) { + timerId = startTimer(1000, Qt::PreciseTimer); + cal(); + } +} + +void DigiClock::timerEvent(QTimerEvent *) { + if(isVisible()) { + cal(); + update(); + } else if(timerId!=0) { + killTimer(timerId); + timerId = 0; + } +} diff --git a/LedOK/player/digiclock.h b/LedOK/player/digiclock.h new file mode 100644 index 0000000..fa6d638 --- /dev/null +++ b/LedOK/player/digiclock.h @@ -0,0 +1,67 @@ +#ifndef DIGICLOCK_H +#define DIGICLOCK_H + +#include +#include +#include +#include + +class ImgWgt : public QWidget { +public: + ImgWgt(QWidget *parent = nullptr) : QWidget{parent} {} + ImgWgt(const QPixmap &img) :img(img){ + setFixedSize(this->img.size()); + } + ImgWgt(QPixmap &&img) { + this->img = std::move(img); + setFixedSize(this->img.size()); + } + ImgWgt &operator=(const QPixmap &img) { + this->img = img; + setFixedSize(this->img.size()); + return *this; + } + ImgWgt &operator=(QPixmap &&img) { + this->img = std::move(img); + setFixedSize(this->img.size()); + return *this; + } + QPixmap img; +protected: + virtual void paintEvent(QPaintEvent *) override { + if(img.isNull()) return; + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); + painter.drawPixmap(0, 0, width(), height(), img); + } +}; + +const QString weeks[7]{"MON","TUE","WED","THU","FRI","SAT","SUN"}; + +class DigiClock : public QWidget { + Q_OBJECT +public: + DigiClock(QString path, QJsonObject layer, QWidget *parent = nullptr); + void cal(); + void addDate(int, QJsonObject, QHBoxLayout*); + void addYear(QJsonObject layer, QHBoxLayout* tar, QPixmap sep); + QTimeZone timeZone; + ImgWgt *yearComps[4] {new ImgWgt(), new ImgWgt(), new ImgWgt(), new ImgWgt()}; + ImgWgt *monthComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *dayComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *weekComp = new ImgWgt(), *ampmComp = new ImgWgt(); + ImgWgt *hourComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *minComps[2] {new ImgWgt(), new ImgWgt()}; + ImgWgt *secComps[2] {new ImgWgt(), new ImgWgt()}; + + QMap imgs; + QString timeptn; + bool multiline, weekly, isSingleMonth; + int timerId = 0; + +protected: + void timerEvent(QTimerEvent *) override; + void showEvent(QShowEvent *) override; +}; + +#endif // DIGICLOCK_H diff --git a/LedOK/player/eleanaclock.cpp b/LedOK/player/eleanaclock.cpp new file mode 100644 index 0000000..9f0918f --- /dev/null +++ b/LedOK/player/eleanaclock.cpp @@ -0,0 +1,74 @@ +#include "eleanaclock.h" +#include +#include +#include + +EleAnaClock::EleAnaClock(QString path, QJsonObject layer, QWidget *parent) : QWidget{parent} { + timeZone = QTimeZone(layer["timezone"].toString().toUtf8()); + img.load(path); + pinHourColor = layer["pinHourColor"].toString(); + pinMinColor = layer["pinMinColor"].toString(); + pinSecColor = layer["pinSecColor"].toString(); +} + +void EleAnaClock::cal() { + QTime time = QDateTime::currentDateTime().toTimeZone(timeZone).time(); + double rad = time.second()*M_PI/30; + double rsin = sin(rad); + double rcos = cos(rad); + double sideLen = width(); + if(height() < sideLen) sideLen = height(); + sPath = QPainterPath(QPointF(sideLen*0.55*rsin, sideLen*-0.55*rcos)); + double pinWidth = sideLen/36; + double sx = pinWidth*rcos; + double sy = pinWidth*rsin; + sPath.lineTo(sx, sy); + sPath.lineTo(-sx, -sy); + sPath.closeSubpath(); + + rad = time.minute()*M_PI/30 + rad/60; + rsin = sin(rad); + rcos = cos(rad); + mPath = QPainterPath(QPointF(sideLen*0.45*rsin, sideLen*-0.45*rcos)); + pinWidth = sideLen/30; + sx = pinWidth*rcos; + sy = pinWidth*rsin; + mPath.lineTo(sx, sy); + mPath.lineTo(-sx, -sy); + mPath.closeSubpath(); + + rad = time.hour()*M_PI/6 + rad/12; + rsin = sin(rad); + rcos = cos(rad); + hPath = QPainterPath(QPointF(sideLen*0.3*rsin, sideLen*-0.3*rcos)); + pinWidth = sideLen/18; + sx = pinWidth*rcos; + sy = pinWidth*rsin; + hPath.lineTo(sx, sy); + hPath.lineTo(-sx, -sy); + hPath.closeSubpath(); +} +void EleAnaClock::paintEvent(QPaintEvent *) { + if(timerId==0) { + timerId = startTimer(1000, Qt::PreciseTimer); + cal(); + } + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); + if(! img.isNull()) painter.drawPixmap(0, 0, width(), height(), img); + painter.translate(width()/2, height()/2); + painter.fillPath(hPath, QBrush(pinHourColor)); + painter.fillPath(mPath, QBrush(pinMinColor)); + painter.fillPath(sPath, QBrush(pinSecColor)); + painter.translate(-width()/2, -height()/2); +} + +void EleAnaClock::timerEvent(QTimerEvent *) { + if(isVisible()) { + cal(); + repaint(); + } else if(timerId!=0) { + killTimer(timerId); + timerId = 0; + } +} diff --git a/LedOK/player/eleanaclock.h b/LedOK/player/eleanaclock.h new file mode 100644 index 0000000..b79cdb7 --- /dev/null +++ b/LedOK/player/eleanaclock.h @@ -0,0 +1,24 @@ +#ifndef ELEANACLOCK_H +#define ELEANACLOCK_H + +#include +#include +#include + +class EleAnaClock : public QWidget { + Q_OBJECT +public: + explicit EleAnaClock(QString path, QJsonObject layer, QWidget *parent = nullptr); + void cal(); + QTimeZone timeZone; + QPixmap img; + QColor pinHourColor, pinMinColor, pinSecColor; + QPainterPath sPath, mPath, hPath; + int timerId = 0; + +protected: + void paintEvent(QPaintEvent *) override; + void timerEvent(QTimerEvent *) override; +}; + +#endif // ELEANACLOCK_H diff --git a/LedOK/player/elebase.cpp b/LedOK/player/elebase.cpp new file mode 100644 index 0000000..ca8907d --- /dev/null +++ b/LedOK/player/elebase.cpp @@ -0,0 +1 @@ +//#include "elebase.h" diff --git a/LedOK/player/elebase.h b/LedOK/player/elebase.h new file mode 100644 index 0000000..241be29 --- /dev/null +++ b/LedOK/player/elebase.h @@ -0,0 +1,21 @@ +#ifndef ELEBASE_H +#define ELEBASE_H +#include + +class EleBase { +public: + QString id; + QString type; + int x; + int y; + int w; + int h; + int startTime; + int timeSpan; + int endTime; + bool needThread; + + QWidget* wgt = nullptr; +}; + +#endif // ELEBASE_H diff --git a/LedOK/player/elegif.cpp b/LedOK/player/elegif.cpp new file mode 100644 index 0000000..eb08c6c --- /dev/null +++ b/LedOK/player/elegif.cpp @@ -0,0 +1,32 @@ +#include "elegif.h" +#include +#include + +EleGif::EleGif(QString path, QWidget *parent) : QWidget{parent} { + movie = new QMovie(path, QByteArray(), this); + movie->setCacheMode(QMovie::CacheAll); + movie->jumpToFrame(0); +} + +void EleGif::paintEvent(QPaintEvent *){ + QPainter painter(this); + if(movie!=nullptr) { + painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); + painter.drawPixmap(0, 0, width(), height(), movie->currentPixmap()); + if(timer==nullptr) { + timer = new SyncTimer(movie->nextFrameDelay()); + connect(timer, &SyncTimer::timeout, this, &EleGif::sltNext, Qt::BlockingQueuedConnection); + timer->start(); + } + } +} +void EleGif::sltNext(){ + if(isVisible()) { + movie->jumpToNextFrame(); + timer->inter = movie->nextFrameDelay(); + repaint(); + } else if(timer!=nullptr) { + timer->stop(); + timer = nullptr; + } +} diff --git a/LedOK/player/elegif.h b/LedOK/player/elegif.h new file mode 100644 index 0000000..38cab57 --- /dev/null +++ b/LedOK/player/elegif.h @@ -0,0 +1,21 @@ +#ifndef ELEGIF_H +#define ELEGIF_H +#include "ttimer.h" +#include + +class EleGif : public QWidget { + Q_OBJECT +public: + explicit EleGif(QString path, QWidget *parent = nullptr); + + QMovie* movie = nullptr; + SyncTimer* timer = nullptr; + +public slots: + void sltNext(); + +protected: + void paintEvent(QPaintEvent *) override; +}; + +#endif // ELEGIF_H diff --git a/LedOK/player/eleimg.cpp b/LedOK/player/eleimg.cpp new file mode 100644 index 0000000..6a800c0 --- /dev/null +++ b/LedOK/player/eleimg.cpp @@ -0,0 +1,15 @@ +#include "eleimg.h" +#include +#include + +EleImg::EleImg(QString path, QWidget *parent) : QWidget{parent} { + img.load(path); + qDebug()<< " EleImg isVisible()" << isVisible(); +} + +void EleImg::paintEvent(QPaintEvent *){ + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); + if(! img.isNull()) painter.drawPixmap(0, 0, width(), height(), img); +} + diff --git a/LedOK/player/eleimg.h b/LedOK/player/eleimg.h new file mode 100644 index 0000000..3ffb6ea --- /dev/null +++ b/LedOK/player/eleimg.h @@ -0,0 +1,16 @@ +#ifndef ELEIMG_H +#define ELEIMG_H + +#include + +class EleImg : public QWidget { + Q_OBJECT +public: + explicit EleImg(QString, QWidget *parent = nullptr); + + QPixmap img; +protected: + void paintEvent(QPaintEvent *) override; +}; + +#endif // ELEIMG_H diff --git a/LedOK/player/elemultipng.cpp b/LedOK/player/elemultipng.cpp new file mode 100644 index 0000000..9099175 --- /dev/null +++ b/LedOK/player/elemultipng.cpp @@ -0,0 +1,97 @@ +#include "elemultipng.h" +#include +#include +#include +#include + +EleMultiPng::EleMultiPng(QString dirPre, QJsonArray maps, QWidget *parent) : QWidget{parent} { + int len = maps.size(); + for(int i=0; i1)) { + timerId = startTimer(picDur, Qt::PreciseTimer); + startMove(); + } + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); + painter.drawPixmap(imgx, imgy, imgs[imgc]); +} + +void EleMultiPng::timerEvent(QTimerEvent *e) { + if(isVisible()) { + int id = e->timerId(); + if(id==timerId){ + if(imgc+2 > imgs.size()) imgc = 0; + else imgc++; + startMove(); + } else if(id==moveTimerId){ + if(effType=='l') { + imgx -= movePx; + if(imgx < 0) imgx = 0; + } else if(effType=='t') { + imgy -= movePx; + if(imgy < 0) imgy = 0; + } else if(effType=='r') { + imgx += movePx; + if(imgx > 0) imgx = 0; + } else if(effType=='b') { + imgy += movePx; + if(imgy > 0) imgy = 0; + } + if(imgx==0 && imgy==0) { + killTimer(moveTimerId); + moveTimerId = 0; + } + } + update(); + } else { + if(timerId!=0) { + killTimer(timerId); + timerId = 0; + } + if(moveTimerId!=0) { + killTimer(moveTimerId); + moveTimerId = 0; + } + } +} diff --git a/LedOK/player/elemultipng.h b/LedOK/player/elemultipng.h new file mode 100644 index 0000000..c19bd9e --- /dev/null +++ b/LedOK/player/elemultipng.h @@ -0,0 +1,26 @@ +#ifndef ELEMULTIPNG_H +#define ELEMULTIPNG_H + +#include +#include + +const QChar effTypes[] = {'l', 't', 'r', 'b'}; + +class EleMultiPng : public QWidget { + Q_OBJECT +public: + explicit EleMultiPng(QString, QJsonArray, QWidget *parent = nullptr); + void startMove(); + + QVector imgs; + int timerId = 0, moveTimerId = 0; + int picDur = 0, EffDur = 0, moveInter = 0, movePx = 0, imgc = 0, imgx = 0, imgy = 0; + QChar effType = 0; + QRandomGenerator rand; + bool needRand = false; +protected: + void paintEvent(QPaintEvent *) override; + void timerEvent(QTimerEvent *) override; +}; + +#endif // ELEMULTIPNG_H diff --git a/LedOK/player/elescroll.cpp b/LedOK/player/elescroll.cpp new file mode 100644 index 0000000..6295818 --- /dev/null +++ b/LedOK/player/elescroll.cpp @@ -0,0 +1,61 @@ +#include "elescroll.h" +#include +#include +#include + +EleScroll::EleScroll(QString dirPre, QJsonObject map, QWidget *parent) : QWidget{parent} { + img.load(dirPre + map["id"].toString()); + QString effStr = map["effect"].toString(); + if(effStr.isNull() || effStr=="no") return; + double effDurD = map["effectSpeed"].toInt()/2; + if(effDurD==0) return; + int idx = effStr.lastIndexOf(' '); + if(idx > -1) { + effect = effStr.at(idx+1); + if(effect=='l') end = -(img.width()-1); + else if(effect=='r') end = img.width()-1; + else if(effect=='t') end = -(img.height()-1); + else if(effect=='b') end = img.height()-1; + } + period = ceil(effDurD/16.666666)*16.666666; + curAdd = ceil(period/effDurD); +} + +void EleScroll::paintEvent(QPaintEvent *) { + if(img.isNull()) return; + if(timerId==0 && effect!=0 && period!=0) { + cur = 0; + timerId = startTimer(period, Qt::PreciseTimer); + } + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform); + if(effect=='l') { + painter.drawPixmap(cur, 0, img); + painter.drawPixmap(cur+img.width(), 0, img); + } else if(effect=='r') { + painter.drawPixmap(cur, 0, img); + painter.drawPixmap(cur-img.width(), 0, img); + } else if(effect=='t') { + painter.drawPixmap(0, cur, img); + painter.drawPixmap(0, cur+img.height(), img); + } else if(effect=='b') { + painter.drawPixmap(0, cur, img); + painter.drawPixmap(0, cur-img.height(), img); + } else painter.drawPixmap(0, 0, img); +} + +void EleScroll::timerEvent(QTimerEvent *) { + if(isVisible()) { + if(effect=='t' || effect=='l') { + if(cur <= end) cur = 0; + else cur-=curAdd; + } else if(effect=='b' || effect=='r') { + if(cur >= end) cur = 0; + else cur+=curAdd; + } + update(); + } else if(timerId!=0) { + killTimer(timerId); + timerId = 0; + } +} diff --git a/LedOK/player/elescroll.h b/LedOK/player/elescroll.h new file mode 100644 index 0000000..eef74f1 --- /dev/null +++ b/LedOK/player/elescroll.h @@ -0,0 +1,21 @@ +#ifndef ELESCROLL_H +#define ELESCROLL_H + +#include + +class EleScroll : public QWidget { + Q_OBJECT +public: + explicit EleScroll(QString, QJsonObject, QWidget *parent = nullptr); + + QPixmap img; + QChar effect = 0; + long period = 0; + int timerId = 0, cur = 0, end = 0, curAdd = 1; + +protected: + void paintEvent(QPaintEvent *) override; + void timerEvent(QTimerEvent *) override; +}; + +#endif // ELESCROLL_H diff --git a/LedOK/player/elevideo.cpp b/LedOK/player/elevideo.cpp new file mode 100644 index 0000000..9df80e6 --- /dev/null +++ b/LedOK/player/elevideo.cpp @@ -0,0 +1,17 @@ +#include "elevideo.h" +#include + +EleVideo::EleVideo(QString path, QWidget *parent) : QVideoWidget{parent} { + setAspectRatioMode(Qt::IgnoreAspectRatio); + QMediaPlayer* player = new QMediaPlayer(this); + player->setMedia(QUrl::fromLocalFile(path)); + player->setVideoOutput(this); + if(isVisible()) player->play(); +} + +void EleVideo::showEvent(QShowEvent *) { + ((QMediaPlayer*)mediaObject())->play(); +} +void EleVideo::hideEvent(QHideEvent *) { + ((QMediaPlayer*)mediaObject())->stop(); +} diff --git a/LedOK/player/elevideo.h b/LedOK/player/elevideo.h new file mode 100644 index 0000000..1842b20 --- /dev/null +++ b/LedOK/player/elevideo.h @@ -0,0 +1,16 @@ +#ifndef ELEVIDEO_H +#define ELEVIDEO_H +#include "elebase.h" +#include +#include + +class EleVideo : public QVideoWidget { + Q_OBJECT +public: + explicit EleVideo(QString path, QWidget *parent = nullptr); +protected: + void showEvent(QShowEvent *event) override; + void hideEvent(QHideEvent *event) override; +}; + +#endif // ELEVIDEO_H diff --git a/LedOK/player/playwin.cpp b/LedOK/player/playwin.cpp new file mode 100644 index 0000000..04bf07f --- /dev/null +++ b/LedOK/player/playwin.cpp @@ -0,0 +1,140 @@ +#include "playwin.h" +#include "eleanaclock.h" +#include "digiclock.h" +#include "eleimg.h" +#include "elegif.h" +#include "elescroll.h" +#include "elemultipng.h" +#include "elevideo.h" +#include "gqt.h" +#include +#include +#include +#include +#include + +Page::Page(QWidget *parent) : QWidget{parent} { + +} + +PlayWin::PlayWin(QString dir, int x, int y, int width, int height, const QJsonObject &aprog, QWidget *parent) : QWidget(parent, Qt::Window|Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint) { + setAttribute(Qt::WA_DeleteOnClose); + setGeometry(x, y, width, height); + QPalette plt = palette(); + plt.setColor(QPalette::Window, QColor(0,0,0)); + setPalette(plt); + connect(this, &PlayWin::sigSetVisible, this, &PlayWin::sltSetVisible); + + QJsonObject prog = aprog["task"].toObject(); + QJsonArray pageMaps = prog["items"].toArray(); + int pageCnt = pageMaps.size(); + EleBase ele; + for(int p=0; psetGeometry(0, 0, width, height); + page->setVisible(false); + page->name = pageMap["name"].toString(); + page->dirPre = dir+"/"+page->name+"/"; + + for(int ll=0; llname<<"-"< page->timeSpan) page->timeSpan = ele.endTime; + if(ele.startTime>0) ele.wgt->setVisible(false); + ele.id = srcMap["id"].toString(); + ele.wgt = nullptr; + if(ele.type=="Image") { + if(srcMap["mime"].toString().endsWith("gif")) ele.wgt = new EleGif(page->dirPre+ele.id, page); + else ele.wgt = new EleImg(page->dirPre+ele.id, page); + } else if(ele.type.startsWith("Environ")) { + QJsonArray arrayPics = srcMap["arrayPics"].toArray(); + for(int i=arrayPics.size()-1; i>=0; i--) if(arrayPics[i].toObject()["name"].toString() == "previewTmp") { + ele.wgt = new EleImg(page->dirPre + arrayPics[i].toObject()["id"].toString(), page); + break; + } + } else if(ele.type=="MultiPng") { + QJsonArray imgs = srcMap["arrayPics"].toArray(); + if(imgs.isEmpty()) continue; + if(imgs.size()==1 && imgs[0].toObject()["picDuration"].toInt()==0) ele.wgt = new EleScroll(page->dirPre, imgs[0].toObject(), page); + else ele.wgt = new EleMultiPng(page->dirPre, imgs, page); + } else if(ele.type=="DigitalClockNew") ele.wgt = new DigiClock(page->dirPre, srcMap, page); + else if(ele.type=="AnalogClock") ele.wgt = new EleAnaClock(page->dirPre+ele.id, srcMap, page); + else if(ele.type=="Video") ele.wgt = new EleVideo(page->dirPre+ele.id, page); + else continue; + if(ele.wgt==nullptr) continue; + ele.wgt->setGeometry(ele.x, ele.y, ele.w, ele.h); + page->eles.append(ele); + } + } + } + setVisible(true); + Page* page0 = (Page*)children()[0]; + EleBase* eleptr; + for(int ee=0; eeeles.size(); ee++) if((eleptr = &page0->eles[ee])->startTime > 0 || eleptr->endTime < page0->timeSpan) { + if(eleptr->startTime > 0) timerMap.insert(startTimer(eleptr->startTime), TimerValue(eleptr->wgt, true)); + timerMap.insert(startTimer(eleptr->endTime), TimerValue(eleptr->wgt, false)); + } +} + +void PlayWin::sltNext() { + if(isVisible()) { + Page* page = (Page*)children()[cur]; + page->setVisible(false); + if(cur+2 > children().size()) cur = 0; + else cur++; + page = (Page*)children()[cur]; + if(timer!=nullptr) timer->inter = page->timeSpan; + EleBase* ele; + for(int ee=0; eeeles.size(); ee++) if((ele = &page->eles[ee])->startTime > 0 || ele->endTime < page->timeSpan) { + if(ele->startTime > 0) timerMap.insert(startTimer(ele->startTime), TimerValue(ele->wgt, true)); + else ele->wgt->setVisible(true); + timerMap.insert(startTimer(ele->endTime), TimerValue(ele->wgt, false)); + } + page->setVisible(true); + } else if(timer!=nullptr) { + timer->stop(); + timer = nullptr; + } +} +void PlayWin::timerEvent(QTimerEvent *e){ + int id = e->timerId(); + killTimer(id); + TimerValue value = timerMap[id]; + if(value.ele!=nullptr){ + qDebug()<setVisible(value.visible); + } +} +void PlayWin::paintEvent(QPaintEvent *e){ + if(timer==nullptr && isVisible()) { + if(cur!=0) { + ((Page*)children()[cur])->setVisible(false); + cur = 0; + } + Page *page = (Page*)children()[cur]; + page->setVisible(true); + timer = new SyncTimer(page->timeSpan); + connect(timer, &SyncTimer::timeout, this, &PlayWin::sltNext, Qt::BlockingQueuedConnection); + timer->start(); + } + QWidget::paintEvent(e); +} diff --git a/LedOK/player/playwin.h b/LedOK/player/playwin.h new file mode 100644 index 0000000..e98dc95 --- /dev/null +++ b/LedOK/player/playwin.h @@ -0,0 +1,45 @@ +#ifndef PLAYWIN_H +#define PLAYWIN_H +#include "elebase.h" +#include "ttimer.h" +#include +#include +#include + +class Page : public QWidget { +public: + explicit Page(QWidget *parent = nullptr); + QString name; + QString dirPre; + int timeSpan = 0; + QVector eles; +}; + +class TimerValue{ +public: + TimerValue(QWidget *ele = nullptr, bool visible = false): ele(ele), visible(visible){} + QWidget* ele; + bool visible; +}; + +class PlayWin : public QWidget{ + Q_OBJECT +public: + SyncTimer* timer = nullptr; + int cur = 0; + QMap timerMap; + + PlayWin(QString dir, int x, int y, int width, int height, const QJsonObject &prog, QWidget *parent = nullptr); +public slots: + void sltNext(); + void sltSetVisible(QWidget *wgt, bool visible){ + wgt->setVisible(visible); + } +signals: + void sigSetVisible(QWidget *, bool); +protected: + void paintEvent(QPaintEvent *) override; + void timerEvent(QTimerEvent *) override; +}; + +#endif // PLAYWIN_H diff --git a/LedOK/ttimer.cpp b/LedOK/ttimer.cpp new file mode 100644 index 0000000..c1dd8d5 --- /dev/null +++ b/LedOK/ttimer.cpp @@ -0,0 +1,26 @@ +#include "ttimer.h" +#include +#include + +SyncTimer::SyncTimer(int inter) { + this->inter = inter; + connect(this, &QThread::finished, this, &QThread::deleteLater); +} +void SyncTimer::run(){ + try { + long curTime = inter; + if(curTime <= 0) return; + msleep(curTime); + long exeTime = QDateTime::currentDateTime().toMSecsSinceEpoch(); + while(inter > 0) { + inter = 0; + emit timeout(); + curTime = inter; + if(curTime<=0) return; + exeTime += curTime; + curTime = QDateTime::currentDateTime().toMSecsSinceEpoch(); + if(exeTime > curTime) msleep(exeTime - curTime); + else exeTime = curTime; + } + } catch (...) {} +} diff --git a/LedOK/ttimer.h b/LedOK/ttimer.h new file mode 100644 index 0000000..a0044fa --- /dev/null +++ b/LedOK/ttimer.h @@ -0,0 +1,21 @@ +#ifndef TTIMER_H +#define TTIMER_H + +#include + +class SyncTimer : public QThread { + Q_OBJECT +public: + int inter = 0; + explicit SyncTimer(int inter = 0); + inline int interval(){return inter;} + inline void setInterval(int inter){this->inter = inter;} +public slots: + inline void stop(){inter=0;} +signals: + void timeout(); +protected: + void run() override; +}; + +#endif // TTIMER_H diff --git a/LedOK/wDevicesManager/controladvparamwidget.cpp b/LedOK/wDevicesManager/controladvparamwidget.cpp index 5249ae9..423c29b 100644 --- a/LedOK/wDevicesManager/controladvparamwidget.cpp +++ b/LedOK/wDevicesManager/controladvparamwidget.cpp @@ -103,23 +103,43 @@ ControlAdvParamWidget::ControlAdvParamWidget(QWidget *parent,QList *l ui->groupBox_4->setVisible(false); ui->checkBox_ADB->setVisible(false); + //modified by alahover 20220116 -s + // oM80ResolutionsObject.insert("640×3840","660×3960"); + // oM80ResolutionsObject.insert("800×3200","825×3300"); + // oM80ResolutionsObject.insert("864×2686","900×2750"); + // oM80ResolutionsObject.insert("1080×2432","1125×2500"); + // oM80ResolutionsObject.insert("1080×1920","1125×2200"); + // oM80ResolutionsObject.insert("1280×1920","1320×2200"); + // oM80ResolutionsObject.insert("1472×1536","1500×1650"); + // oM80ResolutionsObject.insert("1536×1472","1650×1500"); + // oM80ResolutionsObject.insert("1920×1280","2200×1320"); + // oM80ResolutionsObject.insert("1920×1080","2200×1125"); + // oM80ResolutionsObject.insert("2048×1152","2200×1320"); + // oM80ResolutionsObject.insert("2400×1080","2500×1125"); + // oM80ResolutionsObject.insert("2686×864","2750×900"); + // oM80ResolutionsObject.insert("3200×800","3300×825"); + // oM80ResolutionsObject.insert("3840×640","3960×660"); + // oM80ResolutionsObject.insert("4096×480","4500×550"); + + oM80ResolutionsObject.insert("576×3840","625×3960"); + oM80ResolutionsObject.insert("640×3840","660×3960"); + oM80ResolutionsObject.insert("720×3200","750×3300"); + oM80ResolutionsObject.insert("864×2672","900×2750"); + oM80ResolutionsObject.insert("1080×1920","1125×2200"); + oM80ResolutionsObject.insert("1280×1760","1320×1850"); + oM80ResolutionsObject.insert("1472×1536","1500×1650"); + oM80ResolutionsObject.insert("1536×1472","1650×1500"); + oM80ResolutionsObject.insert("1760×1280","1850×1320"); + oM80ResolutionsObject.insert("1920×1080","2200×1125"); + oM80ResolutionsObject.insert("2672×864","2750×900"); + oM80ResolutionsObject.insert("3200×760","3300×825"); + oM80ResolutionsObject.insert("3200×720","3300×750"); + oM80ResolutionsObject.insert("3840×640","3960×660"); + oM80ResolutionsObject.insert("3840×576","3960×625"); + oM80ResolutionsObject.insert("4096×480","4500×550"); + //modified by alahover 20220116 -o + - oM80ResolutionsObject.insert("640×3840","660×3960"); - oM80ResolutionsObject.insert("800×3200","825×3300"); - oM80ResolutionsObject.insert("864×2686","900×2750"); - oM80ResolutionsObject.insert("1080×2432","1125×2500"); - oM80ResolutionsObject.insert("1080×1920","1125×2200"); - oM80ResolutionsObject.insert("1280×1920","1320×2200"); - oM80ResolutionsObject.insert("1472×1536","1500×1650"); - oM80ResolutionsObject.insert("1536×1472","1650×1500"); - oM80ResolutionsObject.insert("1920×1280","2200×1320"); - oM80ResolutionsObject.insert("1920×1080","2200×1125"); - oM80ResolutionsObject.insert("2048×1152","2200×1320"); - oM80ResolutionsObject.insert("2400×1080","2500×1125"); - oM80ResolutionsObject.insert("2686×864","2750×900"); - oM80ResolutionsObject.insert("3200×800","3300×825"); - oM80ResolutionsObject.insert("3840×640","3960×660"); - oM80ResolutionsObject.insert("4096×480","4500×550"); QStringList strtempList=oM80ResolutionsObject.keys(); ui->comboBox_2->clear(); ui->comboBox_2->addItems(strtempList); @@ -1726,7 +1746,7 @@ void setDebugOutput(const QString &rawTargetFilePath_, const bool &argDateFlag_) file.open( QIODevice::WriteOnly | QIODevice::Append ); QTextStream textStream( &file ); - textStream << QDateTime::currentDateTime().toString( "yyyy-MM-dd hh:mm:ss" ) << ": " << message << endl; + textStream << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << ":" << message; } }; diff --git a/LedOK/wDevicesManager/controlverifyclockwidget.cpp b/LedOK/wDevicesManager/controlverifyclockwidget.cpp index 77b0cc4..dee1b9a 100644 --- a/LedOK/wDevicesManager/controlverifyclockwidget.cpp +++ b/LedOK/wDevicesManager/controlverifyclockwidget.cpp @@ -2,10 +2,8 @@ #include "ui_controlverifyclockwidget.h" #include "LoUIClass/x_uimsgboxok.h" #include -ControlVerifyClockWidget::ControlVerifyClockWidget(QWidget *parent,QList *list) : - QWidget(parent), - ui(new Ui::ControlVerifyClockWidget) -{ + +ControlVerifyClockWidget::ControlVerifyClockWidget(QWidget *parent, QList *list) : QWidget(parent), ui(new Ui::ControlVerifyClockWidget) { m_pLedlist=list; ui->setupUi(this); refreshLable(); @@ -28,7 +26,8 @@ ControlVerifyClockWidget::ControlVerifyClockWidget(QWidget *parent,QListpushButtonCurTimeOfController->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonSetTimeZone->setProperty("ssType", "progManageTool"); ui->pushButtonSetTimeZone->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); - + ui->pushButtonSetLang->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); + ui->pushButtonGetLang->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->buttonGroup_2->setId(ui->radioButton_4, 0); ui->buttonGroup_2->setId(ui->radioButton_5, 1); @@ -58,14 +57,15 @@ ControlVerifyClockWidget::ControlVerifyClockWidget(QWidget *parent,QListpushButtonReadbackLoraMaster,SIGNAL(clicked()),this,SLOT(OnReadbackLoraMaster())); connect(ui->pushButtonCurTimeOfController,SIGNAL(clicked()),this,SLOT(OnReadbackCurTimeOfController())); connect(ui->pushButtonSetTimeZone, SIGNAL(clicked()), this, SLOT(OnSetTimeZone())); + connect(ui->pushButtonSetLang, SIGNAL(clicked()), this, SLOT(OnSetLang())); + connect(ui->pushButtonGetLang, SIGNAL(clicked()), this, SLOT(OnGetLang())); initTimezone(); MARCO_DEFINE_CONTROL_FUNC2(parent->parent(),parent) } -void ControlVerifyClockWidget::refreshLable() -{ +void ControlVerifyClockWidget::refreshLable(){ ui->labelTimeZone->setText(tr("Time zone")); ui->labelNtpServerAddress->setText(tr("NTP Server address")); ui->labelTimeOffset->setText(tr("Time offset(msec)")); @@ -178,30 +178,7 @@ void ControlVerifyClockWidget::OnRadioButton3()//ntp ui->pushButtonReadBackSync->setVisible(true); } -void ControlVerifyClockWidget::OnRadioButton6()//ntp -{ -// ui->labelIdCode->setVisible(false); -// ui->lineEditIdCode->setVisible(false); -// ui->labelTimeOffset->setVisible(false); -// ui->lineEditTimeOffset->setVisible(false); -// ui->lineEdit_3->setVisible(false); -// ui->labelSyncTimeInterval->setVisible(false); -// ui->labelmintime->setVisible(false); -// ui->pushButtonSetLoraMaster->setVisible(false); -// ui->pushButtonReadbackLoraMaster->setVisible(false); -// ui->checkBoxScreenSwitch->setVisible(false); -// ui->checkBoxVolume->setVisible(false); -// ui->checkBoxBrightness->setVisible(false); -// ui->checkBoxBrightness->setVisible(false); -// ui->pushButtonSetSync->setVisible(false); -// ui->pushButtonReadBackSync->setVisible(false); - - -// ui->groupBox_4->setVisible(true); -// ui->radioButton_4->setVisible(true); -// ui->radioButton_5->setVisible(true); -// ui->pushButtonSetLoraMaster->setVisible(true); -// ui->pushButtonReadbackLoraMaster->setVisible(true); +void ControlVerifyClockWidget::OnRadioButton6() { ui->labelIdCode->setVisible(true); ui->lineEditIdCode->setVisible(true); ui->labelTimeOffset->setVisible(true); @@ -219,7 +196,6 @@ void ControlVerifyClockWidget::OnRadioButton6()//ntp ui->checkBoxBrightness->setVisible(true); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); - } void ControlVerifyClockWidget::OnSetNtp() { @@ -371,28 +347,20 @@ void ControlVerifyClockWidget::OnSetSyncToCpt() } -void ControlVerifyClockWidget::OnReadbackNtp() -{ +void ControlVerifyClockWidget::OnReadbackNtp(){ QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "GetNtpServer"); MACRO_DEFINE_TIPDLG_FUCN(tr("GetNtpServer"),tr("Success"),tr("failed")) - - - // json.insert("_type", "GetNtpAndTimezone"); - // MACRO_DEFINE_TIPDLG_FUCN(tr("GetNtpAndTimezone"),tr("Success"),tr("failed")) - } -void ControlVerifyClockWidget::OnReadbackSyncInfo() -{ +void ControlVerifyClockWidget::OnReadbackSyncInfo() { + qDebug()<<" OnReadbackSyncInfo"; QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "GetingSyncMethod"); MACRO_DEFINE_TIPDLG_FUCN(tr("GetingSyncMethod"),tr("Success"),tr("failed")) - } -void ControlVerifyClockWidget::onSelectedDeviceList(QList *list) -{ +void ControlVerifyClockWidget::onSelectedDeviceList(QList *list){ m_pLedlist=list; MACRO_DEFINE_CONTROL_FUNC3 } @@ -408,22 +376,25 @@ void ControlVerifyClockWidget::OnControlTypeSwitchIndexChanged(int index) m_bSelected=false; } } -void ControlVerifyClockWidget::onReadbackAllThisPage() -{ - if(m_pLedlist==nullptr) - return; - if(m_pLedlist->count()!=1) - return; +void ControlVerifyClockWidget::onReadbackAllThisPage() { + if(m_pLedlist==nullptr) return; + if(m_pLedlist->count()!=1) return; QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "GetingSyncMethod"); - HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json); - QJsonObject json5; - json5.insert("_id", getRandomString(10)); - json5.insert("_type", "GetTimezone"); - HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json5); - MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed")) + HttpPostByTypeJsonObject(pHpptClientAll, m_strUrl, json); + json = QJsonObject(); + json.insert("_id", getRandomString(10)); + json.insert("_type", "GetTimezone"); + HttpPostByTypeJsonObject(pHpptClientAll, m_strUrl, json); + + json = QJsonObject(); + json.insert("_id", getRandomString(10)); + json.insert("_type", "GetLanguage"); + HttpPostByTypeJsonObject(pHpptClientAll, m_strUrl, json); + + MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed")) } QString ControlVerifyClockWidget::formatTime(int ms) @@ -449,103 +420,56 @@ QString ControlVerifyClockWidget::formatTime(int ms) return hou + ":" + min + ":" + sec ; } //获取到httpPost的应答,如果参数变化需要出发修改控件item的内容 -void ControlVerifyClockWidget::OnProHttpResponse(QString url, QString postMD5, QByteArray data) -{ - Q_UNUSED(postMD5) - //qDebug()<< url + "\r\n"+m_strUrl; - if(url == m_strUrl) - { +void ControlVerifyClockWidget::OnProHttpResponse(QString url, QString, QByteArray data){ + if(url == m_strUrl){ QJsonParseError parseJsonErr; QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr); - if(!(parseJsonErr.error == QJsonParseError::NoError)) - { - if(data.size()==0) - qDebug()<<"json is empty"; - else - qDebug()<m_strCardId +"---------"+ strType; - if(strType == "SetNtpServer")//alahover 新增协议类型 - { - + if(strType == "GetLanguage") { + if(jsonObject["language"].toInt()==1) ui->radioButtonCn->setChecked(true); + else ui->radioButtonEn->setChecked(true); } - else if(strType == "GetNtpServer") - { - ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); - } - else if(strType == "GetNtpAndTimezone") - { - ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); -// { -// "_type": "DataCallback", -// "cardId": "y60-620-40352", -// "commandId": "5f5ed8b24a433cb1555c1d3d", -// "language": "zh", -// "locationFeedback": 0, -// "locked": false, -// "now": "2020年9月14日 上午10:42:58", -// "ntpServer": "ntp1.aliyun.com", -// "timezone": "Asia/Shanghai", -// "_cardId": "y60-620-40352" -// } - } - else if(strType == "SyncTime") - { - - qDebug()<lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); + else if(strType == "GetNtpAndTimezone") ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); + else if(strType == "SyncTime") qDebug()<radioButton_4->setChecked(true); ui->radioButton_5->setChecked(false); - } - else - { + } else { ui->radioButton_4->setChecked(false); ui->radioButton_5->setChecked(true); } } - else if(strType == "SetingSyncMethod") - { - - } + else if(strType == "SetingSyncMethod") ; else if(strType == "GetTimezone"){ QString strtemp=jsonObject["timezone"].toString(); ui->comboBox_Timezone->setCurrentText(strtemp); } - else if(strType == "SetTimezone"){ - - } - else if(strType == "GetControllerDate") - { + else if(strType == "SetTimezone"); + else if(strType == "GetControllerDate") { QString strDate=jsonObject["date"].toString(); //int millis=jsonObject["millis"].toInt(); //strDate+=":"+QString::number(millis); ui->labelCurTime->setText(strDate); - } - else if(strType == "GetingSyncMethod") - { + else if(strType == "GetingSyncMethod") { //jsonObject["brightness"].toString(); QString strType=jsonObject["time"].toString(); strType=strType.toLower(); - if(strType=="serial"||strType=="lan") - { - if(strType=="serial") - ui->radioButton_2->setChecked(true); - else if(strType=="lan") - ui->radioButton_6->setChecked(true); + if(strType=="serial"||strType=="lan"){ + if(strType=="serial") ui->radioButton_2->setChecked(true); + else if(strType=="lan") ui->radioButton_6->setChecked(true); ui->lineEditIdCode->setText(jsonObject["identificationCode"].toString()); QString strtempdelaySync=QString::number(jsonObject["delaySync"].toInt()); @@ -646,41 +570,22 @@ void ControlVerifyClockWidget::OnProHttpResponse(QString url, QString postMD5, Q } //获取到httpPost的应答,如果参数变化需要出发修改控件item的内容 -void ControlVerifyClockWidget::OnProHttpResponseAll(QString url, QString postMD5, QByteArray data) -{ - Q_UNUSED(postMD5) - //qDebug()<< url + "\r\n"+m_strUrl; - if(url == m_strUrl) - { +void ControlVerifyClockWidget::OnProHttpResponseAll(QString url, QString, QByteArray data){ + if(url == m_strUrl) { QJsonParseError parseJsonErr; QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr); - if(!(parseJsonErr.error == QJsonParseError::NoError)) - { - if(data.size()==0) - qDebug()<<"json is empty"; - else - qDebug()<m_strCardId +"---------"+ strType; - - if(strType == "MasterSlaveSwitch") - { - - } - else if(strType == "IsMasterSlave") - { - if(jsonObject["result"].toBool()) - { - - } - else { - - } + if(jsonObject["success"].toBool()) { + qDebug()<m_strCardId +"----All----"+ strType; + if(strType == "GetLanguage") { + if(jsonObject["language"].toInt()==1) ui->radioButtonCn->setChecked(true); + else ui->radioButtonEn->setChecked(true); } else if(strType == "GetTimezone"){ QString strtemp=jsonObject["timezone"].toString(); @@ -688,11 +593,7 @@ void ControlVerifyClockWidget::OnProHttpResponseAll(QString url, QString postMD5 MACRO_ASKTIME_STOP MACRO_POSTING_DLG_UNLOCK } - else if(strType == "SetTimezone"){ - - } - else if(strType == "GetingSyncMethod") - { + else if(strType == "GetingSyncMethod") { //jsonObject["brightness"].toString(); QString strType=jsonObject["time"].toString(); strType=strType.toLower(); @@ -804,8 +705,7 @@ void ControlVerifyClockWidget::DeletePostingDlg() m_PostingDlg=nullptr; } } -void ControlVerifyClockWidget::initTimezone() -{ +void ControlVerifyClockWidget::initTimezone(){ QStringList listTimezone; listTimezone.append("Pacific/Majuro"); listTimezone.append("Pacific/Midway"); @@ -890,185 +790,33 @@ void ControlVerifyClockWidget::initTimezone() listTimezone.append("Pacific/Auckland");//奥克兰 listTimezone.append("Pacific/Fiji");//斐济 listTimezone.append("Pacific/Tongatapu");//东加塔布 -//listTimezone.append("Majuro"); -//listTimezone.append("Midway"); -//listTimezone.append("Honolulu"); -//listTimezone.append("Anchorage");//>安克雷奇 -//listTimezone.append("Los_Angeles");//>美国太平洋时间 (洛杉矶) -//listTimezone.append("Tijuana");//>美国太平洋时间 (提华纳) -//listTimezone.append("Phoenix");//>美国山区时间 (凤凰城) -//listTimezone.append("Chihuahua");//>奇瓦瓦 -//listTimezone.append("Denver");//>美国山区时间 (丹佛) -//listTimezone.append("Costa_Rica");//>美国中部时间 (哥斯达黎加) -//listTimezone.append("Chicago");//>美国中部时间 (芝加哥) -//listTimezone.append("Mexico_City");//>美国中部时间 (墨西哥城) -//listTimezone.append("Regina");//>美国中部时间 (里贾纳) -//listTimezone.append("Bogota");//>哥伦比亚时间 (波哥大) -//listTimezone.append("New_York");//>美国东部时间 (纽约) -//listTimezone.append("Caracas");//>委内瑞拉时间 (加拉加斯) -//listTimezone.append("Barbados");//>大西洋时间 (巴巴多斯) -//listTimezone.append("Manaus");//亚马逊标准时间 (马瑙斯) -//listTimezone.append("Santiago");//圣地亚哥 -//listTimezone.append("St_Johns");//纽芬兰时间 (圣约翰) -//listTimezone.append("Sao_Paulo");//圣保罗 -//listTimezone.append("Buenos_Aires");//布宜诺斯艾利斯 -//listTimezone.append("Godthab");//戈特霍布 -//listTimezone.append("Montevideo");//乌拉圭时间 (蒙得维的亚) -//listTimezone.append("South_Georgia");//南乔治亚 -//listTimezone.append("Azores");//亚述尔群岛 -//listTimezone.append("Cape_Verde");//佛得角 -//listTimezone.append("Casablanca");//卡萨布兰卡 -//listTimezone.append("London");//格林尼治标准时间 (伦敦) -//listTimezone.append("Amsterdam");//中欧标准时间 (阿姆斯特丹) -//listTimezone.append("Belgrade");//中欧标准时间 (贝尔格莱德) -//listTimezone.append("Brussels");//中欧标准时间 (布鲁塞尔) -//listTimezone.append("Sarajevo");//中欧标准时间 (萨拉热窝) -//listTimezone.append("Windhoek");//温得和克 -//listTimezone.append("Brazzaville");//西部非洲标准时间 (布拉扎维) -//listTimezone.append("Amman");//东欧标准时间 (安曼) -//listTimezone.append("Athens");//东欧标准时间 (雅典) -//listTimezone.append("Beirut");//东欧标准时间 (贝鲁特) -//listTimezone.append("Cairo");//东欧标准时间 (开罗) -//listTimezone.append("Helsinki");//东欧标准时间 (赫尔辛基) -//listTimezone.append("Jerusalem");//以色列时间 (耶路撒冷) -//listTimezone.append("Minsk");//明斯克 -//listTimezone.append("Harare");//中部非洲标准时间 (哈拉雷) -//listTimezone.append("Baghdad");//巴格达 -//listTimezone.append("Moscow");//莫斯科 -//listTimezone.append("Kuwait");//科威特 -//listTimezone.append("Nairobi");//东部非洲标准时间 (内罗毕) -//listTimezone.append("Tehran");//伊朗标准时间 (德黑兰) -//listTimezone.append("Baku");//巴库 -//listTimezone.append("Tbilisi");//第比利斯 -//listTimezone.append("Yerevan");//埃里温 -//listTimezone.append("Dubai");//迪拜 -//listTimezone.append("Kabul");//阿富汗时间 (喀布尔) -//listTimezone.append("Karachi");//卡拉奇 -//listTimezone.append("Oral");//乌拉尔 -//listTimezone.append("Yekaterinburg");//叶卡捷林堡 -//listTimezone.append("Calcutta");//加尔各答 -//listTimezone.append("Colombo");//科伦坡 -//listTimezone.append("Katmandu");//尼泊尔时间 (加德满都) -//listTimezone.append("Almaty");//阿拉木图 -//listTimezone.append("Rangoon");//缅甸时间 (仰光) -//listTimezone.append("Krasnoyarsk");//克拉斯诺亚尔斯克 -//listTimezone.append("Bangkok");//曼谷 -//listTimezone.append("Shanghai");//中国标准时间 (北京) -//listTimezone.append("Hong_Kong");//香港时间 (香港) -//listTimezone.append("Irkutsk");//伊尔库茨克时间 (伊尔库茨克) -//listTimezone.append("Kuala_Lumpur");//吉隆坡 -//listTimezone.append("Perth");//佩思 -//listTimezone.append("Taipei");//台北时间 (台北) -//listTimezone.append("Seoul");//首尔 -//listTimezone.append("Tokyo");//日本时间 (东京) -//listTimezone.append("Yakutsk");//雅库茨克时间 (雅库茨克) -//listTimezone.append("Adelaide");//阿德莱德 -//listTimezone.append("Darwin");//达尔文 -//listTimezone.append("Brisbane");//布里斯班 -//listTimezone.append("Hobart");//霍巴特 -//listTimezone.append("Sydney");//悉尼 -//listTimezone.append("Vladivostok");//海参崴时间 (符拉迪沃斯托克) -//listTimezone.append("Guam");//关岛 -//listTimezone.append("Magadan");//马加丹时间 (马加丹) -//listTimezone.append("Auckland");//奥克兰 -//listTimezone.append("Fiji");//斐济 -//listTimezone.append("Tongatapu");//东加塔布 ui->comboBox_Timezone->addItems(listTimezone); } -void ControlVerifyClockWidget::OnSetTimeZone() -{ -// QJsonObject obj; -//obj.insert("Majuro","Pacific/Majuro"); -//obj.insert("Midway","Pacific/Midway"); -//obj.insert("Honolulu","Pacific/Honolulu"); -//obj.insert("Anchorage" ,"America/Anchorage");//>安克雷奇 -//obj.insert("Los_Angeles","America/Los_Angeles");//>美国太平洋时间 (洛杉矶) -//obj.insert("Tijuana","America/Tijuana");//>美国太平洋时间 (提华纳) -//obj.insert("Phoenix","America/Phoenix");//>美国山区时间 (凤凰城) -//obj.insert("Chihuahua","America/Chihuahua");//>奇瓦瓦 -//obj.insert("Denver","America/Denver");//>美国山区时间 (丹佛) -//obj.insert("Costa_Rica","America/Costa_Rica");//>美国中部时间 (哥斯达黎加) -//obj.insert("Chicago","America/Chicago");//>美国中部时间 (芝加哥) -//obj.insert("Mexico_City","America/Mexico_City");//>美国中部时间 (墨西哥城) -//obj.insert("Regina","America/Regina");//>美国中部时间 (里贾纳) -//obj.insert("Bogota","America/Bogota");//>哥伦比亚时间 (波哥大) -//obj.insert("New_York","America/New_York");//>美国东部时间 (纽约) -//obj.insert("Caracas","America/Caracas");//>委内瑞拉时间 (加拉加斯) -//obj.insert("Barbados","America/Barbados");//>大西洋时间 (巴巴多斯) -//obj.insert("Manaus","America/Manaus");//亚马逊标准时间 (马瑙斯) -//obj.insert("Santiago","America/Santiago");//圣地亚哥 -//obj.insert("St_Johns","America/St_Johns");//纽芬兰时间 (圣约翰) -//obj.insert("Sao_Paulo","America/Sao_Paulo");//圣保罗 -//obj.insert("Buenos_Aires","America/Argentina/Buenos_Aires");//布宜诺斯艾利斯 -//obj.insert("Godthab","America/Godthab");//戈特霍布 -//obj.insert("Montevideo","America/Montevideo");//乌拉圭时间 (蒙得维的亚) -//obj.insert("South_Georgia","Atlantic/South_Georgia");//南乔治亚 -//obj.insert("Azores","Atlantic/Azores");//亚述尔群岛 -//obj.insert("Cape_Verde","Atlantic/Cape_Verde");//佛得角 -//obj.insert("Casablanca","Africa/Casablanca");//卡萨布兰卡 -//obj.insert("London","Europe/London");//格林尼治标准时间 (伦敦) -//obj.insert("Amsterdam","Europe/Amsterdam");//中欧标准时间 (阿姆斯特丹) -//obj.insert("Belgrade","Europe/Belgrade");//中欧标准时间 (贝尔格莱德) -//obj.insert("Brussels","Europe/Brussels");//中欧标准时间 (布鲁塞尔) -//obj.insert("Sarajevo","Europe/Sarajevo");//中欧标准时间 (萨拉热窝) -//obj.insert("Windhoek","Africa/Windhoek");//温得和克 -//obj.insert("Brazzaville","Africa/Brazzaville");//西部非洲标准时间 (布拉扎维) -//obj.insert("Amman","Asia/Amman");//东欧标准时间 (安曼) -//obj.insert("Athens","Europe/Athens");//东欧标准时间 (雅典) -//obj.insert("Beirut","Asia/Beirut");//东欧标准时间 (贝鲁特) -//obj.insert("Cairo","Africa/Cairo");//东欧标准时间 (开罗) -//obj.insert("Helsinki","Europe/Helsinki");//东欧标准时间 (赫尔辛基) -//obj.insert("Jerusalem","Asia/Jerusalem");//以色列时间 (耶路撒冷) -//obj.insert("Minsk","Europe/Minsk");//明斯克 -//obj.insert("Harare","Africa/Harare");//中部非洲标准时间 (哈拉雷) -//obj.insert("Baghdad","Asia/Baghdad");//巴格达 -//obj.insert("Moscow","Europe/Moscow");//莫斯科 -//obj.insert("Kuwait","Asia/Kuwait");//科威特 -//obj.insert("Nairobi","Africa/Nairobi");//东部非洲标准时间 (内罗毕) -//obj.insert("Tehran","Asia/Tehran");//伊朗标准时间 (德黑兰) -//obj.insert("Baku","Asia/Baku");//巴库 -//obj.insert("Tbilisi","Asia/Tbilisi");//第比利斯 -//obj.insert("Yerevan","Asia/Yerevan");//埃里温 -//obj.insert("Dubai","Asia/Dubai");//迪拜 -//obj.insert("Kabul","Asia/Kabul");//阿富汗时间 (喀布尔) -//obj.insert("Karachi","Asia/Karachi");//卡拉奇 -//obj.insert("Oral","Asia/Oral");//乌拉尔 -//obj.insert("Yekaterinburg","Asia/Yekaterinburg");//叶卡捷林堡 -//obj.insert("Calcutta","Asia/Calcutta");//加尔各答 -//obj.insert("Colombo","Asia/Colombo");//科伦坡 -//obj.insert("Katmandu","Asia/Katmandu");//尼泊尔时间 (加德满都) -//obj.insert("Almaty","Asia/Almaty");//阿拉木图 -//obj.insert("Rangoon","Asia/Rangoon");//缅甸时间 (仰光) -//obj.insert("Krasnoyarsk","Asia/Krasnoyarsk");//克拉斯诺亚尔斯克 -//obj.insert("Bangkok","Asia/Bangkok");//曼谷 -//obj.insert("Shanghai","Asia/Shanghai");//中国标准时间 (北京) -//obj.insert("Hong_Kong","Asia/Hong_Kong");//香港时间 (香港) -//obj.insert("Irkutsk","Asia/Irkutsk");//伊尔库茨克时间 (伊尔库茨克) -//obj.insert("Kuala_Lumpur","Asia/Kuala_Lumpur");//吉隆坡 -//obj.insert("Perth","Australia/Perth");//佩思 -//obj.insert("Taipei","Asia/Taipei");//台北时间 (台北) -//obj.insert("Seoul","Asia/Seoul");//首尔 -//obj.insert("Tokyo","Asia/Tokyo");//日本时间 (东京) -//obj.insert("Yakutsk","Asia/Yakutsk");//雅库茨克时间 (雅库茨克) -//obj.insert("Adelaide","Australia/Adelaide");//阿德莱德 -//obj.insert("Darwin","Australia/Darwin");//达尔文 -//obj.insert("Brisbane","Australia/Brisbane");//布里斯班 -//obj.insert("Hobart","Australia/Hobart");//霍巴特 -//obj.insert("Sydney","Australia/Sydney");//悉尼 -//obj.insert("Vladivostok","Asia/Vladivostok");//海参崴时间 (符拉迪沃斯托克) -//obj.insert("Guam","Pacific/Guam");//关岛 -//obj.insert("Magadan","Asia/Magadan");//马加丹时间 (马加丹) -//obj.insert("Auckland","Pacific/Auckland");//奥克兰 -//obj.insert("Fiji","Pacific/Fiji");//斐济 -//obj.insert("Tongatapu","Pacific/Tongatapu");//东加塔布 -QString strTimeZone=ui->comboBox_Timezone->currentText(); -//QString strValue= obj[strTimeZone].toString(); -MACRO_DEFINE_NO_SELECTED_CARD_TIP +void ControlVerifyClockWidget::OnSetTimeZone(){ + QString strTimeZone=ui->comboBox_Timezone->currentText(); + MACRO_DEFINE_NO_SELECTED_CARD_TIP -QJsonObject json; -json.insert("_id", getRandomString(10)); -json.insert("_type", "SetTimezone"); -json.insert("timezone", strTimeZone); -MACRO_DEFINE_TIPDLG_FUCN(tr("SetTimezone"),tr("Success"),tr("failed")) + QJsonObject json; + json.insert("_id", getRandomString(10)); + json.insert("_type", "SetTimezone"); + json.insert("timezone", strTimeZone); + MACRO_DEFINE_TIPDLG_FUCN(tr("SetTimezone"),tr("Success"),tr("failed")) +} + +void ControlVerifyClockWidget::OnSetLang(){ + MACRO_DEFINE_NO_SELECTED_CARD_TIP + int lang = ui->radioButtonCn->isChecked() ? 1 : 0; + + QJsonObject json; + json.insert("_id", getRandomString(10)); + json.insert("_type", "SetLanguage"); + json.insert("language", lang); + MACRO_DEFINE_TIPDLG_FUCN("设置语言", "成功", "失败") +} +void ControlVerifyClockWidget::OnGetLang() { + QJsonObject json; + json.insert("_id", getRandomString(10)); + json.insert("_type", "GetLanguage"); + MACRO_DEFINE_TIPDLG_FUCN("回读语言", "成功", "失败") } diff --git a/LedOK/wDevicesManager/controlverifyclockwidget.h b/LedOK/wDevicesManager/controlverifyclockwidget.h index 6ced30e..966047b 100644 --- a/LedOK/wDevicesManager/controlverifyclockwidget.h +++ b/LedOK/wDevicesManager/controlverifyclockwidget.h @@ -34,6 +34,8 @@ protected slots: void OnReadbackLoraMaster(); void OnReadbackCurTimeOfController(); void OnSetTimeZone(); + void OnSetLang(); + void OnGetLang(); //类似的控制操作信号和槽函数和变量定义 signals: diff --git a/LedOK/wDevicesManager/controlverifyclockwidget.ui b/LedOK/wDevicesManager/controlverifyclockwidget.ui index b203cbf..d2a42f6 100644 --- a/LedOK/wDevicesManager/controlverifyclockwidget.ui +++ b/LedOK/wDevicesManager/controlverifyclockwidget.ui @@ -6,7 +6,7 @@ 0 0 - 893 + 901 479 @@ -39,7 +39,6 @@ - Arial 12 @@ -79,6 +78,61 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + 语言: + + + + + + + + + English + + + + + + + 中文 + + + + + + + + + 设置 + + + + + + + 回读 + + + diff --git a/LedOK/wDevicesManager/wdevicesitem.cpp b/LedOK/wDevicesManager/wdevicesitem.cpp index 3652d05..0ab9a54 100644 --- a/LedOK/wDevicesManager/wdevicesitem.cpp +++ b/LedOK/wDevicesManager/wdevicesitem.cpp @@ -755,16 +755,11 @@ void wDevicesItem::OnProHttpResponse(QString url, QString postMD5, QByteArray da { emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetRealtimeServer")+":"+jsonObject["server"].toString()); } - else if(strType == "SetNtpServer") - { - emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetNtpServer")+":"+tr("success")); - } - else if(strType == "GetNtpServer") - { - // ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); + else if(strType == "SetNtpServer") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetNtpServer")+":"+tr("success")); + else if(strType == "GetNtpServer") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetNtpServer")+":"+jsonObject["ntpServer"].toString()); + else if(strType == "SetLanguage") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-设置语言: "+tr("success")); + else if(strType == "GetLanguage") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-获取语言: "+(jsonObject["language"].toInt()==1?"中文":"英文")); - emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetNtpServer")+":"+jsonObject["ntpServer"].toString()); - } else if(strType == "SyncTime") { emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SyncTime")+":"+tr("success")); diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eaclock.cpp b/LedOK/wProgramManager/wEditProgram/wElement/eaclock.cpp index 9660050..0699111 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eaclock.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/eaclock.cpp @@ -333,20 +333,12 @@ QWidget* eAClock::wAttrElement() connect(w, SIGNAL(sAttrChanged(const eAClock::Data &)), this, SLOT(onAttrChanged(const eAClock::Data &))); return w; } -QJsonObject eAClock::save(const QString &pRoot) -{ - - if(!m_attr.bCustomDial) - { - - } - else { - +bool eAClock::save(const QString &pRoot){ + if(m_attr.bCustomDial){ QString file0 = m_attr.path + PAGEDEL_SUFFIX + MACRO_FENGEDANFU + m_attr.name; QString file1 = m_attr.path + MACRO_FENGEDANFU + m_attr.name; QFile f0(file0); QFile f1(file1); - QString old_file; QString file_full=old_file.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); QString new_file = pRoot + MACRO_FENGEDANFU + m_attr.name; @@ -355,7 +347,7 @@ QJsonObject eAClock::save(const QString &pRoot) } else if(f1.exists()) { old_file = file1; } else {//自己画点,不用背景表盘 - return elementJson(); + return false; } QFile old_f(old_file); @@ -384,9 +376,7 @@ QJsonObject eAClock::save(const QString &pRoot) tempPixamp->save(strSaveFile,"PNG"); delete tempPixamp; //生成表盘背景图 - return elementJson(); - - + return true; } QJsonObject eAClock::elementJson() const { diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eaclock.h b/LedOK/wProgramManager/wEditProgram/wElement/eaclock.h index a535dcc..ae33a24 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eaclock.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/eaclock.h @@ -54,7 +54,7 @@ public: virtual int type() const override { return eObject::AClock; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override;// { Q_UNUSED(pRoot); return elementJson(); } + virtual bool save(const QString &pRoot) override;// { Q_UNUSED(pRoot); return elementJson(); } virtual QJsonObject elementJson() const override; protected: diff --git a/LedOK/wProgramManager/wEditProgram/wElement/edclock.cpp b/LedOK/wProgramManager/wEditProgram/wElement/edclock.cpp index 236295e..0316edc 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/edclock.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/edclock.cpp @@ -387,8 +387,7 @@ void eDClock::CreateWordPic(QString strWord,QString strFileName,QString strPath) } -QJsonObject eDClock::save(const QString &pRoot) -{ +bool eDClock::save(const QString &pRoot){ QRectF r1 = geometry(); QRect r=r1.toRect(); QString strDir=QString("%1%2%3%4%5").arg(zValue()).arg(r.x()).arg(r.y()).arg(r.width()).arg(r.height()); @@ -421,5 +420,5 @@ QJsonObject eDClock::save(const QString &pRoot) } } CreateAllWordPic(pRoot+MACRO_FENGEFU+strDir); - return elementJson(); + return true; } diff --git a/LedOK/wProgramManager/wEditProgram/wElement/edclock.h b/LedOK/wProgramManager/wEditProgram/wElement/edclock.h index 38b43da..05349e8 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/edclock.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/edclock.h @@ -55,7 +55,7 @@ public: virtual int type() const override { return eObject::DClock; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override;// { Q_UNUSED(pRoot); return elementJson(); } + virtual bool save(const QString &pRoot) override;// { Q_UNUSED(pRoot); return elementJson(); } virtual QJsonObject elementJson() const override; signals: diff --git a/LedOK/wProgramManager/wEditProgram/wElement/egif.cpp b/LedOK/wProgramManager/wEditProgram/wElement/egif.cpp index dd71879..0b50eba 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/egif.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/egif.cpp @@ -119,8 +119,7 @@ QWidget* eGif::wAttrElement() return w; } -QJsonObject eGif::save(const QString &pRoot) -{ +bool eGif::save(const QString &pRoot){ QString file0 = m_attr.path + PAGEDEL_SUFFIX + MACRO_FENGEFU + m_attr.name; QString file1 = m_attr.path + MACRO_FENGEFU + m_attr.name; QFile f0(file0); @@ -133,7 +132,7 @@ QJsonObject eGif::save(const QString &pRoot) } else if(f1.exists()) { old_file = file1; } else { - return QJsonObject(); + return false; } QFile old_f(old_file); @@ -141,7 +140,7 @@ QJsonObject eGif::save(const QString &pRoot) if(!new_f.exists()) old_f.copy(new_file); m_attr.path = pRoot; - return elementJson(); + return true; } QStringList eGif::filesList() const diff --git a/LedOK/wProgramManager/wEditProgram/wElement/egif.h b/LedOK/wProgramManager/wEditProgram/wElement/egif.h index 2f8ff52..d87d9b0 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/egif.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/egif.h @@ -35,7 +35,7 @@ public: virtual int type() const override { return eObject::Gif; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override; + virtual bool save(const QString &pRoot) override; virtual QStringList filesList() const override; virtual QJsonObject elementJson() const override; diff --git a/LedOK/wProgramManager/wEditProgram/wElement/emovie.cpp b/LedOK/wProgramManager/wEditProgram/wElement/emovie.cpp index 587c64a..868fd2b 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/emovie.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/emovie.cpp @@ -188,8 +188,7 @@ QWidget* eMovie::wAttrElement() return w; } -QJsonObject eMovie::save(const QString &pRoot) -{ +bool eMovie::save(const QString &pRoot){ QString file0 = m_attr.path + PAGEDEL_SUFFIX + MACRO_FENGEFU + m_attr.name; QString file1 = m_attr.path + MACRO_FENGEFU + m_attr.name; QFile f0(file0); @@ -202,7 +201,7 @@ QJsonObject eMovie::save(const QString &pRoot) } else if(f1.exists()) { old_file = file1; } else { - return QJsonObject(); + return false; } QFile old_f(old_file); @@ -210,7 +209,7 @@ QJsonObject eMovie::save(const QString &pRoot) if(!new_f.exists()) old_f.copy(new_file); m_attr.path = pRoot; - return elementJson(); + return true; } QStringList eMovie::filesList() const diff --git a/LedOK/wProgramManager/wEditProgram/wElement/emovie.h b/LedOK/wProgramManager/wEditProgram/wElement/emovie.h index 8a23a3b..1b3939e 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/emovie.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/emovie.h @@ -48,7 +48,7 @@ public: virtual int type() const override { return eObject::Movie; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override; + virtual bool save(const QString &pRoot) override; virtual QStringList filesList() const override; virtual QJsonObject elementJson() const override; diff --git a/LedOK/wProgramManager/wEditProgram/wElement/emovieattr.cpp b/LedOK/wProgramManager/wEditProgram/wElement/emovieattr.cpp index cb5cc59..17704f8 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/emovieattr.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/emovieattr.cpp @@ -393,7 +393,7 @@ QStringList eMovieAttr::getArguments(QString filepath,QString output){ // output=output.left(output.count()-3)+ui->comboBox_convertTo->currentText(); QDir outputPath;outputPath.mkpath(QFileInfo(output).absolutePath()); args << output; - qDebug() << args << endl; + qDebug() << args; return args; } void eMovieAttr::onAttrChanged() diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eobject.cpp b/LedOK/wProgramManager/wEditProgram/wElement/eobject.cpp index 33253a9..d0b4b56 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eobject.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/eobject.cpp @@ -1,6 +1,25 @@ #include "eobject.h" #include "eobjectattr.h" #include +#include +#include + +QVector eObject::bdImgs; +int eObject::maxImgWidth = 0; +struct Initer{ + Initer() { + QDirIterator it(":res/borders/", QDirIterator::Subdirectories); + while(it.hasNext()) { + BorderImg bdImg; + bdImg.name = it.next(); + bdImg.img = QPixmap(bdImg.name); + int idx = bdImg.name.lastIndexOf('/'); + if(idx>-1) bdImg.name = bdImg.name.mid(idx+1); + eObject::bdImgs.append(bdImg); + if(bdImg.img.width()>eObject::maxImgWidth) eObject::maxImgWidth = bdImg.img.width(); + } + } +}; eObject::eObject(InteractiveType type, QGraphicsItem *parent) : QGraphicsObject(parent), m_interactiveType(type), @@ -26,14 +45,25 @@ eObject::eObject(const QJsonObject &json, InteractiveType type, QGraphicsItem *p m_handleLen(10), m_rLimit(INVALID_RECT) { setZValue(json["order"].toInt()); - setGeometry(QRectF(json["x"].toInt(), json["y"].toInt(), - json["w"].toInt(), json["h"].toInt())); + setGeometry(QRectF(json["x"].toInt(), json["y"].toInt(), json["w"].toInt(), json["h"].toInt())); + QString bdName = json["border"].toString(); init(); + for(int i=0; iborderFd->addItem(QIcon(bdImgs[i].img), QString::number(bdImgs[i].img.height())); + m_wAttr->borderFd->setIconSize(QSize(maxImgWidth, 24)); + if(bdImgIdx>-1) m_wAttr->borderFd->setCurrentIndex(bdImgIdx+1); void(QComboBox::*currentIndexChanged)(int) = &QComboBox::currentIndexChanged; connect(m_wAttr->borderFd, currentIndexChanged, this, [this](int idx){ - //m_wAttr->borderFd->itemIcon(idx).data_ptr().; + bdImgIdx = idx-1; + update(); }); return m_wAttr; } @@ -88,6 +105,7 @@ QJsonObject eObject::elementJson() const { oRoot["y"] = (int)r.y(); oRoot["w"] = (int)r.width(); oRoot["h"] = (int)r.height(); + if(bdImgIdx>-1) oRoot["border"] = bdImgs[bdImgIdx].name; return oRoot; } @@ -101,72 +119,65 @@ void eObject::setRLimit(const QRectF &r) { qreal scale_h = r.height() / m_rLimit.height(); mx = std::round(x() * scale_w); my = std::round(y() * scale_h); - mw = std::round(m_w * scale_w); - mh = std::round(m_h * scale_h); + mw = std::round(width * scale_w); + mh = std::round(height * scale_h); setPos(mx, my); - m_w = mw; - m_h = mh; + width = mw; + height = mh; adjustHandle(); - geometryChanged(geometry()); + emit geometryChanged(geometry()); } m_rLimit = r; } -void eObject::onAttrChanged(const QRectF &rect){ - qDebug()<<"eObject::onAttrChanged(QRectF)"; - setGeometry(rect); -} - - QRectF eObject::boundingRect() const { - int m2 = m_handleLen * 2; - return QRectF(-m_handleLen, -m_handleLen, m_w+m2, m_h+m2); + qreal xy = -m_handleLen / 2; + return QRectF(xy, xy, width + m_handleLen, height + m_handleLen); } //绘制选中和未选中的区域边框 -void eObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ +void eObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *){ //qDebug()<<"eObject::paint(QPainter, QStyleOptionGraphicsItem)"; - Q_UNUSED(option); - Q_UNUSED(widget); painter->save(); //绘制边框 - QPixmap img("borders/M8_8.bmp"); - int borderWidth = img.height(); - QBrush brush(img); + if(bdImgIdx > -1) { + int borderWidth = bdImgs[bdImgIdx].img.height(); + QBrush brush(bdImgs[bdImgIdx].img); - QPainterPath path(QPointF(0, 0)); - path.lineTo(m_w, 0); - path.lineTo(m_w - borderWidth, borderWidth); - path.lineTo(borderWidth, borderWidth); - path.closeSubpath(); - painter->fillPath(path, brush); + QPainterPath path(QPointF(0, 0)); + path.lineTo(width, 0); + path.lineTo(width - borderWidth, borderWidth); + path.lineTo(borderWidth, borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); - QTransform transform; - transform.rotate(90); - brush.setTransform(transform); - path = QPainterPath(QPointF(m_w, 0)); - path.lineTo(m_w, m_h); - path.lineTo(m_w - borderWidth, m_h - borderWidth); - path.lineTo(m_w - borderWidth, borderWidth); - path.closeSubpath(); - painter->fillPath(path, brush); + QTransform transform; + transform.rotate(90); + brush.setTransform(transform); + path = QPainterPath(QPointF(width, 0)); + path.lineTo(width, height); + path.lineTo(width - borderWidth, height - borderWidth); + path.lineTo(width - borderWidth, borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); - transform.rotate(90); - brush.setTransform(transform); - path = QPainterPath(QPointF(m_w, m_h)); - path.lineTo(0, m_h); - path.lineTo(borderWidth, m_h - borderWidth); - path.lineTo(m_w - borderWidth, m_h - borderWidth); - path.closeSubpath(); - painter->fillPath(path, brush); + transform.rotate(90); + brush.setTransform(transform); + path = QPainterPath(QPointF(width, height)); + path.lineTo(0, height); + path.lineTo(borderWidth, height - borderWidth); + path.lineTo(width - borderWidth, height - borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); - transform.rotate(90); - brush.setTransform(transform); - path = QPainterPath(QPointF(0, m_h)); - path.lineTo(0, 0); - path.lineTo(borderWidth, borderWidth); - path.lineTo(borderWidth, m_h - borderWidth); - path.closeSubpath(); - painter->fillPath(path, brush); + transform.rotate(90); + brush.setTransform(transform); + path = QPainterPath(QPointF(0, height)); + path.lineTo(0, 0); + path.lineTo(borderWidth, borderWidth); + path.lineTo(borderWidth, height - borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); + } if(isSelected()) { @@ -224,27 +235,23 @@ void eObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q // Qt::PenJoinStyle join = Qt::BevelJoin); // QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); - //painter->drawLine(QPointF(rect().bottomLeft()),QPointF(rect().bottomRight())); painter->restore(); } void eObject::mousePressEvent(QGraphicsSceneMouseEvent *event){ if(Qt::LeftButton == event->button()) { - m_hDir = handleDir(event->pos()); m_pOrg = pointToParent(event->pos()); m_rOrg = geometry(); m_movable = true; bMousePress=true; - } QGraphicsItem::mousePressEvent(event); } void eObject::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ bMousePress=false; - if(Qt::LeftButton == event->button()) { m_hDir = NONE; m_movable = false; @@ -254,7 +261,6 @@ void eObject::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ bBottomCitie=false; m_keyPressId++; emit sigCiTie(false,m_keyPressId); - } QGraphicsItem::mouseReleaseEvent(event); } @@ -269,8 +275,8 @@ void eObject::mouseMoveEvent(QGraphicsSceneMouseEvent *event){ mx = m_rOrg.x(); my = m_rOrg.y(); - mw = m_w; - mh = m_h; + mw = width; + mh = height; if(m_hDir != NONE) { prepareGeometryChange(); @@ -377,8 +383,8 @@ void eObject::mouseMoveEvent(QGraphicsSceneMouseEvent *event){ } setPos(mx, my); - m_w = mw; - m_h = mh; + width = mw; + height = mh; adjustHandle(); updateGeometry(m_rOrg); rectChanged(rect()); @@ -393,92 +399,46 @@ void eObject::mouseMoveEvent(QGraphicsSceneMouseEvent *event){ } setPos(mx, my); } - geometryChanged(geometry()); - if(bMousePress) - { - - emit sigCiTie(true,m_hDir); - - } + if(bMousePress) emit sigCiTie(true,m_hDir); } void eObject::setBrightBianLeft(bool b){ -qDebug()<<"eObject::setBrightBianLeft(bool)"; - //if(bMousePress) -// { -// bLeftCitie=b; - -// } -// else { -// bLeftCitie=false; -// } + qDebug()<<"eObject::setBrightBianLeft(bool)"; +// if(bMousePress) bLeftCitie=b; +// else bLeftCitie=false; bLeftCitie=b; updateGeometry(); - } void eObject::setBrightBianRight(bool b){ -qDebug()<<"eObject::setBrightBianRight(bool)"; -// if(bMousePress) -// { -// bRightCitie=b; - -// } -// else { -// bRightCitie=false; -// } + qDebug()<<"eObject::setBrightBianRight(bool)"; bRightCitie=b; updateGeometry(); - } void eObject::setBrightBianTop(bool b){ -qDebug()<<"eObject::setBrightBianTop(bool)"; -// if(bMousePress) -// { -// bTopCitie=b; - -// } -// else { -// bTopCitie=false; -// } + qDebug()<<"eObject::setBrightBianTop(bool)"; bTopCitie=b; updateGeometry(); - } void eObject::setBrightBianbottom(bool b){ -qDebug()<<"eObject::setBrightBianbottom(bool)"; -// if(bMousePress) -// { -// bBottomCitie=b; - -// } -// else { -// bBottomCitie=false; -// } + qDebug()<<"eObject::setBrightBianbottom(bool)"; bBottomCitie=b; updateGeometry(); - } - - - - - void eObject::setGeometry(const QRectF &r){ qDebug()<<"eObject::setGeometry(QRectF)"; if(r != geometry()) { prepareGeometryChange(); setPos(r.x(), r.y()); - m_w = r.width(); - m_h = r.height(); + width = r.width(); + height = r.height(); adjustHandle(); emit rectChanged(rect()); } } void eObject::updateGeometry(){ - qDebug()<<"eObject::updateGeometry()"; QRectF r = geometry(); qreal x, y, w, h; x = r.x() - m_handleLen; @@ -486,9 +446,7 @@ void eObject::updateGeometry(){ w = r.width() + m_handleLen * 2; h = r.height() + m_handleLen * 2; r = QRectF(x, y, w, h); - if(nullptr != scene()) { - scene()->update(r); - } + if(nullptr != scene()) scene()->update(r); emit requestUpdate(r); } @@ -511,9 +469,7 @@ void eObject::updateGeometry(const QRectF &gC, const QRectF &gL){ qreal r = (gCur.right() > gLast.right()) ? gCur.right() : gLast.right(); qreal b = (gCur.bottom() > gLast.bottom()) ? gCur.bottom() : gLast.bottom(); QRectF gFlash = QRectF(QPointF(l, t), QPointF(r, b)); - if(nullptr != scene()) { - scene()->update(gFlash); - } + if(nullptr != scene()) scene()->update(gFlash); emit requestUpdate(gFlash); } @@ -543,48 +499,21 @@ eObject::HANDLE_DIR eObject::handleDir(const QPointF &p){ //拖拽的虚线矩形 void eObject::adjustHandle(){ qDebug()<<"eObject::adjustHandle()"; - const QRectF &r = rect(); - //左上角 - m_rLT = QRectF(r.left() - m_handleLen/2, - r.top() - m_handleLen/2, - m_handleLen, m_handleLen); - //上中 - m_rT = QRectF(r.center().x() - m_handleLen / 2, - r.top() - m_handleLen/2, - m_handleLen, m_handleLen); - //右上角 - m_rRT = QRectF(r.right()-m_handleLen/2, - r.top() - m_handleLen/2, - m_handleLen, m_handleLen); - //左中 - m_rL = QRectF(r.left() - m_handleLen/2, - r.center().y() - m_handleLen / 2, - m_handleLen, m_handleLen); - //右中 - m_rR = QRectF(r.right()-m_handleLen/2, - r.center().y() - m_handleLen / 2, - m_handleLen, m_handleLen); - //左下角 - m_rLB = QRectF(r.left() - m_handleLen/2, - r.bottom()-m_handleLen / 2, - m_handleLen, m_handleLen); - //中下 - m_rB = QRectF(r.center().x() - m_handleLen / 2, - r.bottom()-m_handleLen / 2, - m_handleLen, m_handleLen); - //右下角 - m_rRB = QRectF(r.right()-m_handleLen / 2, - r.bottom()-m_handleLen / 2, - m_handleLen, m_handleLen); + m_rLT = QRectF(-m_handleLen/2, -m_handleLen/2, m_handleLen, m_handleLen);//左上角 + m_rT = QRectF(width/2 - m_handleLen/2, -m_handleLen/2, m_handleLen, m_handleLen);//上中 + m_rRT = QRectF(width - m_handleLen/2, - m_handleLen/2, m_handleLen, m_handleLen);//右上角 + m_rL = QRectF(-m_handleLen/2, height/2 - m_handleLen/2, m_handleLen, m_handleLen); + m_rR = QRectF(width - m_handleLen/2, height/2 - m_handleLen/2, m_handleLen, m_handleLen); + m_rLB = QRectF(-m_handleLen/2, height - m_handleLen/2, m_handleLen, m_handleLen); + m_rB = QRectF(width/2 - m_handleLen/2, height - m_handleLen/2, m_handleLen, m_handleLen); + m_rRB = QRectF(width - m_handleLen/2, height - m_handleLen/2, m_handleLen, m_handleLen); } - QString eObject::getFileMd5(QString filePath){ qDebug()<<"eObject::getFileMd5(QString)"; QFile localFile(filePath); - if (!localFile.open(QFile::ReadOnly)) - { + if (!localFile.open(QFile::ReadOnly)){ qDebug() << "file open error."; return 0; } @@ -600,25 +529,16 @@ QString eObject::getFileMd5(QString filePath){ totalBytes = localFile.size(); bytesToWrite = totalBytes; - while (1) - { - if(bytesToWrite > 0) - { + while (1){ + if(bytesToWrite > 0){ buf = localFile.read(qMin(bytesToWrite, loadSize)); ch.addData(buf); bytesWritten += buf.length(); bytesToWrite -= buf.length(); buf.resize(0); } - else - { - break; - } - - if(bytesWritten == totalBytes) - { - break; - } + else break; + if(bytesWritten == totalBytes) break; } localFile.close(); diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eobject.h b/LedOK/wProgramManager/wEditProgram/wElement/eobject.h index 7f300be..288537b 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eobject.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/eobject.h @@ -24,10 +24,17 @@ #define MACRO_DEFAULT_PLAYDURATION 10 #define INVALID_RECT QRect(-1, -5, -6, -8) +struct BorderImg { + QString name; + QPixmap img; +}; + class eObjectAttr; class eObject : public QGraphicsObject { Q_OBJECT public: + static QVector bdImgs; + static int maxImgWidth; typedef enum { NONE = 0, LT, @@ -69,29 +76,27 @@ public: int m_iType=-1; virtual QRectF boundingRect() const override; - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override; - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override; + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *) override; + virtual void mousePressEvent(QGraphicsSceneMouseEvent *) override; + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override; virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override{}; - virtual void setInteractiveType(InteractiveType type = Dynamic); - virtual QJsonObject save(const QString &pRoot) = 0; virtual QWidget* wAttrElement() = 0; virtual QWidget* wAttr(); virtual QStringList filesList() const { return QStringList(); } + virtual bool save(const QString &pRoot) = 0; virtual QJsonObject elementJson() const; void setRLimit(const QRectF &r); QRectF rLimit() const { return m_rLimit; } InteractiveType interactiveType() const { return m_interactiveType; } - QRectF rect() const { return QRectF(0, 0, m_w, m_h); } - QRectF geometry() const { return QRectF(x(), y(), m_w, m_h); } - + QRectF rect() const { return QRectF(0, 0, width, height); } + QRectF geometry() const { return QRectF(x(), y(), width, height); } QString getFileMd5(QString filePath); -signals: // Qt::BlockingQueuedConnection +signals: void requestUpdate(const QRectF &); void geometryChanged(const QRectF &); void rectChanged(const QRectF &); @@ -113,8 +118,6 @@ public slots: virtual void playElectment() {} virtual void stopElectment() {} - void onAttrChanged(const QRectF &); - protected: int handleLen() const { return m_handleLen; } @@ -123,34 +126,24 @@ protected: void adjustHandle(); InteractiveType m_interactiveType; - bool m_movable; - int m_handleLen; - QPen m_handlePen; - QPen m_borderPen; + bool m_movable; + int m_handleLen; + QPen m_handlePen; + QPen m_borderPen; - qreal m_w; - qreal m_h; - QRectF m_rLT; - QRectF m_rT; - - QRectF m_rRT; - QRectF m_rL; - QRectF m_rR; - QRectF m_rLB; - QRectF m_rB; - QRectF m_rRB; - QRectF m_rOrg; - QPointF m_pOrg; + qreal width, height; + QRectF m_rL, m_rR, m_rT, m_rB, m_rLT, m_rRT, m_rRB, m_rLB; + QRectF m_rOrg; + QPointF m_pOrg; HANDLE_DIR m_hDir; - QRectF m_rLimit; - bool bMousePress=false; - bool bLeftCitie=false; - bool bRightCitie=false; - bool bTopCitie=false; - bool bBottomCitie=false; + QRectF m_rLimit; + bool bMousePress=false; + bool bLeftCitie=false, bRightCitie=false, bTopCitie=false, bBottomCitie=false; int m_keyPressId=0; eObjectAttr *m_wAttr; + + int bdImgIdx = -1; void init(); }; diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp index 29888e6..882fae7 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp @@ -26,17 +26,8 @@ eObjectAttr::eObjectAttr(const QRectF &data, const QRectF &rLimit, QWidget *pare hBox->addWidget(new QLabel("边框:")); borderFd = new QComboBox(); borderFd->setStyleSheet("QComboBox{padding-left:4px; padding-right:4px;}"); + borderFd->addItem("无"); hBox->addWidget(borderFd); - QDirIterator it(":res/borders/", QDirIterator::Subdirectories); - int maxImgWidth = 0; - while(it.hasNext()) { - QString path = it.next(); - QPixmap img(path); - if(img.width()>maxImgWidth) maxImgWidth = img.width(); - borderFd->addItem(QIcon(img), QString::number(img.height())); - } - borderFd->setIconSize(QSize(maxImgWidth, 24)); - connect(borderFd, SIGNAL(currentIndexChanged(int)), this, SLOT(onHChanged(int))); hBox->addWidget(new QLabel("特效:")); borderEffFd = new QComboBox(); @@ -120,9 +111,7 @@ void eObjectAttr::onHChanged(int n) onAttrChanged(); } -void eObjectAttr::onAttrChanged() -{ - qDebug()<<"eObjectAttr::onAttrChanged()"; +void eObjectAttr::onAttrChanged(){ QRectF rect(ui->wX->value(), ui->wY->value(), ui->wW->value(), ui->wH->value()); emit sAttrChanged(rect); } diff --git a/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp b/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp index 9898192..ab116e5 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp @@ -1,18 +1,12 @@ #include "ephoto.h" #include "ephotoattr.h" #include "QThread" -ePhoto::ePhoto(QRectF rectInit,QSizeF DrawBoardSize,const QString &file, InteractiveType type, QGraphicsItem *parent) : - eObject(rectInit,type, parent) -{ +ePhoto::ePhoto(QRectF rectInit,QSizeF DrawBoardSize,const QString &file, InteractiveType type, QGraphicsItem *parent) : eObject(rectInit,type, parent){ m_rectInit=rectInit; m_DrawBoardSize=DrawBoardSize; m_iType=eObject::Photo; int iResult=onResChanged(file); - if(iResult==2) - { - - } - else { + if(iResult!=2) { setPlayArg(10, 1, 0, 0); int x=rectInit.left(); int y=rectInit.top(); @@ -20,28 +14,20 @@ ePhoto::ePhoto(QRectF rectInit,QSizeF DrawBoardSize,const QString &file, Interac qreal iwbih=static_cast(m_photo.width()) / static_cast(m_photo.height()); qreal w = rectInit.width(); qreal h = floor(w*ihbiw ); - if(x+w>DrawBoardSize.width()) - { + if(x+w>DrawBoardSize.width()) { x=0; - if(w>DrawBoardSize.width()) - w=DrawBoardSize.width(); + if(w>DrawBoardSize.width()) w=DrawBoardSize.width(); h=w*ihbiw; } - if(y+h>DrawBoardSize.height()) - { + if(y+h>DrawBoardSize.height()) { y=0; - if(h>DrawBoardSize.height()) - h=DrawBoardSize.height(); - + if(h>DrawBoardSize.height()) h=DrawBoardSize.height(); w=h*iwbih; } setGeometry(QRectF(x, y, w, h)); } - } -ePhoto::ePhoto(QRectF rectInit,const QString &file, InteractiveType type, QGraphicsItem *parent) : - eObject(rectInit,type, parent) -{ +ePhoto::ePhoto(QRectF rectInit,const QString &file, InteractiveType type, QGraphicsItem *parent) : eObject(rectInit,type, parent) { m_iType=eObject::Photo; onResChanged(file); setPlayArg(10, 1, 0, 0); @@ -51,39 +37,25 @@ ePhoto::ePhoto(QRectF rectInit,const QString &file, InteractiveType type, QGraph qreal h=rectInit.height(); setGeometry(QRectF(x, y, w, h)); } -ePhoto::ePhoto(const QJsonObject &json, const QString &pRoot, InteractiveType type, QGraphicsItem *parent) : - eObject(json["geometry"].toObject(), type, parent) -{ - m_iType=eObject::Photo; +ePhoto::ePhoto(const QJsonObject &json, const QString &pRoot, InteractiveType type, QGraphicsItem *parent) : eObject(json["geometry"].toObject(), type, parent) { + m_iType = eObject::Photo; QJsonDocument jRoot(json); QString file0 = pRoot + MACRO_FENGEFU + jRoot["widget"]["file"].toString(); QString file1 = jRoot["widget"]["path"].toString() + MACRO_FENGEFU + jRoot["widget"]["file"].toString(); QString file2 = jRoot["widget"]["path"].toString() + MACRO_FENGEFU + jRoot["widget"]["yuanshi_file"].toString(); QString file3 = jRoot["widget"]["computer_pic_file"].toString() ; QString file4 = jRoot["widget"]["path"].toString() + MACRO_FENGEFU +"card_"+ jRoot["widget"]["file"].toString(); - QFile f0(file0); QFile f1(file1); QFile f2(file2); QFile f3(file3); QFile f4(file4); QString file; - if(f0.exists()) { - file = file0; - } else if(f1.exists()) { - file = file1; - } - else if(f2.exists()) { - file = file2; - } - else if(f3.exists()) - { - file = file3; - } - else if(f4.exists()) - { - file = file4; - } + if(f0.exists()) file = file0; + else if(f1.exists()) file = file1; + else if(f2.exists()) file = file2; + else if(f3.exists()) file = file3; + else if(f4.exists()) file = file4; else { setGeometry(RECTF_INVALID); return; @@ -102,11 +74,9 @@ ePhoto::ePhoto(const QJsonObject &json, const QString &pRoot, InteractiveType ty m_attr.playTimes = json["play"]["playTimes"].toInt(); m_attr.enterStyle = json["play"]["enterStyle"].toInt(); m_attr.enterDuration = json["play"]["enterDuration"].toInt(); - } -void ePhoto::setElement(const QJsonObject &json, Data &attr) -{ +void ePhoto::setElement(const QJsonObject &json, Data &attr){ attr.name = json["widget"]["file"].toString(); attr.yuanshi_name = json["widget"]["yuanshi_file"].toString(); attr.computer_pic_file = json["widget"]["computer_pic_file"].toString(); @@ -119,15 +89,13 @@ void ePhoto::setElement(const QJsonObject &json, Data &attr) } -void ePhoto::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ +void ePhoto::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ painter->save(); painter->drawImage(rect(), m_photo); painter->restore(); eObject::paint(painter, option, widget); } -void ePhoto:: deleteContent() -{ +void ePhoto:: deleteContent(){ QFile file(m_attr.path+"/card_"+m_attr.name); if(file.exists()) file.remove(); @@ -138,24 +106,27 @@ void ePhoto:: deleteContent() if(file1.exists()) file1.remove(); } -QWidget* ePhoto::wAttr() -{ +QWidget* ePhoto::wAttr(){ QWidget *wObj = eObject::wAttr(); QWidget *w = wAttrElement(); static_cast(w->layout())->insertWidget(0, wObj); return w; } -QWidget* ePhoto::wAttrElement() -{ +QWidget* ePhoto::wAttrElement(){ ePhotoAttr *w = new ePhotoAttr(m_attr); connect(w, SIGNAL(sResChanged(const QString &)), this, SLOT(onResChanged(const QString &))); connect(w, SIGNAL(sAttrChanged(const ePhoto::Data &)), this, SLOT(onAttrChanged(const ePhoto::Data &))); return w; } -#include -QJsonObject ePhoto::save(const QString &pRoot) -{ + +QStringList ePhoto::filesList() const{ + QStringList list; + list.append(m_attr.path + MACRO_FENGEFU + m_attr.name); + return list; +} + +bool ePhoto::save(const QString &pRoot){ QString fileOld = m_attr.computer_pic_file; QString file0 = m_attr.path + PAGEDEL_SUFFIX + MACRO_FENGEFU + m_attr.name; QString file1 = m_attr.path + MACRO_FENGEFU + m_attr.name; @@ -173,147 +144,67 @@ QJsonObject ePhoto::save(const QString &pRoot) // m_attr.name=strFileMD5; // QString new_file = pRoot + MACRO_FENGEFU + strFileMD5; QString new_file = pRoot + MACRO_FENGEFU + m_attr.yuanshi_name; - if(fOld.exists()) { - old_file = fileOld; - } - else { - if(f0.exists()) { - old_file = file0; - } - else - { - if(f3.exists()) - { - old_file = file3; - } - else { - if(f1.exists()) - { - old_file = file1; - } - else { - if(f2.exists()) - { - old_file = file2; - } - else { - return QJsonObject(); - } - } - } - - } - } - - - //QMessageBox::warning(nullptr, "Tip", tr("1")); - + if(fOld.exists()) old_file = fileOld; + else if(f0.exists()) old_file = file0; + else if(f3.exists()) old_file = file3; + else if(f1.exists()) old_file = file1; + else if(f2.exists()) old_file = file2; + else return false; QFile old_f(old_file); QFile new_f(new_file); - if(!new_f.exists()) - { + if(!new_f.exists()) { old_f.copy(new_file); QImage imageOlde(old_file); - qreal x=rect().left(); - qreal y=rect().top(); - qreal w=rect().width(); - qreal h=rect().height(); - if(h<=1) - h=1; - qreal bili=w/h; - if(imageOlde.height()!=0) - { + qreal bili = width/(height==0 ? 1 : height); + if(imageOlde.height()!=0){ qreal ImageBili=imageOlde.width()/imageOlde.height(); //QMessageBox::warning(nullptr, "Tip", tr("2")); - if(ImageBili>=bili && ImageBili!=0) - { + if(ImageBili>=bili && ImageBili!=0) { QImage fitimgpic=imageOlde.scaled(rect().width(),rect().width()/ImageBili,Qt::KeepAspectRatioByExpanding); QString strControllerPicPathName=pRoot+MACRO_FENGEDANFU+"card_"+m_attr.name; fitimgpic.save(strControllerPicPathName); //QMessageBox::warning(nullptr, "Tip", tr("3")); - - } - else { - QImage fitimgpic= imageOlde.scaled(rect().height()*ImageBili,rect().height(),Qt::KeepAspectRatioByExpanding); - QString strControllerPicPathName=pRoot+MACRO_FENGEDANFU+"card_"+m_attr.name; - if(fitimgpic.save(strControllerPicPathName)==false) - { + } else { + QImage fitimgpic= imageOlde.scaled(rect().height()*ImageBili,rect().height(),Qt::KeepAspectRatioByExpanding); + QString strControllerPicPathName=pRoot+MACRO_FENGEDANFU+"card_"+m_attr.name; + if(fitimgpic.save(strControllerPicPathName)==false){ // QMessageBox::warning(nullptr, "Tip", strControllerPicPathName+"\r\n"+old_file+"\r\n"+new_file); - old_f.copy(strControllerPicPathName); - } - else { - - } - - + old_f.copy(strControllerPicPathName); + } } - } - } - else { + } else { QString strControllerPicPathName=pRoot+MACRO_FENGEDANFU+"card_"+m_attr.name; QFile new_card_pic(strControllerPicPathName); - if(!new_card_pic.exists()) - { + if(!new_card_pic.exists()) { QImage imageOlde(old_file); - qreal x=rect().left(); - qreal y=rect().top(); - qreal w=rect().width(); - qreal h=rect().height(); - if(h<=1) - h=1; - qreal bili=w/h; - if(imageOlde.height()!=0) - { + qreal bili = width/(height==0 ? 1 : height); + if(imageOlde.height()!=0){ qreal ImageBili=imageOlde.width()/imageOlde.height(); - if(ImageBili>=bili && ImageBili!=0) - { + if(ImageBili>=bili && ImageBili!=0){ QImage fitimgpic=imageOlde.scaled(rect().width(),rect().width()/ImageBili,Qt::KeepAspectRatioByExpanding); fitimgpic.save(strControllerPicPathName); //QMessageBox::warning(nullptr, "Tip", tr("3")); - - } - else { + } else { QImage fitimgpic= imageOlde.scaled(rect().height()*ImageBili,rect().height(),Qt::KeepAspectRatioByExpanding); if(fitimgpic.save(strControllerPicPathName)==false) { // QMessageBox::warning(nullptr, "Tip", strControllerPicPathName+"\r\n"+old_file+"\r\n"+new_file); old_f.copy(strControllerPicPathName); } - else { - - } - - } - } - //QMessageBox::warning(nullptr, "Tip", tr("2")); - } } - m_attr.path = pRoot; - if(m_CropFlag && !m_photo.isNull())//如果图 剪切过 - { + if(m_CropFlag && !m_photo.isNull()) { //如果图 剪切过 QString strNewPicPathName=m_attr.path+MACRO_FENGEDANFU+m_attr.yuanshi_name; - - QString strControllerPicPathName=pRoot+MACRO_FENGEDANFU+"card_"+m_attr.name; m_photo.save(strNewPicPathName); m_photo.save(strControllerPicPathName); - } - - return elementJson(); -} - -QStringList ePhoto::filesList() const -{ - QStringList list; - list.append(m_attr.path + MACRO_FENGEFU + m_attr.name); - return list; + return true; } QJsonObject ePhoto::elementJson() const @@ -343,40 +234,26 @@ QJsonObject ePhoto::elementJson() const return oRoot; } -int ePhoto::onResChanged(const QString &file) -{ - QFileInfo fi(file); - m_attr.computer_pic_file=file; - m_attr.name = fi.fileName(); - if(!fi.fileName().contains("yuanshi_")) - { - m_attr.yuanshi_name ="yuanshi_"+fi.fileName(); - } - else { - m_attr.yuanshi_name =fi.fileName(); - - } - m_attr.path = fi.absolutePath(); - if(fi.exists()) - { qDebug() << file<< "*********old"; - - m_photo = QImage(file); - if(m_photo.isNull()) - { - +int ePhoto::onResChanged(const QString &filepath){ + m_attr.computer_pic_file = filepath; + QFileInfo fileinfo(filepath); + m_attr.name = fileinfo.fileName(); + m_attr.path = fileinfo.absolutePath(); + m_attr.yuanshi_name = m_attr.name.contains("yuanshi_") ? m_attr.name : "yuanshi_"+m_attr.name; + if(fileinfo.exists()) { + m_photo = QImage(filepath); + if(m_photo.isNull()){ QString strAppPath=QApplication::applicationDirPath(); strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); process = new QProcess(nullptr); process->setWorkingDirectory(strAppPath); - //connect(process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(ConvertImage(int,QProcess::ExitStatus))); - //connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(outputCommand())); - //connect(process,SIGNAL(readyReadStandardError()),this,SLOT(outputCommand())); + QStringList args; - args<<"-i"<NProgramsLocation(); //原始节目保存的路径 - m_strNewFileName=strProgramItemPath+"/"+fi.fileName(); + m_strNewFileName=strProgramItemPath+"/"+fileinfo.fileName(); m_strNewFileName.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); args<start("ffmpeg",args); QFileInfo ff(m_strNewFileName); int iReTryCount=0; - while(!ff.exists()) - { + while(!ff.exists()) { QThread::sleep(1); iReTryCount++; - - if(iReTryCount>10) - break; + if(iReTryCount>10) break; } - m_attr.computer_pic_file=m_strNewFileName; QFileInfo fiNew(m_strNewFileName); m_attr.name = fiNew.fileName(); - if(!fiNew.fileName().contains("yuanshi_")) - { - m_attr.yuanshi_name ="yuanshi_"+fiNew.fileName(); - } - else { - m_attr.yuanshi_name =fiNew.fileName(); - - } + if(!fiNew.fileName().contains("yuanshi_")) m_attr.yuanshi_name ="yuanshi_"+fiNew.fileName(); + else m_attr.yuanshi_name =fiNew.fileName(); m_attr.path = fiNew.absolutePath(); m_photo = QImage(m_strNewFileName); setPlayArg(10, 1, 0, 0); @@ -413,59 +280,33 @@ int ePhoto::onResChanged(const QString &file) qreal iwbih=static_cast(m_photo.width()) / static_cast(m_photo.height()); qreal w = m_rectInit.width(); qreal h = floor(w*ihbiw ); - if(x+w>m_DrawBoardSize.width()) - { + if(x+w>m_DrawBoardSize.width()){ x=0; - if(w>m_DrawBoardSize.width()) - w=m_DrawBoardSize.width(); + if(w>m_DrawBoardSize.width()) w=m_DrawBoardSize.width(); h=w*ihbiw; } - if(y+h>m_DrawBoardSize.height()) - { + if(y+h>m_DrawBoardSize.height()) { y=0; - if(h>m_DrawBoardSize.height()) - h=m_DrawBoardSize.height(); - + if(h>m_DrawBoardSize.height()) h=m_DrawBoardSize.height(); w=h*iwbih; } setGeometry(QRectF(x, y, w, h)); return 2; - - - } - else - { - //QString strCmd="ffmpeg -i \""+file+" -vf “scale=1920:-1” output.jpg"; - } - //m_photo.load(file); - //QPixmap objPixmap(file); - - - - } - else { - QString strFileNew=fi.path()+"/"+m_attr.yuanshi_name; - qDebug() << strFileNew<< "*********new"; + } else { + QString strFileNew=fileinfo.path()+"/"+m_attr.yuanshi_name; m_photo = QImage(strFileNew); - } + return 0; } -void ePhoto::ConvertImage(int i,QProcess::ExitStatus) -{ +void ePhoto::ConvertImage(int i,QProcess::ExitStatus){ Q_UNUSED(i); delete process; m_attr.computer_pic_file=m_strNewFileName; QFileInfo fiNew(m_strNewFileName); m_attr.name = fiNew.fileName(); - if(!fiNew.fileName().contains("yuanshi_")) - { - m_attr.yuanshi_name ="yuanshi_"+fiNew.fileName(); - } - else { - m_attr.yuanshi_name =fiNew.fileName(); - - } + if(!fiNew.fileName().contains("yuanshi_")) m_attr.yuanshi_name ="yuanshi_"+fiNew.fileName(); + else m_attr.yuanshi_name =fiNew.fileName(); m_attr.path = fiNew.absolutePath(); m_photo = QImage(m_strNewFileName); setPlayArg(10, 1, 0, 0); @@ -475,19 +316,14 @@ void ePhoto::ConvertImage(int i,QProcess::ExitStatus) qreal iwbih=static_cast(m_photo.width()) / static_cast(m_photo.height()); qreal w = m_rectInit.width(); qreal h = floor(w*ihbiw ); - if(x+w>m_DrawBoardSize.width()) - { + if(x+w>m_DrawBoardSize.width()){ x=0; - if(w>m_DrawBoardSize.width()) - w=m_DrawBoardSize.width(); + if(w>m_DrawBoardSize.width()) w=m_DrawBoardSize.width(); h=w*ihbiw; } - if(y+h>m_DrawBoardSize.height()) - { + if(y+h>m_DrawBoardSize.height()){ y=0; - if(h>m_DrawBoardSize.height()) - h=m_DrawBoardSize.height(); - + if(h>m_DrawBoardSize.height()) h=m_DrawBoardSize.height(); w=h*iwbih; } setGeometry(QRectF(x, y, w, h)); diff --git a/LedOK/wProgramManager/wEditProgram/wElement/ephoto.h b/LedOK/wProgramManager/wEditProgram/wElement/ephoto.h index 920159e..5a7014f 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/ephoto.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/ephoto.h @@ -5,8 +5,7 @@ #include #include "eobject.h" #include "QProcess" -class ePhoto : public eObject -{ +class ePhoto : public eObject { Q_OBJECT public: enum EnterStyle { @@ -47,7 +46,7 @@ public: virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override; + virtual bool save(const QString &pRoot) override; virtual QStringList filesList() const override; virtual QJsonObject elementJson() const override; diff --git a/LedOK/wProgramManager/wEditProgram/wElement/etemp.cpp b/LedOK/wProgramManager/wEditProgram/wElement/etemp.cpp index e6d5816..905df29 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/etemp.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/etemp.cpp @@ -763,8 +763,7 @@ void eTemp::CreatePreviewPic(QString strPath) delete tempPixamp; } -QJsonObject eTemp::save(const QString &pRoot) -{ +bool eTemp::save(const QString &pRoot) { QRectF r1 = geometry(); QRect r=r1.toRect(); QString strDir=QString("%1%2%3%4%5").arg(zValue()).arg(r.x()).arg(r.y()).arg(r.width()).arg(r.height()); @@ -797,7 +796,7 @@ QJsonObject eTemp::save(const QString &pRoot) } } CreateAllWordPic(pRoot+MACRO_FENGEFU+strDir); - return elementJson(); + return true; } void eTemp::OnRectChanged() { diff --git a/LedOK/wProgramManager/wEditProgram/wElement/etemp.h b/LedOK/wProgramManager/wEditProgram/wElement/etemp.h index 916a84a..af34631 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/etemp.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/etemp.h @@ -66,8 +66,7 @@ public: virtual int type() const override { return eObject::Temp; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override;// { Q_UNUSED(pRoot); return elementJson(); } - + virtual bool save(const QString &pRoot) override;// { Q_UNUSED(pRoot); return elementJson(); } virtual QJsonObject elementJson() const override; signals: diff --git a/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp b/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp index 4aba95f..3150de5 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp @@ -143,8 +143,7 @@ QWidget* eText::wAttrElement() return w; } -QJsonObject eText::save(const QString &pRoot) -{ +bool eText::save(const QString &pRoot) { m_pRootPath=pRoot; QRectF r1 = geometry(); QRect r=r1.toRect(); @@ -233,7 +232,7 @@ QJsonObject eText::save(const QString &pRoot) QString strPngName=strPath+MACRO_FENGEFU+strFile; MakeMuliPngToDir(1,strPngName); } - return elementJson(); + return true; } QJsonObject eText::elementJson() const diff --git a/LedOK/wProgramManager/wEditProgram/wElement/etext.h b/LedOK/wProgramManager/wEditProgram/wElement/etext.h index 47fe006..4f20b13 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/etext.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/etext.h @@ -99,7 +99,7 @@ public: virtual int type() const override { return eObject::Text; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override; + virtual bool save(const QString &pRoot) override; virtual QJsonObject elementJson() const override; // virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; diff --git a/LedOK/wProgramManager/wEditProgram/wElement/etimer.h b/LedOK/wProgramManager/wEditProgram/wElement/etimer.h index e4bc438..99429fd 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/etimer.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/etimer.h @@ -44,7 +44,7 @@ public: virtual int type() const override { return eObject::Timer; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override { Q_UNUSED(pRoot); return elementJson(); } + virtual bool save(const QString &) override{return true;} virtual QJsonObject elementJson() const override; signals: diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eweather.h b/LedOK/wProgramManager/wEditProgram/wElement/eweather.h index e98d10a..6bea73d 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eweather.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/eweather.h @@ -49,7 +49,7 @@ public: virtual int type() const override { return eObject::Weather; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override { Q_UNUSED(pRoot); return elementJson(); } + virtual bool save(const QString &) override{return true;} virtual QJsonObject elementJson() const override; signals: diff --git a/LedOK/wProgramManager/wEditProgram/wElement/ewindow.cpp b/LedOK/wProgramManager/wEditProgram/wElement/ewindow.cpp index c2adcf0..9e8149c 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/ewindow.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/ewindow.cpp @@ -155,9 +155,18 @@ QWidget* eWindow::wAttrElement() // emit geometryChanged(rect()); return w; } +QStringList eWindow::filesList() const{ + QStringList list; + foreach(eObject *e, m_attr.eList) list.append(e->filesList()); + return list; +} -QJsonObject eWindow::save(const QString &pRoot) -{ +bool eWindow::save(const QString &pRoot){ + foreach(eObject *e, m_attr.eList) e->save(pRoot); + return true; +} + +QJsonObject eWindow::elementJson() const{ QJsonObject oRoot; QJsonArray oElements; oRoot["elementType"] = "Window"; @@ -173,7 +182,7 @@ QJsonObject eWindow::save(const QString &pRoot) oSize["y"] = 0; oSize["w"] = (int)r.width(); oSize["h"] = (int)r.height(); - QJsonObject temp = e->save(pRoot); + QJsonObject temp = e->elementJson(); temp["geometry"]=oSize; oElements.append(temp); izIndex++; @@ -182,30 +191,6 @@ QJsonObject eWindow::save(const QString &pRoot) return oRoot; } -QStringList eWindow::filesList() const -{ - QStringList list; - foreach(eObject *e, m_attr.eList) { - list.append(e->filesList()); - } - return list; -} - -QJsonObject eWindow::elementJson() const -{ - QJsonObject oRoot; - QJsonArray oElements; - oRoot["elementType"] = "Window"; - oRoot["elementTypeId"] = type(); - oRoot["geometry"] = eObject::elementJson(); - oRoot["index"] = m_attr.index; - foreach(eObject *e, m_attr.eList) { - oElements.append(e->elementJson()); - } - oRoot["elements"] = oElements; - return oRoot; -} - void eWindow::playElectment() { foreach(eObject *e, m_attr.eList) { diff --git a/LedOK/wProgramManager/wEditProgram/wElement/ewindow.h b/LedOK/wProgramManager/wEditProgram/wElement/ewindow.h index 2bc4c37..e4695b7 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/ewindow.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/ewindow.h @@ -31,7 +31,7 @@ public: virtual int type() const override { return eObject::Window; } virtual QWidget* wAttr() override; virtual QWidget* wAttrElement() override; - virtual QJsonObject save(const QString &pRoot) override; + virtual bool save(const QString &pRoot) override; virtual QStringList filesList() const override; virtual QJsonObject elementJson() const override; diff --git a/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp b/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp index d4d1448..afacd21 100644 --- a/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp +++ b/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp @@ -244,14 +244,7 @@ void wDrawingBoard::onCreatElement(int type) element = new eText(rt); } break; - case eObject::Photo : - { - // QString file = LoAppTools::getInstance()->selectFile(ePhoto::filters(), this); - // if(!file.isNull()) - // { - // QRectF rt(m_xOffset,m_yOffset,iNewWidth,iNewHeight); - // element = new ePhoto(rt,file); - // } + case eObject::Photo : { QStringList fileList = LoAppTools::getInstance()->selectPhotoFile(ePhoto::filters(), this); if(fileList.count()>0) diff --git a/LedOK/wProgramManager/wEditProgram/wmaintoolbar.cpp b/LedOK/wProgramManager/wEditProgram/wmaintoolbar.cpp index c27f1a3..86737c0 100644 --- a/LedOK/wProgramManager/wEditProgram/wmaintoolbar.cpp +++ b/LedOK/wProgramManager/wEditProgram/wmaintoolbar.cpp @@ -98,18 +98,11 @@ wMainToolBar::wMainToolBar(QWidget *parent) : QToolBar(parent) // addAction(actTimer); // addAction(actColorText); addSeparator(); - QString strAppPath=QApplication::applicationDirPath(); - strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); - QString cmd=strAppPath+"/prog_player/bin/java.exe"; - QFileInfo javeFile(cmd); - if(javeFile.exists()) - { +// QString strAppPath = QApplication::applicationDirPath(); +// strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); +// QFileInfo javeFile(strAppPath+"/prog_player/bin/java.exe"); +// if(javeFile.exists()) { addAction(actPreview); - - } - else { - - } addAction(actSend); connect(this, SIGNAL(actionTriggered(QAction*)), this, SLOT(onActionTriggered(QAction*))); diff --git a/LedOK/wProgramManager/wEditProgram/wpageitem.cpp b/LedOK/wProgramManager/wEditProgram/wpageitem.cpp index e059e4f..0cac457 100644 --- a/LedOK/wProgramManager/wEditProgram/wpageitem.cpp +++ b/LedOK/wProgramManager/wEditProgram/wpageitem.cpp @@ -66,86 +66,24 @@ void wPageItem::init() } } //根据json中的elementTypeId来判断创建对应的媒体组件属性页 -void wPageItem::restoreElement(const QJsonObject &json) -{ -// int type = json["elementTypeId"].toInt(); -// const QString &pRoot = m_strProgramItemPath; -// eObject *element = nullptr; -// switch (type) { -// case eObject::Text : -// element = new eText(json); -// break; -// case eObject::Photo : -// element = new ePhoto(json, pRoot); -// break; -// case eObject::Movie : -// element = new eMovie(json, pRoot); -// break; -// case eObject::Gif : -// element = new eGif(json, pRoot); -// break; -// case eObject::DClock : -// element = new eDClock(json); -// break; -// case eObject::AClock : -// element = new eAClock(json); -// break; -// case eObject::Office : -// break; -// case eObject::Temp : -// element = new eTemp(json); -// break; -// case eObject::Weather : -// element = new eWeather(json); -// break; -// case eObject::Rss : -// break; -// case eObject::Timer : -// element = new eTimer(json); -// break; -// case eObject::ColorText : -// break; -// case eObject::Window : -// element = new eWindow(json, pRoot); -// break; -// default: -// element = nullptr; -// break; -// } +void wPageItem::restoreElement(const QJsonObject &json) { QString type = json["elementType"].toString(); const QString &pRoot = m_strProgramItemPath; eObject *element = nullptr; - if(type=="Text") - element = new eText(json); - else if(type=="Photo") - element = new ePhoto(json, pRoot); - else if(type=="Movie") - element = new eMovie(json, pRoot); - else if(type=="Gif") - element = new eGif(json, pRoot); - else if(type=="DClock") - element = new eDClock(json); - else if(type=="AClock") - element = new eAClock(json); - else if(type=="Office") - element = nullptr; - else if(type=="Temp") - element = new eTemp(json); - else if(type=="Weather") - element = new eWeather(json); - else if(type=="Rss") - element = nullptr; - else if(type=="Timer") - element = new eTimer(json); - else if(type=="ColorText") - element = nullptr; - else if(type=="Window") - - element = new eWindow(json, pRoot); - else - element = nullptr; - - + if(type=="Text") element = new eText(json); + else if(type=="Photo") element = new ePhoto(json, pRoot); + else if(type=="Movie") element = new eMovie(json, pRoot); + else if(type=="Gif") element = new eGif(json, pRoot); + else if(type=="DClock") element = new eDClock(json); + else if(type=="AClock") element = new eAClock(json); + else if(type=="Office") element = nullptr; + else if(type=="Temp") element = new eTemp(json); + else if(type=="Weather") element = new eWeather(json); + else if(type=="Rss") element = nullptr; + else if(type=="Timer") element = new eTimer(json); + else if(type=="ColorText") element = nullptr; + else if(type=="Window") element = new eWindow(json, pRoot); + else element = nullptr; if(element != nullptr) { m_scene->addItem(element); element->setRLimit(QRectF(0, 0, m_resolution.width(), m_resolution.height())); @@ -182,10 +120,6 @@ void wPageItem::disconnectCiTieSignal(wDrawingBoard *drawingboard) } -void wPageItem::ClearAllContent() -{ - -} QStringList wPageItem::filesList() const { QStringList flist; @@ -209,24 +143,19 @@ wPageItemWidget* wPageItem::wPage(bool newOne) return m_wPage; } //创建右边页属性组件,返回页属性组件指针 -wPageAttr *wPageItem::wAttr(bool newOne) -{ +wPageAttr *wPageItem::wAttr(bool newOne){ if(newOne) { m_wPageAttr = new wPageAttr(this); m_globalstrSavePath=m_strProgramItemPath;//+MACRO_FENGEFU + m_jRoot["name"].toString(); - } return m_wPageAttr; } - -void wPageItem::save(const QString &pParent) -{ +void wPageItem::save(const QString &pParent){ //pagelist中的一个pageitem,在节目名的目录下,根据pageitem的pagename创建文件夹,文件夹中包含page.json QString pRoot = pParent + MACRO_FENGEFU + name(); QDir dRoot(pRoot); - if(!dRoot.exists()) //如果目录不存在则创建目录 - { + if(!dRoot.exists()) {//如果目录不存在则创建目录 QDir dParent(pParent); dParent.mkdir(name()); } @@ -239,8 +168,7 @@ void wPageItem::save(const QString &pParent) foreach(QGraphicsItem *item, list) { if(item->type() > QGraphicsItem::UserType) { eObject *element = static_cast(item); - if(element->interactiveType() == eObject::Dynamic) - oElements.append(element->save(pRoot)); + if(element->interactiveType() == eObject::Dynamic && element->save(pRoot)) oElements.append(element->elementJson()); } } oRoot["elements"] = oElements; diff --git a/LedOK/wProgramManager/wEditProgram/wpageitem.h b/LedOK/wProgramManager/wEditProgram/wpageitem.h index 56f805b..b0cc443 100644 --- a/LedOK/wProgramManager/wEditProgram/wpageitem.h +++ b/LedOK/wProgramManager/wEditProgram/wpageitem.h @@ -50,7 +50,6 @@ public: // Qt::BlockingQueuedConnection void stopElements(); void disconnectCiTieSignal(wDrawingBoard *drawingboard); void connectCiTieSignal(wDrawingBoard *drawingboard); - void ClearAllContent(); public slots: void onAttrUpdated(const QJsonObject &json); diff --git a/LedOK/wProgramManager/wEditProgram/wpagelist.cpp b/LedOK/wProgramManager/wEditProgram/wpagelist.cpp index 5a8bc99..7f93729 100644 --- a/LedOK/wProgramManager/wEditProgram/wpagelist.cpp +++ b/LedOK/wProgramManager/wEditProgram/wpagelist.cpp @@ -142,16 +142,14 @@ void wPageList::setRes(int w, int h) } } -void wPageList::keyReleaseEvent(QKeyEvent *event) -{ +void wPageList::keyReleaseEvent(QKeyEvent *event){ switch (event->key()) { - case Qt::Key_Delete: onDelete(); break; - default:break; + case Qt::Key_Delete: onDelete(); break; + default:break; } } //停止每个页面元素的播放,将节目目录下的每个页面的文件夹另命名 -void wPageList::save0() -{ +void wPageList::save(){ //停止每个幻灯片的元素 int n = m_wPageList->count(); for(int i=0; istopElements(); } QDir dRoot(m_strProgramItemPath); - if(dRoot.exists()) - { - } - else - { - dRoot.mkdir(m_strProgramItemPath);//只创建一级子目录,即必须保证上级目录存在 - } - + if(! dRoot.exists()) dRoot.mkdir(m_strProgramItemPath);//只创建一级子目录,即必须保证上级目录存在 QStringList list = dRoot.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); - foreach(QString name, list) { - dRoot.rename(name, name + PAGEDEL_SUFFIX); - } -} -//保存每个页面的元素和页面属性到page.json文档 -void wPageList::save1() -{ - int n = m_wPageList->count(); + foreach(QString name, list) dRoot.rename(name, name + PAGEDEL_SUFFIX); + //保存每个页面的元素和页面属性到page.json文档 for(int i=0; i(m_wPageList->item(i)); item->save(m_strProgramItemPath); } -} - -void wPageList::save2() -{ - QDir dRoot(m_strProgramItemPath); + dRoot = QDir(m_strProgramItemPath); QStringList filters; filters << "*" PAGEDEL_SUFFIX; - QStringList list = dRoot.entryList(filters); + list = dRoot.entryList(filters); foreach(QString name, list) { QDir dPage(m_strProgramItemPath + MACRO_FENGEFU + name); dPage.removeRecursively(); } - int n = m_wPageList->count(); for(int i=0; i(m_wPageList->item(i)); item->playElements(); } } -void wPageList::save() -{ - save0(); - save1(); - save2(); -} - -void wPageList::saveAs() -{ - save0(); - save1(); - save2(); -} - -void wPageList::setting() -{ -} - void wPageList::onRestore(const QJsonDocument &json) { QString path = m_strProgramItemPath + MACRO_FENGEFU + json["name"].toString(); @@ -286,12 +248,9 @@ void wPageList::onCopy() } } -void wPageList::onDelete() -{ - if(m_wPageList->count() == 1) - { +void wPageList::onDelete(){ + if(m_wPageList->count() == 1){ wPageItem *item = static_cast(m_wPageList->currentItem()); - emit sigDeletePageItem(item); return; } @@ -299,17 +258,11 @@ void wPageList::onDelete() wPageItem *item = static_cast(m_wPageList->currentItem()); //m_wPageList->setCurrentRow(-1); X_UIMsgBoxOkCancel *dlg = new X_UIMsgBoxOkCancel(tr("Tip Info"),tr("Are you sure you want to delete this program page?"), this); - if(dlg->exec() == QDialog::Accepted) - { + if(dlg->exec() == QDialog::Accepted){ delete item; - if(m_wPageList->count() > 0) { - m_wPageList->setCurrentRow(0); - } + if(m_wPageList->count() > 0) m_wPageList->setCurrentRow(0); flashOrder(); } - else { - - } } } diff --git a/LedOK/wProgramManager/wEditProgram/wpagelist.h b/LedOK/wProgramManager/wEditProgram/wpagelist.h index 1d57ff2..1211edc 100644 --- a/LedOK/wProgramManager/wEditProgram/wpagelist.h +++ b/LedOK/wProgramManager/wEditProgram/wpagelist.h @@ -28,8 +28,6 @@ public: int load(); void setRes(int w, int h); void save(); - void saveAs(); - void setting(); int pageCount() { return m_wPageList->count(); } void Init(); void setCurrentPage(int i) { m_wPageList->setCurrentRow(i); } @@ -51,9 +49,6 @@ public slots: void onCurrentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); private: - void save0(); - void save1(); - void save2(); QString genNewPageName(); void flashOrder(); diff --git a/LedOK/wProgramManager/weditprogram.cpp b/LedOK/wProgramManager/weditprogram.cpp index ce4c9e6..7b694ad 100644 --- a/LedOK/wProgramManager/weditprogram.cpp +++ b/LedOK/wProgramManager/weditprogram.cpp @@ -107,8 +107,7 @@ wEditProgram::~wEditProgram() m_attr_view->deleteLater(); m_playout_main_area->deleteLater(); m_pLayout->deleteLater(); - if(m_po!=nullptr) - { + if(m_po!=nullptr) { m_po->close(); delete m_po; } @@ -182,11 +181,9 @@ void wEditProgram::onSave() #else pl->save(); #endif - - } -void wEditProgram::Save() -{ + +void wEditProgram::onSaveAs() { wPageList *pl = findChild(); //显示沙漏光标 // QApplication::setOverrideCursor(Qt::WaitCursor); @@ -197,13 +194,6 @@ void wEditProgram::Save() connect(save, SIGNAL(finished()), save, SLOT(deleteLater())); connect(save, SIGNAL(finished()), this, SIGNAL(sProgramChanged()));//连接结束信号到节目列表项 save->start(); - - - -} -void wEditProgram::onSaveAs() -{ - Save(); TipDialog *dlg2 = new TipDialog(this,ENUM_SAVEAS_DLG); connect(dlg2, SIGNAL(sigAcceptData(QString,QString)), this, SLOT(onReNameProgram(QString))); if(dlg2->exec() == QDialog::Accepted) @@ -219,7 +209,7 @@ void wEditProgram::onReNameProgram(QString strName) pl->m_strProgramItemPath=m_strProgramItemPath; LoEmptyDialog * dlgTip = new LoEmptyDialog(this); auto save = QThread::create([pl](){ - pl->saveAs(); + pl->save(); QThread::sleep(1); }); dlgTip->lock(tr("Saving..."),tr("Success"),tr("Save failed")); @@ -271,26 +261,17 @@ void wEditProgram::onSend() // QMessageBox::critical(this, tr("Waring"), tr("no finished send function !")); } -void wEditProgram::onPreview(int iState) -{ - if(iState==0) - { - if(IsChangedProgram()) - { - onSave(); - } - else { - - } +void wEditProgram::onPreview(int iState){ + if(iState==0){ + if(IsChangedProgram()) onSave(); LoEmptyDialog * msgbox = new LoEmptyDialog(this); //转换节目 QString m_strConverSaveTmpPath=LoAppConfig::getInstance()->NProgramsLocation(); auto converter = new mConverter(m_name,m_strConverSaveTmpPath,"" ,this); converter->m_usbZipFlag=0; //转换结束,发送信号触发converter释放内存 - connect(converter, SIGNAL(finished()), converter, SLOT(deleteLater())); - connect(converter, SIGNAL(finished()), msgbox, SLOT(unlock())); - // connect(converter, SIGNAL(finished()), this, SLOT(PreviewStart())); + connect(converter, SIGNAL(finished()), converter, SLOT(deleteLater())); + connect(converter, SIGNAL(finished()), msgbox, SLOT(unlock())); //链接转换进度信号到进度条槽函数 connect(converter, SIGNAL(sProgress(QString,int,bool)), msgbox->m_pIndicator, SLOT(onProgress(QString,int,bool))); //链接进度对话框启动信号到转换开始槽函数 @@ -298,51 +279,44 @@ void wEditProgram::onPreview(int iState) connect(converter, SIGNAL(sigConvertTimerOut()), msgbox, SLOT(TimerOutUnlock()));//显示正在保存提示对话框 msgbox->lock(tr("Generate preview data")+"...",tr("Ready"),tr("Generate TimeOut")); msgbox->exec(); - QString sWidth=QString::number(m_width); - QString sHeight=QString::number(m_height); - QString strAppPath=QApplication::applicationDirPath(); - strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); - QString cmd=strAppPath+"/prog_player/bin/java.exe"; - QString strProgram=strAppPath+"/prog_player/prog-player.jar"; - QString strCommand="\""+cmd+"\" -jar \""+strProgram+"\""; - QString strX=" -x 0"; - QString strY=" -y 0"; - QString strW=" -w "+sWidth; - QString strH=" -h "+sHeight; - QString strProg=" -prog \""+m_strProgramItemPath+"_tmp\""; - if(m_po!=nullptr) - { - //m_po->start(strCommand+" -x 0 -y 0 -w 320 -h 240 -prog \""+m_strProgramItemPath+"_tmp\""); - //m_po->start(cmd,argu); - QString strAppPath=QApplication::applicationDirPath(); - strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); - m_po->setWorkingDirectory(strAppPath+"/prog_player/bin"); - //QMessageBox::critical(this, tr("Waring"), strAppPath+"/bin"); + QString dir = m_strProgramItemPath+"_tmp"; + QFile file(dir+"/program"); + if(! file.open(QIODevice::ReadOnly | QIODevice::Text)) return; + QString value = file.readAll(); + file.close(); + QJsonParseError jsErr; + QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object(); + if(jsErr.error) return; + playWin = new PlayWin(dir, 0, 0, m_width, m_height, prog, this); - m_po->start(strCommand+strX+strY+strW+strH+strProg); - // m_po->waitForStarted(); - // m_po->waitForFinished(); - // connect(m_po,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(StopPreview())); - connect(m_po,static_cast(&QProcess::finished),[=](int exitCode,QProcess::ExitStatus exitStatus){emit sigProgPlayerQuit();}); - // QString getStr=QString(m_po->readAllStandardOutput()); - // QMessageBox::information(this,tr("Tip"),getStr); - - } +// QString sWidth=QString::number(m_width); +// QString sHeight=QString::number(m_height); +// QString strAppPath=QApplication::applicationDirPath(); +// strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); +// QString cmd=strAppPath+"/prog_player/bin/java.exe"; +// QString strProgram=strAppPath+"/prog_player/prog-player.jar"; +// QString strCommand="\""+cmd+"\" -jar \""+strProgram+"\""; +// QString strX=" -x 0"; +// QString strY=" -y 0"; +// QString strW=" -w "+sWidth; +// QString strH=" -h "+sHeight; +// QString strProg=" -prog \""+m_strProgramItemPath+"_tmp\""; +// if(m_po!=nullptr){ +// QString strAppPath=QApplication::applicationDirPath(); +// strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN); +// m_po->setWorkingDirectory(strAppPath+"/prog_player/bin"); +// m_po->start(strCommand+strX+strY+strW+strH+strProg); +// connect(m_po,static_cast(&QProcess::finished),[=](int exitCode,QProcess::ExitStatus exitStatus){emit sigProgPlayerQuit();}); +// } + } else { + if(playWin!=nullptr) { + playWin->close(); + playWin = nullptr; + } + if(m_po!=nullptr) m_po->close(); } - else { - if(m_po!=nullptr) - { - m_po->close(); - - } - // QMessageBox::critical(this, tr("Waring"), "close"); - - } - - - } void wEditProgram::StopPreview() { diff --git a/LedOK/wProgramManager/weditprogram.h b/LedOK/wProgramManager/weditprogram.h index cdfd392..b75d732 100644 --- a/LedOK/wProgramManager/weditprogram.h +++ b/LedOK/wProgramManager/weditprogram.h @@ -1,6 +1,6 @@ #ifndef WEDITPROGRAM_H #define WEDITPROGRAM_H - +#include "player/playwin.h" #include #include #include @@ -55,12 +55,12 @@ private: wPageList *m_page_list = nullptr; wDrawingBoard *m_drawing_board = nullptr; wAttrView *m_attr_view = nullptr; + PlayWin * playWin = nullptr; //主区域横向布局(幻灯片页列表,编辑窗,属性窗) QHBoxLayout *m_playout_main_area = nullptr; // //垂直布局(标题栏,主工具栏,主区域) QVBoxLayout *m_pLayout = nullptr; bool IsChangedProgram(); - void Save(); private: QString &m_name; diff --git a/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/.qmake.stash b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/.qmake.stash new file mode 100644 index 0000000..a2df4fd --- /dev/null +++ b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/.qmake.stash @@ -0,0 +1,21 @@ +QMAKE_CXX.QT_COMPILER_STDCXX = 201402L +QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8 +QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 1 +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 = \ + D:/_apps/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++ \ + D:/_apps/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/i686-w64-mingw32 \ + D:/_apps/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/backward \ + D:/_apps/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include \ + D:/_apps/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include-fixed \ + D:/_apps/Qt/Tools/mingw810_32/i686-w64-mingw32/include +QMAKE_CXX.LIBDIRS = \ + D:/_apps/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0 \ + D:/_apps/Qt/Tools/mingw810_32/lib/gcc \ + D:/_apps/Qt/Tools/mingw810_32/i686-w64-mingw32/lib \ + D:/_apps/Qt/Tools/mingw810_32/lib diff --git a/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/LedOK Express_resource.rc b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/LedOK Express_resource.rc new file mode 100644 index 0000000..61a2605 --- /dev/null +++ b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/LedOK Express_resource.rc @@ -0,0 +1,37 @@ +#include + +IDI_ICON1 ICON DISCARDABLE "D:\\_workspace\\comp\\qt\\LedOK\\res\\Logo.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,1,46,0 + PRODUCTVERSION 1,1,46,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "\0" + VALUE "FileVersion", "1.1.46.0\0" + VALUE "LegalCopyright", "\0" + VALUE "OriginalFilename", "LedOK Express.exe\0" + VALUE "ProductName", "LedOK Express\0" + VALUE "ProductVersion", "1.1.46.0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END + END +/* End of Version info */ + diff --git a/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/object_script.LedOK Express.Debug b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/object_script.LedOK Express.Debug new file mode 100644 index 0000000..7d83d4d --- /dev/null +++ b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/object_script.LedOK Express.Debug @@ -0,0 +1,310 @@ +debug/BasicColorArea.o +debug/BasicColorItem.o +debug/ColorDialog.o +debug/CustomColorArea.o +debug/HColorArea.o +debug/PreviewColorArea.o +debug/SVColorArea.o +debug/extendedgroupbox.o +debug/locolorselector.o +debug/lodateselector.o +debug/loglwindow.o +debug/loqgraphicsvideoitem.o +debug/loqgraphicsview.o +debug/loqheaderviewcheckbox.o +debug/loqlineedit.o +debug/loqtreewidget.o +debug/loqvideosurface.o +debug/aboutdlg.o +debug/changepasswordform.o +debug/customprogressindicator.o +debug/loemptydialog.o +debug/louimsgboxokcancel.o +debug/pixbmpshowdialog.o +debug/qiplineedit.o +debug/softconfigdialog.o +debug/switchcontrol.o +debug/taesclass.o +debug/updateledset3dialog.o +debug/updaterdialog.o +debug/updaterfirmwaredialog.o +debug/x_checkboxdelegate.o +debug/x_spinboxdelegate.o +debug/x_timeeditdelegate.o +debug/x_uimsgboxok.o +debug/x_uimsgboxokcancel.o +debug/x_uimsgboxonlyclosebtn.o +debug/x_uimsgboxyesnocancel.o +debug/ccrashstack.o +debug/cfg.o +debug/hpptclient.o +debug/network.o +debug/taserialthread.o +debug/globaldefine.o +debug/jsondecoderloop.o +debug/loappconfig.o +debug/loapptools.o +debug/main.o +debug/mainwindow.o +debug/mdevicemanager.o +debug/mdevicesetting.o +debug/mguangyingpinwidget.o +debug/mprogrammanagera.o +debug/mtitlebar.o +debug/mtabwidget.o +debug/mprogrammanager.o +debug/digiclock.o +debug/eleanaclock.o +debug/elebase.o +debug/elegif.o +debug/eleimg.o +debug/elemultipng.o +debug/elescroll.o +debug/elevideo.o +debug/playwin.o +debug/publishform.o +debug/tipdialog.o +debug/ttimer.o +debug/controladvparamwidget.o +debug/controlbrightnessautowidget.o +debug/controlbrightnessmanualwidget.o +debug/controlbrightnessschedule.o +debug/controlbrightnessscheduleedit.o +debug/controlbrightnesswidget.o +debug/controlencryptwidget.o +debug/controlhdmimanual.o +debug/controlhdmischedule.o +debug/controlhdmiwidget.o +debug/controlnetconfigwidget.o +debug/controlpowermanual.o +debug/controlpowerschedule.o +debug/controlpowerwidget.o +debug/controltestwidget.o +debug/controlverifyclockwidget.o +debug/controlvolumemanual.o +debug/controlvolumeschedule.o +debug/controlvolumewidget.o +debug/devicescontrollwidget.o +debug/inputpassworddialog.o +debug/ledcard.o +debug/specialdlg.o +debug/subspecifyip.o +debug/subspecifyiprange.o +debug/threadupgradeapk.o +debug/upgradeapkdialog.o +debug/wdevicesitem.o +debug/wupgradeapkitem.o +debug/mconverter.o +debug/sendprogramdialog.o +debug/threadexportprogrampro.o +debug/threadsendpro.o +debug/usbdetectdialog.o +debug/usbdiskfuncdialog.o +debug/eaclock.o +debug/eaclockattr.o +debug/eattr.o +debug/edclock.o +debug/edclockattr.o +debug/egif.o +debug/egifattr.o +debug/emovie.o +debug/emovieattr.o +debug/eobject.o +debug/eobjectattr.o +debug/ephoto.o +debug/ephotoattr.o +debug/etemp.o +debug/etempattr.o +debug/etext.o +debug/etextattr.o +debug/etextflipattr.o +debug/etextinput.o +debug/etextscrollattr.o +debug/etextstaticattr.o +debug/etimer.o +debug/etimerattr.o +debug/eweather.o +debug/eweatherattr.o +debug/ewindow.o +debug/ewindowattr.o +debug/fyxcircleprogress.o +debug/imagecutwidget.o +debug/qffwidget.o +debug/videodec.o +debug/wattrview.o +debug/wpageattr.o +debug/wpageitem.o +debug/wpageitemwidget.o +debug/wplanitem.o +debug/wplanlist.o +debug/wexportprogramitem.o +debug/wnewprogram.o +debug/loqdialog.o +debug/loqpushbutton.o +debug/weditprogram.o +debug/loqmainwindow.o +debug/loqtitlebar.o +debug/loqwindowtitlebar.o +debug/wmaintoolbar.o +debug/wpagelist.o +debug/wdrawingboard.o +debug/wprogramitem.o +debug/wprogrampublishitem.o +debug/wprogramitema.o +debug/JQHttpServer.o +debug/JQNet.o +debug/Updater.o +debug/Downloader.o +debug/QSimpleUpdater.o +debug/qrc_icons.o +debug/qrc_images.o +debug/qrc_languages.o +debug/qrc_qss.o +debug/qrc_qsimpleupdater.o +debug/moc_BasicColorArea.o +debug/moc_BasicColorItem.o +debug/moc_ColorDialog.o +debug/moc_CustomColorArea.o +debug/moc_HColorArea.o +debug/moc_PreviewColorArea.o +debug/moc_SVColorArea.o +debug/moc_extendedgroupbox.o +debug/moc_locolorselector.o +debug/moc_lodateselector.o +debug/moc_loglwindow.o +debug/moc_loqgraphicsvideoitem.o +debug/moc_loqheaderviewcheckbox.o +debug/moc_loqlineedit.o +debug/moc_loqtreewidget.o +debug/moc_loqvideosurface.o +debug/moc_aboutdlg.o +debug/moc_changepasswordform.o +debug/moc_customprogressindicator.o +debug/moc_loemptydialog.o +debug/moc_louimsgboxokcancel.o +debug/moc_pixbmpshowdialog.o +debug/moc_qiplineedit.o +debug/moc_softconfigdialog.o +debug/moc_switchcontrol.o +debug/moc_updateledset3dialog.o +debug/moc_updaterdialog.o +debug/moc_updaterfirmwaredialog.o +debug/moc_x_checkboxdelegate.o +debug/moc_x_spinboxdelegate.o +debug/moc_x_timeeditdelegate.o +debug/moc_x_uimsgboxok.o +debug/moc_x_uimsgboxokcancel.o +debug/moc_x_uimsgboxonlyclosebtn.o +debug/moc_x_uimsgboxyesnocancel.o +debug/moc_hpptclient.o +debug/moc_network.o +debug/moc_loapptools.o +debug/moc_mainwindow.o +debug/moc_mdevicemanager.o +debug/moc_mdevicesetting.o +debug/moc_mguangyingpinwidget.o +debug/moc_mprogrammanagera.o +debug/moc_mtitlebar.o +debug/moc_mtabwidget.o +debug/moc_mprogrammanager.o +debug/moc_digiclock.o +debug/moc_eleanaclock.o +debug/moc_elegif.o +debug/moc_eleimg.o +debug/moc_elemultipng.o +debug/moc_elescroll.o +debug/moc_elevideo.o +debug/moc_playwin.o +debug/moc_publishform.o +debug/moc_tipdialog.o +debug/moc_ttimer.o +debug/moc_controladvparamwidget.o +debug/moc_controlbrightnessautowidget.o +debug/moc_controlbrightnessmanualwidget.o +debug/moc_controlbrightnessschedule.o +debug/moc_controlbrightnessscheduleedit.o +debug/moc_controlbrightnesswidget.o +debug/moc_controlencryptwidget.o +debug/moc_controlhdmimanual.o +debug/moc_controlhdmischedule.o +debug/moc_controlhdmiwidget.o +debug/moc_controlnetconfigwidget.o +debug/moc_controlpowermanual.o +debug/moc_controlpowerschedule.o +debug/moc_controlpowerwidget.o +debug/moc_controltestwidget.o +debug/moc_controlverifyclockwidget.o +debug/moc_controlvolumemanual.o +debug/moc_controlvolumeschedule.o +debug/moc_controlvolumewidget.o +debug/moc_devicescontrollwidget.o +debug/moc_inputpassworddialog.o +debug/moc_ledcard.o +debug/moc_specialdlg.o +debug/moc_subspecifyip.o +debug/moc_subspecifyiprange.o +debug/moc_threadupgradeapk.o +debug/moc_upgradeapkdialog.o +debug/moc_wdevicesitem.o +debug/moc_wupgradeapkitem.o +debug/moc_mconverter.o +debug/moc_sendprogramdialog.o +debug/moc_threadexportprogrampro.o +debug/moc_threadsendpro.o +debug/moc_usbdetectdialog.o +debug/moc_usbdiskfuncdialog.o +debug/moc_eaclock.o +debug/moc_eaclockattr.o +debug/moc_eattr.o +debug/moc_edclock.o +debug/moc_edclockattr.o +debug/moc_egif.o +debug/moc_egifattr.o +debug/moc_emovie.o +debug/moc_emovieattr.o +debug/moc_eobject.o +debug/moc_eobjectattr.o +debug/moc_ephoto.o +debug/moc_ephotoattr.o +debug/moc_etemp.o +debug/moc_etempattr.o +debug/moc_etext.o +debug/moc_etextattr.o +debug/moc_etextflipattr.o +debug/moc_etextinput.o +debug/moc_etextscrollattr.o +debug/moc_etextstaticattr.o +debug/moc_etimer.o +debug/moc_etimerattr.o +debug/moc_eweather.o +debug/moc_eweatherattr.o +debug/moc_ewindow.o +debug/moc_ewindowattr.o +debug/moc_fyxcircleprogress.o +debug/moc_imagecutwidget.o +debug/moc_qffwidget.o +debug/moc_videodec.o +debug/moc_wattrview.o +debug/moc_wpageattr.o +debug/moc_wpageitem.o +debug/moc_wpageitemwidget.o +debug/moc_wplanitem.o +debug/moc_wplanlist.o +debug/moc_wexportprogramitem.o +debug/moc_wnewprogram.o +debug/moc_loqdialog.o +debug/moc_loqpushbutton.o +debug/moc_weditprogram.o +debug/moc_loqmainwindow.o +debug/moc_loqtitlebar.o +debug/moc_loqwindowtitlebar.o +debug/moc_wmaintoolbar.o +debug/moc_wpagelist.o +debug/moc_wdrawingboard.o +debug/moc_wprogramitem.o +debug/moc_wprogrampublishitem.o +debug/moc_wprogramitema.o +debug/moc_JQHttpServer.o +debug/moc_QSimpleUpdater.o +debug/moc_Updater.o +debug/moc_Downloader.o diff --git a/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/object_script.LedOK Express.Release b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/object_script.LedOK Express.Release new file mode 100644 index 0000000..b5e2d77 --- /dev/null +++ b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/object_script.LedOK Express.Release @@ -0,0 +1,310 @@ +release/BasicColorArea.o +release/BasicColorItem.o +release/ColorDialog.o +release/CustomColorArea.o +release/HColorArea.o +release/PreviewColorArea.o +release/SVColorArea.o +release/extendedgroupbox.o +release/locolorselector.o +release/lodateselector.o +release/loglwindow.o +release/loqgraphicsvideoitem.o +release/loqgraphicsview.o +release/loqheaderviewcheckbox.o +release/loqlineedit.o +release/loqtreewidget.o +release/loqvideosurface.o +release/aboutdlg.o +release/changepasswordform.o +release/customprogressindicator.o +release/loemptydialog.o +release/louimsgboxokcancel.o +release/pixbmpshowdialog.o +release/qiplineedit.o +release/softconfigdialog.o +release/switchcontrol.o +release/taesclass.o +release/updateledset3dialog.o +release/updaterdialog.o +release/updaterfirmwaredialog.o +release/x_checkboxdelegate.o +release/x_spinboxdelegate.o +release/x_timeeditdelegate.o +release/x_uimsgboxok.o +release/x_uimsgboxokcancel.o +release/x_uimsgboxonlyclosebtn.o +release/x_uimsgboxyesnocancel.o +release/ccrashstack.o +release/cfg.o +release/hpptclient.o +release/network.o +release/taserialthread.o +release/globaldefine.o +release/jsondecoderloop.o +release/loappconfig.o +release/loapptools.o +release/main.o +release/mainwindow.o +release/mdevicemanager.o +release/mdevicesetting.o +release/mguangyingpinwidget.o +release/mprogrammanagera.o +release/mtitlebar.o +release/mtabwidget.o +release/mprogrammanager.o +release/digiclock.o +release/eleanaclock.o +release/elebase.o +release/elegif.o +release/eleimg.o +release/elemultipng.o +release/elescroll.o +release/elevideo.o +release/playwin.o +release/publishform.o +release/tipdialog.o +release/ttimer.o +release/controladvparamwidget.o +release/controlbrightnessautowidget.o +release/controlbrightnessmanualwidget.o +release/controlbrightnessschedule.o +release/controlbrightnessscheduleedit.o +release/controlbrightnesswidget.o +release/controlencryptwidget.o +release/controlhdmimanual.o +release/controlhdmischedule.o +release/controlhdmiwidget.o +release/controlnetconfigwidget.o +release/controlpowermanual.o +release/controlpowerschedule.o +release/controlpowerwidget.o +release/controltestwidget.o +release/controlverifyclockwidget.o +release/controlvolumemanual.o +release/controlvolumeschedule.o +release/controlvolumewidget.o +release/devicescontrollwidget.o +release/inputpassworddialog.o +release/ledcard.o +release/specialdlg.o +release/subspecifyip.o +release/subspecifyiprange.o +release/threadupgradeapk.o +release/upgradeapkdialog.o +release/wdevicesitem.o +release/wupgradeapkitem.o +release/mconverter.o +release/sendprogramdialog.o +release/threadexportprogrampro.o +release/threadsendpro.o +release/usbdetectdialog.o +release/usbdiskfuncdialog.o +release/eaclock.o +release/eaclockattr.o +release/eattr.o +release/edclock.o +release/edclockattr.o +release/egif.o +release/egifattr.o +release/emovie.o +release/emovieattr.o +release/eobject.o +release/eobjectattr.o +release/ephoto.o +release/ephotoattr.o +release/etemp.o +release/etempattr.o +release/etext.o +release/etextattr.o +release/etextflipattr.o +release/etextinput.o +release/etextscrollattr.o +release/etextstaticattr.o +release/etimer.o +release/etimerattr.o +release/eweather.o +release/eweatherattr.o +release/ewindow.o +release/ewindowattr.o +release/fyxcircleprogress.o +release/imagecutwidget.o +release/qffwidget.o +release/videodec.o +release/wattrview.o +release/wpageattr.o +release/wpageitem.o +release/wpageitemwidget.o +release/wplanitem.o +release/wplanlist.o +release/wexportprogramitem.o +release/wnewprogram.o +release/loqdialog.o +release/loqpushbutton.o +release/weditprogram.o +release/loqmainwindow.o +release/loqtitlebar.o +release/loqwindowtitlebar.o +release/wmaintoolbar.o +release/wpagelist.o +release/wdrawingboard.o +release/wprogramitem.o +release/wprogrampublishitem.o +release/wprogramitema.o +release/JQHttpServer.o +release/JQNet.o +release/Updater.o +release/Downloader.o +release/QSimpleUpdater.o +release/qrc_icons.o +release/qrc_images.o +release/qrc_languages.o +release/qrc_qss.o +release/qrc_qsimpleupdater.o +release/moc_BasicColorArea.o +release/moc_BasicColorItem.o +release/moc_ColorDialog.o +release/moc_CustomColorArea.o +release/moc_HColorArea.o +release/moc_PreviewColorArea.o +release/moc_SVColorArea.o +release/moc_extendedgroupbox.o +release/moc_locolorselector.o +release/moc_lodateselector.o +release/moc_loglwindow.o +release/moc_loqgraphicsvideoitem.o +release/moc_loqheaderviewcheckbox.o +release/moc_loqlineedit.o +release/moc_loqtreewidget.o +release/moc_loqvideosurface.o +release/moc_aboutdlg.o +release/moc_changepasswordform.o +release/moc_customprogressindicator.o +release/moc_loemptydialog.o +release/moc_louimsgboxokcancel.o +release/moc_pixbmpshowdialog.o +release/moc_qiplineedit.o +release/moc_softconfigdialog.o +release/moc_switchcontrol.o +release/moc_updateledset3dialog.o +release/moc_updaterdialog.o +release/moc_updaterfirmwaredialog.o +release/moc_x_checkboxdelegate.o +release/moc_x_spinboxdelegate.o +release/moc_x_timeeditdelegate.o +release/moc_x_uimsgboxok.o +release/moc_x_uimsgboxokcancel.o +release/moc_x_uimsgboxonlyclosebtn.o +release/moc_x_uimsgboxyesnocancel.o +release/moc_hpptclient.o +release/moc_network.o +release/moc_loapptools.o +release/moc_mainwindow.o +release/moc_mdevicemanager.o +release/moc_mdevicesetting.o +release/moc_mguangyingpinwidget.o +release/moc_mprogrammanagera.o +release/moc_mtitlebar.o +release/moc_mtabwidget.o +release/moc_mprogrammanager.o +release/moc_digiclock.o +release/moc_eleanaclock.o +release/moc_elegif.o +release/moc_eleimg.o +release/moc_elemultipng.o +release/moc_elescroll.o +release/moc_elevideo.o +release/moc_playwin.o +release/moc_publishform.o +release/moc_tipdialog.o +release/moc_ttimer.o +release/moc_controladvparamwidget.o +release/moc_controlbrightnessautowidget.o +release/moc_controlbrightnessmanualwidget.o +release/moc_controlbrightnessschedule.o +release/moc_controlbrightnessscheduleedit.o +release/moc_controlbrightnesswidget.o +release/moc_controlencryptwidget.o +release/moc_controlhdmimanual.o +release/moc_controlhdmischedule.o +release/moc_controlhdmiwidget.o +release/moc_controlnetconfigwidget.o +release/moc_controlpowermanual.o +release/moc_controlpowerschedule.o +release/moc_controlpowerwidget.o +release/moc_controltestwidget.o +release/moc_controlverifyclockwidget.o +release/moc_controlvolumemanual.o +release/moc_controlvolumeschedule.o +release/moc_controlvolumewidget.o +release/moc_devicescontrollwidget.o +release/moc_inputpassworddialog.o +release/moc_ledcard.o +release/moc_specialdlg.o +release/moc_subspecifyip.o +release/moc_subspecifyiprange.o +release/moc_threadupgradeapk.o +release/moc_upgradeapkdialog.o +release/moc_wdevicesitem.o +release/moc_wupgradeapkitem.o +release/moc_mconverter.o +release/moc_sendprogramdialog.o +release/moc_threadexportprogrampro.o +release/moc_threadsendpro.o +release/moc_usbdetectdialog.o +release/moc_usbdiskfuncdialog.o +release/moc_eaclock.o +release/moc_eaclockattr.o +release/moc_eattr.o +release/moc_edclock.o +release/moc_edclockattr.o +release/moc_egif.o +release/moc_egifattr.o +release/moc_emovie.o +release/moc_emovieattr.o +release/moc_eobject.o +release/moc_eobjectattr.o +release/moc_ephoto.o +release/moc_ephotoattr.o +release/moc_etemp.o +release/moc_etempattr.o +release/moc_etext.o +release/moc_etextattr.o +release/moc_etextflipattr.o +release/moc_etextinput.o +release/moc_etextscrollattr.o +release/moc_etextstaticattr.o +release/moc_etimer.o +release/moc_etimerattr.o +release/moc_eweather.o +release/moc_eweatherattr.o +release/moc_ewindow.o +release/moc_ewindowattr.o +release/moc_fyxcircleprogress.o +release/moc_imagecutwidget.o +release/moc_qffwidget.o +release/moc_videodec.o +release/moc_wattrview.o +release/moc_wpageattr.o +release/moc_wpageitem.o +release/moc_wpageitemwidget.o +release/moc_wplanitem.o +release/moc_wplanlist.o +release/moc_wexportprogramitem.o +release/moc_wnewprogram.o +release/moc_loqdialog.o +release/moc_loqpushbutton.o +release/moc_weditprogram.o +release/moc_loqmainwindow.o +release/moc_loqtitlebar.o +release/moc_loqwindowtitlebar.o +release/moc_wmaintoolbar.o +release/moc_wpagelist.o +release/moc_wdrawingboard.o +release/moc_wprogramitem.o +release/moc_wprogrampublishitem.o +release/moc_wprogramitema.o +release/moc_JQHttpServer.o +release/moc_QSimpleUpdater.o +release/moc_Updater.o +release/moc_Downloader.o diff --git a/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/release/LedOK Express.exe b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/release/LedOK Express.exe new file mode 100644 index 0000000..1f6887f Binary files /dev/null and b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/release/LedOK Express.exe differ diff --git a/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/release/moc_predefs.h b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/release/moc_predefs.h new file mode 100644 index 0000000..cbc372d --- /dev/null +++ b/build-LedOK-Desktop_Qt_5_15_2_MinGW_32_bit-Release/release/moc_predefs.h @@ -0,0 +1,376 @@ +#define __DBL_MIN_EXP__ (-1021) +#define __FLT32X_MAX_EXP__ 1024 +#define __cpp_attributes 200809 +#define __pentiumpro__ 1 +#define __UINT_LEAST16_MAX__ 0xffff +#define __ATOMIC_ACQUIRE 2 +#define __FLT128_MAX_10_EXP__ 4932 +#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F +#define __GCC_IEC_559_COMPLEX 2 +#define __UINT_LEAST8_TYPE__ unsigned char +#define __SIZEOF_FLOAT80__ 12 +#define _WIN32 1 +#define __INTMAX_C(c) c ## LL +#define __CHAR_BIT__ 8 +#define __UINT8_MAX__ 0xff +#define __WINT_MAX__ 0xffff +#define __FLT32_MIN_EXP__ (-125) +#define __cpp_static_assert 200410 +#define __ORDER_LITTLE_ENDIAN__ 1234 +#define __SIZE_MAX__ 0xffffffffU +#define __WCHAR_MAX__ 0xffff +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +#define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +#define __GCC_IEC_559 2 +#define __FLT32X_DECIMAL_DIG__ 17 +#define __FLT_EVAL_METHOD__ 2 +#define __cpp_binary_literals 201304 +#define __FLT64_DECIMAL_DIG__ 17 +#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define __cpp_variadic_templates 200704 +#define __UINT_FAST64_MAX__ 0xffffffffffffffffULL +#define __SIG_ATOMIC_TYPE__ int +#define __DBL_MIN_10_EXP__ (-307) +#define __FINITE_MATH_ONLY__ 0 +#define __GNUC_PATCHLEVEL__ 0 +#define __FLT32_HAS_DENORM__ 1 +#define __UINT_FAST8_MAX__ 0xff +#define __has_include(STR) __has_include__(STR) +#define _stdcall __attribute__((__stdcall__)) +#define __DEC64_MAX_EXP__ 385 +#define __INT8_C(c) c +#define __INT_LEAST8_WIDTH__ 8 +#define __UINT_LEAST64_MAX__ 0xffffffffffffffffULL +#define __SHRT_MAX__ 0x7fff +#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +#define __FLT64X_MAX_10_EXP__ 4932 +#define __UINT_LEAST8_MAX__ 0xff +#define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +#define __UINTMAX_TYPE__ long long unsigned int +#define __DEC32_EPSILON__ 1E-6DF +#define __FLT_EVAL_METHOD_TS_18661_3__ 2 +#define __OPTIMIZE__ 1 +#define __UINT32_MAX__ 0xffffffffU +#define __GXX_EXPERIMENTAL_CXX0X__ 1 +#define __LDBL_MAX_EXP__ 16384 +#define __FLT128_MIN_EXP__ (-16381) +#define __WINT_MIN__ 0 +#define __FLT128_MIN_10_EXP__ (-4931) +#define __INT_LEAST16_WIDTH__ 16 +#define __SCHAR_MAX__ 0x7f +#define __FLT128_MANT_DIG__ 113 +#define __WCHAR_MIN__ 0 +#define __INT64_C(c) c ## LL +#define __DBL_DIG__ 15 +#define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +#define __FLT64X_MANT_DIG__ 64 +#define __SIZEOF_INT__ 4 +#define __SIZEOF_POINTER__ 4 +#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define __USER_LABEL_PREFIX__ _ +#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +#define __STDC_HOSTED__ 1 +#define __WIN32 1 +#define __LDBL_HAS_INFINITY__ 1 +#define __FLT32_DIG__ 6 +#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +#define __GXX_WEAK__ 1 +#define __SHRT_WIDTH__ 16 +#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +#define __DEC32_MAX__ 9.999999E96DF +#define __cpp_threadsafe_static_init 200806 +#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +#define __MINGW32__ 1 +#define __FLT32X_HAS_INFINITY__ 1 +#define __INT32_MAX__ 0x7fffffff +#define __INT_WIDTH__ 32 +#define __SIZEOF_LONG__ 4 +#define __UINT16_C(c) c +#define __PTRDIFF_WIDTH__ 32 +#define __DECIMAL_DIG__ 21 +#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +#define __INTMAX_WIDTH__ 64 +#define __FLT64_MIN_EXP__ (-1021) +#define __has_include_next(STR) __has_include_next__(STR) +#define __FLT64X_MIN_10_EXP__ (-4931) +#define __LDBL_HAS_QUIET_NAN__ 1 +#define __FLT64_MANT_DIG__ 53 +#define _REENTRANT 1 +#define __GNUC__ 8 +#define _cdecl __attribute__((__cdecl__)) +#define __GXX_RTTI 1 +#define __cpp_delegating_constructors 200604 +#define __FLT_HAS_DENORM__ 1 +#define __SIZEOF_LONG_DOUBLE__ 12 +#define __BIGGEST_ALIGNMENT__ 16 +#define __STDC_UTF_16__ 1 +#define __FLT64_MAX_10_EXP__ 308 +#define __i686 1 +#define __FLT32_HAS_INFINITY__ 1 +#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +#define _thiscall __attribute__((__thiscall__)) +#define __cpp_raw_strings 200710 +#define __INT_FAST32_MAX__ 0x7fffffff +#define __WINNT 1 +#define __DBL_HAS_INFINITY__ 1 +#define __WINNT__ 1 +#define __DEC32_MIN_EXP__ (-94) +#define __INTPTR_WIDTH__ 32 +#define __FLT32X_HAS_DENORM__ 1 +#define __INT_FAST16_TYPE__ short int +#define _fastcall __attribute__((__fastcall__)) +#define __LDBL_HAS_DENORM__ 1 +#define __cplusplus 201103L +#define __cpp_ref_qualifiers 200710 +#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +#define __INT_LEAST32_MAX__ 0x7fffffff +#define __DEC32_MIN__ 1E-95DF +#define __DEPRECATED 1 +#define __cpp_rvalue_references 200610 +#define __DBL_MAX_EXP__ 1024 +#define __WCHAR_WIDTH__ 16 +#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +#define __DEC128_EPSILON__ 1E-33DL +#define __ATOMIC_HLE_RELEASE 131072 +#define __WIN32__ 1 +#define __PTRDIFF_MAX__ 0x7fffffff +#define __ATOMIC_HLE_ACQUIRE 65536 +#define __FLT32_HAS_QUIET_NAN__ 1 +#define __GNUG__ 8 +#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL +#define __SIZEOF_SIZE_T__ 4 +#define __cpp_rvalue_reference 200610 +#define __cpp_nsdmi 200809 +#define __FLT64X_MIN_EXP__ (-16381) +#define __SIZEOF_WINT_T__ 2 +#define __LONG_LONG_WIDTH__ 64 +#define __cpp_initializer_lists 200806 +#define __FLT32_MAX_EXP__ 128 +#define __cpp_hex_float 201603 +#define __GCC_HAVE_DWARF2_CFI_ASM 1 +#define __GXX_ABI_VERSION 1012 +#define __FLT128_HAS_INFINITY__ 1 +#define __FLT_MIN_EXP__ (-125) +#define __i686__ 1 +#define __cpp_lambdas 200907 +#define __FLT64X_HAS_QUIET_NAN__ 1 +#define __INT_FAST64_TYPE__ long long int +#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +#define __DECIMAL_BID_FORMAT__ 1 +#define __GXX_TYPEINFO_EQUALITY_INLINE 0 +#define __FLT64_MIN_10_EXP__ (-307) +#define __FLT64X_DECIMAL_DIG__ 21 +#define __DEC128_MIN__ 1E-6143DL +#define __REGISTER_PREFIX__ +#define __UINT16_MAX__ 0xffff +#define __DBL_HAS_DENORM__ 1 +#define __cdecl __attribute__((__cdecl__)) +#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +#define __UINT8_TYPE__ unsigned char +#define __i386 1 +#define __FLT_MANT_DIG__ 24 +#define __LDBL_DECIMAL_DIG__ 21 +#define __VERSION__ "8.1.0" +#define __UINT64_C(c) c ## ULL +#define __cpp_unicode_characters 200704 +#define __GCC_ATOMIC_INT_LOCK_FREE 2 +#define __FLT128_MAX_EXP__ 16384 +#define __FLT32_MANT_DIG__ 24 +#define _X86_ 1 +#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __FLT128_HAS_DENORM__ 1 +#define __FLT128_DIG__ 33 +#define __SCHAR_WIDTH__ 8 +#define __INT32_C(c) c +#define __DEC64_EPSILON__ 1E-15DD +#define __ORDER_PDP_ENDIAN__ 3412 +#define __DEC128_MIN_EXP__ (-6142) +#define __code_model_32__ 1 +#define __FLT32_MAX_10_EXP__ 38 +#define __INT_FAST32_TYPE__ int +#define __UINT_LEAST16_TYPE__ short unsigned int +#define __FLT64X_HAS_INFINITY__ 1 +#define __INT16_MAX__ 0x7fff +#define __i386__ 1 +#define __cpp_rtti 199711 +#define __SIZE_TYPE__ unsigned int +#define __UINT64_MAX__ 0xffffffffffffffffULL +#define __FLT64X_DIG__ 18 +#define __INT8_TYPE__ signed char +#define __GCC_ASM_FLAG_OUTPUTS__ 1 +#define __FLT_RADIX__ 2 +#define __INT_LEAST16_TYPE__ short int +#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +#define __UINTMAX_C(c) c ## ULL +#define __SIG_ATOMIC_MAX__ 0x7fffffff +#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define __SIZEOF_PTRDIFF_T__ 4 +#define __FLT32X_MANT_DIG__ 53 +#define __FLT32X_MIN_EXP__ (-1021) +#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +#define __pentiumpro 1 +#define __MSVCRT__ 1 +#define __INT_FAST16_MAX__ 0x7fff +#define __FLT64_DIG__ 15 +#define __UINT_FAST32_MAX__ 0xffffffffU +#define __UINT_LEAST64_TYPE__ long long unsigned int +#define __FLT_HAS_QUIET_NAN__ 1 +#define __FLT_MAX_10_EXP__ 38 +#define __LONG_MAX__ 0x7fffffffL +#define __FLT64X_HAS_DENORM__ 1 +#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +#define __FLT_HAS_INFINITY__ 1 +#define __cpp_unicode_literals 200710 +#define __UINT_FAST16_TYPE__ short unsigned int +#define __DEC64_MAX__ 9.999999999999999E384DD +#define __INT_FAST32_WIDTH__ 32 +#define __CHAR16_TYPE__ short unsigned int +#define __PRAGMA_REDEFINE_EXTNAME 1 +#define __SIZE_WIDTH__ 32 +#define __SEG_FS 1 +#define __INT_LEAST16_MAX__ 0x7fff +#define __DEC64_MANT_DIG__ 16 +#define __INT64_MAX__ 0x7fffffffffffffffLL +#define __UINT_LEAST32_MAX__ 0xffffffffU +#define __SEG_GS 1 +#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +#define __GCC_ATOMIC_LONG_LOCK_FREE 2 +#define __SIG_ATOMIC_WIDTH__ 32 +#define __INT_LEAST64_TYPE__ long long int +#define __INT16_TYPE__ short int +#define __INT_LEAST8_TYPE__ signed char +#define __DEC32_MAX_EXP__ 97 +#define __INT_FAST8_MAX__ 0x7f +#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +#define __INTPTR_MAX__ 0x7fffffff +#define __GXX_MERGED_TYPEINFO_NAMES 0 +#define __cpp_range_based_for 200907 +#define __FLT64_HAS_QUIET_NAN__ 1 +#define __stdcall __attribute__((__stdcall__)) +#define __FLT32_MIN_10_EXP__ (-37) +#define __EXCEPTIONS 1 +#define __LDBL_MANT_DIG__ 64 +#define __DBL_HAS_QUIET_NAN__ 1 +#define __FLT64_HAS_INFINITY__ 1 +#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +#define __INTPTR_TYPE__ int +#define __UINT16_TYPE__ short unsigned int +#define __WCHAR_TYPE__ short unsigned int +#define __SIZEOF_FLOAT__ 4 +#define __UINTPTR_MAX__ 0xffffffffU +#define __INT_FAST64_WIDTH__ 64 +#define __DEC64_MIN_EXP__ (-382) +#define __cpp_decltype 200707 +#define __FLT32_DECIMAL_DIG__ 9 +#define __INT_FAST64_MAX__ 0x7fffffffffffffffLL +#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +#define __FLT_DIG__ 6 +#define __FLT64X_MAX_EXP__ 16384 +#define __UINT_FAST64_TYPE__ long long unsigned int +#define __INT_MAX__ 0x7fffffff +#define WIN32 1 +#define __INT64_TYPE__ long long int +#define __FLT_MAX_EXP__ 128 +#define __DBL_MANT_DIG__ 53 +#define __cpp_inheriting_constructors 201511 +#define __SIZEOF_FLOAT128__ 16 +#define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL +#define __DEC64_MIN__ 1E-383DD +#define __WINT_TYPE__ short unsigned int +#define __UINT_LEAST32_TYPE__ unsigned int +#define __SIZEOF_SHORT__ 2 +#define __LDBL_MIN_EXP__ (-16381) +#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +#define __WINT_WIDTH__ 16 +#define __INT_LEAST8_MAX__ 0x7f +#define __FLT32X_MAX_10_EXP__ 308 +#define __WCHAR_UNSIGNED__ 1 +#define __LDBL_MAX_10_EXP__ 4932 +#define __ATOMIC_RELAXED 0 +#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +#define __thiscall __attribute__((__thiscall__)) +#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +#define __UINT8_C(c) c +#define __FLT64_MAX_EXP__ 1024 +#define __INT_LEAST32_TYPE__ int +#define __SIZEOF_WCHAR_T__ 2 +#define __FLT128_HAS_QUIET_NAN__ 1 +#define __INT_FAST8_TYPE__ signed char +#define __fastcall __attribute__((__fastcall__)) +#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +#define __GNUC_STDC_INLINE__ 1 +#define __FLT64_HAS_DENORM__ 1 +#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +#define __DBL_DECIMAL_DIG__ 17 +#define __STDC_UTF_32__ 1 +#define __INT_FAST8_WIDTH__ 8 +#define __DEC_EVAL_METHOD__ 2 +#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +#define __ORDER_BIG_ENDIAN__ 4321 +#define __cpp_runtime_arrays 198712 +#define __UINT64_TYPE__ long long unsigned int +#define __UINT32_C(c) c ## U +#define __INTMAX_MAX__ 0x7fffffffffffffffLL +#define __cpp_alias_templates 200704 +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define WINNT 1 +#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +#define __INT8_MAX__ 0x7f +#define __LONG_WIDTH__ 32 +#define __UINT_FAST32_TYPE__ unsigned int +#define __CHAR32_TYPE__ unsigned int +#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F +#define __cpp_constexpr 200704 +#define __INT32_TYPE__ int +#define __SIZEOF_DOUBLE__ 8 +#define __cpp_exceptions 199711 +#define __FLT_MIN_10_EXP__ (-37) +#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +#define __INT_LEAST32_WIDTH__ 32 +#define __INTMAX_TYPE__ long long int +#define i386 1 +#define _INTEGRAL_MAX_BITS 64 +#define __DEC128_MAX_EXP__ 6145 +#define __FLT32X_HAS_QUIET_NAN__ 1 +#define __ATOMIC_CONSUME 1 +#define __GNUC_MINOR__ 1 +#define __INT_FAST16_WIDTH__ 16 +#define __UINTMAX_MAX__ 0xffffffffffffffffULL +#define __DEC32_MANT_DIG__ 7 +#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +#define __DBL_MAX_10_EXP__ 308 +#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +#define __INT16_C(c) c +#define __STDC__ 1 +#define __FLT32X_DIG__ 15 +#define __PTRDIFF_TYPE__ int +#define __ATOMIC_SEQ_CST 5 +#define __UINT32_TYPE__ unsigned int +#define __FLT32X_MIN_10_EXP__ (-307) +#define __UINTPTR_TYPE__ unsigned int +#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +#define __DEC128_MANT_DIG__ 34 +#define __LDBL_MIN_10_EXP__ (-4931) +#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +#define __SIZEOF_LONG_LONG__ 8 +#define __cpp_user_defined_literals 200809 +#define __FLT128_DECIMAL_DIG__ 36 +#define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +#define __LDBL_DIG__ 18 +#define __FLT_DECIMAL_DIG__ 9 +#define __UINT_FAST16_MAX__ 0xffff +#define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +#define __INT_LEAST64_WIDTH__ 64 +#define __UINT_FAST8_TYPE__ unsigned char +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_RELEASE 3 +#define __declspec(x) __attribute__((x))