转码工具页面功能
This commit is contained in:
commit
3db5fe7f13
|
|
@ -0,0 +1,13 @@
|
|||
*
|
||||
!3rd/
|
||||
!3rd/**
|
||||
!python_bindings/
|
||||
!python_bindings/**
|
||||
!src/
|
||||
!src/**
|
||||
!*.bat
|
||||
!*.rc
|
||||
!*.prp
|
||||
!*.cpp
|
||||
!*.qrc
|
||||
!.gitignore
|
||||
Binary file not shown.
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef ELAACRYLICURLCARD_H
|
||||
#define ELAACRYLICURLCARD_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaAcrylicUrlCardPrivate;
|
||||
class ELA_EXPORT ElaAcrylicUrlCard : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaAcrylicUrlCard);
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, MainOpacity)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, NoiseOpacity)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BrushAlpha)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, CardPixmapSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardPixmapBorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaCardPixType::PixMode, CardPixMode);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Url);
|
||||
|
||||
public:
|
||||
explicit ElaAcrylicUrlCard(QWidget* parent = nullptr);
|
||||
~ElaAcrylicUrlCard() override;
|
||||
void setCardPixmapSize(int width, int height);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAACRYLICURLCARD_H
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef ELAACTIONCOMMANDER_H
|
||||
#define ELAACTIONCOMMANDER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ELA_EXPORT ElaActionCommand : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaActionCommand(QObject* parent = nullptr);
|
||||
~ElaActionCommand() override;
|
||||
|
||||
virtual void undo() = 0;
|
||||
virtual void redo() = 0;
|
||||
};
|
||||
|
||||
class ElaActionCommanderPrivate;
|
||||
class ELA_EXPORT ElaActionCommander : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaActionCommander)
|
||||
Q_SINGLETON_CREATE_H(ElaActionCommander)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MaxRouteCount)
|
||||
private:
|
||||
explicit ElaActionCommander(QObject* parent = nullptr);
|
||||
~ElaActionCommander() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void commanderStateChanged(const QString& domainName, ElaActionCommanderType::CommanderState state);
|
||||
|
||||
public:
|
||||
void recordCommand(const QString& domainName, ElaActionCommand* command, bool isRedo = true);
|
||||
void clearCommand(const QString& domainName);
|
||||
void undoCommand(const QString& domainName);
|
||||
void redoCommand(const QString& domainName);
|
||||
|
||||
ElaActionCommanderType::CommanderState getCommanderUndoState(const QString& domainName) const;
|
||||
ElaActionCommanderType::CommanderState getCommanderRedoState(const QString& domainName) const;
|
||||
};
|
||||
|
||||
#endif // ELAACTIONCOMMANDER_H
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
#ifndef ELAAPPBAR_H
|
||||
#define ELAAPPBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#define Q_TAKEOVER_NATIVEEVENT_H virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_H virtual bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
|
||||
#endif
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_H
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define ELAAPPBAR_HANDLE(ElaAppBar) \
|
||||
if (ElaAppBar) \
|
||||
{ \
|
||||
int ret = ElaAppBar->takeOverNativeEvent(eventType, message, result); \
|
||||
if (ret == -1) \
|
||||
{ \
|
||||
return QWidget::nativeEvent(eventType, message, result); \
|
||||
} \
|
||||
return (bool)ret; \
|
||||
} \
|
||||
return QWidget::nativeEvent(eventType, message, result);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#define Q_TAKEOVER_NATIVEEVENT_CPP(CLASS, ElaAppBar) \
|
||||
bool CLASS::nativeEvent(const QByteArray& eventType, void* message, qintptr* result) \
|
||||
{ \
|
||||
ELAAPPBAR_HANDLE(ElaAppBar) \
|
||||
}
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_CPP(CLASS, ElaAppBar) \
|
||||
bool CLASS::nativeEvent(const QByteArray& eventType, void* message, long* result) \
|
||||
{ \
|
||||
ELAAPPBAR_HANDLE(ElaAppBar) \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_CPP(CLASS, ElaAppBar)
|
||||
#endif
|
||||
|
||||
class QMenu;
|
||||
class ElaAppBarPrivate;
|
||||
class ELA_EXPORT ElaAppBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaAppBar)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsOnlyAllowMinAndClose)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
public:
|
||||
explicit ElaAppBar(QWidget* parent = nullptr);
|
||||
~ElaAppBar() override;
|
||||
|
||||
void setCustomWidget(ElaAppBarType::CustomArea customArea, QWidget* customWidget, QObject* hitTestObject = nullptr, const QString& hitTestFunctionName = "");
|
||||
QWidget* getCustomWidget(ElaAppBarType::CustomArea customArea) const;
|
||||
|
||||
void setCustomMenu(QMenu* customMenu);
|
||||
QMenu* getCustomMenu() const;
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
|
||||
void setRouteBackButtonEnable(bool isEnable);
|
||||
void setRouteForwardButtonEnable(bool isEnable);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
int takeOverNativeEvent(const QByteArray& eventType, void* message, qintptr* result);
|
||||
#else
|
||||
int takeOverNativeEvent(const QByteArray& eventType, void* message, long* result);
|
||||
#endif
|
||||
#endif
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void routeBackButtonClicked();
|
||||
Q_SIGNAL void routeForwardButtonClicked();
|
||||
Q_SIGNAL void navigationButtonClicked();
|
||||
Q_SIGNAL void themeChangeButtonClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
Q_SIGNAL void customWidgetChanged();
|
||||
Q_SIGNAL void customMenuChanged();
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
#ifdef Q_OS_WIN
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // ELAAPPBAR_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELAAPPLICATION_H
|
||||
#define ELAAPPLICATION_H
|
||||
|
||||
#include <QIcon>
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaSingleton.h"
|
||||
#define eApp ElaApplication::getInstance()
|
||||
class ElaApplicationPrivate;
|
||||
class ELA_EXPORT ElaApplication : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaApplication)
|
||||
Q_SINGLETON_CREATE_H(ElaApplication)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaApplicationType::WindowDisplayMode, WindowDisplayMode)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, ElaMicaImagePath)
|
||||
private:
|
||||
explicit ElaApplication(QObject* parent = nullptr);
|
||||
~ElaApplication() override;
|
||||
|
||||
public:
|
||||
void init();
|
||||
void syncWindowDisplayMode(QWidget* widget, bool isSync = true);
|
||||
static bool containsCursorToItem(QWidget* item);
|
||||
};
|
||||
|
||||
#endif // ELAAPPLICATION_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELABREADCRUMBBAR_H
|
||||
#define ELABREADCRUMBBAR_H
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaBreadcrumbBarPrivate;
|
||||
class ELA_EXPORT ElaBreadcrumbBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaBreadcrumbBar)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAutoRemove)
|
||||
public:
|
||||
explicit ElaBreadcrumbBar(QWidget* parent = nullptr);
|
||||
~ElaBreadcrumbBar() override;
|
||||
void setBreadcrumbList(QStringList breadcrumbList);
|
||||
QStringList appendBreadcrumb(QString breadcrumb);
|
||||
QStringList removeBreadcrumb(QString breadcrumb);
|
||||
|
||||
int getBreadcrumbListCount() const;
|
||||
QStringList getBreadcrumbList() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void breadcrumbClicked(QString breadcrumb, QStringList lastBreadcrumbList);
|
||||
};
|
||||
|
||||
#endif // ELABREADCRUMBBAR_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELACALENDAR_H
|
||||
#define ELACALENDAR_H
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QDate>
|
||||
#include <QWidget>
|
||||
class ElaCalendarPrivate;
|
||||
class ELA_EXPORT ElaCalendar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaCalendar)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRaiuds)
|
||||
Q_PROPERTY_CREATE_Q_H(QDate, SelectedDate)
|
||||
Q_PROPERTY_CREATE_Q_H(QDate, MinimumDate)
|
||||
Q_PROPERTY_CREATE_Q_H(QDate, MaximumDate)
|
||||
public:
|
||||
explicit ElaCalendar(QWidget* parent = nullptr);
|
||||
~ElaCalendar() override;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void clicked(QDate date);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACALENDAR_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELACALENDARPICKER_H
|
||||
#define ELACALENDARPICKER_H
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QDate>
|
||||
#include <QPushButton>
|
||||
class ElaCalendarPickerPrivate;
|
||||
class ELA_EXPORT ElaCalendarPicker : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaCalendarPicker)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PRIVATE_CREATE_Q_H(QDate, SelectedDate)
|
||||
public:
|
||||
explicit ElaCalendarPicker(QWidget* parent = nullptr);
|
||||
~ElaCalendarPicker() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void selectedDateChanged(QDate date);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACALENDARPICKER_H
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef ELACHECKBOX_H
|
||||
#define ELACHECKBOX_H
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ELA_EXPORT ElaCheckBox : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_CREATE(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaCheckBox(QWidget* parent = nullptr);
|
||||
explicit ElaCheckBox(const QString& text, QWidget* parent = nullptr);
|
||||
~ElaCheckBox() override;
|
||||
};
|
||||
|
||||
#endif // ELACHECKBOX_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELACOLORDIALOG_H
|
||||
#define ELACOLORDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaColorDialogPrivate;
|
||||
class ELA_EXPORT ElaColorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaColorDialog)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, CurrentColor)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaColorDialog(QWidget* parent = nullptr);
|
||||
~ElaColorDialog() override;
|
||||
|
||||
QList<QColor> getCustomColorList() const;
|
||||
QColor getCustomColor(int index) const;
|
||||
QString getCurrentColorRGB() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void colorSelected(const QColor& color);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACOLORDIALOG_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELACOMBOBOX_H
|
||||
#define ELACOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaComboBoxPrivate;
|
||||
class ELA_EXPORT ElaComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaComboBox);
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaComboBox(QWidget* parent = nullptr);
|
||||
~ElaComboBox() override;
|
||||
|
||||
void setEditable(bool editable);
|
||||
|
||||
protected:
|
||||
virtual void showPopup() override;
|
||||
virtual void hidePopup() override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACOMBOBOX_H
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef ELACONTENTDIALOG_H
|
||||
#define ELACONTENTDIALOG_H
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QDialog>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaContentDialogPrivate;
|
||||
class ELA_EXPORT ElaContentDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaContentDialog)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaContentDialog(QWidget* parent);
|
||||
~ElaContentDialog() override;
|
||||
Q_SLOT virtual void onLeftButtonClicked();
|
||||
Q_SLOT virtual void onMiddleButtonClicked();
|
||||
Q_SLOT virtual void onRightButtonClicked();
|
||||
void setCentralWidget(QWidget* centralWidget);
|
||||
|
||||
void setLeftButtonText(QString text);
|
||||
void setMiddleButtonText(QString text);
|
||||
void setRightButtonText(QString text);
|
||||
|
||||
void close();
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void leftButtonClicked();
|
||||
Q_SIGNAL void middleButtonClicked();
|
||||
Q_SIGNAL void rightButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
virtual void keyPressEvent(QKeyEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACONTENTDIALOG_H
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef ELAFRAMEWORK_ELADIALOG_H
|
||||
#define ELAFRAMEWORK_ELADIALOG_H
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaDef.h"
|
||||
#include <QDialog>
|
||||
|
||||
class ElaDialogPrivate;
|
||||
class ELA_EXPORT ElaDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDialog)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaDialog(QWidget* parent = nullptr);
|
||||
~ElaDialog() override;
|
||||
void moveToCenter();
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void routeBackButtonClicked();
|
||||
Q_SIGNAL void navigationButtonClicked();
|
||||
Q_SIGNAL void themeChangeButtonClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELADIALOG_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELADOCKWIDGET_H
|
||||
#define ELADOCKWIDGET_H
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaDockWidgetPrivate;
|
||||
class ELA_EXPORT ElaDockWidget : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDockWidget)
|
||||
public:
|
||||
explicit ElaDockWidget(QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
explicit ElaDockWidget(const QString& title, QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
~ElaDockWidget() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
#ifdef Q_OS_WIN
|
||||
virtual bool event(QEvent* event) override;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
|
||||
#else
|
||||
virtual bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // ELADOCKWIDGET_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELADOUBLESPINBOX_H
|
||||
#define ELADOUBLESPINBOX_H
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
class ElaDoubleSpinBoxPrivate;
|
||||
class ELA_EXPORT ElaDoubleSpinBox : public QDoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDoubleSpinBox)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaSpinBoxType::ButtonMode, ButtonMode)
|
||||
public:
|
||||
explicit ElaDoubleSpinBox(QWidget* parent = nullptr);
|
||||
~ElaDoubleSpinBox() override;
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELADOUBLESPINBOX_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELADRAWERAREA_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELADRAWERAREA_H_
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QWidget>
|
||||
|
||||
class ElaDrawerAreaPrivate;
|
||||
class ELA_EXPORT ElaDrawerArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDrawerArea)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HeaderHeight)
|
||||
public:
|
||||
explicit ElaDrawerArea(QWidget* parent = nullptr);
|
||||
~ElaDrawerArea() override;
|
||||
|
||||
void setDrawerHeader(QWidget* widget);
|
||||
|
||||
void addDrawer(QWidget* widget);
|
||||
void removeDrawer(QWidget* widget);
|
||||
|
||||
void expand();
|
||||
void collapse();
|
||||
|
||||
bool getIsExpand() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void expandStateChanged(bool isExpand);
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELADRAWERAREA_H_
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef ELADXGIMANAGER_H
|
||||
#define ELADXGIMANAGER_H
|
||||
|
||||
#include <QWidget>
|
||||
#ifdef Q_OS_WIN
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ElaDxgiManagerPrivate;
|
||||
class ELA_EXPORT ElaDxgiManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDxgiManager)
|
||||
Q_SINGLETON_CREATE_H(ElaDxgiManager);
|
||||
|
||||
private:
|
||||
explicit ElaDxgiManager(QObject* parent = nullptr);
|
||||
~ElaDxgiManager() override;
|
||||
|
||||
public:
|
||||
QStringList getDxDeviceList() const;
|
||||
QStringList getOutputDeviceList() const;
|
||||
QImage grabScreenToImage() const;
|
||||
void startGrabScreen();
|
||||
void stopGrabScreen();
|
||||
bool getIsGrabScreen() const;
|
||||
bool setDxDeviceID(int dxID);
|
||||
int getDxDeviceID() const;
|
||||
bool setOutputDeviceID(int deviceID);
|
||||
int getOutputDeviceID() const;
|
||||
void setGrabArea(int width, int height); //从屏幕中心向外延伸
|
||||
void setGrabArea(int x, int y, int width, int height);
|
||||
QRect getGrabArea() const;
|
||||
void setGrabFrameRate(int frameRateValue);
|
||||
int getGrabFrameRate() const;
|
||||
void setTimeoutMsValue(int timeoutValue);
|
||||
int getTimeoutMsValue() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void grabImageUpdate(QImage img);
|
||||
};
|
||||
|
||||
class ElaDxgiScreenPrivate;
|
||||
class ELA_EXPORT ElaDxgiScreen : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDxgiScreen)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaDxgiScreen(QWidget* parent = nullptr);
|
||||
~ElaDxgiScreen();
|
||||
void setIsSyncGrabSize(bool isSyncGrabSize);
|
||||
bool getIsSyncGrabSize() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
#endif
|
||||
#endif // ELADXGIMANAGER_H
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef ELAEVENTBUS_H
|
||||
#define ELAEVENTBUS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
class ElaEventPrivate;
|
||||
class ELA_EXPORT ElaEvent : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaEvent)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, EventName);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, FunctionName);
|
||||
Q_PROPERTY_CREATE_Q_H(Qt::ConnectionType, ConnectionType);
|
||||
|
||||
public:
|
||||
explicit ElaEvent(QObject* parent = nullptr);
|
||||
explicit ElaEvent(QString eventName, QString functionName, QObject* parent = nullptr);
|
||||
~ElaEvent() override;
|
||||
ElaEventBusType::EventBusReturnType registerAndInit();
|
||||
};
|
||||
|
||||
class ElaEventBusPrivate;
|
||||
class ELA_EXPORT ElaEventBus : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaEventBus)
|
||||
Q_SINGLETON_CREATE_H(ElaEventBus);
|
||||
|
||||
private:
|
||||
explicit ElaEventBus(QObject* parent = nullptr);
|
||||
~ElaEventBus() override;
|
||||
|
||||
public:
|
||||
ElaEventBusType::EventBusReturnType post(const QString& eventName, const QVariantMap& data = {});
|
||||
QStringList getRegisteredEventsName() const;
|
||||
|
||||
private:
|
||||
friend class ElaEvent;
|
||||
};
|
||||
|
||||
#endif // ELAEVENTBUS_H
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef ELAEXPONENTIALBLUR_H
|
||||
#define ELAEXPONENTIALBLUR_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ElaExponentialBlurPrivate;
|
||||
class ELA_EXPORT ElaExponentialBlur : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SINGLETON_CREATE_H(ElaExponentialBlur)
|
||||
Q_Q_CREATE(ElaExponentialBlur)
|
||||
private:
|
||||
explicit ElaExponentialBlur(QObject* parent = nullptr);
|
||||
~ElaExponentialBlur();
|
||||
|
||||
public:
|
||||
static QPixmap doExponentialBlur(QImage img, const quint16& blurRadius);
|
||||
};
|
||||
|
||||
#endif // ELAEXPONENTIALBLUR_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELAFLOWLAYOUT_H
|
||||
#define ELAFLOWLAYOUT_H
|
||||
|
||||
#include <QLayout>
|
||||
#include <QMap>
|
||||
#include <QStyle>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaFlowLayoutPrivate;
|
||||
class ELA_EXPORT ElaFlowLayout : public QLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaFlowLayout)
|
||||
public:
|
||||
explicit ElaFlowLayout(QWidget* parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
||||
explicit ElaFlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
||||
~ElaFlowLayout() override;
|
||||
|
||||
void addItem(QLayoutItem* item) override;
|
||||
int horizontalSpacing() const;
|
||||
int verticalSpacing() const;
|
||||
Qt::Orientations expandingDirections() const override;
|
||||
bool hasHeightForWidth() const override;
|
||||
int heightForWidth(int) const override;
|
||||
int count() const override;
|
||||
QLayoutItem* itemAt(int index) const override;
|
||||
QSize minimumSize() const override;
|
||||
void setGeometry(const QRect& rect) override;
|
||||
QSize sizeHint() const override;
|
||||
QLayoutItem* takeAt(int index) override;
|
||||
|
||||
void setIsAnimation(bool isAnimation);
|
||||
};
|
||||
|
||||
#endif // ELAFLOWLAYOUT_H
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef ELAGRAPHICSITEM_H
|
||||
#define ELAGRAPHICSITEM_H
|
||||
|
||||
#include <QGraphicsObject>
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaGraphicsScene;
|
||||
class ElaGraphicsItemPrivate;
|
||||
class ELA_EXPORT ElaGraphicsItem : public QGraphicsObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaGraphicsItem)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Width)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Height)
|
||||
Q_PROPERTY_CREATE_Q_H(QImage, ItemImage)
|
||||
Q_PROPERTY_CREATE_Q_H(QImage, ItemSelectedImage)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, ItemName)
|
||||
Q_PROPERTY_CREATE_Q_H(QVariantMap, DataRoutes)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MaxLinkPortCount)
|
||||
public:
|
||||
explicit ElaGraphicsItem(QGraphicsItem* parent = nullptr);
|
||||
explicit ElaGraphicsItem(int width, int height, QGraphicsItem* parent = nullptr);
|
||||
~ElaGraphicsItem();
|
||||
|
||||
QString getItemUID() const;
|
||||
|
||||
void setLinkPortState(bool isFullLink);
|
||||
void setLinkPortState(bool isLink, int portIndex);
|
||||
|
||||
bool getLinkPortState(int portIndex) const;
|
||||
QVector<bool> getLinkPortState() const;
|
||||
|
||||
int getUsedLinkPortCount() const;
|
||||
QVector<int> getUsedLinkPort() const;
|
||||
int getUnusedLinkPortCount() const;
|
||||
QVector<int> getUnusedLinkPort() const;
|
||||
|
||||
protected:
|
||||
virtual QRectF boundingRect() const override;
|
||||
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
|
||||
friend QDataStream& operator<<(QDataStream& stream, const ElaGraphicsItem* item);
|
||||
friend QDataStream& operator>>(QDataStream& stream, ElaGraphicsItem* item);
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSITEM_H
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef ELAGRAPHICSLINEITEM_H
|
||||
#define ELAGRAPHICSLINEITEM_H
|
||||
|
||||
#include <QGraphicsPathItem>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaGraphicsItem;
|
||||
class ElaGraphicsLineItemPrivate;
|
||||
class ELA_EXPORT ElaGraphicsLineItem : public QGraphicsPathItem
|
||||
{
|
||||
Q_Q_CREATE(ElaGraphicsLineItem)
|
||||
Q_PRIVATE_CREATE_Q_H(QPointF, StartPoint);
|
||||
Q_PRIVATE_CREATE_Q_H(QPointF, EndPoint);
|
||||
Q_PRIVATE_CREATE_Q_H(ElaGraphicsItem*, StartItem);
|
||||
Q_PRIVATE_CREATE_Q_H(ElaGraphicsItem*, EndItem);
|
||||
Q_PRIVATE_CREATE_Q_H(int, StartItemPort);
|
||||
Q_PRIVATE_CREATE_Q_H(int, EndItemPort);
|
||||
|
||||
public:
|
||||
explicit ElaGraphicsLineItem(ElaGraphicsItem* startItem, ElaGraphicsItem* endItem, int startItemPort, int endItemPort, QGraphicsItem* parent = nullptr);
|
||||
explicit ElaGraphicsLineItem(QPointF startPoint, QPointF endPoint, QGraphicsItem* parent = nullptr);
|
||||
~ElaGraphicsLineItem();
|
||||
|
||||
bool isTargetLink(ElaGraphicsItem* item) const;
|
||||
bool isTargetLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2) const;
|
||||
bool isTargetLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2, int port1, int port2) const;
|
||||
|
||||
protected:
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
|
||||
QRectF boundingRect() const override;
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSLINEITEM_H
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
#ifndef ELAGRAPHICSSCENE_H
|
||||
#define ELAGRAPHICSSCENE_H
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QEvent>
|
||||
#include <QGraphicsScene>
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaGraphicsItem;
|
||||
class ElaGraphicsScenePrivate;
|
||||
class ELA_EXPORT ElaGraphicsScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaGraphicsScene)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsCheckLinkPort)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SerializePath)
|
||||
public:
|
||||
explicit ElaGraphicsScene(QObject* parent = nullptr);
|
||||
~ElaGraphicsScene();
|
||||
void addItem(ElaGraphicsItem* item);
|
||||
void removeItem(ElaGraphicsItem* item);
|
||||
void removeSelectedItems();
|
||||
void clear();
|
||||
|
||||
QList<ElaGraphicsItem*> createAndAddItem(int width, int height, int count = 1);
|
||||
QList<ElaGraphicsItem*> getSelectedElaItems() const;
|
||||
QList<ElaGraphicsItem*> getElaItems();
|
||||
QList<ElaGraphicsItem*> getElaItems(QPoint pos);
|
||||
QList<ElaGraphicsItem*> getElaItems(QPointF pos);
|
||||
QList<ElaGraphicsItem*> getElaItems(QRect rect);
|
||||
QList<ElaGraphicsItem*> getElaItems(QRectF rect);
|
||||
|
||||
void setSceneMode(ElaGraphicsSceneType::SceneMode mode);
|
||||
ElaGraphicsSceneType::SceneMode getSceneMode() const;
|
||||
|
||||
void selectAllItems();
|
||||
|
||||
QList<QVariantMap> getItemLinkList() const;
|
||||
bool addItemLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2, int port1 = 0, int port2 = 0);
|
||||
bool removeItemLink(ElaGraphicsItem* item1);
|
||||
bool removeItemLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2, int port1 = 0, int port2 = 0);
|
||||
|
||||
QVector<QVariantMap> getItemsDataRoute() const;
|
||||
|
||||
// 序列化 反序列化
|
||||
void serialize();
|
||||
void deserialize();
|
||||
|
||||
Q_SIGNALS:
|
||||
void showItemLink();
|
||||
void mouseLeftClickedItem(ElaGraphicsItem* item);
|
||||
void mouseRightClickedItem(ElaGraphicsItem* item);
|
||||
void mouseDoubleClickedItem(ElaGraphicsItem* item);
|
||||
|
||||
protected:
|
||||
virtual void focusOutEvent(QFocusEvent* event) override;
|
||||
virtual void keyPressEvent(QKeyEvent* event) override;
|
||||
virtual void keyReleaseEvent(QKeyEvent* event) override;
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSSCENE_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELAGRAPHICSVIEW_H
|
||||
#define ELAGRAPHICSVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaGraphicsViewPrivate;
|
||||
class ELA_EXPORT ElaGraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaGraphicsView)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, MaxTransform);
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, MinTransform);
|
||||
|
||||
public:
|
||||
explicit ElaGraphicsView(QWidget* parent = nullptr);
|
||||
explicit ElaGraphicsView(QGraphicsScene* scene, QWidget* parent = nullptr);
|
||||
~ElaGraphicsView();
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSVIEW_H
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ELAICON_H
|
||||
#define ELAICON_H
|
||||
#include <QIcon>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
class ELA_EXPORT ElaIcon
|
||||
{
|
||||
Q_SINGLETON_CREATE_H(ElaIcon)
|
||||
private:
|
||||
explicit ElaIcon();
|
||||
~ElaIcon();
|
||||
|
||||
public:
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, QColor iconColor);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize, QColor iconColor);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize, int fixedWidth, int fixedHeight);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize, int fixedWidth, int fixedHeight, QColor iconColor);
|
||||
};
|
||||
|
||||
#endif // ELAICON_H
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef ELAICONBUTTON_H
|
||||
#define ELAICONBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaIconButtonPrivate;
|
||||
class ELA_EXPORT ElaIconButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaIconButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, Opacity);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightHoverColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkHoverColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightHoverIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkHoverIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsSelected);
|
||||
|
||||
public:
|
||||
ElaIconButton(QPixmap pix, QWidget* parent = nullptr);
|
||||
ElaIconButton(ElaIconType::IconName awesome, QWidget* parent = nullptr);
|
||||
ElaIconButton(ElaIconType::IconName awesome, int pixelSize, QWidget* parent = nullptr);
|
||||
ElaIconButton(ElaIconType::IconName awesome, int pixelSize, int fixedWidth, int fixedHeight, QWidget* parent = nullptr);
|
||||
~ElaIconButton();
|
||||
void setAwesome(ElaIconType::IconName awesome);
|
||||
ElaIconType::IconName getAwesome() const;
|
||||
|
||||
void setPixmap(QPixmap pix);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAICONBUTTON_H
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ELAIMAGECARD_H
|
||||
#define ELAIMAGECARD_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaImageCardPrivate;
|
||||
class ELA_EXPORT ElaImageCard : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaImageCard)
|
||||
Q_PROPERTY_CREATE_Q_H(QImage, CardImage);
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsPreserveAspectCrop)
|
||||
public:
|
||||
explicit ElaImageCard(QWidget* parent = nullptr);
|
||||
~ElaImageCard() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAIMAGECARD_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELAINTERACTIVECARD_H
|
||||
#define ELAINTERACTIVECARD_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaInteractiveCardPrivate;
|
||||
class ELA_EXPORT ElaInteractiveCard : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaInteractiveCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, CardPixmapSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardPixmapBorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaCardPixType::PixMode, CardPixMode);
|
||||
|
||||
public:
|
||||
explicit ElaInteractiveCard(QWidget* parent = nullptr);
|
||||
~ElaInteractiveCard();
|
||||
void setCardPixmapSize(int width, int height);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAINTERACTIVECARD_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELAWIDGETTOOLS_SRC_ELAKEYBINDER_H_
|
||||
#define ELAWIDGETTOOLS_SRC_ELAKEYBINDER_H_
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include <QLabel>
|
||||
|
||||
class ElaKeyBinderPrivate;
|
||||
class ELA_EXPORT ElaKeyBinder : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaKeyBinder)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, BinderKeyText)
|
||||
Q_PROPERTY_CREATE_Q_H(quint32, NativeVirtualBinderKey)
|
||||
public:
|
||||
explicit ElaKeyBinder(QWidget* parent = nullptr);
|
||||
~ElaKeyBinder();
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void binderKeyTextChanged(QString binderKeyText);
|
||||
Q_SIGNAL void nativeVirtualBinderKeyChanged(quint32 binderKey);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAWIDGETTOOLS_SRC_ELAKEYBINDER_H_
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELAWIDGETTOOLS_ELALCDNUMBER_H
|
||||
#define ELAWIDGETTOOLS_ELALCDNUMBER_H
|
||||
|
||||
#include <QLCDNumber>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaLCDNumberPrivate;
|
||||
class ELA_EXPORT ElaLCDNumber : public QLCDNumber
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaLCDNumber)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsUseAutoClock)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, AutoClockFormat)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
|
||||
public:
|
||||
explicit ElaLCDNumber(QWidget* parent = nullptr);
|
||||
explicit ElaLCDNumber(uint numDigits, QWidget* parent = nullptr);
|
||||
~ElaLCDNumber() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAWIDGETTOOLS_ELALCDNUMBER_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELALINEEDIT_H
|
||||
#define ELALINEEDIT_H
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaLineEditPrivate;
|
||||
class ELA_EXPORT ElaLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaLineEdit)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsClearButtonEnable)
|
||||
public:
|
||||
explicit ElaLineEdit(QWidget* parent = nullptr);
|
||||
~ElaLineEdit() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void focusIn(QString text);
|
||||
Q_SIGNAL void focusOut(QString text);
|
||||
Q_SIGNAL void wmFocusOut(QString text);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELALINEEDIT_H
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef ELALISTVIEW_H
|
||||
#define ELALISTVIEW_H
|
||||
|
||||
#include <QListView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaListViewPrivate;
|
||||
class ELA_EXPORT ElaListView : public QListView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaListView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ItemHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
public:
|
||||
explicit ElaListView(QWidget* parent = nullptr);
|
||||
~ElaListView();
|
||||
};
|
||||
|
||||
#endif // ELALISTVIEW_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELALOG_H
|
||||
#define ELALOG_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ElaLogPrivate;
|
||||
class ELA_EXPORT ElaLog : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaLog)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, LogSavePath)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, LogFileName)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsLogFileNameWithTime)
|
||||
Q_SINGLETON_CREATE_H(ElaLog);
|
||||
|
||||
private:
|
||||
explicit ElaLog(QObject* parent = nullptr);
|
||||
~ElaLog();
|
||||
|
||||
public:
|
||||
void initMessageLog(bool isEnable);
|
||||
Q_SIGNALS:
|
||||
void logMessage(QString log);
|
||||
};
|
||||
|
||||
#endif // ELALOG_H
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef ELAMENU_H
|
||||
#define ELAMENU_H
|
||||
|
||||
#include <QMenu>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaMenuPrivate;
|
||||
class ELA_EXPORT ElaMenu : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMenu)
|
||||
|
||||
public:
|
||||
explicit ElaMenu(QWidget* parent = nullptr);
|
||||
explicit ElaMenu(const QString& title, QWidget* parent = nullptr);
|
||||
~ElaMenu();
|
||||
void setMenuItemHeight(int menuItemHeight);
|
||||
int getMenuItemHeight() const;
|
||||
|
||||
QAction* addMenu(QMenu* menu);
|
||||
ElaMenu* addMenu(const QString& title);
|
||||
ElaMenu* addMenu(const QIcon& icon, const QString& title);
|
||||
ElaMenu* addMenu(ElaIconType::IconName icon, const QString& title);
|
||||
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text);
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text, const QKeySequence& shortcut);
|
||||
|
||||
bool isHasChildMenu() const;
|
||||
bool isHasIcon() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void menuShow();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAMENU_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELAMENUBAR_H
|
||||
#define ELAMENUBAR_H
|
||||
|
||||
#include <QMenuBar>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaMenu;
|
||||
class ELA_EXPORT ElaMenuBar : public QMenuBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaMenuBar(QWidget* parent = nullptr);
|
||||
~ElaMenuBar();
|
||||
|
||||
QAction* addMenu(QMenu* menu);
|
||||
ElaMenu* addMenu(const QString& title);
|
||||
ElaMenu* addMenu(const QIcon& icon, const QString& title);
|
||||
ElaMenu* addMenu(ElaIconType::IconName, const QString& title);
|
||||
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text);
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text, const QKeySequence& shortcut);
|
||||
};
|
||||
|
||||
#endif // ELAMENUBAR_H
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ELAMESSAGEBAR_H
|
||||
#define ELAMESSAGEBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaMessageBarPrivate;
|
||||
class ELA_EXPORT ElaMessageBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMessageBar)
|
||||
|
||||
public:
|
||||
static void success(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
static void warning(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
static void information(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
static void error(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
private:
|
||||
explicit ElaMessageBar(ElaMessageBarType::PositionPolicy policy, ElaMessageBarType::MessageMode messageMode, QString& title, QString& text, int displayMsec, QWidget* parent = nullptr);
|
||||
~ElaMessageBar() override;
|
||||
};
|
||||
|
||||
#endif // ELAMESSAGEBAR_H
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef ELAMESSAGEBUTTON_H
|
||||
#define ELAMESSAGEBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaMessageButtonPrivate;
|
||||
class ELA_EXPORT ElaMessageButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMessageButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, BarTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, BarText);
|
||||
Q_PROPERTY_CREATE_Q_H(int, DisplayMsec);
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, MessageTargetWidget)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaMessageBarType::MessageMode, MessageMode);
|
||||
Q_PROPERTY_CREATE_Q_H(ElaMessageBarType::PositionPolicy, PositionPolicy);
|
||||
|
||||
public:
|
||||
explicit ElaMessageButton(QWidget* parent = nullptr);
|
||||
explicit ElaMessageButton(QString text, QWidget* parent = nullptr);
|
||||
~ElaMessageButton();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAMESSAGEBUTTON_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELAMULTISELECTCOMBOBOX_H
|
||||
#define ELAMULTISELECTCOMBOBOX_H
|
||||
#include <QComboBox>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaMultiSelectComboBoxPrivate;
|
||||
class ELA_EXPORT ElaMultiSelectComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMultiSelectComboBox)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaMultiSelectComboBox(QWidget* parent = nullptr);
|
||||
~ElaMultiSelectComboBox();
|
||||
void setCurrentSelection(QString selection);
|
||||
void setCurrentSelection(QStringList selection);
|
||||
void setCurrentSelection(int index);
|
||||
void setCurrentSelection(QList<int> selectionIndex);
|
||||
QStringList getCurrentSelection() const;
|
||||
QList<int> getCurrentSelectionIndex() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void itemSelectionChanged(QVector<bool> itemSelection);
|
||||
Q_SIGNAL void currentTextListChanged(QStringList selectedTextList);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
void showPopup() override;
|
||||
void hidePopup() override;
|
||||
};
|
||||
|
||||
#endif // ELAMULTISELECTCOMBOBOX_H
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
#ifndef ELANAVIGATIONBAR_H
|
||||
#define ELANAVIGATIONBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSuggestBox.h"
|
||||
class ElaNavigationBarPrivate;
|
||||
class ELA_EXPORT ElaNavigationBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaNavigationBar)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAllowPageOpenInNewWindow)
|
||||
Q_PROPERTY_CREATE_Q_H(int, NavigationBarWidth)
|
||||
public:
|
||||
explicit ElaNavigationBar(QWidget* parent = nullptr);
|
||||
~ElaNavigationBar() override;
|
||||
void setUserInfoCardVisible(bool isVisible);
|
||||
void setUserInfoCardPixmap(QPixmap pix);
|
||||
void setUserInfoCardTitle(QString title);
|
||||
void setUserInfoCardSubTitle(QString subTitle);
|
||||
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QWidget* page, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey, const QString& targetExpanderKey);
|
||||
|
||||
bool getNodeIsExpanded(QString expanderKey) const;
|
||||
void expandNode(QString expanderKey);
|
||||
void collapseNode(QString expanderKey);
|
||||
void removeNode(QString nodeKey);
|
||||
|
||||
void setNodeKeyPoints(QString nodeKey, int keyPoints);
|
||||
int getNodeKeyPoints(QString nodeKey) const;
|
||||
|
||||
void setNodeTitle(QString nodeKey, QString nodeTitle);
|
||||
QString getNodeTitle(QString nodeKey) const;
|
||||
|
||||
void navigation(QString pageKey, bool isLogClicked = true, bool isRouteBack = false);
|
||||
void setDisplayMode(ElaNavigationType::NavigationDisplayMode displayMode, bool isAnimation = true);
|
||||
ElaNavigationType::NavigationDisplayMode getDisplayMode() const;
|
||||
|
||||
int getPageOpenInNewWindowCount(QString nodeKey) const;
|
||||
|
||||
QList<ElaSuggestBox::SuggestData> getSuggestDataList() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void pageOpenInNewWindow(QString nodeKey);
|
||||
Q_SIGNAL void userInfoCardClicked();
|
||||
Q_SIGNAL void navigationNodeClicked(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey, bool isRouteBack);
|
||||
Q_SIGNAL void navigationNodeAdded(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey, QWidget* page);
|
||||
Q_SIGNAL void navigationNodeRemoved(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELANAVIGATIONBAR_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELAPIVOT_H
|
||||
#define ELAPIVOT_H
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaPivotPrivate;
|
||||
class ELA_EXPORT ElaPivot : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPivot)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(int, PivotSpacing)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MarkWidth)
|
||||
public:
|
||||
explicit ElaPivot(QWidget* parent = nullptr);
|
||||
~ElaPivot();
|
||||
|
||||
void appendPivot(QString pivotTitle);
|
||||
void removePivot(QString pivotTitle);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void pivotClicked(int index);
|
||||
Q_SIGNAL void pivotDoubleClicked(int index);
|
||||
};
|
||||
|
||||
#endif // ELAPIVOT_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELAPLAINTEXTEDIT_H
|
||||
#define ELAPLAINTEXTEDIT_H
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaPlainTextEditPrivate;
|
||||
class ELA_EXPORT ElaPlainTextEdit : public QPlainTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPlainTextEdit)
|
||||
public:
|
||||
explicit ElaPlainTextEdit(QWidget* parent = nullptr);
|
||||
explicit ElaPlainTextEdit(const QString& text, QWidget* parent = nullptr);
|
||||
~ElaPlainTextEdit() override;
|
||||
|
||||
protected:
|
||||
virtual void focusInEvent(QFocusEvent* event) override;
|
||||
virtual void focusOutEvent(QFocusEvent* event) override;
|
||||
virtual void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPLAINTEXTEDIT_H
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef ELAPOPULARCARD_H
|
||||
#define ELAPOPULARCARD_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPopularCardPrivate;
|
||||
class ELA_EXPORT ElaPopularCard : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPopularCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, InteractiveTips)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, DetailedText)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, CardButtonText)
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, CardFloatArea)
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardFloatPixmap)
|
||||
public:
|
||||
explicit ElaPopularCard(QWidget* parent = nullptr);
|
||||
~ElaPopularCard() override;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void popularCardClicked();
|
||||
Q_SIGNAL void popularCardButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPOPULARCARD_H
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ELAPROGRESSBAR_H
|
||||
#define ELAPROGRESSBAR_H
|
||||
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaProgressBarPrivate;
|
||||
class ELA_EXPORT ElaProgressBar : public QProgressBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaProgressBar)
|
||||
public:
|
||||
explicit ElaProgressBar(QWidget* parent = nullptr);
|
||||
~ElaProgressBar() override;
|
||||
void setMinimum(int minimum);
|
||||
void setMaximum(int maximum);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
virtual void resizeEvent(QResizeEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPROGRESSBAR_H
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAPROGRESSRING_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAPROGRESSRING_H_
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ElaProgressRingPrivate;
|
||||
class ELA_EXPORT ElaProgressRing : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaProgressRing);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsBusying)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDisplayValue)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaProgressRingType::ValueDisplayMode, ValueDisplayMode)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BusyingWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BusyingDurationTime)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Minimum)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Maximum)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Value)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ValuePixelSize)
|
||||
public:
|
||||
explicit ElaProgressRing(QWidget* parent = nullptr);
|
||||
~ElaProgressRing() override;
|
||||
|
||||
void setRange(int min, int max);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void rangeChanged(int min, int max);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAPROGRESSRING_H_
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef ELAPROMOTIONCARD_H
|
||||
#define ELAPROMOTIONCARD_H
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPromotionCardPrivate;
|
||||
class ELA_EXPORT ElaPromotionCard : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPromotionCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, CardTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, PromotionTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, CardTitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, PromotionTitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, PromotionTitleBaseColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, TitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, SubTitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardTitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, PromotionTitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, HorizontalCardPixmapRatio)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, VerticalCardPixmapRatio)
|
||||
public:
|
||||
explicit ElaPromotionCard(QWidget* parent = nullptr);
|
||||
~ElaPromotionCard();
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void promotionCardClicked();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPROMOTIONCARD_H
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ELAPROMOTIONVIEW_H
|
||||
#define ELAPROMOTIONVIEW_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPromotionCard;
|
||||
class ElaPromotionViewPrivate;
|
||||
class ELA_EXPORT ElaPromotionView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPromotionView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardExpandWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardCollapseWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAutoScroll)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AutoScrollInterval)
|
||||
public:
|
||||
explicit ElaPromotionView(QWidget* parent = nullptr);
|
||||
~ElaPromotionView();
|
||||
|
||||
void appendPromotionCard(ElaPromotionCard* card);
|
||||
|
||||
protected:
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPROMOTIONVIEW_H
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_ELAPROPERTY_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_ELAPROPERTY_H_
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifdef ELAWIDGETTOOLS_LIBRARY
|
||||
#define ELA_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
#define ELA_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#define Q_PROPERTY_CREATE(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M MEMBER _p##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(TYPE M) \
|
||||
{ \
|
||||
_p##M = std::move(M); \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
TYPE get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PROPERTY_REF_CREATE(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M MEMBER _p##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(const TYPE& M) \
|
||||
{ \
|
||||
_p##M = M; \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
const TYPE& get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PROPERTY_CREATE_Q_H(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M READ get##M WRITE set##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(TYPE M); \
|
||||
TYPE get##M() const;
|
||||
|
||||
#define Q_PROPERTY_REF_CREATE_Q_H(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M READ get##M WRITE set##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(const TYPE& M); \
|
||||
const TYPE& get##M() const;
|
||||
|
||||
#define Q_PRIVATE_CREATE_Q_H(TYPE, M) \
|
||||
public: \
|
||||
void set##M(TYPE M); \
|
||||
TYPE get##M() const;
|
||||
|
||||
#define Q_PRIVATE_REF_CREATE_Q_H(TYPE, M) \
|
||||
public: \
|
||||
void set##M(const TYPE& M); \
|
||||
const TYPE& get##M() const;
|
||||
|
||||
#define Q_PROPERTY_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(TYPE M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = std::move(M); \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
TYPE CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PROPERTY_REF_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(const TYPE& M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = M; \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
const TYPE& CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PRIVATE_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(TYPE M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = std::move(M); \
|
||||
} \
|
||||
TYPE CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PRIVATE_REF_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(const TYPE& M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = M; \
|
||||
} \
|
||||
const TYPE& CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PROPERTY_CREATE_D(TYPE, M) \
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PRIVATE_CREATE_D(TYPE, M) \
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PRIVATE_CREATE(TYPE, M) \
|
||||
public: \
|
||||
void set##M(TYPE M) \
|
||||
{ \
|
||||
_p##M = std::move(M); \
|
||||
} \
|
||||
TYPE get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PRIVATE_REF_CREATE(TYPE, M) \
|
||||
public: \
|
||||
void set##M(const TYPE& M) \
|
||||
{ \
|
||||
_p##M = M; \
|
||||
} \
|
||||
const TYPE& get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_Q_CREATE(CLASS) \
|
||||
protected: \
|
||||
explicit CLASS(CLASS##Private& dd, CLASS* parent = nullptr); \
|
||||
QScopedPointer<CLASS##Private> d_ptr; \
|
||||
\
|
||||
private: \
|
||||
Q_DISABLE_COPY(CLASS) \
|
||||
Q_DECLARE_PRIVATE(CLASS);
|
||||
|
||||
#define Q_D_CREATE(CLASS) \
|
||||
protected: \
|
||||
CLASS* q_ptr; \
|
||||
\
|
||||
private: \
|
||||
Q_DECLARE_PUBLIC(CLASS);
|
||||
|
||||
#endif // ELAFRAMEWORK_ELAWIDGETTOOLS_ELAPROPERTY_H_
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ELAPUSHBUTTON_H
|
||||
#define ELAPUSHBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPushButtonPrivate;
|
||||
class ELA_EXPORT ElaPushButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPushButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightDefaultColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkDefaultColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightHoverColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkHoverColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightPressColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkPressColor)
|
||||
public:
|
||||
explicit ElaPushButton(QWidget* parent = nullptr);
|
||||
explicit ElaPushButton(QString text, QWidget* parent = nullptr);
|
||||
~ElaPushButton();
|
||||
|
||||
void setLightTextColor(QColor color);
|
||||
QColor getLightTextColor() const;
|
||||
|
||||
void setDarkTextColor(QColor color);
|
||||
QColor getDarkTextColor() const;
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPUSHBUTTON_H
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef ELARADIOBUTTON_H
|
||||
#define ELARADIOBUTTON_H
|
||||
|
||||
#include <QRadioButton>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaRadioButtonPrivate;
|
||||
class ELA_EXPORT ElaRadioButton : public QRadioButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaRadioButton)
|
||||
public:
|
||||
explicit ElaRadioButton(QWidget* parent = nullptr);
|
||||
explicit ElaRadioButton(const QString& text, QWidget* parent = nullptr);
|
||||
~ElaRadioButton() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELARADIOBUTTON_H
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef ELAREMINDERCARD_H
|
||||
#define ELAREMINDERCARD_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
class ElaReminderCardPrivate;
|
||||
class ELA_EXPORT ElaReminderCard : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaReminderCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, CardPixmapSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardPixmapBorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaCardPixType::PixMode, CardPixMode);
|
||||
|
||||
public:
|
||||
explicit ElaReminderCard(QWidget* parent = nullptr);
|
||||
~ElaReminderCard();
|
||||
void setCardPixmapSize(int width, int height);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAREMINDERCARD_H
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAROLLER_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAROLLER_H_
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QWidget>
|
||||
|
||||
class ElaRollerPrivate;
|
||||
class ELA_EXPORT ElaRoller : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaRoller)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QStringList, ItemList)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ItemHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MaxVisibleItems)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsContainer)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsEnableLoop)
|
||||
public:
|
||||
explicit ElaRoller(QWidget* parent = nullptr);
|
||||
~ElaRoller() override;
|
||||
|
||||
void setCurrentData(const QString& data);
|
||||
QString getCurrentData() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void currentDataChanged(const QString& data);
|
||||
|
||||
protected:
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAROLLER_H_
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef ELAFRAMEWORK_ELAROLLERPICKER_H
|
||||
#define ELAFRAMEWORK_ELAROLLERPICKER_H
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QPushButton>
|
||||
|
||||
class ElaRollerPickerPrivate;
|
||||
class ELA_EXPORT ElaRollerPicker : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaRollerPicker)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaRollerPicker(QWidget* parent = nullptr);
|
||||
~ElaRollerPicker() override;
|
||||
|
||||
void addRoller(const QStringList& itemList, bool isEnableLoop = true);
|
||||
void removeRoller(int index);
|
||||
|
||||
void setRollerItemList(int index, const QStringList& itemList);
|
||||
void setRollerWidth(int index, int width);
|
||||
|
||||
void setCurrentData(int index, const QString& data);
|
||||
void setCurrentData(const QStringList& dataList);
|
||||
QString getCurrentData(int index) const;
|
||||
QStringList getCurrentData() const;
|
||||
|
||||
void setCurrentIndex(int rollerIndex, int index);
|
||||
void setCurrentIndex(const QList<int>& indexList);
|
||||
int getCurrentIndex(int rollerIndex) const;
|
||||
QList<int> getCurrentIndex() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void currentDataChanged(const QStringList& dataList);
|
||||
Q_SIGNAL void currentDataSelectionChanged(const QStringList& dataList);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAROLLERPICKER_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELASCROLLAREA_H
|
||||
#define ELASCROLLAREA_H
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaScrollAreaPrivate;
|
||||
class ELA_EXPORT ElaScrollArea : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollArea)
|
||||
public:
|
||||
explicit ElaScrollArea(QWidget* parent = nullptr);
|
||||
~ElaScrollArea();
|
||||
|
||||
void setIsGrabGesture(bool isEnable, qreal mousePressEventDelay = 0.5);
|
||||
|
||||
void setIsOverShoot(Qt::Orientation orientation, bool isEnable);
|
||||
bool getIsOverShoot(Qt::Orientation orientation) const;
|
||||
|
||||
void setIsAnimation(Qt::Orientation orientation, bool isAnimation);
|
||||
bool getIsAnimation(Qt::Orientation orientation) const;
|
||||
};
|
||||
|
||||
#endif // ELASCROLLAREA_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELASCROLLBAR_H
|
||||
#define ELASCROLLBAR_H
|
||||
|
||||
#include <QAbstractScrollArea>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaScrollBarPrivate;
|
||||
class ELA_EXPORT ElaScrollBar : public QScrollBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollBar)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAnimation)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, SpeedLimit)
|
||||
public:
|
||||
explicit ElaScrollBar(QWidget* parent = nullptr);
|
||||
explicit ElaScrollBar(Qt::Orientation orientation, QWidget* parent = nullptr);
|
||||
explicit ElaScrollBar(QScrollBar* originScrollBar, QAbstractScrollArea* parent = nullptr);
|
||||
~ElaScrollBar() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void rangeAnimationFinished();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
virtual void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELASCROLLBAR_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELASCROLLPAGE_H
|
||||
#define ELASCROLLPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaScrollArea;
|
||||
class ElaText;
|
||||
class QHBoxLayout;
|
||||
class ElaScrollPagePrivate;
|
||||
class ELA_EXPORT ElaScrollPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollPage)
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, CustomWidget)
|
||||
public:
|
||||
explicit ElaScrollPage(QWidget* parent = nullptr);
|
||||
~ElaScrollPage() override;
|
||||
|
||||
void addCentralWidget(QWidget* centralWidget, bool isWidgetResizeable = true, bool isVerticalGrabGesture = true, qreal mousePressEventDelay = 0.5);
|
||||
|
||||
void navigation(int widgetIndex, bool isLogRoute = true);
|
||||
|
||||
void setPageTitleSpacing(int spacing);
|
||||
int getPageTitleSpacing() const;
|
||||
void setTitleVisible(bool isVisible);
|
||||
};
|
||||
|
||||
#endif // ELASCROLLPAGE_H
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef ELASCROLLPAGEAREA_H
|
||||
#define ELASCROLLPAGEAREA_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaScrollPageAreaPrivate;
|
||||
class ELA_EXPORT ElaScrollPageArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollPageArea)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaScrollPageArea(QWidget* parent = nullptr);
|
||||
~ElaScrollPageArea() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELASCROLLPAGEAREA_H
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef ELASINGLETON_H
|
||||
#define ELASINGLETON_H
|
||||
|
||||
#include <QMutex>
|
||||
|
||||
#ifndef Q_SINGLETON_CREATE_H
|
||||
template <typename T>
|
||||
class Singleton
|
||||
{
|
||||
public:
|
||||
static T* getInstance();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Singleton)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T* Singleton<T>::getInstance()
|
||||
{
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
static T* instance = nullptr;
|
||||
if (instance == nullptr)
|
||||
{
|
||||
instance = new T();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
#define Q_SINGLETON_CREATE(Class) \
|
||||
private: \
|
||||
friend class Singleton<Class>; \
|
||||
\
|
||||
public: \
|
||||
static Class* getInstance() \
|
||||
{ \
|
||||
return Singleton<Class>::getInstance(); \
|
||||
}
|
||||
|
||||
#define Q_SINGLETON_CREATE_H(Class) \
|
||||
private: \
|
||||
static Class* _instance; \
|
||||
\
|
||||
public: \
|
||||
static Class* getInstance();
|
||||
|
||||
#define Q_SINGLETON_CREATE_CPP(Class) \
|
||||
Class* Class::_instance = nullptr; \
|
||||
Class* Class::getInstance() \
|
||||
{ \
|
||||
static QMutex mutex; \
|
||||
QMutexLocker locker(&mutex); \
|
||||
if (_instance == nullptr) \
|
||||
{ \
|
||||
_instance = new Class(); \
|
||||
} \
|
||||
return _instance; \
|
||||
}
|
||||
#endif
|
||||
#endif // ELASINGLETON_H
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef ELASLIDER_H
|
||||
#define ELASLIDER_H
|
||||
|
||||
#include <QSlider>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ELA_EXPORT ElaSlider : public QSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaSlider(QWidget* parent = nullptr);
|
||||
explicit ElaSlider(Qt::Orientation orientation, QWidget* parent = nullptr);
|
||||
~ElaSlider();
|
||||
};
|
||||
|
||||
#endif // ELASLIDER_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELASPINBOX_H
|
||||
#define ELASPINBOX_H
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
class ElaSpinBoxPrivate;
|
||||
class ELA_EXPORT ElaSpinBox : public QSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaSpinBox)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaSpinBoxType::ButtonMode, ButtonMode)
|
||||
public:
|
||||
explicit ElaSpinBox(QWidget* parent = nullptr);
|
||||
~ElaSpinBox() override;
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELASPINBOX_H
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef ELASTATUSBAR_H
|
||||
#define ELASTATUSBAR_H
|
||||
|
||||
#include <QStatusBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ELA_EXPORT ElaStatusBar : public QStatusBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaStatusBar(QWidget* parent = nullptr);
|
||||
~ElaStatusBar() override;
|
||||
};
|
||||
|
||||
#endif // ELASTATUSBAR_H
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef ELASUGGESTBOX_H
|
||||
#define ELASUGGESTBOX_H
|
||||
|
||||
#include <QVariantMap>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaSuggestBoxPrivate;
|
||||
class ELA_EXPORT ElaSuggestBox : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaSuggestBox)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(Qt::CaseSensitivity, CaseSensitivity)
|
||||
public:
|
||||
explicit ElaSuggestBox(QWidget* parent = nullptr);
|
||||
~ElaSuggestBox() override;
|
||||
void setPlaceholderText(const QString& placeholderText);
|
||||
void setFixedSize(const QSize& size);
|
||||
void setFixedSize(int w, int h);
|
||||
void setFixedHeight(int h);
|
||||
|
||||
struct ELA_EXPORT SuggestData {
|
||||
Q_PRIVATE_CREATE(ElaIconType::IconName, ElaIcon)
|
||||
Q_PRIVATE_CREATE(QString, SuggestText)
|
||||
Q_PRIVATE_CREATE(QString, SuggestKey)
|
||||
Q_PRIVATE_CREATE(QVariantMap, SuggestData)
|
||||
public:
|
||||
explicit SuggestData();
|
||||
explicit SuggestData(ElaIconType::IconName icon, const QString& suggestText, const QVariantMap& suggestData = {});
|
||||
~SuggestData();
|
||||
};
|
||||
QString addSuggestion(const QString& suggestText, const QVariantMap& suggestData = {});
|
||||
QString addSuggestion(ElaIconType::IconName icon, const QString& suggestText, const QVariantMap& suggestData = {});
|
||||
QString addSuggestion(const ElaSuggestBox::SuggestData& suggestData);
|
||||
QStringList addSuggestion(const QList<ElaSuggestBox::SuggestData>& suggestDataList);
|
||||
|
||||
void removeSuggestion(const QString& suggestKey);
|
||||
void removeSuggestion(int index);
|
||||
void clearSuggestion();
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void suggestionClicked(const ElaSuggestBox::SuggestData& suggestData);
|
||||
};
|
||||
|
||||
#endif // ELASUGGESTBOX_H
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef ELATABBAR_H
|
||||
#define ELATABBAR_H
|
||||
|
||||
#include <QDrag>
|
||||
#include <QTabBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaTabBarPrivate;
|
||||
class ELA_EXPORT ElaTabBar : public QTabBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTabBar)
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, TabSize)
|
||||
public:
|
||||
explicit ElaTabBar(QWidget* parent = nullptr);
|
||||
~ElaTabBar() override;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void tabDragCreate(QMimeData* mimeData);
|
||||
Q_SIGNAL void tabDragEnter(QMimeData* mimeData);
|
||||
Q_SIGNAL void tabDragLeave(QMimeData* mimeData);
|
||||
Q_SIGNAL void tabDragDrop(QMimeData* mimeData);
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
virtual void dragMoveEvent(QDragMoveEvent* event) override;
|
||||
virtual void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||
virtual void dropEvent(QDropEvent* event) override;
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATABBAR_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELATABWIDGET_H
|
||||
#define ELATABWIDGET_H
|
||||
|
||||
#include <QTabWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaTabWidgetPrivate;
|
||||
class ELA_EXPORT ElaTabWidget : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTabWidget)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTabTransparent);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsContainerAcceptDrops);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, TabSize)
|
||||
public:
|
||||
explicit ElaTabWidget(QWidget* parent = nullptr);
|
||||
~ElaTabWidget() override;
|
||||
void setTabPosition(TabPosition position);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
virtual void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
virtual void dropEvent(QDropEvent* event) override;
|
||||
virtual void tabInserted(int index);
|
||||
|
||||
private:
|
||||
friend class ElaCustomTabWidget;
|
||||
};
|
||||
|
||||
#endif // ELATABWIDGET_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELATABLEVIEW_H
|
||||
#define ELATABLEVIEW_H
|
||||
|
||||
#include <QTableView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaTableViewPrivate;
|
||||
class ELA_EXPORT ElaTableView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTableView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HeaderMargin)
|
||||
public:
|
||||
explicit ElaTableView(QWidget* parent = nullptr);
|
||||
~ElaTableView();
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void tableViewShow();
|
||||
Q_SIGNAL void tableViewHide();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void hideEvent(QHideEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void leaveEvent(QEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATABLEVIEW_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELATEXT_H
|
||||
#define ELATEXT_H
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaTextPrivate;
|
||||
class ELA_EXPORT ElaText : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaText)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsWrapAnywhere)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPointSize)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaTextType::TextStyle, TextStyle)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaIconType::IconName, ElaIcon)
|
||||
public:
|
||||
explicit ElaText(QWidget* parent = nullptr);
|
||||
explicit ElaText(QString text, QWidget* parent = nullptr);
|
||||
explicit ElaText(QString text, int pixelSize, QWidget* parent = nullptr);
|
||||
~ElaText() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATEXT_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELATHEME_H
|
||||
#define ELATHEME_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
#define eTheme ElaTheme::getInstance()
|
||||
#define ElaThemeColor(themeMode, themeColor) eTheme->getThemeColor(themeMode, ElaThemeType::themeColor)
|
||||
class QPainter;
|
||||
class ElaThemePrivate;
|
||||
class ELA_EXPORT ElaTheme : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTheme)
|
||||
Q_SINGLETON_CREATE_H(ElaTheme)
|
||||
private:
|
||||
explicit ElaTheme(QObject* parent = nullptr);
|
||||
~ElaTheme();
|
||||
|
||||
public:
|
||||
void setThemeMode(ElaThemeType::ThemeMode themeMode);
|
||||
ElaThemeType::ThemeMode getThemeMode() const;
|
||||
|
||||
void drawEffectShadow(QPainter* painter, QRect widgetRect, int shadowBorderWidth, int borderRadius);
|
||||
|
||||
void setThemeColor(ElaThemeType::ThemeMode themeMode, ElaThemeType::ThemeColor themeColor, QColor newColor);
|
||||
const QColor& getThemeColor(ElaThemeType::ThemeMode themeMode, ElaThemeType::ThemeColor themeColor);
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void themeModeChanged(ElaThemeType::ThemeMode themeMode);
|
||||
};
|
||||
|
||||
#endif // ELATHEME_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELATOGGLEBUTTON_H
|
||||
#define ELATOGGLEBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaToggleButtonPrivate;
|
||||
class ELA_EXPORT ElaToggleButton : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToggleButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Text)
|
||||
public:
|
||||
explicit ElaToggleButton(QWidget* parent = nullptr);
|
||||
explicit ElaToggleButton(QString text, QWidget* parent = nullptr);
|
||||
~ElaToggleButton();
|
||||
|
||||
void setIsToggled(bool isToggled);
|
||||
bool getIsToggled() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void toggled(bool checked);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOGGLEBUTTON_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELATOGGLESWITCH_H
|
||||
#define ELATOGGLESWITCH_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaToggleSwitchPrivate;
|
||||
class ELA_EXPORT ElaToggleSwitch : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToggleSwitch);
|
||||
|
||||
public:
|
||||
explicit ElaToggleSwitch(QWidget* parent = nullptr);
|
||||
~ElaToggleSwitch() override;
|
||||
void setIsToggled(bool isToggled);
|
||||
bool getIsToggled() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void toggled(bool checked);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOGGLESWITCH_H
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ELATOOLBAR_H
|
||||
#define ELATOOLBAR_H
|
||||
|
||||
#include <QToolBar>
|
||||
|
||||
#include "ElaDef.h"
|
||||
class ElaToolBarPrivate;
|
||||
class ELA_EXPORT ElaToolBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToolBar)
|
||||
public:
|
||||
explicit ElaToolBar(QWidget* parent = nullptr);
|
||||
explicit ElaToolBar(const QString& title, QWidget* parent = nullptr);
|
||||
~ElaToolBar() override;
|
||||
|
||||
void setToolBarSpacing(int spacing);
|
||||
int getToolBarSpacing() const;
|
||||
|
||||
void setToolButtonSize(const QSize& size);
|
||||
const QSize& getToolButtonSize() const;
|
||||
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text);
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text, const QKeySequence& shortcut);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOOLBAR_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELATOOLBUTTON_H
|
||||
#define ELATOOLBUTTON_H
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
class ElaMenu;
|
||||
class ElaToolButtonPrivate;
|
||||
class ELA_EXPORT ElaToolButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToolButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsSelected);
|
||||
|
||||
public:
|
||||
explicit ElaToolButton(QWidget* parent = nullptr);
|
||||
~ElaToolButton() override;
|
||||
|
||||
void setIsTransparent(bool isTransparent);
|
||||
bool getIsTransparent() const;
|
||||
|
||||
void setMenu(ElaMenu* menu);
|
||||
void setElaIcon(ElaIconType::IconName icon);
|
||||
void setElaIcon(ElaIconType::IconName icon, int rotate);
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOOLBUTTON_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELATOOLTIP_H
|
||||
#define ELATOOLTIP_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaToolTipPrivate;
|
||||
class ELA_EXPORT ElaToolTip : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToolTip)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(int, DisplayMsec)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ShowDelayMsec)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HideDelayMsec)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, ToolTip)
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, CustomWidget)
|
||||
public:
|
||||
explicit ElaToolTip(QWidget* parent = nullptr);
|
||||
~ElaToolTip() override;
|
||||
|
||||
void updatePos();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
};
|
||||
|
||||
#endif // ELATOOLTIP_H
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef ELATREEVIEW_H
|
||||
#define ELATREEVIEW_H
|
||||
|
||||
#include <QTreeView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaTreeViewPrivate;
|
||||
class ELA_EXPORT ElaTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTreeView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ItemHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HeaderMargin)
|
||||
public:
|
||||
explicit ElaTreeView(QWidget* parent = nullptr);
|
||||
~ElaTreeView();
|
||||
};
|
||||
|
||||
#endif // ELATREEVIEW_H
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ELAWIDGET_H
|
||||
#define ELAWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaDef.h"
|
||||
class ElaWidgetPrivate;
|
||||
class ELA_EXPORT ElaWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaWidget)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaWidget(QWidget* parent = nullptr);
|
||||
~ElaWidget() override;
|
||||
void moveToCenter();
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void routeBackButtonClicked();
|
||||
Q_SIGNAL void navigationButtonClicked();
|
||||
Q_SIGNAL void themeChangeButtonClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAWIDGET_H
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
#ifndef ELAWINDOW_H
|
||||
#define ELAWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaDef.h"
|
||||
#include "ElaSuggestBox.h"
|
||||
class ElaWindowPrivate;
|
||||
class ELA_EXPORT ElaWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaWindow)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ThemeChangeTime)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsCentralStackedWidgetTransparent)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAllowPageOpenInNewWindow)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsNavigationBarEnable)
|
||||
Q_PROPERTY_CREATE_Q_H(int, NavigationBarWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentStackIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaNavigationType::NavigationDisplayMode, NavigationBarDisplayMode)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaWindowType::StackSwitchMode, StackSwitchMode)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaWindowType::PaintMode, WindowPaintMode)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
Q_INVOKABLE explicit ElaWindow(QWidget* parent = nullptr);
|
||||
~ElaWindow() override;
|
||||
|
||||
void moveToCenter();
|
||||
|
||||
void setCustomWidget(ElaAppBarType::CustomArea customArea, QWidget* customWidget, QObject* hitTestObject = nullptr, const QString& hitTestFunctionName = "");
|
||||
QWidget* getCustomWidget(ElaAppBarType::CustomArea customArea) const;
|
||||
|
||||
void setCentralCustomWidget(QWidget* customWidget);
|
||||
QWidget* getCentralCustomWidget() const;
|
||||
|
||||
void setCustomMenu(QMenu* customMenu);
|
||||
QMenu* getCustomMenu() const;
|
||||
|
||||
void setUserInfoCardVisible(bool isVisible);
|
||||
void setUserInfoCardPixmap(QPixmap pix);
|
||||
void setUserInfoCardTitle(QString title);
|
||||
void setUserInfoCardSubTitle(QString subTitle);
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, ElaIconType::IconName awesome = ElaIconType::None) const;
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None) const;
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None) const;
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QWidget* page, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey, const QString& targetExpanderKey);
|
||||
|
||||
void addCentralWidget(QWidget* centralWidget);
|
||||
QWidget* getCentralWidget(int index) const;
|
||||
|
||||
bool getNavigationNodeIsExpanded(QString expanderKey) const;
|
||||
void expandNavigationNode(QString expanderKey);
|
||||
void collapseNavigationNode(QString expanderKey);
|
||||
void removeNavigationNode(QString nodeKey) const;
|
||||
int getPageOpenInNewWindowCount(QString nodeKey) const;
|
||||
void backtrackNavigationNode(QString nodeKey);
|
||||
|
||||
void setNodeKeyPoints(QString nodeKey, int keyPoints);
|
||||
int getNodeKeyPoints(QString nodeKey) const;
|
||||
|
||||
void setNavigationNodeTitle(QString nodeKey, QString nodeTitle);
|
||||
QString getNavigationNodeTitle(QString nodeKey) const;
|
||||
|
||||
void navigation(QString pageKey);
|
||||
int getCurrentNavigationIndex() const;
|
||||
QString getCurrentNavigationPageKey() const;
|
||||
|
||||
QList<ElaSuggestBox::SuggestData> getNavigationSuggestDataList() const;
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
|
||||
void setWindowMoviePath(ElaThemeType::ThemeMode themeMode, const QString& moviePath);
|
||||
QString getWindowMoviePath(ElaThemeType::ThemeMode themeMode) const;
|
||||
|
||||
void setWindowPixmap(ElaThemeType::ThemeMode themeMode, const QPixmap& pixmap);
|
||||
QPixmap getWindowPixmap(ElaThemeType::ThemeMode themeMode) const;
|
||||
|
||||
void setWindowMovieRate(qreal rate);
|
||||
qreal getWindowMovieRate() const;
|
||||
|
||||
void tabifyDockWidget(QDockWidget* targetDockWidget, QDockWidget* dockWidget);
|
||||
void tabifyDockWidget(Qt::DockWidgetArea area, const QString& targetDockTitle, QDockWidget* dockWidget);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void userInfoCardClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
Q_SIGNAL void navigationNodeClicked(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey);
|
||||
Q_SIGNAL void customWidgetChanged();
|
||||
Q_SIGNAL void centralCustomWidgetChanged();
|
||||
Q_SIGNAL void customMenuChanged();
|
||||
Q_SIGNAL void pageOpenInNewWindow(QString nodeKey);
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
virtual QMenu* createPopupMenu() override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
private:
|
||||
QWidget* centralWidget() const;
|
||||
void setCentralWidget(QWidget* widget);
|
||||
};
|
||||
|
||||
#endif // ELAWINDOW_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||||
####### Any changes to this file will be overwritten by the next CMake run ####
|
||||
####### The input file was ElaWidgetToolsConfig.cmake.in ########
|
||||
|
||||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE)
|
||||
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
####################################################################################
|
||||
|
||||
set( ElaWidgetTools_LIBRARIES ElaWidgetTools)
|
||||
set( ElaWidgetTools_INCLUDE_DIRS ${PACKAGE_PREFIX_DIR}/include)
|
||||
set( ElaWidgetTools_LIBRARY_DIRS ${PACKAGE_PREFIX_DIR}/lib)
|
||||
|
||||
check_required_components(${PROJECT_NAME})
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
include(${PACKAGE_PREFIX_DIR}/lib/cmake/ElaWidgetToolsTargets.cmake)
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "2.0.0")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("2.0.0" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "2.0.0")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed project requested no architecture check, don't perform the check
|
||||
if("FALSE")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file for configuration "Debug".
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Import target "ElaWidgetTools" for configuration "Debug"
|
||||
set_property(TARGET ElaWidgetTools APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(ElaWidgetTools PROPERTIES
|
||||
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/ElaWidgetTools/lib/libElaWidgetTools.dll.a"
|
||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/ElaWidgetTools/bin/ElaWidgetTools.dll"
|
||||
)
|
||||
|
||||
list(APPEND _cmake_import_check_targets ElaWidgetTools )
|
||||
list(APPEND _cmake_import_check_files_for_ElaWidgetTools "${_IMPORT_PREFIX}/ElaWidgetTools/lib/libElaWidgetTools.dll.a" "${_IMPORT_PREFIX}/ElaWidgetTools/bin/ElaWidgetTools.dll" )
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 2.8.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
message(FATAL_ERROR "CMake >= 2.8.3 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 2.8.3...3.22)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS ElaWidgetTools)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target ElaWidgetTools
|
||||
add_library(ElaWidgetTools SHARED IMPORTED)
|
||||
|
||||
set_target_properties(ElaWidgetTools PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/ElaWidgetTools/include"
|
||||
INTERFACE_LINK_LIBRARIES "Qt6::Widgets;Qt6::WidgetsPrivate;D3D11;DXGI"
|
||||
)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
|
||||
endif()
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/ElaWidgetToolsTargets-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
Binary file not shown.
|
|
@ -0,0 +1,91 @@
|
|||
@echo off
|
||||
chcp 65001 >nul
|
||||
title Build UFT30 ChangeCode
|
||||
|
||||
echo.
|
||||
echo ==========================================
|
||||
echo Building UFT30 ChangeCode
|
||||
echo ==========================================
|
||||
echo.
|
||||
|
||||
REM Set paths
|
||||
set QT_PATH=D:\01.InstallInfo\InstallPath\QT\6.6.2\mingw_64
|
||||
set MINGW_PATH=D:\01.InstallInfo\InstallPath\QT\Tools\mingw1120_64
|
||||
|
||||
REM Check if paths exist
|
||||
if not exist "%QT_PATH%\bin\qmake.exe" (
|
||||
echo ERROR: Cannot find qmake.exe
|
||||
echo Please check QT_PATH variable
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%MINGW_PATH%\bin\mingw32-make.exe" (
|
||||
echo ERROR: Cannot find mingw32-make.exe
|
||||
echo Please check MINGW_PATH variable
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Set PATH
|
||||
set PATH=%QT_PATH%\bin;%MINGW_PATH%\bin;%PATH%
|
||||
echo [OK] Environment configured
|
||||
echo.
|
||||
|
||||
REM Check and close running program
|
||||
echo [1/4] Checking running program...
|
||||
tasklist /FI "IMAGENAME eq Uft30ChangeCode.exe" 2>NUL | find /I /N "Uft30ChangeCode.exe">NUL
|
||||
if "%ERRORLEVEL%"=="0" (
|
||||
echo [WARN] Program is running, closing...
|
||||
taskkill /F /IM "Uft30ChangeCode.exe" >nul 2>&1
|
||||
timeout /t 1 /nobreak >nul
|
||||
echo [OK] Program closed
|
||||
)
|
||||
echo.
|
||||
|
||||
REM Clean old files
|
||||
echo [2/4] Cleaning old build files...
|
||||
if exist Makefile del /Q Makefile
|
||||
if exist Makefile.Debug del /Q Makefile.Debug
|
||||
if exist Makefile.Release del /Q Makefile.Release
|
||||
if exist .qmake.stash del /Q .qmake.stash
|
||||
if exist debug rmdir /S /Q debug 2>nul
|
||||
if exist release rmdir /S /Q release 2>nul
|
||||
echo [OK] Old files cleaned
|
||||
echo.
|
||||
|
||||
REM Run qmake
|
||||
echo [3/4] Running qmake...
|
||||
qmake Uft30ChangeCode.pro -spec win32-g++
|
||||
if errorlevel 1 (
|
||||
echo ERROR: qmake failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [OK] qmake done
|
||||
echo.
|
||||
|
||||
REM Compile
|
||||
echo [4/4] Compiling Debug version...
|
||||
mingw32-make debug
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo ERROR: Compilation failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ==========================================
|
||||
echo Build SUCCESSFUL!
|
||||
echo ==========================================
|
||||
echo.
|
||||
echo Output: bin\Uft30ChangeCode.exe
|
||||
echo.
|
||||
if exist "bin\uf2touft3\uf2touft3.exe" (
|
||||
echo [OK] uf2touft3.exe found, everything is ready!
|
||||
) else (
|
||||
echo [WARN] Please make sure bin\uf2touft3\uf2touft3.exe exists
|
||||
)
|
||||
echo.
|
||||
pause
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
@echo off
|
||||
chcp 65001 >nul
|
||||
title Build UFT30 ChangeCode - Advanced
|
||||
|
||||
echo.
|
||||
echo ==========================================
|
||||
echo Build UFT30 ChangeCode (Advanced)
|
||||
echo ==========================================
|
||||
echo.
|
||||
|
||||
REM Set paths
|
||||
set QT_PATH=D:\01.InstallInfo\InstallPath\QT\6.6.2\mingw_64
|
||||
set MINGW_PATH=D:\01.InstallInfo\InstallPath\QT\Tools\mingw1120_64
|
||||
|
||||
REM Check paths
|
||||
if not exist "%QT_PATH%\bin\qmake.exe" (
|
||||
echo ERROR: Cannot find qmake.exe
|
||||
echo Please check QT_PATH variable
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%MINGW_PATH%\bin\mingw32-make.exe" (
|
||||
echo ERROR: Cannot find mingw32-make.exe
|
||||
echo Please check MINGW_PATH variable
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Set PATH
|
||||
set PATH=%QT_PATH%\bin;%MINGW_PATH%\bin;%PATH%
|
||||
echo [OK] Environment configured
|
||||
echo.
|
||||
|
||||
:MENU
|
||||
echo Please select build type:
|
||||
echo 1 - Debug (with debug info)
|
||||
echo 2 - Release (optimized for release)
|
||||
echo 3 - Both (Debug + Release)
|
||||
echo 4 - Exit
|
||||
echo.
|
||||
set /p BUILD_TYPE="Enter option (1-4): "
|
||||
|
||||
if "%BUILD_TYPE%"=="1" goto BUILD_DEBUG
|
||||
if "%BUILD_TYPE%"=="2" goto BUILD_RELEASE
|
||||
if "%BUILD_TYPE%"=="3" goto BUILD_BOTH
|
||||
if "%BUILD_TYPE%"=="4" goto EXIT_SCRIPT
|
||||
|
||||
echo ERROR: Invalid option, please try again
|
||||
echo.
|
||||
goto MENU
|
||||
|
||||
:BUILD_DEBUG
|
||||
echo.
|
||||
echo [Selected] Debug version
|
||||
call :DO_BUILD Debug
|
||||
goto END_SUCCESS
|
||||
|
||||
:BUILD_RELEASE
|
||||
echo.
|
||||
echo [Selected] Release version
|
||||
call :DO_BUILD Release
|
||||
goto END_SUCCESS
|
||||
|
||||
:BUILD_BOTH
|
||||
echo.
|
||||
echo [Selected] Both versions
|
||||
echo.
|
||||
call :DO_BUILD Debug
|
||||
echo.
|
||||
call :DO_BUILD Release
|
||||
goto END_SUCCESS
|
||||
|
||||
:EXIT_SCRIPT
|
||||
echo.
|
||||
echo [Exit] Script terminated
|
||||
pause
|
||||
exit /b 0
|
||||
|
||||
:DO_BUILD
|
||||
set BUILD_NAME=%~1
|
||||
|
||||
echo.
|
||||
echo ==========================================
|
||||
echo Building %BUILD_NAME% version
|
||||
echo ==========================================
|
||||
|
||||
REM Check and close running program
|
||||
echo.
|
||||
echo [1/4] Checking running program...
|
||||
tasklist /FI "IMAGENAME eq Uft30ChangeCode.exe" 2>NUL | find /I /N "Uft30ChangeCode.exe">NUL
|
||||
if "%ERRORLEVEL%"=="0" (
|
||||
echo [WARN] Program is running, closing...
|
||||
taskkill /F /IM "Uft30ChangeCode.exe" >nul 2>&1
|
||||
timeout /t 1 /nobreak >nul
|
||||
echo [OK] Program closed
|
||||
)
|
||||
|
||||
REM Clean old files
|
||||
echo.
|
||||
echo [2/4] Cleaning old build files...
|
||||
if exist Makefile del /Q Makefile
|
||||
if exist Makefile.Debug del /Q Makefile.Debug
|
||||
if exist Makefile.Release del /Q Makefile.Release
|
||||
if exist .qmake.stash del /Q .qmake.stash
|
||||
if exist debug rmdir /S /Q debug 2>nul
|
||||
if exist release rmdir /S /Q release 2>nul
|
||||
echo [OK] Old files cleaned
|
||||
|
||||
REM Run qmake
|
||||
echo.
|
||||
echo [3/4] Running qmake...
|
||||
qmake Uft30ChangeCode.pro -spec win32-g++
|
||||
if errorlevel 1 (
|
||||
echo ERROR: qmake failed
|
||||
exit /b 1
|
||||
)
|
||||
echo [OK] qmake done
|
||||
|
||||
REM Compile
|
||||
echo.
|
||||
echo [4/4] Compiling...
|
||||
if "%BUILD_NAME%"=="Debug" (
|
||||
mingw32-make debug
|
||||
) else (
|
||||
mingw32-make release
|
||||
)
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Compilation failed
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [OK] %BUILD_NAME% version compiled!
|
||||
goto :eof
|
||||
|
||||
:END_SUCCESS
|
||||
echo.
|
||||
echo ==========================================
|
||||
echo Build SUCCESSFUL!
|
||||
echo ==========================================
|
||||
echo.
|
||||
echo Output: bin\Uft30ChangeCode.exe
|
||||
echo.
|
||||
if exist "bin\uf2touft3\uf2touft3.exe" (
|
||||
echo [OK] uf2touft3.exe found, everything is ready!
|
||||
) else (
|
||||
echo [WARN] Please make sure bin\uf2touft3\uf2touft3.exe exists
|
||||
)
|
||||
echo.
|
||||
pause
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#include "src/mainwindow/mainwindow.h"
|
||||
#include "ElaApplication.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
eApp->init();
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
# Python 项目集成指南
|
||||
|
||||
本指南说明如何将 `F:/04.python/04.python/uf2touft3` 项目与 Qt 应用程序集成。
|
||||
|
||||
## 两个方案对比
|
||||
|
||||
### 方案一:增强的 QProcess 方案 (推荐用于生产环境)
|
||||
|
||||
**优点:**
|
||||
- 简单稳定,不易出错
|
||||
- 进程隔离,不会影响主应用程序
|
||||
- Python 依赖问题独立解决
|
||||
- 调试方便
|
||||
|
||||
**缺点:**
|
||||
- 进程间通信开销
|
||||
- 无法直接共享内存
|
||||
|
||||
**状态:已实现并集成 ✅**
|
||||
|
||||
### 方案二:pybind11 嵌入方案 (高级选项)
|
||||
|
||||
**优点:**
|
||||
- 更紧密的集成
|
||||
- 可以直接调用 Python 函数
|
||||
- 更好的性能
|
||||
|
||||
**缺点:**
|
||||
- 配置复杂
|
||||
- 需要 C++ 编译环境
|
||||
- 调试困难
|
||||
- Python 全局解释器锁 (GIL) 问题
|
||||
|
||||
**状态:提供示例代码 ⚠️**
|
||||
|
||||
## 使用方案一 (推荐)
|
||||
|
||||
### 1. 确保 Python 环境可用
|
||||
|
||||
确保系统已安装 Python 3.8+,并且可以在命令行中运行:
|
||||
```bash
|
||||
python --version
|
||||
```
|
||||
|
||||
### 2. 确保 Python 项目完整
|
||||
|
||||
确保 `F:/04.python/04.python/uf2touft3` 目录包含所有必要文件:
|
||||
- `main.py`
|
||||
- `processCombination.py`
|
||||
- `config.ini`
|
||||
- 其他依赖的模块和配置文件
|
||||
|
||||
### 3. 使用 Qt 应用程序
|
||||
|
||||
直接运行编译好的 `Uft30ChangeCode.exe`,点击"开始转换"按钮即可调用 Python 代码。
|
||||
|
||||
## 构建方案二 (高级)
|
||||
|
||||
如果你想使用 pybind11 方案,按以下步骤:
|
||||
|
||||
### 1. 安装依赖
|
||||
|
||||
```bash
|
||||
pip install pybind11
|
||||
```
|
||||
|
||||
### 2. 创建构建目录
|
||||
|
||||
```bash
|
||||
cd python_bindings/pybind11_binding
|
||||
mkdir build
|
||||
cd build
|
||||
```
|
||||
|
||||
### 3. 配置 CMake
|
||||
|
||||
```bash
|
||||
cmake .. -G "MinGW Makefiles"
|
||||
# 或使用 Visual Studio
|
||||
# cmake .. -G "Visual Studio 16 2019" -A x64
|
||||
```
|
||||
|
||||
### 4. 编译
|
||||
|
||||
```bash
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
### 5. 集成到 Qt 项目
|
||||
|
||||
在你的 Qt 代码中动态加载编译好的库。
|
||||
|
||||
## Python 项目的依赖
|
||||
|
||||
确保你的 Python 项目所需的所有依赖都已安装:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
*(需要在 uf2touft3 项目中创建 requirements.txt)*
|
||||
|
||||
## 故障排查
|
||||
|
||||
### Python 无法启动
|
||||
- 检查 Python 是否在 PATH 中
|
||||
- 尝试设置完整的 Python 路径
|
||||
- 检查是否有多个 Python 版本
|
||||
|
||||
### 模块导入错误
|
||||
- 确保工作目录设置正确
|
||||
- 检查所有依赖的模块是否都在 Python 路径中
|
||||
- 检查 `config.ini` 中的路径配置是否正确
|
||||
|
||||
### 中文路径问题
|
||||
- 确保所有路径使用 UTF-8 编码
|
||||
- 避免在路径中使用特殊字符
|
||||
|
||||
## 自定义配置
|
||||
|
||||
如需修改 Python 脚本路径,可以编辑 `mainwindow.cpp` 中的配置:
|
||||
```cpp
|
||||
QString scriptPath = "F:/04.python/04.python/uf2touft3/main.py";
|
||||
```
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Python Bindings for UFT30 Change Code
|
||||
|
||||
本目录包含将 Python 项目编译为可被 Qt 调用的库的相关代码。
|
||||
|
||||
## 方案一:使用 pybind11 (推荐用于高性能集成)
|
||||
|
||||
此方案创建一个 C++ 库,直接嵌入 Python 解释器并调用 Python 代码。
|
||||
|
||||
## 方案二:增强的 QProcess 方案 (推荐用于简单集成)
|
||||
|
||||
此方案保持使用子进程调用,但增加更好的错误处理、进度显示等功能。
|
||||
|
||||
## 构建说明
|
||||
|
||||
### 前置要求
|
||||
|
||||
- Python 3.8+ (开发版,包含头文件)
|
||||
- CMake 3.15+
|
||||
- Visual Studio 2019+ 或 MinGW-w64
|
||||
- pybind11 (可以通过 pip 安装)
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
cmake_minimum_required(VERSION 3.15)
|
||||
project(uf2touft3_binding VERSION 1.0.0 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# 查找 Python
|
||||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
||||
|
||||
# 尝试查找 pybind11
|
||||
# 方法 1: 通过 pip 安装的 pybind11
|
||||
execute_process(
|
||||
COMMAND ${Python3_EXECUTABLE} -m pybind11 --cmakedir
|
||||
OUTPUT_VARIABLE PYBIND11_CMAKE_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if(PYBIND11_CMAKE_DIR)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${PYBIND11_CMAKE_DIR})
|
||||
endif()
|
||||
|
||||
find_package(pybind11 REQUIRED)
|
||||
|
||||
# 创建 Python 模块
|
||||
pybind11_add_module(uf2touft3_binding uf2touft3_binding.cpp)
|
||||
|
||||
# Windows 特定设置
|
||||
if(WIN32)
|
||||
set_target_properties(uf2touft3_binding PROPERTIES
|
||||
SUFFIX ".pyd"
|
||||
)
|
||||
endif()
|
||||
|
||||
# 安装目标
|
||||
install(TARGETS uf2touft3_binding
|
||||
LIBRARY DESTINATION .
|
||||
RUNTIME DESTINATION .
|
||||
)
|
||||
|
||||
message(STATUS "Python3 executable: ${Python3_EXECUTABLE}")
|
||||
message(STATUS "Python3 include dirs: ${Python3_INCLUDE_DIRS}")
|
||||
message(STATUS "Python3 libraries: ${Python3_LIBRARIES}")
|
||||
message(STATUS "pybind11 found: ${pybind11_FOUND}")
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/embed.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
// 全局解释器持有对象
|
||||
py::scoped_interpreter* g_python_interpreter = nullptr;
|
||||
|
||||
// 初始化 Python 解释器
|
||||
extern "C" __declspec(dllexport) bool InitializePython()
|
||||
{
|
||||
try {
|
||||
if (!g_python_interpreter) {
|
||||
g_python_interpreter = new py::scoped_interpreter();
|
||||
}
|
||||
return true;
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "Failed to initialize Python: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 清理 Python 解释器
|
||||
extern "C" __declspec(dllexport) void FinalizePython()
|
||||
{
|
||||
if (g_python_interpreter) {
|
||||
delete g_python_interpreter;
|
||||
g_python_interpreter = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// 执行 doWork 函数
|
||||
extern "C" __declspec(dllexport) bool RunConversion(const char* script_path)
|
||||
{
|
||||
try {
|
||||
if (!g_python_interpreter) {
|
||||
std::cerr << "Python interpreter not initialized!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 添加脚本路径到 sys.path
|
||||
py::module sys = py::module::import("sys");
|
||||
py::object path = sys.attr("path");
|
||||
|
||||
// 获取脚本目录
|
||||
std::string script_dir = script_path;
|
||||
size_t last_sep = script_dir.find_last_of("/\\");
|
||||
if (last_sep != std::string::npos) {
|
||||
script_dir = script_dir.substr(0, last_sep);
|
||||
}
|
||||
|
||||
// 添加到 sys.path
|
||||
path.attr("insert")(0, script_dir);
|
||||
|
||||
// 导入脚本模块
|
||||
py::module script_module = py::module::import("main");
|
||||
|
||||
// 调用 doWork 函数
|
||||
script_module.attr("doWork")();
|
||||
|
||||
return true;
|
||||
} catch (const py::error_already_set& e) {
|
||||
std::cerr << "Python error: " << e.what() << std::endl;
|
||||
return false;
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "Error: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 简单的 C API 封装
|
||||
PYBIND11_MODULE(uf2touft3, m) {
|
||||
m.doc() = "UFT2 to UFT3 code conversion module";
|
||||
|
||||
m.def("initialize", &InitializePython, "Initialize Python interpreter");
|
||||
m.def("finalize", &FinalizePython, "Finalize Python interpreter");
|
||||
m.def("run_conversion", &RunConversion, "Run the conversion process",
|
||||
py::arg("script_path"));
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
@echo off
|
||||
echo ========================================
|
||||
echo UFT30 ChangeCode - Python 工具初始化
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
REM 设置目录
|
||||
set "PROJECT_DIR=%~dp0"
|
||||
set "PYTHON_SRC_DIR=F:\04.python\04.python\uf2touft3"
|
||||
set "PYTHON_DEST_DIR=%PROJECT_DIR%3rd\Python\uf2touft3"
|
||||
set "BIN_DEST_DIR=%PYTHON_DEST_DIR%\bin"
|
||||
|
||||
echo [步骤 1/4] 创建目录结构...
|
||||
if not exist "%PYTHON_DEST_DIR%" mkdir "%PYTHON_DEST_DIR%"
|
||||
if not exist "%PYTHON_DEST_DIR%\src" mkdir "%PYTHON_DEST_DIR%\src"
|
||||
if not exist "%BIN_DEST_DIR%" mkdir "%BIN_DEST_DIR%"
|
||||
echo ✓ 目录结构已创建
|
||||
echo.
|
||||
|
||||
echo [步骤 2/4] 复制 Python 源代码...
|
||||
xcopy /E /I /Y "%PYTHON_SRC_DIR%" "%PYTHON_DEST_DIR%\src\" >nul
|
||||
echo ✓ 源代码已复制
|
||||
echo.
|
||||
|
||||
echo [步骤 3/4] 复制配置文件...
|
||||
if exist "%PYTHON_SRC_DIR%\config.ini" (
|
||||
copy /Y "%PYTHON_SRC_DIR%\config.ini" "%BIN_DEST_DIR%\" >nul
|
||||
echo ✓ 配置文件已复制到 bin 目录
|
||||
)
|
||||
echo.
|
||||
|
||||
echo [步骤 4/4] 复制临时可执行文件(占位符)...
|
||||
REM 这里可以先放一个简单的说明文件
|
||||
echo 请运行 build_package.bat 来生成 uf2touft3_converter.exe > "%BIN_DEST_DIR%\README.txt"
|
||||
echo.
|
||||
|
||||
echo ========================================
|
||||
echo ✓ 初始化完成!
|
||||
echo.
|
||||
echo 下一步:
|
||||
echo 1. 运行 3rd\Python\uf2touft3\build_package.bat
|
||||
echo 来打包 Python 项目
|
||||
echo 2. 编译 Qt 项目,Python 工具会自动
|
||||
echo 拷贝到 bin 目录
|
||||
echo ========================================
|
||||
echo.
|
||||
pause
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
#include "mainwindow.h"
|
||||
#include "ElaIcon.h"
|
||||
#include "ElaText.h"
|
||||
#include "ElaTheme.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QGroupBox>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
#include <QTextEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: ElaWindow(parent)
|
||||
, m_pythonRunner(new PythonRunner(this))
|
||||
{
|
||||
initWindow();
|
||||
initContent();
|
||||
|
||||
// 获取应用程序目录
|
||||
QString appDir = QCoreApplication::applicationDirPath();
|
||||
|
||||
// 配置 Python 运行器 - 只使用打包好的 exe,路径是 uf2touft3/uf2touft3.exe
|
||||
m_pythonRunner->setRunMode(PythonRunner::UsePackagedExe);
|
||||
|
||||
// 设置打包好的可执行文件路径和工作目录
|
||||
QString exePath = appDir + "/uf2touft3/uf2touft3.exe";
|
||||
QString workDir = appDir + "/uf2touft3";
|
||||
|
||||
m_pythonRunner->setPackagedExePath(exePath);
|
||||
m_pythonRunner->setWorkingDirectory(workDir);
|
||||
|
||||
// 检查 exe 是否存在
|
||||
QFileInfo exeInfo(exePath);
|
||||
if (!exeInfo.exists() || !exeInfo.isFile()) {
|
||||
m_batchLogEdit->append("⚠️ 警告:未找到 uf2touft3/uf2touft3.exe!");
|
||||
m_batchLogEdit->append(QString(" 期望位置:%1").arg(exePath));
|
||||
} else {
|
||||
m_batchLogEdit->append("✓ Python 工具准备就绪");
|
||||
}
|
||||
|
||||
connect(m_pythonRunner, &PythonRunner::finished, this, &MainWindow::onPythonRunnerFinished);
|
||||
connect(m_pythonRunner, &PythonRunner::standardOutput, this, &MainWindow::onPythonRunnerOutput);
|
||||
connect(m_pythonRunner, &PythonRunner::standardError, this, &MainWindow::onPythonRunnerError);
|
||||
connect(m_pythonRunner, &PythonRunner::started, [this]() {
|
||||
m_batchLogEdit->append("转换任务已启动...");
|
||||
});
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::initWindow()
|
||||
{
|
||||
setWindowTitle("UFT30 Change Code");
|
||||
setWindowIcon(QIcon(":/Resource/Image/Cirno.jpg"));
|
||||
resize(900, 600);
|
||||
setUserInfoCardTitle("UFT30");
|
||||
setUserInfoCardSubTitle("Change Code Tool");
|
||||
}
|
||||
|
||||
void MainWindow::initContent()
|
||||
{
|
||||
QString helpKey;
|
||||
QString aboutKey;
|
||||
QString settingKey;
|
||||
addPageNode("转码业务", createBatchConvertPage(), ElaIconType::FileCode);
|
||||
addPageNode("功能搜索", createFunctionSearchPage(), ElaIconType::MagnifyingGlass);
|
||||
addFooterNode("帮助", createHelpPage(), helpKey, 0, ElaIconType::CircleQuestion);
|
||||
addFooterNode("关于", createAboutPage(), aboutKey, 0, ElaIconType::User);
|
||||
addFooterNode("设置", createSettingsPage(), settingKey, 0, ElaIconType::GearComplex);
|
||||
}
|
||||
|
||||
QWidget* MainWindow::createBatchConvertPage()
|
||||
{
|
||||
BatchConvertPage *page = new BatchConvertPage;
|
||||
m_batchLogEdit = page->getLogEdit();
|
||||
connect(page, &BatchConvertPage::startConvert, this, &MainWindow::onBatchConvertStart);
|
||||
connect(m_pythonRunner, &PythonRunner::started, [this]() {
|
||||
if (m_batchLogEdit) {
|
||||
m_batchLogEdit->append("转换任务已启动...");
|
||||
}
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
QWidget* MainWindow::createFunctionSearchPage()
|
||||
{
|
||||
return new FunctionSearchPage;
|
||||
}
|
||||
|
||||
QWidget* MainWindow::createHelpPage()
|
||||
{
|
||||
return new HelpPage;
|
||||
}
|
||||
|
||||
QWidget* MainWindow::createAboutPage()
|
||||
{
|
||||
return new AboutPage;
|
||||
}
|
||||
|
||||
QWidget* MainWindow::createSettingsPage()
|
||||
{
|
||||
return new SettingsPage();
|
||||
}
|
||||
|
||||
void MainWindow::onBatchConvertStart()
|
||||
{
|
||||
if (m_pythonRunner->isRunning()) {
|
||||
m_batchLogEdit->append("警告: 上一个任务还在运行中...");
|
||||
QMessageBox::warning(this, "提示", "上一个转换任务正在运行,请等待完成或停止当前任务。");
|
||||
return;
|
||||
}
|
||||
|
||||
QString appDir = QCoreApplication::applicationDirPath();
|
||||
QString exePath = appDir + "/uf2touft3/uf2touft3.exe";
|
||||
|
||||
if (!m_pythonRunner->canRun()) {
|
||||
m_batchLogEdit->append("错误: 找不到 uf2touft3/uf2touft3.exe!");
|
||||
QMessageBox::critical(this, "错误",
|
||||
QString("无法启动转换任务!\n\n请确保:\nuf2touft3/uf2touft3.exe 存在,且该目录下包含 config.ini\n\n期望路径:\n%1")
|
||||
.arg(exePath));
|
||||
return;
|
||||
}
|
||||
|
||||
m_batchLogEdit->append("========================================");
|
||||
m_batchLogEdit->append("开始执行 UFT2 到 UFT3 的代码转换...");
|
||||
m_batchLogEdit->append(QString("工具路径: %1").arg(exePath));
|
||||
m_batchLogEdit->append("========================================");
|
||||
|
||||
if (!m_pythonRunner->start()) {
|
||||
m_batchLogEdit->append("错误: 无法启动转换进程!");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onPythonRunnerFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
m_batchLogEdit->append("========================================");
|
||||
if (exitStatus == QProcess::NormalExit && exitCode == 0) {
|
||||
m_batchLogEdit->append("✓ 代码转换完成!");
|
||||
QMessageBox::information(this, "完成", "代码转换任务已成功完成!");
|
||||
} else {
|
||||
m_batchLogEdit->append(QString("✗ 转换失败! 退出码: %1").arg(exitCode));
|
||||
QMessageBox::warning(this, "失败", QString("代码转换任务失败,退出码: %1").arg(exitCode));
|
||||
}
|
||||
m_batchLogEdit->append("========================================");
|
||||
}
|
||||
|
||||
void MainWindow::onPythonRunnerOutput(const QString &output)
|
||||
{
|
||||
if (!output.trimmed().isEmpty()) {
|
||||
m_batchLogEdit->append(output);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onPythonRunnerError(const QString &error)
|
||||
{
|
||||
if (!error.trimmed().isEmpty()) {
|
||||
m_batchLogEdit->append(QString("[ERROR] %1").arg(error));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "ElaWindow.h"
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include "src/pythonrunner/PythonRunner.h"
|
||||
#include "src/pages/batchconvert/batchconvertpage.h"
|
||||
#include "src/pages/functionsearch/functionsearchpage.h"
|
||||
#include "src/pages/help/helppage.h"
|
||||
#include "src/pages/about/aboutpage.h"
|
||||
#include "src/pages/settings/settingspage.h"
|
||||
|
||||
class MainWindow : public ElaWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
void initWindow();
|
||||
void initContent();
|
||||
|
||||
QWidget* createBatchConvertPage();
|
||||
QWidget* createFunctionSearchPage();
|
||||
QWidget* createHelpPage();
|
||||
QWidget* createAboutPage();
|
||||
QWidget* createSettingsPage();
|
||||
|
||||
void onBatchConvertStart();
|
||||
void onPythonRunnerFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void onPythonRunnerOutput(const QString &output);
|
||||
void onPythonRunnerError(const QString &error);
|
||||
|
||||
PythonRunner *m_pythonRunner;
|
||||
QTextEdit *m_batchLogEdit;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#include "aboutpage.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
AboutPage::AboutPage(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
initUI();
|
||||
}
|
||||
|
||||
AboutPage::~AboutPage()
|
||||
{
|
||||
}
|
||||
|
||||
void AboutPage::initUI()
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(30, 30, 30, 30);
|
||||
layout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
QLabel *logoLabel = new QLabel;
|
||||
logoLabel->setStyleSheet("font-size: 48px; text-align: center;");
|
||||
logoLabel->setText("UFT30");
|
||||
layout->addWidget(logoLabel, 0, Qt::AlignCenter);
|
||||
|
||||
QLabel *title = new QLabel("<h1>UFT30 Change Code</h1>");
|
||||
title->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(title);
|
||||
|
||||
QLabel *version = new QLabel("<p style='font-size: 16px;'>版本: 1.0.0</p>");
|
||||
version->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(version);
|
||||
|
||||
QLabel *description = new QLabel("<p style='font-size: 14px; color: #666;'>一款强大的编码转换工具,支持批量转码和非LS格式转换。</p>");
|
||||
description->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(description);
|
||||
|
||||
QLabel *copyright = new QLabel("<p style='font-size: 12px; color: #999;'>Copyright © 2024 UFT30 Team. All rights reserved.</p>");
|
||||
copyright->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(copyright);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef ABOUTPAGE_H
|
||||
#define ABOUTPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class AboutPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutPage(QWidget *parent = nullptr);
|
||||
~AboutPage();
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
};
|
||||
|
||||
#endif // ABOUTPAGE_H
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
#include "batchconvertpage.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QGroupBox>
|
||||
#include <QFile>
|
||||
#include <QCoreApplication>
|
||||
|
||||
BatchConvertPage::BatchConvertPage(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
initUI();
|
||||
}
|
||||
|
||||
BatchConvertPage::~BatchConvertPage()
|
||||
{
|
||||
}
|
||||
|
||||
void BatchConvertPage::initUI()
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(30, 30, 30, 30);
|
||||
layout->setSpacing(20);
|
||||
|
||||
QGroupBox *funcBox = new QGroupBox("转码功能");
|
||||
QVBoxLayout *funcLayout = new QVBoxLayout(funcBox);
|
||||
funcLayout->setSpacing(10);
|
||||
|
||||
QLabel *funcLabel = new QLabel("请输入需要转码的功能名称(每行一个):");
|
||||
funcLayout->addWidget(funcLabel);
|
||||
|
||||
m_funcEdit = new QTextEdit;
|
||||
m_funcEdit->setPlaceholderText("");
|
||||
m_funcEdit->setMinimumHeight(120);
|
||||
funcLayout->addWidget(m_funcEdit);
|
||||
|
||||
layout->addWidget(funcBox);
|
||||
|
||||
QHBoxLayout *btnLayout = new QHBoxLayout;
|
||||
QPushButton *startBtn = new QPushButton("开始转换");
|
||||
startBtn->setStyleSheet("background-color: #1abc9c; color: white; padding: 10px 30px; font-size: 14px; border: none; border-radius: 4px;");
|
||||
connect(startBtn, &QPushButton::clicked, this, &BatchConvertPage::onStartConvert);
|
||||
QPushButton *clearBtn = new QPushButton("清空");
|
||||
connect(clearBtn, &QPushButton::clicked, this, &BatchConvertPage::onClearLog);
|
||||
btnLayout->addStretch();
|
||||
btnLayout->addWidget(startBtn);
|
||||
btnLayout->addWidget(clearBtn);
|
||||
layout->addLayout(btnLayout);
|
||||
|
||||
m_logEdit = new QTextEdit;
|
||||
m_logEdit->setReadOnly(true);
|
||||
m_logEdit->setStyleSheet("background-color: #2c3e50; color: #ecf0f1;");
|
||||
m_logEdit->append("转码工具已准备就绪...");
|
||||
layout->addWidget(m_logEdit);
|
||||
}
|
||||
|
||||
bool BatchConvertPage::saveToCustJson(const QStringList &funcList)
|
||||
{
|
||||
QString jsonPath = QCoreApplication::applicationDirPath() + "/uf2touft3/cust.json";
|
||||
|
||||
QFile file(jsonPath);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
m_logEdit->append("[ERROR] 无法打开文件: " + jsonPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray data = file.readAll();
|
||||
file.close();
|
||||
|
||||
QString content = QString::fromUtf8(data);
|
||||
|
||||
int dirStart = content.indexOf("\"dir\":[");
|
||||
if (dirStart < 0) {
|
||||
dirStart = content.indexOf("\"dir\" : [");
|
||||
}
|
||||
if (dirStart < 0) {
|
||||
m_logEdit->append("[ERROR] 未找到 \"dir\" 节点");
|
||||
return false;
|
||||
}
|
||||
|
||||
int arrayStart = content.indexOf('[', dirStart);
|
||||
int bracketCount = 1;
|
||||
int pos = arrayStart + 1;
|
||||
while (pos < content.length() && bracketCount > 0) {
|
||||
if (content[pos] == '[') bracketCount++;
|
||||
else if (content[pos] == ']') bracketCount--;
|
||||
pos++;
|
||||
}
|
||||
int arrayEnd = pos;
|
||||
|
||||
QString newDirArray = "[";
|
||||
for (int i = 0; i < funcList.size(); ++i) {
|
||||
if (i > 0) newDirArray += ",";
|
||||
newDirArray += "\n \"" + funcList[i] + ".service_design\"";
|
||||
}
|
||||
newDirArray += "\n ]";
|
||||
|
||||
content.replace(arrayStart, arrayEnd - arrayStart, newDirArray);
|
||||
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||
m_logEdit->append("[ERROR] 无法写入文件: " + jsonPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
file.write(content.toUtf8());
|
||||
file.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BatchConvertPage::onStartConvert()
|
||||
{
|
||||
QString funcText = m_funcEdit->toPlainText().trimmed();
|
||||
if (funcText.isEmpty()) {
|
||||
m_logEdit->append("请输入需要转码的功能名称!");
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList funcs = funcText.split('\n', Qt::SkipEmptyParts);
|
||||
QStringList trimmedFuncs;
|
||||
for (const QString &func : funcs) {
|
||||
QString trimmed = func.trimmed();
|
||||
if (!trimmed.isEmpty()) {
|
||||
trimmedFuncs.append(trimmed);
|
||||
}
|
||||
}
|
||||
|
||||
if (trimmedFuncs.isEmpty()) {
|
||||
m_logEdit->append("请输入有效的功能名称!");
|
||||
return;
|
||||
}
|
||||
|
||||
m_logEdit->append("========================================");
|
||||
m_logEdit->append("正在写入 cust.json ...");
|
||||
m_logEdit->append("功能列表:");
|
||||
|
||||
for (const QString &func : trimmedFuncs) {
|
||||
m_logEdit->append(" - " + func + ".service_design");
|
||||
}
|
||||
|
||||
if (saveToCustJson(trimmedFuncs)) {
|
||||
m_logEdit->append("[OK] cust.json 写入成功!");
|
||||
} else {
|
||||
m_logEdit->append("[FAIL] cust.json 写入失败!");
|
||||
m_logEdit->append("========================================");
|
||||
return;
|
||||
}
|
||||
|
||||
m_logEdit->append("========================================");
|
||||
emit startConvert();
|
||||
}
|
||||
|
||||
void BatchConvertPage::onClearLog()
|
||||
{
|
||||
m_logEdit->clear();
|
||||
m_logEdit->append("转码工具已准备就绪...");
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef BATCHCONVERTPAGE_H
|
||||
#define BATCHCONVERTPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QTextEdit>
|
||||
|
||||
class BatchConvertPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BatchConvertPage(QWidget *parent = nullptr);
|
||||
~BatchConvertPage();
|
||||
|
||||
QTextEdit* getLogEdit() { return m_logEdit; }
|
||||
|
||||
signals:
|
||||
void startConvert();
|
||||
|
||||
private slots:
|
||||
void onStartConvert();
|
||||
void onClearLog();
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
bool saveToCustJson(const QStringList &funcList);
|
||||
|
||||
QTextEdit *m_funcEdit;
|
||||
QTextEdit *m_logEdit;
|
||||
};
|
||||
|
||||
#endif // BATCHCONVERTPAGE_H
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
#include "functionsearchpage.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QSet>
|
||||
|
||||
FunctionSearchPage::FunctionSearchPage(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
initUI();
|
||||
}
|
||||
|
||||
FunctionSearchPage::~FunctionSearchPage()
|
||||
{
|
||||
}
|
||||
|
||||
void FunctionSearchPage::initUI()
|
||||
{
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(30, 30, 30, 30);
|
||||
mainLayout->setSpacing(15);
|
||||
|
||||
m_tabWidget = new QTabWidget;
|
||||
|
||||
// ==========================================
|
||||
// Tab 1: UF20功能搜索
|
||||
// ==========================================
|
||||
QWidget *uf20Tab = new QWidget;
|
||||
QVBoxLayout *uf20Layout = new QVBoxLayout(uf20Tab);
|
||||
uf20Layout->setSpacing(15);
|
||||
|
||||
QHBoxLayout *uf20SearchLayout = new QHBoxLayout;
|
||||
m_uf20SearchEdit = new QLineEdit;
|
||||
m_uf20SearchEdit->setPlaceholderText("输入功能名称或关键词搜索...");
|
||||
m_uf20SearchBtn = new QPushButton("搜索");
|
||||
m_uf20SearchBtn->setStyleSheet("padding: 8px 25px;");
|
||||
connect(m_uf20SearchBtn, &QPushButton::clicked, this, &FunctionSearchPage::onSearchUF20);
|
||||
connect(m_uf20SearchEdit, &QLineEdit::returnPressed, this, &FunctionSearchPage::onSearchUF20);
|
||||
connect(m_uf20SearchEdit, &QLineEdit::textChanged, this, &FunctionSearchPage::onUF20SearchTextChanged);
|
||||
uf20SearchLayout->addWidget(m_uf20SearchEdit);
|
||||
uf20SearchLayout->addWidget(m_uf20SearchBtn);
|
||||
uf20Layout->addLayout(uf20SearchLayout);
|
||||
|
||||
m_uf20ResultTable = new QTableWidget;
|
||||
m_uf20ResultTable->setColumnCount(4);
|
||||
m_uf20ResultTable->setHorizontalHeaderLabels({"功能名称", "功能类型", "所属模块", "文件路径"});
|
||||
m_uf20ResultTable->horizontalHeader()->setStretchLastSection(true);
|
||||
m_uf20ResultTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
m_uf20ResultTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||
m_uf20ResultTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
||||
m_uf20ResultTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_uf20ResultTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_uf20ResultTable->setAlternatingRowColors(true);
|
||||
uf20Layout->addWidget(m_uf20ResultTable);
|
||||
|
||||
m_uf20StatusLabel = new QLabel("请输入关键词搜索UF20功能");
|
||||
uf20Layout->addWidget(m_uf20StatusLabel);
|
||||
|
||||
m_tabWidget->addTab(uf20Tab, "UF20功能");
|
||||
|
||||
// ==========================================
|
||||
// Tab 2: UFT3功能搜索
|
||||
// ==========================================
|
||||
QWidget *uft3Tab = new QWidget;
|
||||
QVBoxLayout *uft3Layout = new QVBoxLayout(uft3Tab);
|
||||
uft3Layout->setSpacing(15);
|
||||
|
||||
QHBoxLayout *uft3SearchLayout = new QHBoxLayout;
|
||||
m_uft3SearchEdit = new QLineEdit;
|
||||
m_uft3SearchEdit->setPlaceholderText("输入功能名称或关键词搜索...");
|
||||
m_uft3SearchBtn = new QPushButton("搜索");
|
||||
m_uft3SearchBtn->setStyleSheet("padding: 8px 25px;");
|
||||
connect(m_uft3SearchBtn, &QPushButton::clicked, this, &FunctionSearchPage::onSearchUFT3);
|
||||
connect(m_uft3SearchEdit, &QLineEdit::returnPressed, this, &FunctionSearchPage::onSearchUFT3);
|
||||
connect(m_uft3SearchEdit, &QLineEdit::textChanged, this, &FunctionSearchPage::onUFT3SearchTextChanged);
|
||||
uft3SearchLayout->addWidget(m_uft3SearchEdit);
|
||||
uft3SearchLayout->addWidget(m_uft3SearchBtn);
|
||||
uft3Layout->addLayout(uft3SearchLayout);
|
||||
|
||||
m_uft3ResultTable = new QTableWidget;
|
||||
m_uft3ResultTable->setColumnCount(4);
|
||||
m_uft3ResultTable->setHorizontalHeaderLabels({"功能名称", "功能类型", "所属模块", "文件路径"});
|
||||
m_uft3ResultTable->horizontalHeader()->setStretchLastSection(true);
|
||||
m_uft3ResultTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
m_uft3ResultTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||
m_uft3ResultTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
||||
m_uft3ResultTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_uft3ResultTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_uft3ResultTable->setAlternatingRowColors(true);
|
||||
uft3Layout->addWidget(m_uft3ResultTable);
|
||||
|
||||
m_uft3StatusLabel = new QLabel("请输入关键词搜索UFT3功能");
|
||||
uft3Layout->addWidget(m_uft3StatusLabel);
|
||||
|
||||
m_tabWidget->addTab(uft3Tab, "UFT3功能");
|
||||
|
||||
mainLayout->addWidget(m_tabWidget);
|
||||
}
|
||||
|
||||
void FunctionSearchPage::onSearchUF20()
|
||||
{
|
||||
QString keyword = m_uf20SearchEdit->text().trimmed();
|
||||
if (keyword.isEmpty()) {
|
||||
m_uf20StatusLabel->setText("请输入搜索关键词");
|
||||
return;
|
||||
}
|
||||
|
||||
m_uf20ResultTable->setRowCount(0);
|
||||
m_uf20StatusLabel->setText(QString("正在搜索 \"%1\"...").arg(keyword));
|
||||
|
||||
m_uf20ResultTable->insertRow(0);
|
||||
m_uf20ResultTable->setItem(0, 0, new QTableWidgetItem(keyword));
|
||||
m_uf20ResultTable->setItem(0, 1, new QTableWidgetItem("-"));
|
||||
m_uf20ResultTable->setItem(0, 2, new QTableWidgetItem("-"));
|
||||
m_uf20ResultTable->setItem(0, 3, new QTableWidgetItem("-"));
|
||||
|
||||
m_uf20StatusLabel->setText(QString("搜索完成,共找到 1 条结果"));
|
||||
}
|
||||
|
||||
void FunctionSearchPage::onSearchUFT3()
|
||||
{
|
||||
QString keyword = m_uft3SearchEdit->text().trimmed();
|
||||
if (keyword.isEmpty()) {
|
||||
m_uft3StatusLabel->setText("请输入搜索关键词");
|
||||
return;
|
||||
}
|
||||
|
||||
m_uft3ResultTable->setRowCount(0);
|
||||
m_uft3StatusLabel->setText(QString("正在搜索 \"%1\"...").arg(keyword));
|
||||
|
||||
m_uft3ResultTable->insertRow(0);
|
||||
m_uft3ResultTable->setItem(0, 0, new QTableWidgetItem(keyword));
|
||||
m_uft3ResultTable->setItem(0, 1, new QTableWidgetItem("-"));
|
||||
m_uft3ResultTable->setItem(0, 2, new QTableWidgetItem("-"));
|
||||
m_uft3ResultTable->setItem(0, 3, new QTableWidgetItem("-"));
|
||||
|
||||
m_uft3StatusLabel->setText(QString("搜索完成,共找到 1 条结果"));
|
||||
}
|
||||
|
||||
void FunctionSearchPage::onUF20SearchTextChanged(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text);
|
||||
}
|
||||
|
||||
void FunctionSearchPage::onUFT3SearchTextChanged(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef FUNCTIONSEARCHPAGE_H
|
||||
#define FUNCTIONSEARCHPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QTabWidget>
|
||||
#include <QTableWidget>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
|
||||
class FunctionSearchPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FunctionSearchPage(QWidget *parent = nullptr);
|
||||
~FunctionSearchPage();
|
||||
|
||||
private slots:
|
||||
void onSearchUF20();
|
||||
void onSearchUFT3();
|
||||
void onUF20SearchTextChanged(const QString &text);
|
||||
void onUFT3SearchTextChanged(const QString &text);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
|
||||
QTabWidget *m_tabWidget;
|
||||
|
||||
QLineEdit *m_uf20SearchEdit;
|
||||
QPushButton *m_uf20SearchBtn;
|
||||
QTableWidget *m_uf20ResultTable;
|
||||
QLabel *m_uf20StatusLabel;
|
||||
|
||||
QLineEdit *m_uft3SearchEdit;
|
||||
QPushButton *m_uft3SearchBtn;
|
||||
QTableWidget *m_uft3ResultTable;
|
||||
QLabel *m_uft3StatusLabel;
|
||||
};
|
||||
|
||||
#endif // FUNCTIONSEARCHPAGE_H
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
#include "helppage.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
|
||||
HelpPage::HelpPage(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
initUI();
|
||||
}
|
||||
|
||||
HelpPage::~HelpPage()
|
||||
{
|
||||
}
|
||||
|
||||
void HelpPage::initUI()
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(30, 30, 30, 30);
|
||||
|
||||
QLabel *title = new QLabel("<h1>使用帮助</h1>");
|
||||
layout->addWidget(title);
|
||||
|
||||
QTextEdit *helpText = new QTextEdit;
|
||||
helpText->setReadOnly(true);
|
||||
helpText->setStyleSheet("background-color: white;");
|
||||
helpText->setHtml(R"(
|
||||
<h2>批量转码工具</h2>
|
||||
<p>批量转码工具用于将指定目录下的多个文件从一种编码格式转换为另一种编码格式。</p>
|
||||
<ul>
|
||||
<li><strong>源目录:</strong> 选择包含待转换文件的目录</li>
|
||||
<li><strong>目标目录:</strong> 选择转换后文件的保存目录</li>
|
||||
<li><strong>文件过滤:</strong> 设置要转换的文件类型,如 *.txt</li>
|
||||
<li><strong>源编码:</strong> 选择源文件的编码格式</li>
|
||||
<li><strong>目标编码:</strong> 选择目标编码格式</li>
|
||||
</ul>
|
||||
|
||||
<h2>非LS转码工具</h2>
|
||||
<p>非LS转码工具用于在LS和非LS格式之间进行转换。</p>
|
||||
<ul>
|
||||
<li><strong>非LS转LS:</strong> 将非LS格式转换为LS格式</li>
|
||||
<li><strong>LS转非LS:</strong> 将LS格式转换为非LS格式</li>
|
||||
</ul>
|
||||
|
||||
<h2>支持的编码格式</h2>
|
||||
<ul>
|
||||
<li>GBK</li>
|
||||
<li>GB2312</li>
|
||||
<li>UTF-8</li>
|
||||
<li>UTF-16</li>
|
||||
<li>ASCII</li>
|
||||
</ul>
|
||||
|
||||
<h2>注意事项</h2>
|
||||
<ul>
|
||||
<li>转换前请备份重要文件</li>
|
||||
<li>确保有足够的磁盘空间</li>
|
||||
<li>大文件转换可能需要较长时间</li>
|
||||
</ul>
|
||||
)");
|
||||
layout->addWidget(helpText);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue