移除部分不需要的头文件

调整userInfo的配置
master
bobpan 6 years ago
parent 77ea121eef
commit cbc0a26cec

@ -1,73 +0,0 @@
#ifndef APPINSTANCE_H__
#define APPINSTANCE_H__
#include <QtCore>
#include <QObject>
#include <QString>
#include <QLocalServer>
#include <QLocalSocket>
#include <QMutex>
#include "MultiBase.h"
#include "tpProtocol.h"
#include "GlobalFunction.h"
#include "tpProcess.h"
#include "CmdProcess.h"
class CAppInstance : public QObject, public CMultiBase < CAppInstance >
{
Q_OBJECT
public:
CAppInstance(const QString& strAppName);
virtual ~CAppInstance(void);
virtual void close();
void init(TPA_APP_OPTION& appopt);
void sendPackage(TP_PROTOCOL_MESSAGE& msg);
qint64 getLastHeartBeat();
void sendCloseMsg();
TPSYS_PROCESS_INFO getProcessInfo() const { return m_procInfo; }
TPA_APP_OPTION getProcessOpt() const { return m_AppOpt; }
private slots:
void slotNewConnection();
void slotDisconnected();
void slotErrorHandler(QLocalSocket::LocalSocketError err);
void slotDataReceived();
void slotAppStatusRefresh();
void slotCompressFinished(const QString&, const QString&, int, bool);
private:
void parserMsg(QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg);
void initLogger();
void logmsg(emTPALogLevel level, const QString& msg);
void handleDiskCheckCmd(QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg);
private:
QMutex m_mutex;
bool m_bInited;
bool m_bClosed;
QLocalServer m_server;
QLocalSocket* m_pSocket;
TpProtocolDeCode mDecoder;
qint64 m_lastHeartBeat;
QString m_sAppName;
TPA_APP_OPTION m_AppOpt;
QSharedPointer<CTpProcess> m_ptpProc;
TPSYS_PROCESS_INFO m_procInfo;
QTimer mTimerAppStatusRefresh;
};
#endif //APPINSTANCE_H__

@ -1,40 +0,0 @@
#ifndef LP_APPMANAGER_H__
#define LP_APPMANAGER_H__
#include "QTpSingletonBase.h"
#include <QtCore>
#include <QtCore\qobject.h>
#include <QList>
#include <QMap>
#include <QMutex>
#include <QSharedPointer>
#include "GlobalFunction.h"
#include "AppInstance.h"
class CAppManager : public QObject, public CSingletonBase < CAppManager >
{
Q_OBJECT
public:
CAppManager();
~CAppManager();
virtual void close();
QList<QString> getAllApps() const { return m_appslist; }
void logmsg(emTPALogLevel level, const QString& msg);
private:
void init();
void initLogger();
private:
QMutex m_mutex;
bool m_bInited;
bool m_bClosed;
QList<QString> m_appslist;
QString m_sLoggerName;
};
#endif //LP_APPMANAGER_H__

@ -1,193 +0,0 @@
#ifndef TPAS_APPPROTOCOL_H__
#define TPAS_APPPROTOCOL_H__
#include <QMap>
#include <QString>
enum emTPAS_TOKS{
TOK_UNKNOWN = 0,
TOK_HEARTBEAT,
TOK_CK_DISK_SPACE,
TOK_COPY_FOLDER,
TOK_CLOSE_CLIENT_APP,
TOK_COMPRESS,
TOK_UNCOMPRESS,
};
class CIPCHeartBeat{
private:
emTPAS_TOKS m_cmd;
public:
QString m_appName;
qint64 m_time;
CIPCHeartBeat()
: m_cmd(TOK_HEARTBEAT)
{}
CIPCHeartBeat(const QJsonObject& jsobj)
: m_cmd(TOK_HEARTBEAT)
{
m_appName = jsobj["app_name"].toString("");
m_time = jsobj["time"].toInt(QDateTime::currentMSecsSinceEpoch());
}
void toJsonObj(QJsonObject& jsobj) const {
jsobj = QJsonObject();
jsobj["cmd"] = m_cmd;
jsobj["app_name"] = m_appName;
jsobj["time"] = m_time;
}
};
class CIPCCheckDiskSpace{
private:
emTPAS_TOKS m_cmd;
public:
QString m_diskTarget; // like"D:","D:/","D:\\Program Files", "\\\\server\\share"
double m_total; // resp in GB
double m_free; // resp in GB
double m_avail; // resp in GB
double m_used; // resp in GB
CIPCCheckDiskSpace()
: m_cmd(TOK_CK_DISK_SPACE)
{}
CIPCCheckDiskSpace(const QJsonObject& jsobj)
: m_cmd(TOK_CK_DISK_SPACE)
{
m_diskTarget = jsobj["disk_target"].toString("D");
m_total = jsobj["total_space"].toDouble(0.0f);
m_free = jsobj["free_space"].toDouble(0.0f);
m_avail = jsobj["avalible_space"].toDouble(0.0f);
m_used = jsobj["used_space"].toDouble(0.0f);
}
void toJsonObj(QJsonObject& jsobj) const {
jsobj = QJsonObject();
jsobj["cmd"] = m_cmd;
jsobj["disk_target"] = m_diskTarget;
jsobj["total_space"] = m_total;
jsobj["free_space"] = m_free;
jsobj["avalible_space"] = m_avail;
jsobj["used_space"] = m_used;
}
};
class CIPCCopyFolder{
private:
emTPAS_TOKS m_cmd;
public:
QString m_srcFolder;
QString m_dstFolder;
bool m_needReply;
bool m_result; // resp true:copy complete false:error occur
QString m_error; // resp error detail
CIPCCopyFolder()
: m_cmd(TOK_COPY_FOLDER)
{}
CIPCCopyFolder(const QJsonObject& jsobj)
: m_cmd(TOK_COPY_FOLDER)
{
m_srcFolder = jsobj["src_folder"].toString("");
m_dstFolder = jsobj["dst_folder"].toString("");
m_needReply = jsobj["need_reply"].toBool(false);
m_result = jsobj["result"].toBool(false);
m_error = jsobj["error"].toString("");
}
void toJsonObj(QJsonObject& jsobj) const {
jsobj = QJsonObject();
jsobj["cmd"] = m_cmd;
jsobj["src_folder"] = m_srcFolder;
jsobj["dst_folder"] = m_dstFolder;
jsobj["need_reply"] = m_needReply;
jsobj["result"] = m_result;
jsobj["error"] = m_error;
}
};
class CIPCClientClose{
private:
emTPAS_TOKS m_cmd;
public:
CIPCClientClose()
: m_cmd(TOK_CLOSE_CLIENT_APP)
{}
CIPCClientClose(const QJsonObject& jsobj)
: m_cmd(TOK_CLOSE_CLIENT_APP)
{
}
void toJsonObj(QJsonObject& jsobj) const {
jsobj = QJsonObject();
jsobj["cmd"] = m_cmd;
}
};
/*
* @brief srcdst
*
* D:\\LeaperWork\\git\\tadpole, \\\\server\\share\\bbb\\quatest.zip
* error
*/
class CIPCCompress{
private:
emTPAS_TOKS m_cmd;
public:
QString m_src; // 要压缩的文件或者文件夹。
QString m_dst; // 生成的压缩文件一般以zip为后缀
int m_result; // 0:ok 1:src error 2:dst error 3:zip err
CIPCCompress()
: m_cmd(TOK_COMPRESS)
{}
CIPCCompress(const QJsonObject& jsobj)
: m_cmd(TOK_COMPRESS)
{
m_src = jsobj["src"].toString("");
m_dst = jsobj["dst"].toString("");
m_result = jsobj["result"].toInt(-1);
}
void toJsonObj(QJsonObject& jsobj) const {
jsobj = QJsonObject();
jsobj["cmd"] = m_cmd;
jsobj["src"] = m_src;
jsobj["dst"] = m_dst;
jsobj["result"] = m_result;
}
};
class CIPCUnCompress : public CIPCCompress
{
private:
emTPAS_TOKS m_cmd;
public:
CIPCUnCompress()
: m_cmd(TOK_UNCOMPRESS)
{}
CIPCUnCompress(const QJsonObject& jsobj)
: CIPCCompress(jsobj)
, m_cmd(TOK_UNCOMPRESS)
{
}
void toJsonObj(QJsonObject& jsobj) const {
jsobj = QJsonObject();
CIPCCompress::toJsonObj(jsobj);
jsobj["cmd"] = m_cmd;
}
};
#endif //TPAS_APPPROTOCOL_H__

@ -1,27 +0,0 @@
#ifndef LP_COMMANDPROCESS_H__
#define LP_COMMANDPROCESS_H__
#include <QString>
#include "tpProtocol.h"
#include "AppProtocol.h"
#include <QRunnable>
#include <QThreadPool>
class CCompressTask : public QObject, public QRunnable
{
Q_OBJECT
public:
CCompressTask(const QString& src, const QString& dst, bool bzip=true);
~CCompressTask();
void run();
signals:
void sigTaskFinished(const QString&, const QString&, int, bool);
private:
QString m_sSrc;
QString m_sDst;
bool m_bzip;
};
#endif //LP_COMMANDPROCESS_H__

@ -1,46 +0,0 @@
#ifndef globalfunction_h__
#define globalfunction_h__
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/thread.hpp>
#include <boost/regex.hpp>
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <vector>
#include <string>
#include <log4cplus/logger.h>
#include <log4cplus/loggingmacros.h>
#include <log4cplus/configurator.h>
#include <log4cplus/initializer.h>
#include "log4cplus/consoleappender.h"
#include <log4cplus/fileappender.h>
#include <log4cplus/layout.h>
#include "log4cplus/helpers/appenderattachableimpl.h"
#include "log4cplus/helpers/loglog.h"
#include <QString>
enum emTPALogLevel {
TPA_DEBUG = 0,
TPA_INFO,
TPA_WARN,
TPA_ERROR,
TPA_FATAL,
};
typedef struct tagTPA_APP_OPTION {
QString sName;
QString sDir;
bool bAutoLaunch;
int nRefreshRate;
int nRelaunch;
}TPA_APP_OPTION;
namespace TPA{
void log(const QString& loggername, emTPALogLevel level, const QString& msg);
}
#endif // globalfunction_h__

@ -1,152 +0,0 @@
#ifndef MultiBase_h__
#define MultiBase_h__
#include <boost/thread.hpp>
#include <string>
#include <map>
#include <QString>
#include <QMap>
template <class T>
class CMultiBase
{
public:
class PTR
{
public:
PTR(T* ptr){
m_PTR = ptr;
}
~PTR(){
if (m_PTR != 0){
m_PTR->m_mutexlock.unlock_shared();
}
}
bool valid(){
if (m_PTR != 0)
return true;
return false;
}
T* operator->() { return m_PTR; }
private:
T* m_PTR;
};
protected:
static boost::recursive_mutex m_mutex_instancemap;
static std::map<std::string, T*> m_mapInstances;
QString m_strInstanceName;
boost::shared_mutex m_mutexlock;
public:
CMultiBase(const QString& strInstanceName)
{
m_strInstanceName = strInstanceName;
};
virtual ~CMultiBase(void)
{
};
virtual void Close()
{
return;
};
static void createinstance(const QString& strInstanceName)
{
boost::recursive_mutex::scoped_lock lock(m_mutex_instancemap);
if (strInstanceName.isEmpty())
return;
std::string sname = strInstanceName.toStdString();
typename std::map<std::string, T*>::iterator itr;
itr = m_mapInstances.find(sname);
if (itr == m_mapInstances.end())
{
m_mapInstances[sname] = new T(strInstanceName);
}
};
static T* getinstance(const QString& strInstanceName)
{
boost::recursive_mutex::scoped_lock lock(m_mutex_instancemap);
if (strInstanceName.isEmpty())
return 0;
std::string sname = strInstanceName.toStdString();
typename std::map<std::string, T*>::iterator itr;
itr = m_mapInstances.find(sname);
if (itr != m_mapInstances.end())
{
itr->second->m_mutexlock.lock_shared();
return itr->second;
}
else
{
return 0;
}
};
static void uninstance(const QString& strInstanceName)
{
boost::recursive_mutex::scoped_lock lock(m_mutex_instancemap);
if (strInstanceName.isEmpty())
return;
std::string sname = strInstanceName.toStdString();
typename std::map<std::string, T*>::iterator itr;
itr = m_mapInstances.find(sname);
if (itr != m_mapInstances.end())
{
T* pptr = itr->second;
pptr->m_mutexlock.lock();
pptr->m_mutexlock.unlock();
m_mapInstances.erase(itr);
pptr->Close();
}
};
static void uninstanceall()
{
boost::recursive_mutex::scoped_lock lock(m_mutex_instancemap);
for (typename std::map<std::string, T*>::iterator itr = m_mapInstances.begin(); itr != m_mapInstances.end();)
{
T* pptr = itr->second;
pptr->m_mutexlock.lock();
pptr->m_mutexlock.unlock();
m_mapInstances.erase(itr++);
pptr->Close();
}
};
};
template <class T>
std::map<std::string, T*> CMultiBase<T>::m_mapInstances;
template <class T>
boost::recursive_mutex CMultiBase<T>::m_mutex_instancemap;
#endif // MultiBase_h__

@ -1,32 +0,0 @@
#ifndef TPLAUNCHER_H
#define TPLAUNCHER_H
#include <QtWidgets/QMainWindow>
#include <QTimer>
#include "ui_tpAssister.h"
class tpAssister : public QMainWindow
{
Q_OBJECT
public:
tpAssister(QWidget *parent = 0);
~tpAssister();
private:
void init();
Q_SLOT void slotAppStatusRefresh();
QTimer mTimerAppStatusRefresh;
Q_SLOT void slotStartupApp(bool bChecked);
Q_SLOT void slotShutdownApp(bool bChecked);
private:
Ui::tpAssisterClass ui;
};
#endif // TPLAUNCHER_H

@ -1,77 +0,0 @@
#include "CDllCoreCtrl.h"
#include "QMainFilter.h"
#define _USE_LIB_CORECTRL_DLL
#ifdef _USE_LIB_CORECTRL_DLL
#include "DllLoader.h"
#else
extern "C" void* Lib_CoreCtrl_Init(void* inParam);
extern "C" void Lib_CoreCtrl_Free();
#endif
CDllCoreCtrl::CDllCoreCtrl(const ZStringList& szDllPaths, IGuiCallback* pCb, class IDetectorEngine* pDE /*= NULL*/)
{
m_szDllPaths = szDllPaths;
memset(&m_tpGlobal, 0, sizeof(m_tpGlobal));
m_tpGlobal.tgdpDllPaths = &m_szDllPaths;
if (m_szDllPaths.size() > 0)
{
strncpy(m_tpGlobal.tgdMainPath, m_szDllPaths.last().toUtf8().data(), BASE_MAX_FILE_PATH - 1);
strncpy(m_tpGlobal.tgdUserPath, m_szDllPaths.first().toUtf8().data(), BASE_MAX_FILE_PATH - 1);
strcpy(m_tpGlobal.tgdDllPath, m_tpGlobal.tgdMainPath);
}
QJsonObject jsonUser = gpCallback->IJsonUser();
QString folderStr = jsonUser.value("config").toString("config\\");
strcpy(m_tpGlobal.tgdFolderNames[TP_FOLDER_NAME_CONFIG], folderStr.toUtf8().data());
folderStr = jsonUser.value("pic").toString("pic\\");
strcpy(m_tpGlobal.tgdFolderNames[TP_FOLDER_NAME_PICTURE], folderStr.toUtf8().data());
strcpy(m_tpGlobal.tgdFolderNames[TP_FOLDER_NAME_UI], "ui\\");
CORE_CTRL_IN_PARAM inParam;
inParam.pGuiCb = pCb;
inParam.pGlobalData = &m_tpGlobal;
inParam.pCoreSetting = NULL;
#ifdef _USE_LIB_CORECTRL_DLL
m_pLibCoreCtrl = new CDllLoaderM("tpCoreCtrl", "Lib_CoreCtrl_Init", "Lib_CoreCtrl_Free", m_szDllPaths);
if (NULL != m_pLibCoreCtrl)
{
m_pCoreCtrl = (ICoreCtrl*)m_pLibCoreCtrl->ModuleInit(&inParam);
if (NULL != m_pCoreCtrl)
{
m_pCoreCtrl->IInitCore(pDE);
}
else
{
tpDebugOut("failed to get instance from tpCoreCtrl.dll");
}
}
else
{
tpDebugOut("failed to load tpCoreCtrl.dll");
}
#else
m_pLibCoreCtrl = NULL;
m_pCoreCtrl = (ICoreCtrl*)Lib_CoreCtrl_Init(&inParam);
#endif
}
CDllCoreCtrl::~CDllCoreCtrl()
{
if (NULL != m_pCoreCtrl)
{
m_pCoreCtrl->IFreeCore();
#ifdef _USE_LIB_CORECTRL_DLL
if (NULL != m_pLibCoreCtrl)
{
m_pLibCoreCtrl->ModuleFree();
}
#else
Lib_CoreCtrl_Free();
#endif
m_pCoreCtrl = NULL;
}
if (NULL != m_pLibCoreCtrl)
{
delete m_pLibCoreCtrl;
m_pLibCoreCtrl = NULL;
}
}

@ -1,21 +0,0 @@
#ifndef CDLLCORECTRL_H
#define CDLLCORECTRL_H
#include "iCoreCtrl.h"
#include "zclasses.h"
class CDllCoreCtrl
{
public:
CDllCoreCtrl(const ZStringList& szDllPaths, IGuiCallback* pCb, class IDetectorEngine* pDE = NULL);
~CDllCoreCtrl();
public:
TP_GLOBAL_DATA m_tpGlobal;
class CDllLoaderM* m_pLibCoreCtrl;
private:
ICoreCtrl* m_pCoreCtrl;
ZStringList m_szDllPaths;
friend class QMainFilter;
};
#endif // CDLLCORECTRL_H

@ -1,86 +0,0 @@
#include "CDllDetectorEngine.h"
#include "iCoreCtrl.h"
CDllDetectorEngine::CDllDetectorEngine()
{
m_pDE = NULL;
#ifdef _DEBUG
m_lib.setFileName("lpbengined.dll");
#else
m_lib.setFileName("lpbengine.dll");
#endif
if (!m_lib.load())
{
qWarning("failed to load lpbengine");
}
FnLpNewEngineInstance pfnLpNewInstance = (FnLpNewEngineInstance)m_lib.resolve("LpNewEngineInstance");
if (pfnLpNewInstance)
pfnLpNewInstance(&m_pDE, NULL);
if (!m_pDE)
{
qWarning("failed to get instance from lpbengine");
}
}
CDllDetectorEngine::~CDllDetectorEngine()
{
Quit();
}
bool CDllDetectorEngine::Initialize(class ICoreCtrl* pCoreCtrl)
{
if (m_pDE && pCoreCtrl)
{
m_pCoreCtrl = pCoreCtrl;
void* p = NULL;
m_pDE->GetDataInterface(DEVICEMGR, &p);
IDetectorDeviceMgr* pDeviceMgr = (IDetectorDeviceMgr*)p;
if (pDeviceMgr)
{
pDeviceMgr->RegisterCoreCtrl(m_pCoreCtrl);
QList<QString> strCameraKeys = m_pCoreCtrl->ICameraKeys();
for (int i = 0; i < strCameraKeys.size(); i++)
{
IDetectorCameraDevice* pCamera = (IDetectorCameraDevice*)pDeviceMgr->AddDevice(CAMERA);
if (pCamera)
{
TP_CAMERA_OPTION option;
m_pCoreCtrl->ICameraOptionByKey(strCameraKeys.at(i), option);
pCamera->SetName(strCameraKeys.at(i));
pCamera->SetID(option.id);
}
}
}
m_pDE->GetDataInterface(SHAREAPARAM, &p);
IAlgorithmShare* pAlgoShare = (IAlgorithmShare*)p;
if (pAlgoShare)
{
pAlgoShare->RegisterCoreCtrl(m_pCoreCtrl);
}
return true;
}
return false;
}
void CDllDetectorEngine::Quit()
{
FnLpDeleteEngineInstance pfnLpDeleteInstance = (FnLpDeleteEngineInstance)m_lib.resolve("LpDeleteEngineInstance");
if (pfnLpDeleteInstance)
pfnLpDeleteInstance();
if (m_lib.isLoaded())
m_lib.unload();
}

@ -1,22 +0,0 @@
#ifndef CDLLDETECTORENGINE_H
#define CDLLDETECTORENGINE_H
#include "lpbengine.h"
class CDllDetectorEngine
{
public:
CDllDetectorEngine();
~CDllDetectorEngine();
public:
bool Initialize(class ICoreCtrl* pCoreCtrl);
void Quit();
private:
IDetectorEngine *m_pDE;
QLibrary m_lib;
class ICoreCtrl* m_pCoreCtrl;
friend class QMainFilter;
};
#endif // CDLLDETECTORENGINE_H

File diff suppressed because it is too large Load Diff

@ -1,251 +0,0 @@
#ifndef QMAINFILTER_H
#define QMAINFILTER_H
#include "zdefines.h"
#include "tpMainHeader.h"
#include "CDllCoreCtrl.h"
#include "CDllDetectorEngine.h"
#include "tadpoleGuiHeader.h"
#include "qTpFunctions.h"
#include "tpGuiHeader.h"
#include <QtCore\qtimer.h>
#include <QApplication>
#include <QFileDialog>
#include <QMessageBox>
#include <QTableWidget>
#include "tpNetServer.h"
#include "tpNetClient.h"
#include "DllLoader.h"
#include "tpSubFilterHeader.h"
//#include "QSubFilterAppConfig.h"
#define TP_PUSHBUTTON_DEMARCATING "tp_pushbuttong_demarcating"
#define TP_DEMARCATE_CAM_WIN_PREFIX "demarcate_cam_win_"
typedef CDllLoader<void*, QSubFilter*, QSubFilter*, void> FilterDllLoader;
typedef QList<FilterDllLoader*> FilterDllLoaderList;
typedef QList<QSubFilter*> FilterList;
class QMainFilter : public QObject, public IMainFilter, public IGuiCallback, public INetClientCallback, public INetServerCallback
{
Q_OBJECT
public:
QMainFilter(IMainCallback* pMainCb);
virtual ~QMainFilter();
protected://IMainFilter
virtual int InitMain();
virtual void FreeMain();
virtual QWidget* CreateWidget(const QString & className, QWidget * parent, const QString& name);
virtual bool ActionTrigger(class QAction* pAction, bool bChecked);
virtual bool OnPaint(QWidget* watched, QPaintEvent* event);
virtual bool ButtonClicked(class QObject* pButton, bool bChecked);
virtual bool OnToggled(class QObject* pButton, bool bChecked);
virtual bool OnPolished(QWidget * watched, QEvent * event);
virtual bool OnComboxCurrentChanged(QObject * watched, int index);
virtual bool OnInitMainWindow(QObject * watched);
virtual bool OnProcessFinished(class QProcess* p, int exitCode, QProcess::ExitStatus exitStatus);
virtual bool OnProcessError(class QProcess* p, QProcess::ProcessError error);
virtual bool OnValueChanged(QObject* watched, int i);
virtual bool OnValueChanged(QObject* watched, double v);
virtual bool OnValueChanged(QObject* watched, const QString& text);
virtual bool OnStateChanged(QObject* watched, int state);
virtual bool OnCurrentChanged(QObject* watched, int index);
virtual bool OnDoubleClicked(QObject* watched, QMouseEvent* event);
virtual bool OnMousePress(QObject* watched, QMouseEvent* event);
virtual bool OnMouseRelease(QObject* watched, QMouseEvent* event);
virtual bool OnMouseMove(QObject* watched, QMouseEvent* event);
virtual bool OnNonClientAreaMouseMove(QObject* watched, QMouseEvent* event);
virtual bool OnNonClientAreaMouseButtonPress(QObject* watched, QMouseEvent* event);
virtual bool OnKeyPress(QObject* watched, QKeyEvent* event);
virtual bool OnKeyRelease(QObject* watched, QKeyEvent* event);
virtual bool OnResize(QWidget* watched, QResizeEvent* event);
virtual bool OnWidgetClosed(QWidget* watched, QCloseEvent* event);
virtual bool OnDeferredDelete(QObject* watched, QEvent* event);
virtual bool OnVersionUpdate(const QString& sOldVersion, const QString& sNewVersion);
virtual bool OnLineEditCursorPositionChanged(class QLineEdit* pObj, int nOld, int nNew);
virtual bool OnLineEditEditingFinished(class QLineEdit* pObj);
virtual bool OnLineEditSelectionChanged(class QLineEdit* pObj);
virtual bool OnLineEditTextChanged(class QLineEdit* pObj, const QString& text);
virtual bool OnLineEditTextEdited(class QLineEdit* pObj, const QString& text);
virtual bool OnWidgetShow(QWidget* pWidget, QShowEvent* event);
virtual bool OnWidgetHide(QWidget* pWidget, QHideEvent* event);
virtual bool OnWheel(QWidget* pWidget, QWheelEvent* event);
virtual bool onItemSelectionChanged(QWidget* pWidget);
virtual void onIPCResponse(QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg);
virtual void OnHandleMessage(const QStringList& listFilterKey, const QJsonObject& jsonObj);
protected: //INetServerCallback
virtual void onServerMessageRecevied(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg);
virtual void onServerDataReceived(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg, QSharedPointer<QByteArray> pData);
virtual void onServerDataSentEnd();
virtual void onClientConnected(const QString& strClient);
virtual void onClientDisconnected(const QString& strClient);
protected: //INetClientCallback
virtual void onClientMessageRecevied(QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg);
virtual void onClientDataReceived(QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg, QSharedPointer<QByteArray> pData);
virtual void onClientDataSentEnd();
protected:
enum emCC_ACTION {
CC_AC_OUT = 0,
CC_AC_START = 1,
CC_AC_STOP = 2,
CC_AC_SHILFT = 3,
CC_AC_SNAP = 4,
CC_AC_NEXT = 5,
CC_AC_LAST = 6,
CC_AC_REPEAT = 7
};
void CC_Action(emCC_ACTION ca);
void CC_ActionShilft();
void EnableShilft(QObjectList& objLists, bool bEnable);
QString ShowWindowsName(const QString& name) {
return m_winShowMap.value(name, NULL);
}
void SetAlgorithmOption(IAlgorithmOption* pOption, class QObject* pGroupbox);
void SaveAlgorithmOption(IAlgorithmOption* pOption, class QObject* parent = NULL);
void SetAlgorithmResult(const QVariantMap varMap, class QObject* parent = NULL);
void SaveCameraOption(class QObject* parent = NULL);
QStringList CameraWindows(const QString& camKey);
bool SwapTriggerOutOrSoft(bool bTrigger);
bool SetAutoSendTrigger(bool bAuto, QObject* parent = NULL);
//
virtual void timerEvent(QTimerEvent * event);
virtual void initSubFilter();
private:
Q_SLOT void autoTriggerTimeout();
void updateTriggerMode();
void loadAndInitUiFilters(const QStringList& listDllName, const QString& dirPath);
void devTest();
private:
TP_CALLBACKS_H
TP_SIGNALS
//please reimplemente the slots' functions if necessary
TP_SLOTS
public:
static IMainCallback* s_pMainCb;
static CDllCoreCtrl* s_pDllCoreCtrl;
static CDllDetectorEngine* s_pDllDetectorEngine;
protected:
QHash<QString, QString> m_winShowMap; //QWidget object name to CShowWindow's name
bool m_bAutoTrigger;
IAlgorithmOption* m_pAlgOption;
QByteArray m_commName;
ICoreCtrl* m_pCoreCtrl;
IDetectorEngine* m_pDetectorEngine;
int m_triggerTimer;
bool m_bOutTrigger;//true for out trigger, false for soft trigger
bool m_bAutoSendTrigger;//auto send trigger to camera, softTrigger by api, outTrigger by comm.
QTimer m_autoTriggerTimer;
static INetClient* s_pNetClient;
CDllLoaderM* m_pLibNetClient;
static INetServer* s_pNetServer;
CDllLoaderM* m_pLibNetServer;
FilterDllLoaderList m_listFilterDllLoader;
QList<QSubFilter*> mSubFilters;
};
#define gTpGlobalData QMainFilter::s_pDllCoreCtrl->m_tpGlobal//s_pGlobalData
#define gpTpCoreCtrl m_pCoreCtrl//QMainFilter::s_pDllCoreCtrl->m_pCoreCtrl//
#define gpTpDetectorEngine m_pDetectorEngine
#define gpCallback QMainFilter::s_pMainCb
#define CoreCtrl_VoidCall(fun, ...) if( NULL != gpTpCoreCtrl ) gpTpCoreCtrl->##fun##(__VA_ARGS__)
#define CoreCtrl_ReturnCall(def, fun, ...) (NULL != gpTpCoreCtrl) ? gpTpCoreCtrl->##fun##(__VA_ARGS__) : def
#define Main_Callback(fun, ...) if (NULL != gpCallback) gpCallback->##fun##(__VA_ARGS__)
#define Main_ValueCall(def, fun, ...) (NULL != gpCallback) ? gpCallback->##fun##(__VA_ARGS__) : def
#define GET_WIDGET_POINTER(name, widgetType) \
(gpCallback->FindWidgets(name).size() >= 1 ? qobject_cast<widgetType*>(*gpCallback->FindWidgets(name).begin()) : NULL)
inline QTableWidgetItem* get_table_widget_item_ptr(QTableWidget* pTable, int row, int col)
{
Q_ASSERT(pTable);
QTableWidgetItem* pItem = pTable->item(row, col);
if (NULL == pItem){
pItem = new QTableWidgetItem();
pTable->setItem(row, col, pItem);
}
return pItem;
}
inline void tp_enable_widget(const QString& name, bool enable)
{
QWidget* pWidget = GET_WIDGET_POINTER(name, QWidget);
if (pWidget)
pWidget->setEnabled(enable);
}
inline void tp_set_lineedit_validator(const QString& name, QIntValidator* pValid)
{
QLineEdit* pLineEdit = GET_WIDGET_POINTER(name, QLineEdit);
if (pLineEdit)
pLineEdit->setValidator(pValid);
}
inline void tp_show_widget(const QString& name, bool enable)
{
QWidget* pWidget = GET_WIDGET_POINTER(name, QWidget);
if (pWidget)
pWidget->setVisible(enable);
}
template<typename _Widget>
_Widget* replaceWidget(QString name)
{
QWidget* pSrcWidget = GET_WIDGET_POINTER(name, QWidget);
if (!pSrcWidget)
{
return NULL;
}
QWidget* pParent = qobject_cast<QWidget*>(pSrcWidget->parent());
if (!pParent)
{
return NULL;
}
_Widget* pDstWidget = new _Widget;
auto pFrom = pParent->layout()->replaceWidget(pSrcWidget, pDstWidget);
delete pFrom;
return pDstWidget;
}
inline QVariant gui_get_value(const QString& name, QObject* parent = NULL)
{
return tpfunc_get_value(name, parent, gpCallback);
}
inline void qcombobox_add_item(const QString& name, const QStringList& texts, QObject* parent = NULL)
{
return tpfunc_qcombobox_add_item(name, texts, parent, gpCallback);
}
inline void qcombobox_add_item(const QString& name, const QString& text, QObject* parent = NULL)
{
return tpfunc_qcombobox_add_item(name, text, parent, gpCallback);
}
inline void qcombobox_del_item(const QString& name, const QString& text, QObject* parent = NULL)
{
return tpfunc_qcombobox_del_item(name, text, parent, gpCallback);
}
inline void qlistwidget_add_item(const QString& name, const QStringList& texts, QObject* parent = NULL)
{
return tpfunc_qcombobox_add_item(name, texts, parent, gpCallback);
}
inline QWidget* widget_by_property(QObject* pObj, bool bDoubleClicked = false)
{
return tpfunc_widget_by_property(pObj, bDoubleClicked, gpCallback);
}
#endif // QMAINFILTER_H

@ -1,381 +0,0 @@
/******************************************************************************
Copyright(C):2015~2018 hzleaper
FileName:$FILE_BASE$.$FILE_EXT$
Author:zhikun wu
Email:zk.wu@hzleaper.com
Tools:vs2010 pc on company
Created:$DATE$
History:$DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$
*******************************************************************************/
#ifndef __TP_MAIN_HEADER_H
#define __TP_MAIN_HEADER_H
//#define _LOAD_MAIN_DLL_STATIC
#include "tpGuiHeader.h"
#include <QtWidgets\qwidget.h>
#include <QtCore\qprocess.h>
#include <QtGui\qicon.h>
#include <QtWidgets\qlistwidget.h>
#include <QtCore\qstring.h>
#include <QtCore\qobject.h>
#include <QtGui\qimage.h>
#include <QtGui\qpainter.h>
#include <QtWidgets\qcombobox.h>
#include <QtWidgets\qaction.h>
#include <QtWidgets\qpushbutton.h>
#include <QtWidgets\qlineedit.h>
#include <QtWidgets\qcheckbox.h>
#include <QtWidgets\qlcdnumber.h>
#include <QtWidgets\qlabel.h>
#include <QtWidgets\qcombobox.h>
#include <QtWidgets\qstatusbar.h>
#include <QRadioButton>
#include <QPlainTextEdit>
#include <QSpinBox>
#include <QDoubleSpinBox>
//#include "tpProtocol.h"
class TP_PROTOCOL_MESSAGE;
typedef QList<QWidget*> QWidgetList;
typedef QList<QObject*> QObjectList;
typedef QMap<QString, QString> QStrStrMap;
class IMainFilter
{
public:
IMainFilter() {}
virtual ~IMainFilter() {}
virtual int InitMain() = 0;
virtual void FreeMain() = 0;
// 事件响应函数如果返回true则代表后续不需要响应此事件。
// TODO - 现在代码很多没有利用这个返回值。
virtual QWidget* CreateWidget(const QString & className, QWidget * parent, const QString& name) = 0;
virtual bool ActionTrigger(class QAction* pAction, bool bChecked) = 0;
virtual bool OnPaint(QWidget* watched, QPaintEvent* event) = 0;
virtual bool ButtonClicked(class QObject* pButton, bool bChecked) = 0;
virtual bool OnToggled(class QObject* pButton, bool bChecked) = 0;
virtual bool OnPolished(QWidget * watched, QEvent * event) = 0;
virtual bool OnComboxCurrentChanged(QObject * watched, int index) = 0;
virtual bool OnInitMainWindow(QObject * watched) = 0;
virtual bool OnProcessFinished(class QProcess* p, int exitCode, QProcess::ExitStatus exitStatus) = 0;
virtual bool OnProcessError(class QProcess* p, QProcess::ProcessError error) = 0;
virtual bool OnValueChanged(QObject* watched, int i) = 0;
virtual bool OnValueChanged(QObject* watched, double v) = 0;
virtual bool OnValueChanged(QObject* watched, const QString& text) = 0;
virtual bool OnStateChanged(QObject* watched, int state) = 0;
virtual bool OnCurrentChanged(QObject* watched, int index) = 0;
virtual bool OnDoubleClicked(QObject* watched, QMouseEvent* event) = 0;
virtual bool OnMousePress(QObject* watched, QMouseEvent* event) = 0;
virtual bool OnMouseRelease(QObject* watched, QMouseEvent* event) = 0;
virtual bool OnMouseMove(QObject* watched, QMouseEvent* event) = 0;
virtual bool OnNonClientAreaMouseMove(QObject* watched, QMouseEvent* event) = 0;
virtual bool OnNonClientAreaMouseButtonPress(QObject* watched, QMouseEvent* event) = 0;
virtual bool OnKeyPress(QObject* watched, QKeyEvent* event) = 0;
virtual bool OnKeyRelease(QObject* watched, QKeyEvent* event) = 0;
virtual bool OnResize(QWidget* watched, QResizeEvent* event) = 0;
virtual bool OnWidgetClosed(QWidget* watched, QCloseEvent* event) = 0;
virtual bool OnDeferredDelete(QObject* wathced, QEvent* event) = 0;
virtual bool OnVersionUpdate(const QString& sOldVersion, const QString& sNewVersion) = 0;
virtual bool OnLineEditCursorPositionChanged(class QLineEdit* pObj, int nOld, int nNew) = 0;
virtual bool OnLineEditEditingFinished(class QLineEdit* pObj) = 0;
virtual bool OnLineEditSelectionChanged(class QLineEdit* pObj) = 0;
virtual bool OnLineEditTextChanged(class QLineEdit* pObj, const QString& text) = 0;
virtual bool OnLineEditTextEdited(class QLineEdit* pObj, const QString& text) = 0;
virtual bool OnWidgetShow(QWidget* pWidget, QShowEvent* event) = 0;
virtual bool OnWidgetHide(QWidget* pWidget, QHideEvent* event) = 0;
virtual bool OnWheel(QWidget* pWidget, QWheelEvent* event) = 0;
virtual bool onItemSelectionChanged(QWidget* pWidget) = 0;
virtual void onIPCResponse(QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg) = 0;
virtual void OnHandleMessage(const QStringList& listFilterKey, const QJsonObject& jsonObj) = 0;
};
class IMainCallback
{
public:
IMainCallback() {}
virtual ~IMainCallback() {}
//更新某个窗口的的接口在非UI线程中更新窗口时会用signal-slot切换到UI Thread更新窗口
virtual void IUpdateWidget(QWidget* w) = 0;
virtual void IUpdateWidget(const QString& skey, const QObject* parent = NULL) = 0;
//获取DLL路径列表数据在app.json中配置
virtual QStringList IDllPaths() = 0;
//三个设置Widget的包装函数舍弃用下面的 tpfunc_ 开头的inline全局函数
virtual void ISetComboBoxText(const QString& name, const QStrStrMap& textData, QObject* parent = NULL) = 0;
virtual void ISetEditText(const QString& name, const QString& text, QObject* parent = NULL) = 0;
virtual void ISetValue(const QString& name, const QVariant& text, QObject* parent = NULL) = 0;
virtual QObjectList IFindObjects(const QString& objName, QObject* parent = NULL) = 0;
virtual QObjectList IFindObjects(const QStringList& objNames, QObject* parent = NULL) = 0;
virtual QWidgetList FindWidgets(const QString& objName, QObject* parent = NULL) = 0;
virtual QWidgetList FindWidgets(const QRegExp& regExp, QObject* parent = NULL) = 0;
virtual bool IQueueJson(const QString& key, const QJsonObject& json) = 0;
virtual bool IQueuePicture(const QString& name, QImage& img, const QString& format) = 0;
virtual QWidget* IGetWidget(const QString& sKey) = 0;
virtual bool IDelWidget(const QString& sKey) = 0;
virtual bool IDelWidget(QWidget* pWdg) = 0;
virtual void IThumbnailItemAppend(const char* name, const QIcon& icon, const QString& text) = 0;
virtual void IThumbnailItemRemove(const char* name) = 0;
virtual void ISetComboBoxTextData(const QString& name, const QTpStrStrMap& textData, QObject* parent = NULL) = 0;
virtual QJsonObject IJsonUser() = 0;
virtual void ILogString(const QString& str) = 0;
virtual bool IGetUserInfo(QString& user, QString& level) = 0;
virtual bool ISetFilter(QObject* pObject) = 0;
virtual void ISendIPCPackage(TP_PROTOCOL_MESSAGE& msg) = 0;
virtual void IHandleMessage(const QStringList& listFilterKey, const QJsonObject& jsonObj) = 0;
};
//inline functions for conveniece
inline QString tpfunc_main_path(IMainCallback* pCb)
{
if (NULL == pCb)
{
return "";
}
QStringList dllPaths = pCb->IDllPaths();
if (dllPaths.size() == 0)
{
return "";
}
return dllPaths.last();
}
inline bool tpfunc_get_lineedit_text(QString& text, IMainCallback* pCb, const QString& name, QObject* parent = NULL)
{
QWidgetList wdgList = pCb->FindWidgets(name, parent);
for (QWidgetList::iterator it = wdgList.begin(); it != wdgList.end(); ++it)
{
QLineEdit* pEdit = qobject_cast<QLineEdit*>(*it);
if (NULL != pEdit)
{
text = pEdit->text();
return true;
}
}
return false;
}
inline bool tpfunc_get_combobox_current_data(QVariant& v, IMainCallback* pCb, const QString& name, QObject* parent = NULL)
{
QWidgetList wdgList = pCb->FindWidgets(name, parent);
for (QWidgetList::iterator it = wdgList.begin(); it != wdgList.end(); ++it)
{
QComboBox* pCombo = qobject_cast<QComboBox*>(*it);
if (NULL != pCombo)
{
v = pCombo->currentData();
return true;
}
}
return true;
}
inline QListWidgetItem* tpfunc_text_2_listwidget_item(QListWidget* pList, const QString& text, bool bAdd = true)
{
if (NULL == pList)
{
return NULL;
}
if (bAdd)
{
return new QListWidgetItem(text, pList);
}
else
{
QList<QListWidgetItem*> items = pList->findItems(text, Qt::MatchFixedString);
for (QList<QListWidgetItem*>::iterator it = items.begin(); it != items.end(); ++it)
{
pList->removeItemWidget(*it);
delete *it;
}
return NULL;
}
}
inline void tpfunc_set_value(const QString& name, const QVariant& value, QObject* parent, IMainCallback* pCb)
{
pCb->ISetValue(name, value, parent);
}
inline QVariant tpfunc_get_value(const QString& name, QObject* parent, IMainCallback* pCb)
{
QVariantMap vMap;
QTpWidgetList wgtList = pCb->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QLineEdit* pEdit = qobject_cast<QLineEdit*>(*it);
if (NULL != pEdit)
{
return pEdit->text();
}
QLabel* pLabel = qobject_cast<QLabel*>(*it);
if (NULL != pLabel)
{
return pLabel->text();
}
QCheckBox* pBox = qobject_cast<QCheckBox*>(*it);
if (NULL != pBox)
{
return pBox->checkState();
}
QComboBox* pCombo = qobject_cast<QComboBox*>(*it);
if (NULL != pCombo)
{
QVariant v = pCombo->currentData();
if (v.isValid())
{
return v;
}
return pCombo->currentText();
}
QSpinBox* pSpinBox = qobject_cast<QSpinBox*>(*it);
if (pSpinBox){
return pSpinBox->value();
}
QDoubleSpinBox* pDSpinBox = qobject_cast<QDoubleSpinBox*>(*it);
if (pDSpinBox){
return pDSpinBox->value();
}
QLCDNumber* pLcd = qobject_cast<QLCDNumber*>(*it);
if (NULL != pLcd)
{
return pLcd->value();
}
}
return QVariant();
}
inline void tpfunc_qcombobox_add_item(const QString& name, const QStringList& texts, QObject* parent, IMainCallback* pCb)
{
QTpWidgetList wgtList = pCb->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QComboBox* pCombo = qobject_cast<QComboBox*>(*it);
if (NULL == pCombo)
{
continue;
}
pCombo->addItems(texts);
}
}
inline void tpfunc_qcombobox_add_item(const QString& name, const QString& text, QObject* parent, IMainCallback* pCb)
{
QTpWidgetList wgtList = pCb->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QComboBox* pCombo = qobject_cast<QComboBox*>(*it);
if (NULL == pCombo)
{
continue;
}
pCombo->addItem(text);
}
}
inline void tpfunc_qcombobox_del_item(const QString& name, const QString& text, QObject* parent, IMainCallback* pCb)
{
QTpWidgetList wgtList = pCb->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QComboBox* pCombo = qobject_cast<QComboBox*>(*it);
if (NULL == pCombo)
{
continue;
}
int index = pCombo->findText(text);
if (-1 != index)
{
pCombo->removeItem(index);
}
}
}
inline void tpfunc_qlistwidget_add_item(const QString& name, const QStringList& texts, QObject* parent, IMainCallback* pCb)
{
QTpWidgetList wgtList = pCb->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QListWidget* pList = qobject_cast<QListWidget*>(*it);
if (NULL == pList)
{
continue;
}
pList->addItems(texts);
}
}
inline QWidget* tpfunc_widget_by_property(QObject* pObj, bool bDoubleClicked, IMainCallback* pCb)
{
if (NULL == pObj)
{
return NULL;
}
QString uiFile;
if (bDoubleClicked)
{
uiFile = tp_check_string_property(TP_PROP_STRING_DOUBLE_CLICKED_TO_OPEN_UI_FILE, pObj);
}
else
{
uiFile = tp_check_string_property(TP_PROP_STRING_CLICKED_TO_OPEN_UI_FILE, pObj);
}
if (uiFile.isEmpty())
{
return NULL;
}
QWidget* pWg = pCb->IGetWidget(uiFile);
if (NULL != pWg)
{
pWg->setProperty(TP_PROP_STRING_OPENED_BY_OBJECT, pObj->objectName());
}
//pWg->show();
return pWg;
}
inline void tpfunc_widget_enable(const QString& name, bool bEnable, QObject* parent, IMainCallback* pCb)
{
QWidgetList wList = pCb->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wList.begin(); it != wList.end(); ++it)
{
(*it)->setEnabled(bEnable);
}
}
inline void tpfunc_message_to_status(const QString& msg, IMainCallback* pCb, QObject* parent = NULL)
{
QWidgetList wList = pCb->FindWidgets("statusbar", parent);
for (QTpWidgetList::Iterator it = wList.begin(); it != wList.end(); ++it)
{
QStatusBar* pStatus = qobject_cast<QStatusBar*>(*it);
if (NULL != pStatus)
{
pStatus->clearMessage();
pStatus->showMessage(msg);
}
}
}
//
#ifdef TPMAIN_EXPORTS
#define MAIN_API extern "C" __declspec(dllexport)
#else
#ifndef _LOAD_MAIN_DLL_STATIC
#define MAIN_API extern "C"
#else
#define MAIN_API extern "C" __declspec(dllimport)
#endif
#endif
MAIN_API IMainFilter* Main_Create(IMainCallback* pMainCb);
MAIN_API void Main_Delete(IMainFilter* pMain);
#endif

@ -1,21 +0,0 @@
#include "QMainFilter_WheelHubWF2.h"
#include "tpMainHeader.h"
#include "QMainFilter.h"
QMainFilter* gz_mainFilter = NULL;
MAIN_API IMainFilter* Main_Create(IMainCallback* pMainCb)
{
if (NULL == gz_mainFilter)
{
gz_mainFilter = new QMainFilter_WheelHubWF2(pMainCb);
}
return gz_mainFilter;
}
MAIN_API void Main_Delete(IMainFilter* pMain)
{
if (NULL != gz_mainFilter && pMain == gz_mainFilter)
{
delete gz_mainFilter;
gz_mainFilter = NULL;
}
}

@ -1,49 +0,0 @@
/******************************************************************************
Copyright(C):2015~2018 hzleaper
FileName:$FILE_BASE$.$FILE_EXT$
Author:zhikun wu
Email:zk.wu@hzleaper.com
Tools:vs2010 pc on company
Created:$DATE$
History:$DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$
*******************************************************************************/
#ifndef __TP_NET_CLIENT_H
#define __TP_NET_CLIENT_H
#include "zclasses.h"
#include "tpProtocol.h"
typedef struct tagTP_NET_CLIENT_PARAM{
class INetClientCallback* pCallback;
const char* szJsonText;
}TP_NET_CLIENT_PARAM;
#define NET_CLIENT_USER "user_id"
#define NET_HOST_IP "ip"
#define NET_HOST_PORT "port"
#define NET_AUTO_RECONNECT "auto_reconnect"
class INetClient
{
public:
INetClient(){}
virtual ~INetClient(){}
virtual void IGetClientStatus(TP_CLIENT_STATUS& clistatus) = 0;
virtual void ISendMessage(TP_PROTOCOL_MESSAGE& msg) = 0;
virtual void ISendBinaryData(TP_PROTOCOL_MESSAGE& msg, QByteArray& binaryData) = 0;
};
class INetClientCallback
{
public:
INetClientCallback(){}
virtual ~INetClientCallback(){}
virtual void onClientMessageRecevied(QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg) = 0;
virtual void onClientDataReceived(QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg, QSharedPointer<QByteArray> pData) = 0;
virtual void onClientDataSentEnd() = 0;
};
#endif //__TP_NET_CLIENT_H

@ -1,52 +0,0 @@
/******************************************************************************
Copyright(C):2015~2018 hzleaper
FileName:$FILE_BASE$.$FILE_EXT$
Author:zhikun wu
Email:zk.wu@hzleaper.com
Tools:vs2010 pc on company
Created:$DATE$
History:$DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$
*******************************************************************************/
#ifndef __TP_NET_SERVER_H
#define __TP_NET_SERVER_H
#include "zclasses.h"
#include "tpProtocol.h"
typedef struct tagTP_NET_SERVER_PARAM{
class INetServerCallback* pCallback;
const char* szJsonText;//toJsonObject
}TP_NET_SERVER_PARAM;
#define NET_PARAM_KEY_IP "ip"
#define NET_PARAM_KEY_PORT "port"
class INetServer
{
public:
INetServer(){}
virtual ~INetServer(){}
virtual const ClientsStatusMap IGetClientsStatus() = 0;
virtual const TpServerStatus IGetServerStatus() = 0;
virtual void IStartServer() = 0;
virtual void IStopServer() = 0;
virtual void ISendMessage(const QString& strClient, TP_PROTOCOL_MESSAGE& msg) = 0;
virtual void ISendBinaryData(const QString& strClient, TP_PROTOCOL_MESSAGE& msg, QByteArray& binaryData) = 0;
};
class INetServerCallback
{
public:
INetServerCallback() {}
virtual ~INetServerCallback() {}
virtual void onServerMessageRecevied(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg) = 0;
virtual void onServerDataReceived(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg, QSharedPointer<QByteArray> pData) = 0;
virtual void onServerDataSentEnd() = 0;
virtual void onClientConnected(const QString& strClient) = 0;
virtual void onClientDisconnected(const QString& strClient) = 0;
};
#endif //__TP_NET_SERVER_H

@ -1,95 +0,0 @@
#ifndef __TP_PROTOCOL_H__
#define __TP_PROTOCOL_H__
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtCore/qjsonarray.h>
#include <QtCore/QTextStream>
#include <QQueue>
#include <QByteArray>
#include <QMap>
#include <QDateTime>
#include <QTcpSocket>
#include <QSharedPointer>
const quint8 TP_PROTO_VERSION = 77;
const quint8 TP_PROTO_MAGIC = 88;
const quint16 TP_PROTO_SERVER = 9999;
const quint32 TP_PROTO_MAX_SIZE = 100 * 1024 * 1024; //100M
const quint32 TP_PROTO_HEAD_SIZE = 8;
typedef enum TpServerStatus
{
ON_RUNNING = 0,
ON_SHUTDOWN = 1,
}TpServerStatus;
typedef struct tagTP_CLIENT_STATUS
{
QString strClientName;
QString strClientIP;
QString strHostIP;
QAbstractSocket::SocketState status;
int nSessID;
QDateTime tLastActive;
}TP_CLIENT_STATUS;
typedef QMap<QString, TP_CLIENT_STATUS> ClientsStatusMap;
typedef enum TpProtoParserStatus
{
ON_PARSER_INIT = 0,
ON_PARSER_HAED = 1,
ON_PARSER_BODY = 2,
}TpProtoParserStatus;
typedef struct tagTP_PROTOCOL_HEAD
{
quint8 version;
quint8 magic;
quint16 server;
quint32 len;
}TP_PROTOCOL_HEAD;
class TP_PROTOCOL_MESSAGE
{
public:
TP_PROTOCOL_MESSAGE(){}
~TP_PROTOCOL_MESSAGE(){}
public:
TP_PROTOCOL_HEAD head;
QJsonObject body;
};
class TpProtocolEnCode
{
public:
TpProtocolEnCode();
~TpProtocolEnCode();
static QSharedPointer<QByteArray> encode(TP_PROTOCOL_MESSAGE& msg);
};
class TpProtocolDeCode
{
public:
void init();
void clear();
bool parser(QByteArray inData);
bool empty();
QSharedPointer<TP_PROTOCOL_MESSAGE> front();
void pop();
private:
bool parserHead(QByteArray& curData, quint32& curLen, quint32& parserLen, bool & parserBreak);
bool parserBody(QByteArray& curData, quint32& curLen, quint32& parserLen, bool & parserBreak);
private:
TP_PROTOCOL_MESSAGE mCurMsg;
QQueue<QSharedPointer<TP_PROTOCOL_MESSAGE> > mMsgQ;
QByteArray mCurReserved;
TpProtoParserStatus mCurParserStatus;
};
#endif //__TP_PROTOCOL_H__

@ -1,161 +0,0 @@
#include "QFilterImp.h"
#include <QtCore\qcoreevent.h>
#include "zfunctions.h"
#include "QZkJsonParser.h"
QFilterImp::QFilterImp(IDetectorEngine* pDetectorEngine, INetClient* pNetClient, INetServer* pNetServer)
:QSubFilter()
{
}
QFilterImp::~QFilterImp()
{
}
bool QFilterImp::InitSubFilter()
{
return true;
}
void QFilterImp::UnInitSubFilter()
{
}
QWidget* QFilterImp::CreateWidget(const QString & className, QWidget * parent, const QString& name)
{
return NULL;
}
bool QFilterImp::ActionTrigger(class QAction* pAction, bool bChecked)
{
return false;
}
bool QFilterImp::OnPaint(QWidget* watched, QPaintEvent* event)
{
return false;
}
bool QFilterImp::ButtonClicked(class QObject* pButton, bool bChecked)
{
return false;
}
bool QFilterImp::OnToggled(class QObject* pButton, bool bChecked)
{
return false;
}
bool QFilterImp::OnPolished(QWidget * watched, QEvent * event)
{
return false;
}
bool QFilterImp::OnComboxCurrentChanged(QObject * watched, int index)
{
return false;
}
bool QFilterImp::OnInitMainWindow(QObject * watched)
{
return false;
}
bool QFilterImp::OnProcessFinished(class QProcess* p, int exitCode, QProcess::ExitStatus exitStatus)
{
return false;
}
bool QFilterImp::OnProcessError(class QProcess* p, QProcess::ProcessError error)
{
return false;
}
bool QFilterImp::OnValueChanged(QObject* watched, int i)
{
return false;
}
bool QFilterImp::OnValueChanged(QObject* watched, const QString& text)
{
return false;
}
bool QFilterImp::OnStateChanged(QObject* watched, int state)
{
return false;
}
bool QFilterImp::OnCurrentChanged(QObject* watched, int index)
{
return false;
}
bool QFilterImp::OnDoubleClicked(QObject* watched, QMouseEvent* event)
{
return false;
}
bool QFilterImp::OnMousePress(QObject* watched, QMouseEvent* event)
{
return false;
}
bool QFilterImp::OnMouseRelease(QObject* watched, QMouseEvent* event)
{
return false;
}
bool QFilterImp::OnMouseMove(QObject* watched, QMouseEvent* event)
{
return false;
}
bool QFilterImp::OnNonClientAreaMouseMove(QObject* watched, QMouseEvent* event)
{
return false;
}
bool QFilterImp::OnNonClientAreaMouseButtonPress(QObject* watched, QMouseEvent* event)
{
return false;
}
bool QFilterImp::OnKeyPress(QObject* watched, QKeyEvent* event)
{
return false;
}
bool QFilterImp::OnKeyRelease(QObject* watched, QKeyEvent* event)
{
return false;
}
bool QFilterImp::OnResize(QWidget* watched, QResizeEvent* event)
{
return false;
}
bool QFilterImp::OnWidgetClosed(QWidget* watched, QCloseEvent* event)
{
return false;
}
bool QFilterImp::OnDeferredDelete(QObject* wathced, QEvent* event)
{
return false;
}
bool QFilterImp::OnVersionUpdate(const QString& sOldVersion, const QString& sNewVersion)
{
return false;
}
bool QFilterImp::OnLineEditCursorPositionChanged(class QLineEdit* pObj, int nOld, int nNew)
{
return false;
}
bool QFilterImp::OnLineEditEditingFinished(class QLineEdit* pObj)
{
return false;
}
bool QFilterImp::OnLineEditSelectionChanged(class QLineEdit* pObj)
{
return false;
}
bool QFilterImp::OnLineEditTextChanged(class QLineEdit* pObj, const QString& text)
{
return false;
}
bool QFilterImp::OnLineEditTextEdited(class QLineEdit* pObj, const QString& text)
{
return false;
}
bool QFilterImp::OnWidgetShow(QWidget* pWidget, QShowEvent* event)
{
return false;
}
bool QFilterImp::OnWidgetHide(QWidget* pWidget, QHideEvent* event)
{
return false;
}
bool QFilterImp::OnWheel(QWidget* pWidget, QWheelEvent* event)
{
return false;
}

@ -1,61 +0,0 @@
#ifndef QFILTERIMP_H
#define QFILTERIMP_H
#include "zdefines.h"
#include "tpSubFilterHeader.h"
#include "tadpoleGuiHeader.h"
#include "qTpFunctions.h"
#include "tpGuiHeader.h"
#include <QtCore\qtimer.h>
#include "lpbengine.h"
#include "tpNetClient.h"
#include "tpNetServer.h"
class QFilterImp : public QSubFilter
{
Q_OBJECT
public:
QFilterImp(IDetectorEngine* pDetectorEngine, INetClient* pNetClient, INetServer* pNetServer);
virtual ~QFilterImp();
protected://IFilterInterface
virtual bool InitSubFilter();
virtual void UnInitSubFilter();
virtual QWidget* CreateWidget(const QString & className, QWidget * parent, const QString& name);
virtual bool ActionTrigger(class QAction* pAction, bool bChecked);
virtual bool OnPaint(QWidget* watched, QPaintEvent* event);
virtual bool ButtonClicked(class QObject* pButton, bool bChecked);
virtual bool OnToggled(class QObject* pButton, bool bChecked);
virtual bool OnPolished(QWidget * watched, QEvent * event);
virtual bool OnComboxCurrentChanged(QObject * watched, int index);
virtual bool OnInitMainWindow(QObject * watched);
virtual bool OnProcessFinished(class QProcess* p, int exitCode, QProcess::ExitStatus exitStatus);
virtual bool OnProcessError(class QProcess* p, QProcess::ProcessError error);
virtual bool OnValueChanged(QObject* watched, int i);
virtual bool OnValueChanged(QObject* watched, const QString& text);
virtual bool OnStateChanged(QObject* watched, int state);
virtual bool OnCurrentChanged(QObject* watched, int index);
virtual bool OnDoubleClicked(QObject* watched, QMouseEvent* event);
virtual bool OnMousePress(QObject* watched, QMouseEvent* event);
virtual bool OnMouseRelease(QObject* watched, QMouseEvent* event);
virtual bool OnMouseMove(QObject* watched, QMouseEvent* event);
virtual bool OnNonClientAreaMouseMove(QObject* watched, QMouseEvent* event);
virtual bool OnNonClientAreaMouseButtonPress(QObject* watched, QMouseEvent* event);
virtual bool OnKeyPress(QObject* watched, QKeyEvent* event);
virtual bool OnKeyRelease(QObject* watched, QKeyEvent* event);
virtual bool OnResize(QWidget* watched, QResizeEvent* event);
virtual bool OnWidgetClosed(QWidget* watched, QCloseEvent* event);
virtual bool OnDeferredDelete(QObject* wathced, QEvent* event);
virtual bool OnVersionUpdate(const QString& sOldVersion, const QString& sNewVersion);
virtual bool OnLineEditCursorPositionChanged(class QLineEdit* pObj, int nOld, int nNew);
virtual bool OnLineEditEditingFinished(class QLineEdit* pObj);
virtual bool OnLineEditSelectionChanged(class QLineEdit* pObj);
virtual bool OnLineEditTextChanged(class QLineEdit* pObj, const QString& text);
virtual bool OnLineEditTextEdited(class QLineEdit* pObj, const QString& text);
virtual bool OnWidgetShow(QWidget* pWidget, QShowEvent* event);
virtual bool OnWidgetHide(QWidget* pWidget, QHideEvent* event);
virtual bool OnWheel(QWidget* pWidget, QWheelEvent* event);
};
#endif // QFILTERIMP_H

@ -1,21 +0,0 @@
#include "QFilterImp.h"
QFilterImp* gz_FilterImp = NULL;
SUB_FILTER_API QSubFilter* SubFilter_Create(void* param)
{
if (NULL == gz_FilterImp)
{
TP_SUB_FILTER_PARAM* p = (TP_SUB_FILTER_PARAM*)param;
gz_FilterImp = new QFilterImp(p->pDetectorEngine, p->pNetClient, p->pNetServer);
}
return gz_FilterImp;
}
SUB_FILTER_API void SubFilter_Delete(QSubFilter* psf)
{
if (NULL != gz_FilterImp)
{
delete gz_FilterImp;
gz_FilterImp = NULL;
}
}

@ -1,113 +0,0 @@
#ifndef __TP_FILTER_HEADER_H
#define __TP_FILTER_HEADER_H
#include "tpGuiHeader.h"
#include <QtWidgets\qwidget.h>
#include <QtCore\qprocess.h>
#include <QtGui\qicon.h>
#include <QtWidgets\qlistwidget.h>
#include <QtCore\qstring.h>
#include <QtCore\qobject.h>
#include <QtGui\qimage.h>
#include <QtGui\qpainter.h>
#include <QtWidgets\qcombobox.h>
#include <QtWidgets\qaction.h>
#include <QtWidgets\qpushbutton.h>
#include <QtWidgets\qlineedit.h>
#include <QtWidgets\qcheckbox.h>
#include <QtWidgets\qlcdnumber.h>
#include <QtWidgets\qlabel.h>
#include <QtWidgets\qcombobox.h>
#include <QtWidgets\qstatusbar.h>
typedef QList<QWidget*> QWidgetList;
typedef QList<QObject*> QObjectList;
typedef QMap<QString, QString> QStrStrMap;
class TP_PROTOCOL_MESSAGE;
enum emTpUiDataType;
class QSubFilter// : public QObject
{
//Q_OBJECT
public:
//QSubFilter(QObject* parent = NULL):QObject(parent){}
QSubFilter() {}
virtual ~QSubFilter(){};
virtual bool InitSubFilter(){ return true; }
virtual void UnInitSubFilter(){}
virtual QString FilterKey() = 0;
// 事件响应函数如果返回true则代表后续不需要响应此事件。
virtual void VariantMapToUI(emTpUiDataType dataType, const QString& camKey, const QVariantMap& vMap){};
virtual QWidget* CreateWidget(const QString & className, QWidget * parent, const QString& name){ return NULL; }
virtual bool ActionTrigger(class QAction* pAction, bool bChecked) { return false; };
virtual bool OnPaint(QWidget* watched, QPaintEvent* event) { return false; };
virtual bool ButtonClicked(class QObject* pButton, bool bChecked) { return false; };
virtual bool OnToggled(class QObject* pButton, bool bChecked) { return false; };
virtual bool OnPolished(QWidget * watched, QEvent * event) { return false; };
virtual bool OnComboxCurrentChanged(QObject * watched, int index) { return false; };
virtual bool OnInitMainWindow(QObject * watched) { return false; };
virtual bool OnProcessFinished(class QProcess* p, int exitCode, QProcess::ExitStatus exitStatus) { return false; };
virtual bool OnProcessError(class QProcess* p, QProcess::ProcessError error) { return false; };
virtual bool OnValueChanged(QObject* watched, int i) { return false; };
virtual bool OnValueChanged(QObject* watched, double v) { return false; };
virtual bool OnValueChanged(QObject* watched, const QString& text) { return false; };
virtual bool OnStateChanged(QObject* watched, int state) { return false; };
virtual bool OnCurrentChanged(QObject* watched, int index) { return false; };
virtual bool OnDoubleClicked(QObject* watched, QMouseEvent* event) { return false; };
virtual bool OnMousePress(QObject* watched, QMouseEvent* event) { return false; };
virtual bool OnMouseRelease(QObject* watched, QMouseEvent* event) { return false; };
virtual bool OnMouseMove(QObject* watched, QMouseEvent* event) { return false; };
virtual bool OnNonClientAreaMouseMove(QObject* watched, QMouseEvent* event) { return false; };
virtual bool OnNonClientAreaMouseButtonPress(QObject* watched, QMouseEvent* event) { return false; };
virtual bool OnKeyPress(QObject* watched, QKeyEvent* event) { return false; };
virtual bool OnKeyRelease(QObject* watched, QKeyEvent* event) { return false; };
virtual bool OnResize(QWidget* watched, QResizeEvent* event) { return false; };
virtual bool OnWidgetClosed(QWidget* watched, QCloseEvent* event) { return false; };
virtual bool OnDeferredDelete(QObject* wathced, QEvent* event) { return false; };
virtual bool OnVersionUpdate(const QString& sOldVersion, const QString& sNewVersion) { return false; };
virtual bool OnLineEditCursorPositionChanged(class QLineEdit* pObj, int nOld, int nNew) { return false; };
virtual bool OnLineEditEditingFinished(class QLineEdit* pObj) { return false; };
virtual bool OnLineEditSelectionChanged(class QLineEdit* pObj) { return false; };
virtual bool OnLineEditTextChanged(class QLineEdit* pObj, const QString& text) { return false; };
virtual bool OnLineEditTextEdited(class QLineEdit* pObj, const QString& text) { return false; };
virtual bool OnWidgetShow(QWidget* pWidget, QShowEvent* event) { return false; };
virtual bool OnWidgetHide(QWidget* pWidget, QHideEvent* event) { return false; };
virtual bool OnWheel(QWidget* pWidget, QWheelEvent* event) { return false; };
virtual bool onItemSelectionChanged(QWidget* pWidget) { return false; };
//INetServerCallback
virtual bool onServerMessageRecevied(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg) { return false; };
virtual bool onServerDataReceived(const QString& strClient, QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg, QSharedPointer<QByteArray> pData) { return false; };
virtual bool onServerDataSentEnd() { return false; };
virtual bool onClientConnected(const QString& strClient) { return false; };
virtual bool onClientDisconnected(const QString& strClient) { return false; };
//INetClientCallback
virtual bool onClientMessageRecevied(QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg) { return false; };
virtual bool onClientDataReceived(QSharedPointer<TP_PROTOCOL_MESSAGE> pMsg, QSharedPointer<QByteArray> pData) { return false; };
virtual bool onClientDataSentEnd() { return false; };
virtual bool onNewCameraImage(const QVariantMap& vMap) { return false; };
virtual void HandleMessage(const QJsonObject& jsonObj){}
};
typedef struct tagTP_SUB_FILTER_PARAM{
class ICoreCtrl* pCoreCtrl;
class INetServer* pNetServer;
class INetClient* pNetClient;
class IDetectorEngine* pDetectorEngine;
class IMainCallback* pMainCallback;
}TP_SUB_FILTER_PARAM;
#define SUB_FILTER_API extern "C" __declspec(dllexport)
SUB_FILTER_API QSubFilter* SubFilter_Create(void* param);
SUB_FILTER_API void SubFilter_Delete(QSubFilter* psf);
#endif

@ -1,20 +0,0 @@
#ifndef QTPACTION_H
#define QTPACTION_H
#include "tpGuiHeader.h"
#include <QtWidgets\qaction.h>
class QTpAction : public QAction
{
Q_OBJECT
public:
QTpAction(QObject *parent);
virtual ~QTpAction();
private Q_SLOTS:
void OnTriggered(bool bChecked);
};
#endif // QTPACTION_H

@ -1,174 +0,0 @@
#ifndef QTPAPPLICATION_H
#define QTPAPPLICATION_H
#include <QtWidgets\qapplication.h>
#include "qTpFunctions.h"
//#include "QTadpoleCallback.h"
//#include "QTpFilter.h"
#include "tpGuiHeader.h"
#include "QTpProcess.h"
//#include <QtCore\qcoreevent.h>
//#include <QtWidgets\qwidget.h>
#include "QTpAction.h"
#include "QTpComboBox.h"
#include "QTpPushButton.h"
#include "QTpSpinBox.h"
#include "QTpRadioButton.h"
#include "QTpCheckBox.h"
#include "QTpTabWidget.h"
#include "QTpListWidget.h"
#include "QTpStackedWidget.h"
#include <QtWidgets\qdockwidget.h>
#include <qtsingleapplication\qtsingleapplication.h>
#define ADD_FILTER_MEMBER(cls) protected: \
class cls##* m_pFilter;
class QTpApplication : public QtSingleApplication
{
Q_OBJECT
public:
QTpApplication(class QTpFilter* pfilterObj, int& argc, char** argv);
~QTpApplication();
virtual int OnAppIn(int ncode);
virtual int OnAppOut(int ncode);
virtual int Exec(bool bShow = true);
QWidget* GetWidget(const QString& sKey);
bool DelWidget(const QString& sKey);
bool DelWidget(QWidget* pWdg);
//QList<QWidget*> FindWidgets(const QString& objName);
//QList<QObject*> FindObjects(const QString& objName);
QTpWidgetList FindWidgets(const QString& objName, QObject* parent = NULL);
QTpWidgetList FindWidgets(const QRegExp& regExp, QObject* parent = NULL);
QTpObjectList FindObjects(const QString& objName, QObject* parent = NULL);
QJsonObject AppJson();
QString MainWindowName();
void SetEditText(const QString& name, const QString& text, QObject* parent = NULL);
void SetValue(const QString& name, const QVariant& text, QObject* parent = NULL);
QString GetEditText(const QString& name, QObject* parent = NULL);
void SetComboBoxTextData(const QString& name, const QTpStrStrMap& textData, QObject* parent = NULL);
void ShlftFullScreen(const QString& name, QObject* parent = NULL);
void ShlftFullScreen(QObject* pChild);
QWidget* MainWidget();
void WidgetUpdate(QWidget* p) {
emit sgUpdateWidget(p);
}
QString DllPath() {
return m_dllPath;
}
QStringList DllPaths() {
return m_dllPaths;
}
QString MainPath() {
return m_mainPath;
}
static QObject* TopParent(QObject* p) {
if (NULL != p) {
while (NULL != p->parent()) {
p = p->parent();
}
}
return p;
}
static QString CurrentPath() {
return TpExeFileToPath(applicationFilePath());
}
static void AddPluginsPath(char* filePath) {
QString szPath = TpExeFileToPath(QString::fromLocal8Bit(filePath));
QApplication::addLibraryPath(szPath + "plugins");
}
void SetLinkedSlider(/*class QLineEdit* pEdit*/class QObject* pWdg);
void SetLinkedValueEdit(class QSlider* pSlider, int value);
void SetJson2TableWidget(const QJsonObject& json);
bool SetFilter(QObject* pObject);
// void connectSignals();
private:
Q_SIGNALS :
void sgUpdateWidget(QWidget*);
private Q_SLOTS:
void OnUpdateWidget(QWidget* pWgt);
protected:
QString m_mainPath;
QString m_dllPath;
QStringList m_dllPaths;
private:
class QTpUiContainer* m_pContainer;
ADD_FILTER_MEMBER(QTpFilter)
};
#define INIT_FILTER_OBJ(obj) m_pFilter = obj; obj->SetApp(this);
//#define SET_FILTER_MEMBER(obj) m_pFilter = obj;
//#define CALL_SET_APP_FUNC(obj) obj->SetApp(this);
inline bool open_widget_by_property(QObject* pObj, QTpApplication* pApp, bool bDoubleClicked = false)
{
if (NULL == pObj || NULL == pApp)
{
return false;
}
QString uiFile;
if (bDoubleClicked)
{
uiFile = tp_check_string_property(TP_PROP_STRING_DOUBLE_CLICKED_TO_OPEN_UI_FILE, pObj);
}
else
{
uiFile = tp_check_string_property(TP_PROP_STRING_CLICKED_TO_OPEN_UI_FILE, pObj);
}
if (uiFile.isEmpty())
{
return false;
}
QWidget* pWg = pApp->GetWidget(uiFile);
if (NULL == pWg)
{
return false;
}
pWg->setProperty(TP_PROP_STRING_OPENED_BY_OBJECT, pObj->objectName());
if (tp_check_bool_property(TP_PROP_BOOL_STAY_ON_TOP, pObj)){
pWg->setWindowFlags(Qt::WindowStaysOnTopHint);
}
pWg->show();
return true;
}
inline bool clicked_to_show_hide_widget_by_property(QObject* pObj, QTpApplication* pApp)
{
if (NULL == pObj || NULL == pApp)
{
return false;
}
QString objName = tp_check_string_property(TP_PROP_STRING_CLICKED_TO_SHOW_DOCKWIDGET, pObj);
if (objName.isEmpty())
{
return false;
}
QWidgetList wList = pApp->FindWidgets(objName);
if (0 == wList.size())
{
return false;
}
for (QWidgetList::iterator it = wList.begin(); it != wList.end(); ++it)
{
QDockWidget *pDock = qobject_cast<QDockWidget*>(*it);
if (NULL == pDock)
{
continue;
}
if (pDock->isHidden())
{
pDock->show();
}
else
{
pDock->hide();
}
}
//
return true;
}
#endif // QTPAPPLICATION_H

@ -1,31 +0,0 @@
#ifndef QTPCAMERA_H
#define QTPCAMERA_H
#include <QtWidgets\qwidget.h>
#include "QTpPicture.h"
#include "QTpLabel.h"
#include <QtCore\qjsonobject.h>
#define QTPCAMERA_NAME_PREFIX "QTpCamera_"
class QTpCamera : public QWidget
{
Q_OBJECT
public:
QTpCamera(const QString& wdgName, const QJsonObject& jsonCamera, QWidget *parent);
virtual ~QTpCamera();
void SetTitle(const QString& titile);
//QString GetShowName() {
// return m_strShowName;
//}
QTpPicture* PictureWidget() {
return m_pPicture;
}
private:
QTpLabel* m_pTitle;
QTpPicture* m_pPicture;
QString m_strShowName;
};
#endif // QTPCAMERA_H

@ -1,20 +0,0 @@
#ifndef QTPCAMERAESSCENE_H
#define QTPCAMERAESSCENE_H
#include <QtWidgets\qgraphicsscene.h>
#include <QtWidgets\qgraphicsproxywidget.h>
#include "QTpCamera.h"
class QTpCameraesScene : public QGraphicsScene
{
Q_OBJECT
public:
QTpCameraesScene(const QString& objName, const QJsonObject& jsonCfg, QWidget *parent);
~QTpCameraesScene();
void AddCameraes(const QJsonObject& jsonCfg);
private:
QWidget* m_parentWidget;
};
#endif // QTPCAMERAESSCENE_H

@ -1,30 +0,0 @@
#ifndef QTPCAMERAESWINDOW_H
#define QTPCAMERAESWINDOW_H
#include <QtWidgets\qscrollarea.h>
#include <QtWidgets\qgridlayout.h>
#include <QtCore\qmap.h>
#include <QtCore\qjsonobject.h>
#include "QTpCamera.h"
class QTpCameraesWindow : public QScrollArea
{
Q_OBJECT
public:
QTpCameraesWindow(const QString& objName, const QJsonObject& jsonCfg, QWidget *parent);
virtual ~QTpCameraesWindow();
//callback interfaces
void AddCameraes(const QJsonObject& jsonCfg);
// QString GetShowName(const QString& objName);
QGridLayout& GetGridLayout() {
return m_topLayout;
}
private:
QWidget m_topWidget;
QGridLayout m_topLayout;
QMap<QString, class QTpCamera*> m_tpCameraes;
};
#endif // QTPCAMERAESWINDOW_H

@ -1,20 +0,0 @@
#ifndef QTPCHECKBOX_H
#define QTPCHECKBOX_H
#include <QtWidgets\qcheckbox.h>
class QTpCheckBox : public QCheckBox
{
Q_OBJECT
public:
QTpCheckBox(QWidget *parent);
~QTpCheckBox();
private Q_SLOTS:
void OnStateChanged(int nState);
private:
};
#endif // QTPCHECKBOX_H

@ -1,19 +0,0 @@
#ifndef QTPCOMBOBOX_H
#define QTPCOMBOBOX_H
#include <QtWidgets\qcombobox.h>
class QTpComboBox : public QComboBox
{
Q_OBJECT
public:
QTpComboBox(QWidget *parent);
~QTpComboBox();
private Q_SLOTS:
void onSetCurrentIndex(int index);
};
#endif // QTPCOMBOBOX_H

@ -1,18 +0,0 @@
#ifndef QTPCUSTOMPLOT_H
#define QTPCUSTOMPLOT_H
#include <qcustomplot/qcustomplot.h>
class QTpCustomPlot : public QCustomPlot
{
Q_OBJECT
public:
QTpCustomPlot(QWidget *parent = NULL);
virtual ~QTpCustomPlot();
private:
};
#endif // QTPCUSTOMPLOT_H

@ -1,20 +0,0 @@
#ifndef QTPDOUBLESPINBOX_H
#define QTPDOUBLESPINBOX_H
#include <QtWidgets\qspinbox.h>
class QTpDoubleSpinBox : public QDoubleSpinBox
{
Q_OBJECT
public:
QTpDoubleSpinBox(QWidget *parent);
~QTpDoubleSpinBox();
private Q_SLOTS:
void OnValueChanged(double v);
void OnValueChanged(const QString& text);
private:
};
#endif // QTPDOUBLESPINBOX_H

@ -1,164 +0,0 @@
#ifndef QTPFILTEROBJECT_H
#define QTPFILTEROBJECT_H
#include "tpGuiHeader.h"
#include "QTpApplication.h"
#include <QtCore\qprocess.h>
#include <QtWidgets\qwidget.h>
#include <QtWidgets\qdialog.h>
#include <QtWidgets\qspinbox.h>
#include <QtWidgets\qlineedit.h>
#include <QtWidgets\qlabel.h>
#ifndef tpDebugOut
#define tpDebugOut(...) qDebug(__VA_ARGS__)
#endif
#define ADD_APP_MEMBER(cls) \
public: \
void SetApp(class cls##* pApp) { \
m_pApp = pApp; \
} \
protected: \
class cls##* m_pApp;
#define INIT_APP_MEMBER m_pApp = NULL;
class QTpFilter : public QObject//public QTpObject
{
Q_OBJECT
public:
QTpFilter(QObject *parent = NULL);
~QTpFilter();
void WidgetUpdate(QWidget* p) {
emit sgUpdateWidget(p);
}
virtual QWidget* CreateWidget(const QString & className, QWidget * parent, const QString& name);
virtual bool ActionTrigger(class QAction* pAction, bool bChecked);
virtual bool OnPaint(QWidget* watched, QPaintEvent* event);
virtual bool ButtonClicked(class QObject* pButton, bool bChecked);
virtual bool OnToggled(class QObject* pButton, bool bChecked);
virtual bool OnPolished(QWidget * watched, QEvent * event);
virtual bool OnComboxCurrentChanged(QObject * watched, int index);
virtual bool OnInitMainWindow(QObject * watched);
virtual bool OnProcessFinished(class QProcess* p, int exitCode, QProcess::ExitStatus exitStatus);
virtual bool OnProcessError(class QProcess* p, QProcess::ProcessError error);
virtual bool OnValueChanged(QObject* watched, int i);
virtual bool OnValueChanged(QObject* watched, double v);
virtual bool OnValueChanged(QObject* watched, const QString& text);
virtual bool OnStateChanged(QObject* watched, int state);
virtual bool OnCurrentChanged(QObject* watched, int index);
virtual bool OnDoubleClicked(QObject* watched, QMouseEvent* event);
virtual bool OnMousePress(QObject* watched, QMouseEvent* event);
virtual bool OnMouseRelease(QObject* watched, QMouseEvent* event);
virtual bool OnMouseMove(QObject* watched, QMouseEvent* event);
virtual bool OnNonClientAreaMouseMove(QObject* watched, QMouseEvent* event);
virtual bool OnNonClientAreaMouseButtonPress(QObject* watched, QMouseEvent* event);
virtual bool OnKeyPress(QObject* watched, QKeyEvent* event);
virtual bool OnKeyRelease(QObject* watched, QKeyEvent* event);
virtual bool OnResize(QWidget* watched, QResizeEvent* event);
virtual bool OnWidgetClosed(QWidget* watched, QCloseEvent* event);
virtual bool OnDeferredDelete(QObject* wathced, QEvent* event);
virtual bool OnVersionUpdate(const QString& sOldVersion, const QString& sNewVersion);
virtual bool OnLineEditCursorPositionChanged(class QLineEdit* pObj, int nOld, int nNew) { return false; }
virtual bool OnLineEditEditingFinished(class QLineEdit* pObj);
virtual bool OnLineEditSelectionChanged(class QLineEdit* pObj) { return false; }
virtual bool OnLineEditTextChanged(class QLineEdit* pObj, const QString& text);
virtual bool OnLineEditTextEdited(class QLineEdit* pObj, const QString& text) { return false; }
virtual bool OnWidgetShow(QWidget* pWidget, QShowEvent* event) { return false; }
virtual bool OnWidgetHide(QWidget* pWidget, QHideEvent* event) { return false; }
virtual bool OnSliderValueChanged(class QSlider* pObj, int value);
virtual bool OnSliderMoved(class QSlider* pObj, int value);
virtual bool onItemSelectionChanged(QWidget* watched) { return false; }
protected:
virtual bool eventFilter(QObject * watched, QEvent * event);
Q_SIGNALS:
void sgUpdateWidget(QWidget*);
private Q_SLOTS:
void OnUpdateWidget(QWidget* pWgt);
protected:
// class QTpUiContainer* m_pUiContainer;
ADD_APP_MEMBER(QTpApplication)
};
inline void tp_app_set_spinbox_value(const QString& name, int iv, QTpApplication* pApp, QObject* parent = NULL)
{
if (NULL == pApp)
{
return;
}
QTpWidgetList wgtList = pApp->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QSpinBox* pSpinBox = qobject_cast<QSpinBox*>(*it);
if (NULL != pSpinBox)
{
pSpinBox->setValue(iv);
}
}
}
inline bool tp_app_get_spinbox_value(const QString& name, int& iv, QTpApplication* pApp, QObject* parent = NULL)
{
if (NULL == pApp)
{
return false;
}
QTpWidgetList wgtList = pApp->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QSpinBox* pSpinBox = qobject_cast<QSpinBox*>(*it);
if (NULL != pSpinBox)
{
iv = pSpinBox->value();
return true;
}
}
return false;
}
inline QVariant tp_app_get_variant(QTpApplication* pApp, const QString& name, QObject* parent = NULL)
{
QTpWidgetList wgtList = pApp->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QLineEdit* pEdit = qobject_cast<QLineEdit*>(*it);
if (NULL != pEdit)
{
return QVariant(pEdit->text());
}
QComboBox* pCombo = qobject_cast<QComboBox*>(*it);
if (NULL != pCombo)
{
return QVariant(pCombo->currentText());
}
}
return QVariant();
}
inline void tp_app_set_variant(const QVariant& v, QTpApplication* pApp, const QString& name, QObject* parent = NULL)
{
QTpWidgetList wgtList = pApp->FindWidgets(name, parent);
for (QTpWidgetList::Iterator it = wgtList.begin(); it != wgtList.end(); ++it)
{
QLineEdit* pEdit = qobject_cast<QLineEdit*>(*it);
if (NULL != pEdit)
{
pEdit->setText(v.toString());
continue;
}
QComboBox* pCombo = qobject_cast<QComboBox*>(*it);
if (NULL != pCombo)
{
pCombo->addItem(v.toString(), v);
continue;
}
QLabel* pLabel = qobject_cast<QLabel*>(*it);
if (NULL != pLabel)
{
pLabel->setText(v.toString());
continue;
}
}
}
#endif // QTPFILTEROBJECT_H

@ -1,20 +0,0 @@
#ifndef QTPGRAPHICSVIEW_H
#define QTPGRAPHICSVIEW_H
#include <QtWidgets\qgraphicsview.h>
#include <QtWidgets\qgraphicsscene.h>
#include <QtCore\qjsonobject.h>
class QTpGraphicsView : public QGraphicsView
{
Q_OBJECT
public:
QTpGraphicsView(QWidget * parent = 0, const QJsonObject& jObj = QJsonObject());
~QTpGraphicsView();
private:
QGraphicsScene* m_pScene;
};
#endif // QTPGRAPHICSVIEW_H

@ -1,32 +0,0 @@
#ifndef QTPJSONFILE_H
#define QTPJSONFILE_H
#include "QZkJsonParser.h"
#include <QtCore\qreadwritelock.h>
class QTpJsonFile
{
public:
QTpJsonFile(const QString& fileName);
~QTpJsonFile();
int GetInt(const QString& skey, int nDefault);
void SetInt(const QString& skey, int value);
QString GetString(const QString& skey, const QString& default = "");
void SetString(const QString& skey, const QString& value);
bool Save(bool bWait = true);
private:
void Insert(const QString& skey, const QJsonValue& v) {
m_bNeedSave = true;
QWriteLocker locker(&m_wLock);
m_jsonObj.insert(skey, v);
}
private:
const static char cs_szSuffix[];
QJsonObject m_jsonObj;
QString m_fileName;
bool m_bNeedSave;
QReadWriteLock m_wLock;
};
#endif // QTPJSONFILE_H

@ -1,26 +0,0 @@
#ifndef QTPJSONSETTING_H
#define QTPJSONSETTING_H
#include <QtWidgets\qformlayout.h>
#include <QtCore\qjsonobject.h>
class QTpJsonSetting : public QFormLayout
{
Q_OBJECT
public:
QTpJsonSetting(QWidget *parent);
~QTpJsonSetting();
void SetJson(const QJsonObject& json) {
m_json = json;
}
QJsonObject GetJson() {
return m_json;
}
private:
void reconstruct();
private:
QJsonObject m_json;
};
#endif // QTPJSONSETTING_H

@ -1,18 +0,0 @@
#ifndef QTPLABEL_H
#define QTPLABEL_H
#include <QtWidgets\qlabel.h>
class QTpLabel : public QLabel
{
Q_OBJECT
public:
QTpLabel(QWidget *parent);
virtual ~QTpLabel();
private:
};
#endif // QTPLABEL_H

@ -1,24 +0,0 @@
#ifndef QTPLINEEDIT_H
#define QTPLINEEDIT_H
#include <QtWidgets\qlineedit.h>
class QTpLineEdit : public QLineEdit
{
Q_OBJECT
public:
QTpLineEdit(QWidget *parent);
~QTpLineEdit();
private Q_SLOTS:
void OnCursorPositionChanged(int nOld, int nNew);
void OnEditingFinished();
void OnReturnPressed();
void OnSelectionChanged();
void OnTextChanged(const QString& text);
void OnTextEdited(const QString& text);
private:
};
#endif // QTPLINEEDIT_H

@ -1,21 +0,0 @@
#ifndef QTPLISTWIDGET_H
#define QTPLISTWIDGET_H
#include <QListWidget>
class QTpListWidget : public QListWidget
{
Q_OBJECT
public:
QTpListWidget(QWidget *parent);
~QTpListWidget();
private slots:
void onCurrentRowChanged(int index);
void onItemSelectionChanged();
private:
};
#endif // QTPLISTWIDGET_H

@ -1,17 +0,0 @@
#ifndef QTPMAINWINDOW_H
#define QTPMAINWINDOW_H
#include <QtWidgets\qmainwindow.h>
#include <QtWidgets\qdockwidget.h>
//#include "QTadpoleCallback.h"
class QTpMainWindow : public QMainWindow
{
Q_OBJECT
public:
QTpMainWindow(QWidget *parent = NULL);
virtual ~QTpMainWindow();
};
#endif // QTPMAINWINDOW_H

@ -1,44 +0,0 @@
#ifndef QTPMULTIINPUTDIALOG_H
#define QTPMULTIINPUTDIALOG_H
#include <QtWidgets/QDialog>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QVBoxLayout>
#include <QtGui/QRegExpValidator>
class QTpMultiInputDialog : public QDialog
{
Q_OBJECT
public:
QTpMultiInputDialog(int count, QWidget *parent = 0);
virtual ~QTpMultiInputDialog();
QString ShowDlg(int nIndex);
void SetLabelTexts(const QStringList &listText);
void SetOneLabelText(int nIndex, const QString &text);
void SetOneLineEditText(int nIndex, const QString &text);
QString GetOneLineEditText(int nIndex);
void SetOneLineEditReadOnly(int nIndex, bool bRead);
void SetLabelsWidth(int width);
void SetLineEditWidth(int width);
void SetLineEditRegExp(int nIndex, QRegExp regExp);
virtual void accept() { QDialog::accept(); }
virtual void reject() { QDialog::reject(); }
private:
const int m_GroupCount;
QVector<QLabel*> m_vecLabel;
QVector<QLineEdit*> m_vecLineEdit;
QPushButton *m_pOKButton;
QPushButton *m_pCancelButton;
};
#endif // QTPMULTIINPUTDIALOG_H

@ -1,18 +0,0 @@
#ifndef QTPPICTURE_H
#define QTPPICTURE_H
#include <QtWidgets\qframe.h>
class QTpPicture : public QFrame
{
Q_OBJECT
public:
QTpPicture(QWidget *parent);
virtual ~QTpPicture();
private:
//virtual void paintEvent(QPaintEvent *event);
};
#endif // QTPPICTURE_H

@ -1,20 +0,0 @@
#ifndef QTPPROCESS_H
#define QTPPROCESS_H
#include <QtCore\qprocess.h>
class QTpProcess : public QProcess
{
Q_OBJECT
public:
QTpProcess(QObject *parent = NULL);
~QTpProcess();
private Q_SLOTS:
void OnFinished(int exitCode, QProcess::ExitStatus exitStatus);
void OnError(QProcess::ProcessError error);
private:
};
#endif // QTPPROCESS_H

@ -1,19 +0,0 @@
#ifndef QTPPUSHBUTTON_H
#define QTPPUSHBUTTON_H
#include <QtWidgets\qpushbutton.h>
class QTpPushButton : public QPushButton
{
Q_OBJECT
public:
QTpPushButton(QWidget *parent);
~QTpPushButton();
private Q_SLOTS:
void OnClicked(bool checked = false);
private:
};
#endif // QTPPUSHBUTTON_H

@ -1,21 +0,0 @@
#ifndef QTPRADIOBUTTON_H
#define QTPRADIOBUTTON_H
#include <QtWidgets\qradiobutton.h>
class QTpRadioButton : public QRadioButton
{
Q_OBJECT
public:
QTpRadioButton(QWidget *parent);
~QTpRadioButton();
private Q_SLOTS:
void OnToggled(bool bchecked);
void OnClicked(bool bchecked);
private:
};
#endif // QTPRADIOBUTTON_H

@ -1,19 +0,0 @@
#ifndef QTPSLIDER_H
#define QTPSLIDER_H
#include <QtWidgets\qslider.h>
class QTpSlider : public QSlider
{
Q_OBJECT
public:
QTpSlider(QWidget *parent);
~QTpSlider();
private Q_SLOTS :
void OnValueChanged(int value);
void OnSliderMoved(int value);
};
#endif // QTPSLIDER_H

@ -1,20 +0,0 @@
#ifndef QTPSPINBOX_H
#define QTPSPINBOX_H
#include <QtWidgets\qspinbox.h>
class QTpSpinBox : public QSpinBox
{
Q_OBJECT
public:
QTpSpinBox(QWidget *parent);
~QTpSpinBox();
private Q_SLOTS:
void OnValueChanged(int i);
void OnValueChanged(const QString& text);
private:
};
#endif // QTPSPINBOX_H

@ -1,21 +0,0 @@
#ifndef QTPSTACKEDWIDGET_H
#define QTPSTACKEDWIDGET_H
#include <QStackedWidget>
class QTpStackedWidget : public QStackedWidget
{
Q_OBJECT
public:
QTpStackedWidget(QWidget *parent);
~QTpStackedWidget();
private slots:
void onSetCurrentIndex(int index);
private:
};
#endif // QTPSTACKEDWIDGET_H

@ -1,19 +0,0 @@
#ifndef QTPTABWIDGET_H
#define QTPTABWIDGET_H
#include <QtWidgets\qtabwidget.h>
class QTpTabWidget : public QTabWidget
{
Q_OBJECT
public:
QTpTabWidget(QWidget *parent);
~QTpTabWidget();
private Q_SLOTS:
void OnCurrentChanged(int index);
private:
};
#endif // QTPTABWIDGET_H

@ -1,19 +0,0 @@
#ifndef QTPTABLEWIDGET_H
#define QTPTABLEWIDGET_H
#include <QTableWidget>
class QTpTableWidget : public QTableWidget
{
Q_OBJECT
public:
QTpTableWidget(QWidget *parent);
~QTpTableWidget();
private Q_SLOTS:
void onItemSelectionChanged();
private:
};
#endif // QTPTABLEWIDGET_H

@ -1,19 +0,0 @@
#ifndef QTPTOOLBUTTON_H
#define QTPTOOLBUTTON_H
#include <QtWidgets\qtoolbutton.h>
class QTpToolButton : public QToolButton
{
Q_OBJECT
public:
QTpToolButton(QWidget *parent);
~QTpToolButton();
private Q_SLOTS:
void OnClicked(bool checked = false);
private:
};
#endif // QTPTOOLBUTTON_H

@ -1,208 +0,0 @@
/******************************************************************************
Copyright(C):2015~2018 hzleaper
FileName:$FILE_BASE$.$FILE_EXT$
Author:zhikun wu
Email:zk.wu@hzleaper.com
Tools:vs2010 pc on company
Created:$DATE$
History:$DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$
*******************************************************************************/
#ifndef __Q_TP_FUNCTIONS_H
#define __Q_TP_FUNCTIONS_H
//#include "baseStruct.h"
#include "tpGuiHeader.h"
#include <QtCore\qregularexpression.h>
#include <QtCore\qjsonarray.h>
#include <QtCore\qpoint.h>
#include <QtCore\qrect.h>
#include <QtCore\qvector.h>
#include <QtCore\qfile.h>
#include <QtWidgets\qwidget.h>
#include <QtWidgets\qtreewidget.h>
#include <QtCore\qjsonobject.h>
#include <QFileInfo>
#include <QDir>
#include <QDebug>
inline void TpRectMaxRB(const QRect& rect, QRect& rtMax) {
if (rect.right() > rtMax.right()) {
rtMax.setRight(rect.right());
}
if (rect.bottom() > rtMax.bottom()) {
rtMax.setBottom(rect.bottom());
}
}
inline QString TpExeFileToPath(QString& strExe) {
QFileInfo fph(strExe);
return fph.absolutePath() + QString("/");
}
inline QString TpExeFileName(QString& strExe) {
QFileInfo fph(strExe);
if (!fph.exists())
{
qWarning() << "Invalid file path : " << strExe;
return QString("");
}
return fph.baseName();
}
inline bool TpJsonArray2Point(const QJsonArray& jsonArray, QPoint& point) {
if (jsonArray.isEmpty() || jsonArray.size() < 2) {
return false;
}
point.setX(jsonArray[0].toInt());
point.setY(jsonArray[1].toInt());
return true;
}
inline bool TpJsonArray2Rect(const QJsonArray& jsonArray, QRect& rect) {
if (jsonArray.isEmpty() || jsonArray.size() < 4) {
return false;
}
rect.setX(jsonArray[0].toInt());
rect.setY(jsonArray[1].toInt());
rect.setWidth(jsonArray[2].toInt());
rect.setHeight(jsonArray[3].toInt());
return true;
}
inline bool TpJsonArray2RectF(const QJsonArray& jsonArray, QRectF& rectF) {
if (jsonArray.isEmpty() || jsonArray.size() < 4) {
return false;
}
rectF.setX(jsonArray[0].toDouble());
rectF.setY(jsonArray[1].toDouble());
rectF.setWidth(jsonArray[2].toDouble());
rectF.setHeight(jsonArray[3].toDouble());
return true;
}
inline QVector<int> TpSplitSize(int nTotals, int splits)
{
QVector<int> vt(splits);
int blkSize = nTotals / splits;
int blkRem = nTotals % splits;
int blks = 0;
for (int i = 0; i < splits; ++i)
{
blks += blkSize;
if (blkRem > 0)
{
blks += 1;
--blkRem;
}
vt[i] = blks;
}
return vt;
}
inline QVector<int> TpSplitFixedSize(int nTotals, int size, int d)
{
QVector<int> vt;
if (size <= 0)
{
size = nTotals;
}
int nBlk = size;
if (d > 0)
{
nBlk = d;
}
else
{
nBlk += d;
}
while (nBlk < nTotals)
{
vt.append(nBlk);
nBlk += size;
}
vt.append(nTotals);
return vt;
}
#define __SPECIAL_EXE_NAME "leaper.exe"
#define __SPECIAL_CODE "abcdeaxx&&88**xxdddr88**dfejjjf"
inline bool TpExeCanStart(int argc, const char *argv[])
{
QString sExe(argv[0]);
if (sExe.endsWith(__SPECIAL_EXE_NAME, Qt::CaseInsensitive) ||
(argc >= 2 && 0 == strcmp(__SPECIAL_CODE, argv[1])) )
{
return true;
}
return false;
}
#define __SPECIAL_FILE_FOR_UPDATED "update.leaper"
inline bool TpIsUpdated(const QString& szMainPath, bool bCreate = true)
{
QFile file(szMainPath + __SPECIAL_FILE_FOR_UPDATED);
if (file.exists())
{
return false;
}
if (bCreate)
{
file.open(QFile::WriteOnly);
}
return true;
}
inline QObject* TpTopParent(QObject* p)
{
if (NULL != p)
{
while (NULL != p->parent())
{
p = p->parent();
}
}
return p;
}
inline QWidget* TpTopWidget(QObject* p)
{
QWidget* pw = NULL;
while (NULL != p)
{
if (p->isWidgetType())
{
pw = qobject_cast<QWidget*>(p);
}
p = p->parent();
}
return pw;
}
inline void TpPathChecked(QString& szPath)
{
if (!szPath.endsWith("/") && !szPath.endsWith("\\"))
{
szPath.append("/");
}
}
inline QTpObjectList TpFindObjects(const QString& objName, QObject* parent)
{
QTpObjectList objList;
if (NULL != parent)
{
objList.append(parent->findChildren<QObject*>(objName));
if (objName == parent->objectName())
{
objList.append(parent);
}
}
return objList;
}
inline bool TpWidgetLessThan(const QWidget* p1, const QWidget* p2)
{
return p1->objectName() < p2->objectName();
}
#endif

@ -1,188 +0,0 @@
/******************************************************************************
Copyright(C):2015~2018 hzleaper
FileName:$FILE_BASE$.$FILE_EXT$
Author:zhikun wu
Email:zk.wu@hzleaper.com
Tools:vs2010 pc on company
Created:$DATE$
History:$DAY$:$MONTH$:$YEAR$ $HOUR$:$MINUTE$
*******************************************************************************/
#ifndef __TP_GUI_HEADER_H
#define __TP_GUI_HEADER_H
#include <QtCore\qobject.h>
#include <QtCore\qvariant.h>
#include <QtGui\qimage.h>
#include "QTpListWidget.h"
#include "QTpStackedWidget.h"
/*
class QTpObject : public QObject
{
public:
QTpObject(QObject *parent = NULL)
: QObject(parent) {}
virtual ~QTpObject() {}
// virtual bool ActionTrigger(class QObject* pAction, bool bChecked) = 0;
};
*/
typedef QList<QWidget*> QTpWidgetList;
typedef QList<QObject*> QTpObjectList;
typedef QMap<QString, QString> QTpStrStrMap;
#define TP_APP_MAIN_WIDGET_NAME "main"
#define TP_GLOBAL_ACTION_FULL_SCREEN "tp_global_action_full_screen"
#define TP_GLOBAL_PUSHBUTTON_FULL_SCREEN "tp_global_button_full_screen"
#define TP_GLOBAL_ACTION_OPEN_IMAGES "tp_global_action_open_images"
#define TP_GLOBAL_PUSHBUTTON_OPEN_IMAGES "tp_global_button_open_images"
#define TP_GLOBAL_WIDGET_THUMBNAIL_DEFAULT "tp_global_widget_thumbnail_default"
#define TP_GLOBAL_LISTWIDGET_THUMBNAIL "tp_global_listwidget_thumbnail"
#define TP_GLOBAL_DIALOG_PUSHBUTTON_OK "tp_global_dialog_pushbutton_ok"
#define TP_GLOBAL_DIALOG_PUSHBUTTON_CANCEL "tp_global_dialog_pushbutton_cancel"
#define TP_GLOBAL_BUTTON_OPEN_KEYBOARD "tp_global_dialog_pushbutton_keyboard"
#define WIDGET_UI_FILE_HEAD "WIDGET_UI_FILE_"
//property names
#define TP_PROP_STRING_WIDGET_KEY "tp_prop_string_widget_key"
#define TP_PROP_BOOL_HIDE_TITLE_WIDGET "tp_prop_bool_hide_title_widget"
#define TP_PROP_BOOL_FULL_SCREEN "tp_prop_bool_full_screen"
#define TP_PROP_BOOL_STAY_ON_TOP "tp_prop_bool_stay_on_top"
#define TP_PROP_BOOL_NO_DOCK_FEATURE "tp_prop_bool_no_dock_feature"
#define TP_PROP_BOOL_CLOSE_TO_DELETE "tp_prop_bool_close_to_delete"
#define TP_PROP_BOOL_DOUBLE_CLICKED_TO_ZOOM "tp_prop_bool_double_clicked_to_zoom"
#define TP_PROP_BOOL_START_TO_HIDE_WIDGET "tp_prop_bool_start_to_hide_widget"
#define TP_PROP_STRING_CLICKED_TO_SHOW_DOCKWIDGET "tp_prop_string_clicked_to_show_dockwidget"
#define TP_PROP_STRING_CLICKED_TO_OPEN_UI_FILE "tp_prop_string_clicked_to_open_ui_file"
#define TP_PROP_STRING_DOUBLE_CLICKED_TO_OPEN_UI_FILE "tp_prop_string_double_clicked_to_open_ui_file"
#define TP_PROP_STRING_DIR_PATH "tp_prop_string_dir_path"
#define TP_PROP_STRINGLIST_SELECTED_FILES "tp_prop_stringlist_slected_files"
#define TP_PROP_STRING_EDIT_VALUE_SLIDE "tp_prop_string_edit_value_slide"//property in edit, value is the name of a slider
#define TP_PROP_STRING_SLIDE_VALUE_EDIT "tp_prop_string_slide_value_edit"//property in slide, value is the name of a edit
//#define TP_PROP_BOOL_SCROLL_AREA_VERTICAL_EXTEND "tp_prop_bool_scroll_area_vertical_extend"
//#define TP_PROP_INT_SCROLL_AREA_LIMITS "tp_prop_int_scroll_area_limits"
//#define TP_PROP_STRING_SCROLL_AREA_NODE_UI_FILE "tp_prop_string_scroll_area_node_ui_file"
#define TP_PROP_STRING_UI_FILE_EXTEND "tp_prop_string_ui_file_extend"
#define TP_PROP_POINTSLIST_CURVE "tp_prop_pointslist_curve"
//for TP_GLOBAL_WIDGET_ZOOM_IMAGE//原图放到窗口相关的属性和对象名称
//#define TP_GLOBAL_WIDGET_THUMBNAIL "tp_global_widget_thumbnail"
//#define TP_GLOBAL_WIDGET_IMAGE "tp_global_widget_image"//the widget only for drawing image
#define TP_GLOBAL_WIDGET_ZOOM_IMAGE "tp_global_widget_zoom_image"
#define TP_PROP_QIMAGE_FOR_ZOOM "tp_prop_qimage_for_zoom"
#define TP_PROP_STRING_FOR_ZOOM "tp_prop_string_for_zoom"//whole name of the image's file
#define TP_PROP_FLOAT_SCALE_FOR_ZOOM "tp_prop_float_scale_for_zoom"//1.0 is original scale
//
//#define TP_GLOBAL_WIDGET_THUMBTAIL_MAIN "tp_global_widget_thumbtail_main"
//#define TP_GLOBAL_WIDGET_THUMBTAIL_LAYOUT "tp_global_widget_thumbtail_layout"
//
#define TP_PROP_STRING_OPENED_BY_OBJECT "tp_prop_string_opened_by_object"
#define TP_GLOBAL_TABLE_WIDGET_JSONS "tp_global_table_widget_jsons"
#define TP_PROP_STRINGLIST_TABLE_WIDGET_JSON_KEYS "tp_prop_stringlist_table_widget_json_keys"
#define TP_PROP_STRING_WIDGET_JSON_FILE "tp_prop_string_widget_json_file"
#define TP_PROP_STRINGLIST_COMBOBOX_VALUES "tp_prop_stringlist_combobox_values"
#define TP_PROP_STRING_SHILFT "tp_prop_string_shilft"
#define TP_GLOBAL_CONFIG_DIALOG "tp_global_config_dialog"
inline bool tp_check_bool_property(const char* sname, const QObject* pObj)
{
QVariant var = pObj->property(sname);
if (!var.isValid())
{
return false;
}
else
{
return var.toBool();
}
}
inline QString tp_check_string_property(const char* name, const QObject* pObj)
{
QVariant var = pObj->property(name);
if (!var.isValid())
{
return NULL;
}
else
{
return var.toString();
}
}
inline QStringList tp_check_stringlist_property(const char* name, const QObject* pObj)
{
QVariant var = pObj->property(name);
if (!var.isValid())
{
return QStringList();
}
else
{
return var.toStringList();
}
}
inline float tp_check_float_property(const char* name, const QObject* pObj, float def = 0.0)
{
QVariant var = pObj->property(name);
if (!var.isValid())
{
return def;
}
else
{
bool bOk;
float fv = var.toFloat(&bOk);
if (bOk)
{
return fv;
}
else
{
return def;
}
}
}
inline QImage tp_check_qimage_property(const char* name, const QObject* pObj)
{
QVariant var = pObj->property(name);
if (!var.isValid() || !var.canConvert<QImage>())
{
return QImage();
}
return var.value<QImage>();
}
inline bool tp_shilf_string_property(QString& prop, QObject* pObj)
{
QString btnText = tp_check_string_property(TP_PROP_STRING_SHILFT, pObj);
if (!btnText.isEmpty())
{
pObj->setProperty(TP_PROP_STRING_SHILFT, prop);
prop = btnText;
return true;
}
else
{
return false;
}
}
class CTpThumbnail
{
public:
CTpThumbnail() {}
~CTpThumbnail() {}
static void AddImage();
};
#endif

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save