add linguist for facetick.
This commit is contained in:
28
Linguist/utility/AsyncEvent.h
Normal file
28
Linguist/utility/AsyncEvent.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef __ASYNCEVENT_H__
|
||||
#define __ASYNCEVENT_H__
|
||||
|
||||
#include "rw_zlog.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QEvent>
|
||||
#include <functional>
|
||||
|
||||
class AsyncEvent : public QEvent {
|
||||
public:
|
||||
using Functor = std::function<void()>;
|
||||
AsyncEvent(Functor &&functor)
|
||||
: QEvent(static_cast<QEvent::Type>(QEvent::registerEventType())), m_functor(std::forward<Functor>(functor)) {
|
||||
}
|
||||
|
||||
~AsyncEvent() {
|
||||
if (QCoreApplication::closingDown()) {
|
||||
LOGW("QCoreApplication closed,skip handle task.");
|
||||
return;
|
||||
}
|
||||
if (m_functor) m_functor();
|
||||
}
|
||||
|
||||
private:
|
||||
Functor m_functor;
|
||||
};
|
||||
|
||||
#endif // __ASYNCEVENT_H__
|
64
Linguist/utility/DndModeCountDownItem.cpp
Normal file
64
Linguist/utility/DndModeCountDownItem.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
#include "DndModeCountDownItem.h"
|
||||
#include "rw_zlog.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <sstream>
|
||||
|
||||
DndModeCountDownItem::DndModeCountDownItem(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) {
|
||||
m_label = new QLabel(this);
|
||||
QFont font;
|
||||
m_label->setMargin(0);
|
||||
font.setPointSize(20);
|
||||
m_label->setFont(font);
|
||||
|
||||
auto hint = new QLabel(this);
|
||||
font.setPointSize(12);
|
||||
hint->setFont(font);
|
||||
hint->setText("后结束");
|
||||
hint->setMargin(0);
|
||||
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->addWidget(m_label);
|
||||
layout->addWidget(hint);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
QPalette palette(this->palette());
|
||||
palette.setColor(QPalette::WindowText, Qt::black);
|
||||
setPalette(palette);
|
||||
}
|
||||
|
||||
void DndModeCountDownItem::setEndTime(const std::chrono::system_clock::time_point &endTime) {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
m_endTime = endTime;
|
||||
if (m_endTime > now) {
|
||||
if (m_timerId < 0) m_timerId = startTimer(500);
|
||||
} else {
|
||||
if (m_timerId >= 0) {
|
||||
killTimer(m_timerId);
|
||||
m_timerId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DndModeCountDownItem::timerEvent(QTimerEvent *event) {
|
||||
constexpr int SencondsOfMinute = 60;
|
||||
constexpr int SencondsOfHour = SencondsOfMinute * 60;
|
||||
constexpr int SencondsOfDay = SencondsOfHour * 24;
|
||||
|
||||
using namespace std::chrono;
|
||||
auto now = system_clock::now();
|
||||
int duration = duration_cast<seconds>(m_endTime - now).count();
|
||||
if (duration <= 0) {
|
||||
killTimer(m_timerId);
|
||||
m_timerId = -1;
|
||||
}
|
||||
|
||||
int days = duration / SencondsOfDay;
|
||||
int hours = (duration - days * SencondsOfDay) / SencondsOfHour;
|
||||
int minutes = (duration - days * SencondsOfDay - hours * SencondsOfHour) / SencondsOfMinute;
|
||||
int sec = (duration - days * SencondsOfDay - hours * SencondsOfHour - minutes * SencondsOfMinute);
|
||||
|
||||
m_label->setText(
|
||||
QString("%1:%2:%3").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')).arg(sec, 2, 10, QLatin1Char('0')));
|
||||
}
|
23
Linguist/utility/DndModeCountDownItem.h
Normal file
23
Linguist/utility/DndModeCountDownItem.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef __DNDMODECOUNTDOWNITEM_H__
|
||||
#define __DNDMODECOUNTDOWNITEM_H__
|
||||
|
||||
#include <QWidget>
|
||||
#include <chrono>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class DndModeCountDownItem : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DndModeCountDownItem(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
void setEndTime(const std::chrono::system_clock::time_point &endTime);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) final;
|
||||
|
||||
private:
|
||||
QLabel *m_label = nullptr;
|
||||
std::chrono::system_clock::time_point m_endTime;
|
||||
int m_timerId = -1;
|
||||
};
|
||||
#endif // __DNDMODECOUNTDOWNITEM_H__
|
155
Linguist/utility/SwitchControl.cpp
Normal file
155
Linguist/utility/SwitchControl.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include "SwitchControl.h"
|
||||
|
||||
SwitchControl::SwitchControl(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_bChecked(false),
|
||||
m_background(Qt::black),
|
||||
m_checkedColor(0, 150, 136),
|
||||
m_disabledColor(190, 190, 190),
|
||||
m_thumbColor(Qt::white),
|
||||
m_radius(8.0),
|
||||
m_nHeight(16),
|
||||
m_nMargin(3)
|
||||
{
|
||||
// 鼠标滑过光标形状 - 手型
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
|
||||
// 连接信号槽
|
||||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
|
||||
}
|
||||
|
||||
// 绘制开关
|
||||
void SwitchControl::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
QPainterPath path;
|
||||
QColor background;
|
||||
QColor thumbColor;
|
||||
qreal dOpacity;
|
||||
if (isEnabled()) { // 可用状态
|
||||
if (m_bChecked) { // 打开状态
|
||||
background = m_checkedColor;
|
||||
thumbColor = m_checkedColor;
|
||||
dOpacity = 0.600;
|
||||
} else { //关闭状态
|
||||
background = m_background;
|
||||
thumbColor = m_thumbColor;
|
||||
dOpacity = 0.800;
|
||||
}
|
||||
} else { // 不可用状态
|
||||
background = m_background;
|
||||
dOpacity = 0.260;
|
||||
thumbColor = m_disabledColor;
|
||||
}
|
||||
// 绘制大椭圆
|
||||
painter.setBrush(background);
|
||||
painter.setOpacity(dOpacity);
|
||||
path.addRoundedRect(QRectF(m_nMargin, m_nMargin, width() - 2 * m_nMargin, height() - 2 * m_nMargin), m_radius, m_radius);
|
||||
painter.drawPath(path.simplified());
|
||||
|
||||
// 绘制小椭圆
|
||||
painter.setBrush(thumbColor);
|
||||
painter.setOpacity(1.0);
|
||||
painter.drawEllipse(QRectF(m_nX - (m_nHeight / 2), m_nY - (m_nHeight / 2), height(), height()));
|
||||
}
|
||||
|
||||
// 鼠标按下事件
|
||||
void SwitchControl::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (isEnabled()) {
|
||||
if (event->buttons() & Qt::LeftButton) {
|
||||
event->accept();
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 鼠标释放事件 - 切换开关状态、发射toggled()信号
|
||||
void SwitchControl::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (isEnabled()) {
|
||||
if ((event->type() == QMouseEvent::MouseButtonRelease) && (event->button() == Qt::LeftButton)) {
|
||||
event->accept();
|
||||
m_bChecked = !m_bChecked;
|
||||
emit toggled(m_bChecked);
|
||||
emit signal_clicked(m_bChecked);
|
||||
m_timer.start(10);
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 大小改变事件
|
||||
void SwitchControl::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
m_nX = m_nHeight / 2;
|
||||
m_nY = m_nHeight / 2;
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
// 默认大小
|
||||
QSize SwitchControl::sizeHint() const
|
||||
{
|
||||
return minimumSizeHint();
|
||||
}
|
||||
|
||||
// 最小大小
|
||||
QSize SwitchControl::minimumSizeHint() const
|
||||
{
|
||||
return QSize(2 * (m_nHeight + m_nMargin), m_nHeight + 2 * m_nMargin);
|
||||
}
|
||||
|
||||
// 切换状态 - 滑动
|
||||
void SwitchControl::onTimeout()
|
||||
{
|
||||
if (m_bChecked) {
|
||||
m_nX += 1;
|
||||
if (m_nX >= width() - m_nHeight)
|
||||
m_timer.stop();
|
||||
} else {
|
||||
m_nX -= 1;
|
||||
if (m_nX <= m_nHeight / 2)
|
||||
m_timer.stop();
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
// 返回开关状态 - 打开:true 关闭:false
|
||||
bool SwitchControl::isToggled() const
|
||||
{
|
||||
return m_bChecked;
|
||||
}
|
||||
|
||||
// 设置开关状态
|
||||
void SwitchControl::setToggle(bool checked)
|
||||
{
|
||||
m_bChecked = checked;
|
||||
m_timer.start(10);
|
||||
}
|
||||
|
||||
// 设置背景颜色
|
||||
void SwitchControl::setBackgroundColor(QColor color)
|
||||
{
|
||||
m_background = color;
|
||||
}
|
||||
|
||||
// 设置选中颜色
|
||||
void SwitchControl::setCheckedColor(QColor color)
|
||||
{
|
||||
m_checkedColor = color;
|
||||
}
|
||||
|
||||
// 设置不可用颜色
|
||||
void SwitchControl::setDisbaledColor(QColor color)
|
||||
{
|
||||
m_disabledColor = color;
|
||||
}
|
69
Linguist/utility/SwitchControl.h
Normal file
69
Linguist/utility/SwitchControl.h
Normal file
@ -0,0 +1,69 @@
|
||||
#ifndef SWITCH_CONTROL
|
||||
#define SWITCH_CONTROL
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
|
||||
class SwitchControl : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SwitchControl(QWidget *parent = nullptr);
|
||||
|
||||
// 返回开关状态 - 打开:true 关闭:false
|
||||
bool isToggled() const;
|
||||
|
||||
// 设置开关状态
|
||||
void setToggle(bool checked);
|
||||
|
||||
// 设置背景颜色
|
||||
void setBackgroundColor(QColor color);
|
||||
|
||||
// 设置选中颜色
|
||||
void setCheckedColor(QColor color);
|
||||
|
||||
// 设置不可用颜色
|
||||
void setDisbaledColor(QColor color);
|
||||
|
||||
protected:
|
||||
// 绘制开关
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
// 鼠标按下事件
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
// 鼠标释放事件 - 切换开关状态、发射toggled()信号
|
||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
// 大小改变事件
|
||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
// 缺省大小
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
// 状态改变时,发射信号
|
||||
void toggled(bool checked);
|
||||
void signal_clicked(bool state);
|
||||
|
||||
private slots:
|
||||
// 状态切换时,用于产生滑动效果
|
||||
void onTimeout();
|
||||
|
||||
private:
|
||||
bool m_bChecked; // 是否选中
|
||||
QColor m_background; // 背景颜色
|
||||
QColor m_checkedColor; // 选中颜色
|
||||
QColor m_disabledColor; // 不可用颜色
|
||||
QColor m_thumbColor; // 拇指颜色
|
||||
qreal m_radius; // 圆角
|
||||
qreal m_nX; // x点坐标
|
||||
qreal m_nY; // y点坐标
|
||||
qint16 m_nHeight; // 高度
|
||||
qint16 m_nMargin; // 外边距
|
||||
QTimer m_timer; // 定时器
|
||||
};
|
||||
|
||||
#endif // SWITCH_CONTROL
|
3146
Linguist/utility/UiTools.cpp
Normal file
3146
Linguist/utility/UiTools.cpp
Normal file
File diff suppressed because it is too large
Load Diff
994
Linguist/utility/UiTools.h
Normal file
994
Linguist/utility/UiTools.h
Normal file
@ -0,0 +1,994 @@
|
||||
#ifndef UITOOLS_H
|
||||
#define UITOOLS_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QListWidgetItem>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QRadioButton>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QStackedWidget>
|
||||
#include <QTimer>
|
||||
#include <QComboBox>
|
||||
|
||||
#include "LineEditWithKeyboard.h"
|
||||
#include "BackstageInterfaceForUi.h"
|
||||
|
||||
class WidgetWithBackstageInterface : public QWidget
|
||||
{
|
||||
protected:
|
||||
BackstageInterfaceForUi* m_backstageIf;
|
||||
|
||||
public:
|
||||
WidgetWithBackstageInterface(QWidget *parent = nullptr);
|
||||
virtual ~WidgetWithBackstageInterface();
|
||||
virtual void setBackstageUiinterface(BackstageInterfaceForUi* interface);
|
||||
//virtual void reset() = 0;
|
||||
};
|
||||
|
||||
class PageAcceptMouseAndTouch : public WidgetWithBackstageInterface
|
||||
{
|
||||
public:
|
||||
explicit PageAcceptMouseAndTouch(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
bool event(QEvent *event);
|
||||
};
|
||||
|
||||
class PureColorPage : public PageAcceptMouseAndTouch
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PureColorPage(unsigned int color, unsigned char tran = 255, bool drawRect = false, QWidget *parent = nullptr);
|
||||
~PureColorPage();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
private:
|
||||
unsigned m_color;
|
||||
unsigned char m_tran;
|
||||
bool m_drawRect;
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
class MyWidgetWithMainStyleColor : public WidgetWithBackstageInterface
|
||||
{
|
||||
public:
|
||||
explicit MyWidgetWithMainStyleColor(QWidget *parent = nullptr);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
class MyWidgetWithSubStyleColor : public WidgetWithBackstageInterface
|
||||
{
|
||||
public:
|
||||
explicit MyWidgetWithSubStyleColor(QWidget *parent = nullptr);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
class CustomDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CustomDialog(const QString& okBtnText, QObject *bgWidget = nullptr, const QString& cancelBtnText = tr("取消"), int timeout = 0);
|
||||
virtual ~CustomDialog();
|
||||
|
||||
signals:
|
||||
void signalShowShadowPage(bool show);
|
||||
|
||||
public slots:
|
||||
void slotCancleBtnClicked();
|
||||
virtual void slotConfirmBtnClicked();
|
||||
|
||||
protected:
|
||||
QHBoxLayout* hbtmLayout;
|
||||
int dialogWidth;
|
||||
int dialogHeight;
|
||||
|
||||
PureColorPage* m_wBg;
|
||||
QTimer *m_timer = nullptr;
|
||||
|
||||
private:
|
||||
QPushButton* m_btn_ok = nullptr;
|
||||
QPushButton* m_btn_cancle = nullptr;
|
||||
const int m_timeout = 0;
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
bool event(QEvent *event);
|
||||
};
|
||||
|
||||
#if 1
|
||||
class PasswordDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PasswordDialog(const QString& title, const QString& tip1, int timeout, QObject *bgWidget = nullptr, const QString& pwd = "",
|
||||
const QString& tip0 = QString(), const QString& okBtn = tr("确定"), const QString& cancelBtn = tr("取消"));
|
||||
virtual ~PasswordDialog();
|
||||
const QString& getPwd() const;
|
||||
|
||||
public slots:
|
||||
void slotPwdVisableBtnClicked();
|
||||
void slotRestoreBtnClicked();
|
||||
void slotConfirmBtnClicked();
|
||||
|
||||
signals:
|
||||
void signalRestoreFactory();
|
||||
|
||||
private:
|
||||
LineEditWithKeyboard* m_lineEdit_pwd;
|
||||
QPushButton* m_btn_visable;
|
||||
QPushButton* m_btn_factory;
|
||||
QObject *m_bgWidget;
|
||||
|
||||
QString m_pwd;
|
||||
int m_mode = 0;
|
||||
};
|
||||
|
||||
class QuestionDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QuestionDialog(const QString& question, QObject *bgWidget = nullptr, const QString& btnText = tr("确定"));
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
};
|
||||
|
||||
class InfoDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InfoDialog(const QString& info, QObject *bgWidget = nullptr, const QString& btnText = tr("知道了"), int timeout = 0);
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
};
|
||||
|
||||
class SliderDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SliderDialog(int current, int min, int max, const QString& tip, QObject *bgWidget = nullptr);
|
||||
~SliderDialog();
|
||||
int getValueSet() const;
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotValueChanged(int value);
|
||||
|
||||
private:
|
||||
QLabel* m_labelCurrent;
|
||||
QSlider* m_slider;
|
||||
int m_iCurrent;
|
||||
};
|
||||
|
||||
class DateTimeDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DateTimeDialog(const QDateTime& dateTime, QObject *bgWidget = nullptr, bool needDate = true, bool needTime = true);
|
||||
QDateTime getValueSet() const;
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotConfirmBtnClicked();
|
||||
|
||||
private:
|
||||
QDateTimeEdit* m_dateTimeSet;
|
||||
QDateTime m_dataTimeVal;
|
||||
};
|
||||
|
||||
class RadioBtnChooseDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QLabel* m_label_title;
|
||||
QRadioButton* m_rdo;
|
||||
QVBoxLayout* vLayout;
|
||||
|
||||
public:
|
||||
explicit RadioBtnChooseDialog(const QVector<QString>& labels, QObject *bgWidget = nullptr, const int choose = 0, const QVector<bool> *config = nullptr, const QString& title = "");
|
||||
virtual ~RadioBtnChooseDialog();
|
||||
int getChoosedIndex() const;
|
||||
|
||||
public slots:
|
||||
void slotRadioButtonPressed();
|
||||
|
||||
private:
|
||||
int m_option_num;
|
||||
int m_chooseIndex;
|
||||
};
|
||||
|
||||
class LineEditInputDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QFormLayout* formLayout;
|
||||
QVBoxLayout* vLayout;
|
||||
|
||||
LineEditWithKeyboard* m_editRow;
|
||||
QString* m_stringRowInput;
|
||||
int m_rowNum;
|
||||
|
||||
protected slots:
|
||||
void slotConfirmBtnClicked();
|
||||
|
||||
public:
|
||||
LineEditInputDialog(const QStringList& labels, QObject *bgWidget = nullptr, const QString& confirBtm = tr("确定"));
|
||||
LineEditInputDialog(const QString& label, QObject *bgWidget = nullptr, const QString& confirBtm = tr("确定"));
|
||||
virtual ~LineEditInputDialog();
|
||||
|
||||
QString getRow(const int) const ;
|
||||
void fillRow(const int, const QString&, bool readOnly = false);
|
||||
|
||||
private:
|
||||
void init(const QStringList& labels);
|
||||
};
|
||||
|
||||
class MsgDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MsgDialog(const QString& msg, QObject *bgWidget = nullptr);
|
||||
};
|
||||
|
||||
class ComSelectDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QFormLayout* formLayout;
|
||||
QVBoxLayout* vLayout;
|
||||
|
||||
QVector<QComboBox*> m_cbSels;
|
||||
int m_rowNum;
|
||||
|
||||
protected slots:
|
||||
|
||||
public:
|
||||
ComSelectDialog(const QStringList& titles, const QVector<QStringList>& sels, QObject *bgWidget = nullptr, const QString& confirBtm = tr("确定"));
|
||||
virtual ~ComSelectDialog();
|
||||
|
||||
int getRow(int) const ;
|
||||
void setRow(int row, int set, bool readOnly = false);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class IpInputDialog : public LineEditInputDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
|
||||
protected slots:
|
||||
void slotTextChanged(const QString &);
|
||||
void slotConfirmBtnClicked();
|
||||
|
||||
public:
|
||||
IpInputDialog(const QStringList& ips, QObject *bgWidget = nullptr, const QString& confirBtm = tr("确定"));
|
||||
IpInputDialog(const QString& ip, QObject *bgWidget = nullptr, const QString& confirBtm = tr("确定"));
|
||||
virtual ~IpInputDialog();
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
|
||||
class MyMessageBox : public QMessageBox
|
||||
{
|
||||
public:
|
||||
MyMessageBox();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
class myListWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
enSwitch,
|
||||
enMoreArrow,
|
||||
enRedWord,
|
||||
enTick,
|
||||
enIndent1
|
||||
}_enProp;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
enPropertyNull,
|
||||
enPropertySwitch = 1 << enSwitch,
|
||||
enPropertyMoreArrow = 1 << enMoreArrow,
|
||||
enPropertyRedWord = 1 << enRedWord,
|
||||
enPropertyTick = 1 << enTick,
|
||||
enPropertyIndent1 = 1 << enIndent1
|
||||
}enProperty;
|
||||
|
||||
class SetOpnCfg
|
||||
{
|
||||
public:
|
||||
const QString m_sOpn;
|
||||
const QString m_sVal;
|
||||
const enProperty m_prop;
|
||||
SetOpnCfg(const QString& opn, const QString& val, const enProperty prop) : m_sOpn(opn), m_sVal(val), m_prop(prop){}
|
||||
SetOpnCfg(const QString& opn, const QString& val) : m_sOpn(opn), m_sVal(val), m_prop(myListWidget::enPropertyNull){}
|
||||
SetOpnCfg(const QString& opn) : m_sOpn(opn), m_sVal(""), m_prop(myListWidget::enPropertyNull){}
|
||||
SetOpnCfg() : m_sOpn(""), m_sVal(""), m_prop(myListWidget::enPropertyNull){}
|
||||
SetOpnCfg& operator= (const SetOpnCfg& obj){Q_UNUSED(obj) return *this;}
|
||||
};
|
||||
|
||||
myListWidget(const SetOpnCfg& cfg, QWidget* parent = nullptr);
|
||||
~myListWidget();
|
||||
|
||||
void updateLabel(const QString& val);
|
||||
void updateIcon(const QString& icon, int scale_w=0, int scale_h=0);
|
||||
void setLeftIcon(const QString& icon, int scale_w, int scale_h);
|
||||
const QString getLabelString() const;
|
||||
const QString getOpnLabelString() const;
|
||||
const QString getOptionLabel() const;
|
||||
|
||||
private:
|
||||
QLabel* m_label_leftIcon;
|
||||
QLabel* m_label_left;
|
||||
QLabel* m_label_right;
|
||||
QLabel* m_label_icon;
|
||||
QHBoxLayout* m_hbLayout;
|
||||
int m_layoutObjQty = 0;
|
||||
bool m_hasIndent = false;
|
||||
};
|
||||
|
||||
class SwitchListWidget : public QWidget
|
||||
{
|
||||
private:
|
||||
QLabel* m_label_left;
|
||||
QLabel* m_label_right;
|
||||
QLabel* m_label_icon;
|
||||
|
||||
bool m_Res;
|
||||
|
||||
public:
|
||||
SwitchListWidget(const QString& left, const QString& right, const QString& icon, QWidget*parent);
|
||||
~SwitchListWidget();
|
||||
|
||||
void updateLabel(const QString& label);
|
||||
void updateIcon(const QString& icon);
|
||||
void updateIcon(bool bFlag);
|
||||
bool getSwitchRes();
|
||||
const QString getLabelString() const;
|
||||
};
|
||||
|
||||
class FourListWidget : public QWidget
|
||||
{
|
||||
private:
|
||||
QLabel* m_label_left;
|
||||
QLabel* m_label_right;
|
||||
QLabel* m_label_icon;
|
||||
QPushButton* m_btn_mid;
|
||||
|
||||
public:
|
||||
FourListWidget(const QString& left, const QString& right, const QString& btnText, const QString& icon, QWidget*parent);
|
||||
~FourListWidget();
|
||||
|
||||
void updateLabel(const QString& label);
|
||||
void updateIcon(const QString& icon);
|
||||
void updateBtnText(const QString& text);
|
||||
|
||||
QPushButton* getPushButton();
|
||||
|
||||
const QString getLabelString() const;
|
||||
};
|
||||
|
||||
class setPushButton : public QWidget
|
||||
{
|
||||
public:
|
||||
setPushButton(QPushButton* pPushButton, const QString& tip, const QString& icon, const QSize& size);
|
||||
~setPushButton();
|
||||
|
||||
private:
|
||||
QVBoxLayout* _pVBoxLayoutDevice;
|
||||
QLabel* _pLabelIcon;
|
||||
};
|
||||
|
||||
void setLanguage(QApplication&, const QString&);
|
||||
void setFont(QApplication& app, const QString&, const int fontSize, const int);
|
||||
|
||||
void setLineEditFontColor(QLineEdit* edit, const QColor& color);
|
||||
void setLineEditStyle(QLineEdit* edit);
|
||||
void setButtonBackImage(QPushButton *button, QString image, int sizeW = 0, int sizeH = 0);
|
||||
QListWidgetItem* setListWidgetItem(QListWidgetItem* item, const QString text = "", const QString image = "");
|
||||
|
||||
class TimerUpdate : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TimerUpdate(QLabel* pLabel, QWidget *parent = nullptr);
|
||||
TimerUpdate(QLabel* labelTime, QLabel* labelDate, QWidget *parent = nullptr, int timeType = 0, int dateType = 0, int weekType = 0);
|
||||
~TimerUpdate();
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void enableUpdate(bool enable);
|
||||
|
||||
signals:
|
||||
void signalNewDay();
|
||||
|
||||
private:
|
||||
int _timerID;
|
||||
QLabel* _labelTime;
|
||||
QLabel* _labelDate;
|
||||
int m_timeType;
|
||||
int m_dateType;
|
||||
int m_weekType;
|
||||
|
||||
bool m_enableUpdate = true;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
QPixmap PixmapToRound(QPixmap &src, int radius);
|
||||
QImage ScaleImage(const QImage& image, const QSize& size);
|
||||
QImage ScaleImage2Label(const QImage& qImage, const QLabel& label);
|
||||
QPixmap ScalePixmap(const QPixmap& pixmap, const QSize& size);
|
||||
QPixmap ScalePixmap2Label(const QPixmap& pixmap, const QLabel& label);
|
||||
|
||||
class MyLineEdit:public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyLineEdit(QWidget *parent = nullptr);
|
||||
~MyLineEdit();
|
||||
protected:
|
||||
//添加并重写鼠标点击事件函数
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
signals:
|
||||
//点击信号函数
|
||||
void clicked();
|
||||
};
|
||||
|
||||
class LocalFourListWidget : public QWidget
|
||||
{
|
||||
private:
|
||||
QLabel* m_label_left;
|
||||
QLabel* m_label_mid;
|
||||
QLabel* m_label_right;
|
||||
QLabel* m_label_icon;
|
||||
|
||||
|
||||
public:
|
||||
LocalFourListWidget(const QString& left, const QString& mid, const QString& right, const QString& icon, QWidget*parent);
|
||||
|
||||
~LocalFourListWidget();
|
||||
|
||||
void updateLabel(const QString& label);
|
||||
|
||||
void updateRight(const QString& text);
|
||||
|
||||
void updateIcon(const QString& icon);
|
||||
|
||||
const QString getLabelString() const;
|
||||
};
|
||||
|
||||
bool checkip(const QString& ip);
|
||||
bool checkMask(const QString& mask);
|
||||
|
||||
//判断是否在同一网段
|
||||
bool isSameNetwork(const QString& ip, const QString& mask, const QString& gateway);
|
||||
|
||||
bool getIpFromUserInput(const QString& lineEdit, const QString& initIp, QString& newIp, QObject *bgWidget = nullptr);
|
||||
bool getMaskFromUserInput(const QString& lineEdit, const QString& initIp, QString& newIp, QObject *bgWidget = nullptr);
|
||||
bool getNumFromUserInput(const QString& lineEdit, const QString& initNum, QString& newValue, const int min, const int max, QObject *bgWidget = nullptr);
|
||||
|
||||
QString GBK2UTF8(const QString &inStr);
|
||||
QString UTF82GBK(const QString &inStr);
|
||||
std::string gbk2utf8(const QString &inStr);
|
||||
QString utf82gbk(const std::string &inStr);
|
||||
void gbkToUtf8(char *gbkstr);
|
||||
|
||||
class ProgressWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit ProgressWidget(const QString& title);
|
||||
~ProgressWidget();
|
||||
void setMsg(const unsigned current, const unsigned all);
|
||||
|
||||
private:
|
||||
QLabel* m_label_title;
|
||||
QLabel* m_label_msg;
|
||||
QSlider* m_slider_progess;
|
||||
};
|
||||
|
||||
class SettingUiPage : public MyWidgetWithMainStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef myListWidget::SetOpnCfg SetOpn;
|
||||
explicit SettingUiPage(const QVector<SetOpn>& config, QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
const QVector<SetOpn> config;
|
||||
QListWidget* m_listWidget;
|
||||
|
||||
void controlListWidgetItemShow(const bool sw, int option);
|
||||
|
||||
signals:
|
||||
void signalShowPage(int, const QString title = "");
|
||||
|
||||
protected slots:
|
||||
virtual void slotItemClicked(QListWidgetItem* item) = 0;
|
||||
};
|
||||
|
||||
class MsgListWidgetItem : public QWidget
|
||||
{
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
enBold,
|
||||
enGreyWord,
|
||||
enGreenWord,
|
||||
enRedWord
|
||||
}_enProp;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
enPropertyNull,
|
||||
enPropertyBold = 1 << enBold,
|
||||
enPropertyGreyWord = 1 << enGreyWord,
|
||||
enPropertyGreenWord = 1 << enGreenWord,
|
||||
enPropertyRedWord = 1 << enRedWord
|
||||
}enProperty;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
QString m_sMsg;
|
||||
enProperty m_eProp;
|
||||
}stMsgOpn;
|
||||
|
||||
class MsgSet
|
||||
{
|
||||
public:
|
||||
const QString m_sPic;
|
||||
const QVector<stMsgOpn> m_vMsgs;
|
||||
MsgSet() : m_sPic(""){}
|
||||
MsgSet(const QString& pic, const QVector<stMsgOpn>& msgs) : m_sPic(pic), m_vMsgs(msgs){}
|
||||
MsgSet& operator=(const MsgSet& obj){Q_UNUSED(obj) return *this;}
|
||||
};
|
||||
|
||||
MsgListWidgetItem(QWidget* parent);
|
||||
~MsgListWidgetItem();
|
||||
|
||||
void showMsg(const QString& pic, const QVector<stMsgOpn>& msgs);
|
||||
private:
|
||||
const int m_msgOpnQty = 4;
|
||||
|
||||
QLabel* labelPic;
|
||||
QVector<QLabel*> labelMsg;
|
||||
};
|
||||
|
||||
class PersonMsgUiPage : public MyWidgetWithMainStyleColor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef MsgListWidgetItem::stMsgOpn MsgOpn;
|
||||
typedef MsgListWidgetItem::enProperty MsgOpnProp;
|
||||
typedef MsgListWidgetItem::MsgSet MsgSet;
|
||||
|
||||
const unsigned m_itemQty = 5;
|
||||
|
||||
explicit PersonMsgUiPage(QWidget *parent = nullptr);
|
||||
void showMsg(const QVector<MsgSet>& msgs);
|
||||
void clearMsg();
|
||||
void setPageControlBarHide(bool hide, int min = 0, int max = 0, int current = 0);
|
||||
void showMoreSearchOpn();
|
||||
|
||||
protected:
|
||||
#define SEARCH_OPN_QTY 2
|
||||
enum{
|
||||
enSearchOpnName,
|
||||
enSearchOpnTime
|
||||
};
|
||||
QLineEdit* m_editSearch[SEARCH_OPN_QTY];
|
||||
QPushButton* m_btnClearSearch[SEARCH_OPN_QTY];
|
||||
QLabel* m_labelTip[SEARCH_OPN_QTY];
|
||||
QPushButton* m_btnMore;
|
||||
|
||||
QStackedWidget* m_stackWgt;
|
||||
QListWidget* m_listWidget;
|
||||
QLabel* m_labelPage;
|
||||
QLabel* m_labelMin;
|
||||
QLabel* m_labelMax;
|
||||
QPushButton* m_btnPrePage;
|
||||
QPushButton* m_btnNextPage;
|
||||
QSlider* m_sliderPage;
|
||||
|
||||
int m_toPageNum;
|
||||
QString m_sSearchName;
|
||||
QString m_sSearchtime;
|
||||
|
||||
protected slots:
|
||||
virtual void slotTextChanged(const QString& text) = 0;
|
||||
virtual void slotBtnClicked();
|
||||
virtual void slotSliderReleased() = 0;
|
||||
virtual void slotItemClicked(QListWidgetItem *item);
|
||||
void slotValueChanged(int value);
|
||||
};
|
||||
|
||||
class ItemChoosePage : public SettingUiPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemChoosePage(const QVector<SetOpn>& config, int choose, QWidget *parent = nullptr);
|
||||
int getChoosedIndex() const;
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
|
||||
private:
|
||||
int m_chooseIndex;
|
||||
};
|
||||
|
||||
class ItemChooseDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
ItemChoosePage* m_ItemsPage;
|
||||
QVBoxLayout* vLayout;
|
||||
|
||||
public:
|
||||
explicit ItemChooseDialog(const QVector<QString>& items, const int choose, QObject *bgWidget = nullptr);
|
||||
virtual ~ItemChooseDialog();
|
||||
int getChoosedIndex() const;
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
class CalendarDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CalendarDialog(bool isEn, QObject *bgWidget = nullptr);
|
||||
QDate getDateChoose() const;
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotConfirmBtnClicked();
|
||||
|
||||
private:
|
||||
QCalendarWidget* m_wgtCal;
|
||||
QDate m_date;
|
||||
};
|
||||
|
||||
class LineEditWithDialog : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LineEditWithDialog(int dialogType, QObject *bgWidget = nullptr, QWidget *parent = nullptr);
|
||||
~LineEditWithDialog();
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
int m_dialogType;
|
||||
QObject *m_bgWidget;
|
||||
};
|
||||
|
||||
class WifiListWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
WifiListWidget(const QString& ssid, bool connected, bool withLock, int sigLevel, bool isTargetNet, QWidget* parent);
|
||||
~WifiListWidget();
|
||||
|
||||
void updateStatus(bool connected);
|
||||
QString getSsid() const;
|
||||
bool isTargetNet() const;
|
||||
bool isConnected() const;
|
||||
bool getLockStatus() const;
|
||||
void clearStatus();
|
||||
|
||||
private:
|
||||
QLabel* m_label_conn;
|
||||
QLabel* m_label_ssid;
|
||||
const bool m_isLock;
|
||||
bool m_isTargetNet;
|
||||
bool m_isConnected;
|
||||
};
|
||||
|
||||
class WifiAccPointDialog : public LineEditInputDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void slotConfirmBtnClicked();
|
||||
|
||||
public:
|
||||
WifiAccPointDialog(QObject *bgWidget = nullptr);
|
||||
virtual ~WifiAccPointDialog();
|
||||
|
||||
QString getEncType() const;
|
||||
|
||||
private:
|
||||
QComboBox* m_comBox_encType;
|
||||
QString m_sEncType;
|
||||
};
|
||||
|
||||
int GrabFullScreen(const QString& picName, int rotate = 0);
|
||||
|
||||
class DrawPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
struct DrawPara
|
||||
{
|
||||
QList<QPoint> points;
|
||||
};
|
||||
|
||||
QPushButton* m_btnClear;
|
||||
QPushButton* m_btnExit;
|
||||
|
||||
QList<DrawPara> m_drawList;
|
||||
DrawPara m_current;
|
||||
|
||||
void draw(QPainter& painter, DrawPara& param);
|
||||
void append(QPoint p);
|
||||
|
||||
signals:
|
||||
void signalClosed();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *evt);
|
||||
void mouseMoveEvent(QMouseEvent *evt);
|
||||
void mouseReleaseEvent(QMouseEvent *evt);
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
public slots:
|
||||
void slotClearBtnClicked();
|
||||
void slotExitBtnClicked();
|
||||
|
||||
public:
|
||||
DrawPage(int w, int h, QWidget *parent = 0);
|
||||
~DrawPage();
|
||||
};
|
||||
|
||||
class UserPwdDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QString m_pwd;
|
||||
explicit UserPwdDialog();
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void slotBtnClicked();
|
||||
|
||||
private:
|
||||
enum{NUM_BTNS_QTY = 10};
|
||||
QLineEdit* m_editPwd;
|
||||
QPushButton* m_btnsNum[NUM_BTNS_QTY];
|
||||
QPushButton* m_btnBack;
|
||||
QPushButton* m_btnClear;
|
||||
QPushButton* m_btnBackspace;
|
||||
QPushButton* m_btnConfirm;
|
||||
};
|
||||
|
||||
class QPasswordLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QPasswordLineEdit(QWidget *parent, const QString& ch = "•", int timeout = 300);
|
||||
~QPasswordLineEdit();
|
||||
private slots:
|
||||
void DisplayPasswordAfterEditSlot(int,int);
|
||||
void DisplayPasswordSlot();
|
||||
void GetRealTextSlot(const QString&);
|
||||
|
||||
public:
|
||||
QString GetPassword() const;
|
||||
void SetTimeout(int msec);
|
||||
int GetTimeout() const;
|
||||
|
||||
private:
|
||||
QString GetMaskString();
|
||||
|
||||
private:
|
||||
const QString m_ch;
|
||||
int m_Timeout;
|
||||
QString m_LineEditText;
|
||||
int m_LastCharCount = 0;
|
||||
QTimer* m_timer;
|
||||
};
|
||||
|
||||
class RoundedWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RoundedWidget(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
class StyleItemChooseDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
explicit StyleItemChooseDialog(const QString& title, const QStringList& items, BackstageInterfaceForUi* backstageIf);
|
||||
virtual ~StyleItemChooseDialog();
|
||||
int getChoosedIndex() const;
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem* item);
|
||||
void slotTimeout();
|
||||
|
||||
private:
|
||||
enum{
|
||||
TIMEOUT = 1000,
|
||||
BACKSTAGE_PROC_OVERTIME = 5,
|
||||
PROC_OVERTIME = 10
|
||||
};
|
||||
BackstageInterfaceForUi* m_backstageIf;
|
||||
QListWidget* m_listWidget;
|
||||
int m_chooseIndex = 0;
|
||||
int m_timeCnt = 0;
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
class SelectionDialog : public CustomDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SelectionDialog(const QString& tips, const QString& sel0, const QString& sel1, QObject *bgWidget = nullptr);
|
||||
int selecion() const;
|
||||
signals:
|
||||
public slots:
|
||||
|
||||
private:
|
||||
int m_sel = 0;
|
||||
};
|
||||
|
||||
class TimeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TimeWidget(bool enType, int timeSize, int dateSize, QWidget *parent = nullptr);
|
||||
void enableUpdate(bool enable);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
TimerUpdate* m_timerUpdate;
|
||||
};
|
||||
|
||||
class DateTimeWidgetClassical : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DateTimeWidgetClassical(int fontSize, QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void signalNewDay();
|
||||
};
|
||||
|
||||
class BtListWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
//BtListWidget(const QString& devId, const QString& devName, bool isPaired, int devStat);
|
||||
BtListWidget(BluetoothDev_t &rBtDev/*, bool isPaired = false*/);
|
||||
~BtListWidget();
|
||||
|
||||
void refreshWidget();
|
||||
void getDevInfo(BluetoothDev_t &dev);
|
||||
void updateDev(BluetoothDev_t &rBtDev);
|
||||
|
||||
signals:
|
||||
void signalClickSet(BluetoothDev_t btDev);
|
||||
|
||||
public slots:
|
||||
void slotBtnSetClick();
|
||||
|
||||
private:
|
||||
QLabel* m_label_btIcon = nullptr;
|
||||
QLabel* m_label_dev = nullptr;
|
||||
//QLabel* m_label_pairedIcon;
|
||||
//QLabel* m_label_stat;
|
||||
QPushButton *m_pushButton_set = nullptr;
|
||||
#if 0
|
||||
QString m_devId;//设备唯一标识
|
||||
QString m_devName;
|
||||
int m_devStat;
|
||||
#endif
|
||||
BluetoothDev_t m_btDev;
|
||||
//bool m_isPaired;//是否已配对的蓝牙设备
|
||||
|
||||
};
|
||||
|
||||
class IpInputBar : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IpInputBar(bool isMask, QWidget *parent = nullptr);
|
||||
bool isEmpty() const;
|
||||
QString getIp() const;
|
||||
|
||||
protected slots:
|
||||
void slotTextChanged(const QString &t);
|
||||
void slotBackspacePressed();
|
||||
|
||||
private:
|
||||
const bool m_isMask;
|
||||
QVector<LineEditWithKeyboard *> m_edits;
|
||||
};
|
||||
|
||||
class IpInputBarDialog : public CustomDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IpInputBarDialog(const QStringList &options, const QVector<bool> &required, const QVector<bool> &isMask,
|
||||
QObject *bgWidget);
|
||||
QString getRow(int row) const;
|
||||
|
||||
protected slots:
|
||||
void slotConfirmBtnClicked();
|
||||
|
||||
private:
|
||||
QVector<IpInputBar *> m_bars;
|
||||
const QVector<bool> m_required;
|
||||
};
|
||||
|
||||
class SearchBarCandidate : public ItemChoosePage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using ItemChoosePage::ItemChoosePage;
|
||||
QString getCurrentChooseText();
|
||||
|
||||
signals:
|
||||
void signalItemChoosed(int);
|
||||
|
||||
public slots:
|
||||
void slotItemClicked(QListWidgetItem*);
|
||||
};
|
||||
|
||||
class ImgPlayer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImgPlayer(int width, int height, QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotImgLoad(QImage);
|
||||
|
||||
private:
|
||||
QImage m_img;
|
||||
int m_width;
|
||||
int m_height;
|
||||
QRectF m_targetRct;
|
||||
|
||||
void paintEvent(QPaintEvent *);
|
||||
};
|
||||
|
||||
#endif // _UITOOLS_H_
|
Reference in New Issue
Block a user