diff --git a/control/0snap/battery.jpg b/control/0snap/battery.jpg new file mode 100644 index 0000000..261d432 Binary files /dev/null and b/control/0snap/battery.jpg differ diff --git a/control/0snap/cpumemorylabel.jpg b/control/0snap/cpumemorylabel.jpg new file mode 100644 index 0000000..3881ccd Binary files /dev/null and b/control/0snap/cpumemorylabel.jpg differ diff --git a/control/0snap/devicebutton.jpg b/control/0snap/devicebutton.jpg new file mode 100644 index 0000000..4b5f770 Binary files /dev/null and b/control/0snap/devicebutton.jpg differ diff --git a/control/0snap/devicesizetable.jpg b/control/0snap/devicesizetable.jpg new file mode 100644 index 0000000..5f81f5d Binary files /dev/null and b/control/0snap/devicesizetable.jpg differ diff --git a/control/0snap/imageswitch.jpg b/control/0snap/imageswitch.jpg new file mode 100644 index 0000000..81ac048 Binary files /dev/null and b/control/0snap/imageswitch.jpg differ diff --git a/control/0snap/ipaddress.jpg b/control/0snap/ipaddress.jpg new file mode 100644 index 0000000..3afe1e6 Binary files /dev/null and b/control/0snap/ipaddress.jpg differ diff --git a/control/0snap/lightbutton.jpg b/control/0snap/lightbutton.jpg new file mode 100644 index 0000000..210453a Binary files /dev/null and b/control/0snap/lightbutton.jpg differ diff --git a/control/0snap/navbutton.jpg b/control/0snap/navbutton.jpg new file mode 100644 index 0000000..846483c Binary files /dev/null and b/control/0snap/navbutton.jpg differ diff --git a/control/0snap/savelog.jpg b/control/0snap/savelog.jpg new file mode 100644 index 0000000..f3978a0 Binary files /dev/null and b/control/0snap/savelog.jpg differ diff --git a/control/0snap/saveruntime.jpg b/control/0snap/saveruntime.jpg new file mode 100644 index 0000000..9744710 Binary files /dev/null and b/control/0snap/saveruntime.jpg differ diff --git a/control/0snap/smoothcurve.jpg b/control/0snap/smoothcurve.jpg new file mode 100644 index 0000000..53ffa7b Binary files /dev/null and b/control/0snap/smoothcurve.jpg differ diff --git a/control/0snap/zhtopy.jpg b/control/0snap/zhtopy.jpg new file mode 100644 index 0000000..c2c78ce Binary files /dev/null and b/control/0snap/zhtopy.jpg differ diff --git a/control/battery/battery.cpp b/control/battery/battery.cpp new file mode 100644 index 0000000..246c20f --- /dev/null +++ b/control/battery/battery.cpp @@ -0,0 +1,421 @@ +#pragma execution_character_set("utf-8") + +#include "battery.h" +#include "qpainter.h" +#include "qtimer.h" +#include "qdebug.h" + +Battery::Battery(QWidget *parent) : QWidget(parent) +{ + minValue = 0; + maxValue = 100; + value = 0; + alarmValue = 30; + + animation = true; + animationStep = 0.5; + + borderWidth = 5; + borderRadius = 8; + bgRadius = 5; + headRadius = 3; + + borderColorStart = QColor(100, 100, 100); + borderColorEnd = QColor(80, 80, 80); + alarmColorStart = QColor(250, 118, 113); + alarmColorEnd = QColor(204, 38, 38); + normalColorStart = QColor(50, 205, 51); + normalColorEnd = QColor(60, 179, 133); + + isForward = false; + currentValue = 0; + + timer = new QTimer(this); + timer->setInterval(10); + connect(timer, SIGNAL(timeout()), this, SLOT(updateValue())); +} + +Battery::~Battery() +{ + if (timer->isActive()) { + timer->stop(); + } +} + +void Battery::paintEvent(QPaintEvent *) +{ + //绘制准备工作,启用反锯齿 + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); + + //绘制边框 + drawBorder(&painter); + //绘制背景 + drawBg(&painter); + //绘制头部 + drawHead(&painter); +} + +void Battery::drawBorder(QPainter *painter) +{ + painter->save(); + + double headWidth = width() / 15; + double batteryWidth = width() - headWidth; + + //绘制电池边框 + QPointF topLeft(borderWidth, borderWidth); + QPointF bottomRight(batteryWidth, height() - borderWidth); + batteryRect = QRectF(topLeft, bottomRight); + + painter->setPen(QPen(borderColorStart, borderWidth)); + painter->setBrush(Qt::NoBrush); + painter->drawRoundedRect(batteryRect, borderRadius, borderRadius); + + painter->restore(); +} + +void Battery::drawBg(QPainter *painter) +{ + if (value == minValue) { + return; + } + + painter->save(); + + QLinearGradient batteryGradient(QPointF(0, 0), QPointF(0, height())); + if (currentValue <= alarmValue) { + batteryGradient.setColorAt(0.0, alarmColorStart); + batteryGradient.setColorAt(1.0, alarmColorEnd); + } else { + batteryGradient.setColorAt(0.0, normalColorStart); + batteryGradient.setColorAt(1.0, normalColorEnd); + } + + int margin = qMin(width(), height()) / 20; + double unit = (batteryRect.width() - (margin * 2)) / (maxValue - minValue); + double width = currentValue * unit; + QPointF topLeft(batteryRect.topLeft().x() + margin, batteryRect.topLeft().y() + margin); + QPointF bottomRight(width + margin + borderWidth, batteryRect.bottomRight().y() - margin); + QRectF rect(topLeft, bottomRight); + + painter->setPen(Qt::NoPen); + painter->setBrush(batteryGradient); + painter->drawRoundedRect(rect, bgRadius, bgRadius); + + painter->restore(); +} + +void Battery::drawHead(QPainter *painter) +{ + painter->save(); + + QPointF headRectTopLeft(batteryRect.topRight().x(), height() / 3); + QPointF headRectBottomRight(width(), height() - height() / 3); + QRectF headRect(headRectTopLeft, headRectBottomRight); + + QLinearGradient headRectGradient(headRect.topLeft(), headRect.bottomLeft()); + headRectGradient.setColorAt(0.0, borderColorStart); + headRectGradient.setColorAt(1.0, borderColorEnd); + + painter->setPen(Qt::NoPen); + painter->setBrush(headRectGradient); + painter->drawRoundedRect(headRect, headRadius, headRadius); + + painter->restore(); +} + +void Battery::updateValue() +{ + if (isForward) { + currentValue -= animationStep; + if (currentValue <= value) { + currentValue = value; + timer->stop(); + } + } else { + currentValue += animationStep; + if (currentValue >= value) { + currentValue = value; + timer->stop(); + } + } + + this->update(); +} + +QSize Battery::sizeHint() const +{ + return QSize(150, 80); +} + +QSize Battery::minimumSizeHint() const +{ + return QSize(30, 10); +} + +void Battery::setRange(double minValue, double maxValue) +{ + //如果最小值大于或者等于最大值则不设置 + if (minValue >= maxValue) { + return; + } + + this->minValue = minValue; + this->maxValue = maxValue; + + //如果目标值不在范围值内,则重新设置目标值 + //值小于最小值则取最小值,大于最大值则取最大值 + if (value < minValue) { + setValue(minValue); + } else if (value > maxValue) { + setValue(maxValue); + } + + this->update(); +} + +void Battery::setRange(int minValue, int maxValue) +{ + setRange((double)minValue, (double)maxValue); +} + +double Battery::getMinValue() const +{ + return this->minValue; +} + +void Battery::setMinValue(double minValue) +{ + setRange(minValue, maxValue); +} + +double Battery::getMaxValue() const +{ + return this->maxValue; +} + +void Battery::setMaxValue(double maxValue) +{ + setRange(minValue, maxValue); +} + +double Battery::getValue() const +{ + return this->value; +} + +void Battery::setValue(double value) +{ + //值和当前值一致则无需处理 + if (value == this->value) { + return; + } + + //值小于最小值则取最小值,大于最大值则取最大值 + if (value < minValue) { + value = minValue; + } else if (value > maxValue) { + value = maxValue; + } + + if (value > currentValue) { + isForward = false; + } else if (value < currentValue) { + isForward = true; + } else { + this->value = value; + this->update(); + return; + } + + this->value = value; + Q_EMIT valueChanged(value); + if (animation) { + timer->stop(); + timer->start(); + } else { + this->currentValue = value; + this->update(); + } +} + +void Battery::setValue(int value) +{ + setValue((double)value); +} + +double Battery::getAlarmValue() const +{ + return this->alarmValue; +} + +void Battery::setAlarmValue(double alarmValue) +{ + if (this->alarmValue != alarmValue) { + this->alarmValue = alarmValue; + this->update(); + } +} + +void Battery::setAlarmValue(int alarmValue) +{ + setAlarmValue((double)alarmValue); +} + + +bool Battery::getAnimation() const +{ + return this->animation; +} + +void Battery::setAnimation(bool animation) +{ + if (this->animation != animation) { + this->animation = animation; + this->update(); + } +} + +double Battery::getAnimationStep() const +{ + return this->animationStep; +} + +void Battery::setAnimationStep(double animationStep) +{ + if (this->animationStep != animationStep) { + this->animationStep = animationStep; + this->update(); + } +} + +int Battery::getBorderWidth() const +{ + return this->borderWidth; +} + +void Battery::setBorderWidth(int borderWidth) +{ + if (this->borderWidth != borderWidth) { + this->borderWidth = borderWidth; + this->update(); + } +} + +int Battery::getBorderRadius() const +{ + return this->borderRadius; +} + +void Battery::setBorderRadius(int borderRadius) +{ + if (this->borderRadius != borderRadius) { + this->borderRadius = borderRadius; + this->update(); + } +} + +int Battery::getBgRadius() const +{ + return this->bgRadius; +} + +void Battery::setBgRadius(int bgRadius) +{ + if (this->bgRadius != bgRadius) { + this->bgRadius = bgRadius; + this->update(); + } +} + +int Battery::getHeadRadius() const +{ + return this->headRadius; +} + +void Battery::setHeadRadius(int headRadius) +{ + if (this->headRadius != headRadius) { + this->headRadius = headRadius; + this->update(); + } +} + +QColor Battery::getBorderColorStart() const +{ + return this->borderColorStart; +} + +void Battery::setBorderColorStart(const QColor &borderColorStart) +{ + if (this->borderColorStart != borderColorStart) { + this->borderColorStart = borderColorStart; + this->update(); + } +} + +QColor Battery::getBorderColorEnd() const +{ + return this->borderColorEnd; +} + +void Battery::setBorderColorEnd(const QColor &borderColorEnd) +{ + if (this->borderColorEnd != borderColorEnd) { + this->borderColorEnd = borderColorEnd; + this->update(); + } +} + +QColor Battery::getAlarmColorStart() const +{ + return this->alarmColorStart; +} + +void Battery::setAlarmColorStart(const QColor &alarmColorStart) +{ + if (this->alarmColorStart != alarmColorStart) { + this->alarmColorStart = alarmColorStart; + this->update(); + } +} + +QColor Battery::getAlarmColorEnd() const +{ + return this->alarmColorEnd; +} + +void Battery::setAlarmColorEnd(const QColor &alarmColorEnd) +{ + if (this->alarmColorEnd != alarmColorEnd) { + this->alarmColorEnd = alarmColorEnd; + this->update(); + } +} + +QColor Battery::getNormalColorStart() const +{ + return this->normalColorStart; +} + +void Battery::setNormalColorStart(const QColor &normalColorStart) +{ + if (this->normalColorStart != normalColorStart) { + this->normalColorStart = normalColorStart; + this->update(); + } +} + +QColor Battery::getNormalColorEnd() const +{ + return this->normalColorEnd; +} + +void Battery::setNormalColorEnd(const QColor &normalColorEnd) +{ + if (this->normalColorEnd != normalColorEnd) { + this->normalColorEnd = normalColorEnd; + this->update(); + } +} diff --git a/control/battery/battery.h b/control/battery/battery.h new file mode 100644 index 0000000..2302a33 --- /dev/null +++ b/control/battery/battery.h @@ -0,0 +1,166 @@ +#ifndef BATTERY_H +#define BATTERY_H + +/** + * 电池电量控件 作者:feiyangqingyun(QQ:517216493) 2016-10-23 + * 1. 可设置电池电量,动态切换电池电量变化。 + * 2. 可设置电池电量警戒值。 + * 3. 可设置电池电量正常颜色和报警颜色。 + * 4. 可设置边框渐变颜色。 + * 5. 可设置电量变化时每次移动的步长。 + * 6. 可设置边框圆角角度、背景进度圆角角度、头部圆角角度。 + */ + +#include + +#ifdef quc +class Q_DECL_EXPORT Battery : public QWidget +#else +class Battery : public QWidget +#endif + +{ + Q_OBJECT + + Q_PROPERTY(double minValue READ getMinValue WRITE setMinValue) + Q_PROPERTY(double maxValue READ getMaxValue WRITE setMaxValue) + Q_PROPERTY(double value READ getValue WRITE setValue) + Q_PROPERTY(double alarmValue READ getAlarmValue WRITE setAlarmValue) + + Q_PROPERTY(bool animation READ getAnimation WRITE setAnimation) + Q_PROPERTY(double animationStep READ getAnimationStep WRITE setAnimationStep) + + Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth) + Q_PROPERTY(int borderRadius READ getBorderRadius WRITE setBorderRadius) + Q_PROPERTY(int bgRadius READ getBgRadius WRITE setBgRadius) + Q_PROPERTY(int headRadius READ getHeadRadius WRITE setHeadRadius) + + Q_PROPERTY(QColor borderColorStart READ getBorderColorStart WRITE setBorderColorStart) + Q_PROPERTY(QColor borderColorEnd READ getBorderColorEnd WRITE setBorderColorEnd) + + Q_PROPERTY(QColor alarmColorStart READ getAlarmColorStart WRITE setAlarmColorStart) + Q_PROPERTY(QColor alarmColorEnd READ getAlarmColorEnd WRITE setAlarmColorEnd) + + Q_PROPERTY(QColor normalColorStart READ getNormalColorStart WRITE setNormalColorStart) + Q_PROPERTY(QColor normalColorEnd READ getNormalColorEnd WRITE setNormalColorEnd) + +public: + explicit Battery(QWidget *parent = 0); + ~Battery(); + +protected: + void paintEvent(QPaintEvent *); + void drawBorder(QPainter *painter); + void drawBg(QPainter *painter); + void drawHead(QPainter *painter); + +private slots: + void updateValue(); + +private: + double minValue; //最小值 + double maxValue; //最大值 + double value; //目标电量 + double alarmValue; //电池电量警戒值 + + bool animation; //是否启用动画显示 + double animationStep; //动画显示时步长 + + int borderWidth; //边框粗细 + int borderRadius; //边框圆角角度 + int bgRadius; //背景进度圆角角度 + int headRadius; //头部圆角角度 + + QColor borderColorStart;//边框渐变开始颜色 + QColor borderColorEnd; //边框渐变结束颜色 + + QColor alarmColorStart; //电池低电量时的渐变开始颜色 + QColor alarmColorEnd; //电池低电量时的渐变结束颜色 + + QColor normalColorStart;//电池正常电量时的渐变开始颜色 + QColor normalColorEnd; //电池正常电量时的渐变结束颜色 + + bool isForward; //是否往前移 + double currentValue; //当前电量 + QRectF batteryRect; //电池主体区域 + QTimer *timer; //绘制定时器 + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //设置范围值 + void setRange(double minValue, double maxValue); + void setRange(int minValue, int maxValue); + + //获取和设置最小值 + double getMinValue() const; + void setMinValue(double minValue); + + //获取和设置最大值 + double getMaxValue() const; + void setMaxValue(double maxValue); + + //获取和设置电池电量值 + double getValue() const; + void setValue(double value); + + //获取和设置电池电量警戒值 + double getAlarmValue() const; + void setAlarmValue(double alarmValue); + + //获取和设置是否启用动画显示 + bool getAnimation() const; + void setAnimation(bool animation); + + //获取和设置动画显示的步长 + double getAnimationStep() const; + void setAnimationStep(double animationStep); + + //获取和设置边框粗细 + int getBorderWidth() const; + void setBorderWidth(int borderWidth); + + //获取和设置边框圆角角度 + int getBorderRadius() const; + void setBorderRadius(int borderRadius); + + //获取和设置背景圆角角度 + int getBgRadius() const; + void setBgRadius(int bgRadius); + + //获取和设置头部圆角角度 + int getHeadRadius() const; + void setHeadRadius(int headRadius); + + //获取和设置边框渐变颜色 + QColor getBorderColorStart() const; + void setBorderColorStart(const QColor &borderColorStart); + + QColor getBorderColorEnd() const; + void setBorderColorEnd(const QColor &borderColorEnd); + + //获取和设置电池电量报警时的渐变颜色 + QColor getAlarmColorStart() const; + void setAlarmColorStart(const QColor &alarmColorStart); + + QColor getAlarmColorEnd() const; + void setAlarmColorEnd(const QColor &alarmColorEnd); + + //获取和设置电池电量正常时的渐变颜色 + QColor getNormalColorStart() const; + void setNormalColorStart(const QColor &normalColorStart); + + QColor getNormalColorEnd() const; + void setNormalColorEnd(const QColor &normalColorEnd); + +public Q_SLOTS: + void setValue(int value); + void setAlarmValue(int alarmValue); + +Q_SIGNALS: + void valueChanged(double value); +}; + +#endif // BATTERY_H diff --git a/control/battery/battery.pro b/control/battery/battery.pro new file mode 100644 index 0000000..3a106b1 --- /dev/null +++ b/control/battery/battery.pro @@ -0,0 +1,17 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = battery +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmbattery.cpp +SOURCES += battery.cpp + +HEADERS += frmbattery.h +HEADERS += battery.h + +FORMS += frmbattery.ui diff --git a/control/battery/frmbattery.cpp b/control/battery/frmbattery.cpp new file mode 100644 index 0000000..e6d157e --- /dev/null +++ b/control/battery/frmbattery.cpp @@ -0,0 +1,21 @@ +#pragma execution_character_set("utf-8") + +#include "frmbattery.h" +#include "ui_frmbattery.h" + +frmBattery::frmBattery(QWidget *parent) : QWidget(parent), ui(new Ui::frmBattery) +{ + ui->setupUi(this); + this->initForm(); +} + +frmBattery::~frmBattery() +{ + delete ui; +} + +void frmBattery::initForm() +{ + connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->battery, SLOT(setValue(int))); + ui->horizontalSlider->setValue(30); +} diff --git a/control/battery/frmbattery.h b/control/battery/frmbattery.h new file mode 100644 index 0000000..9a1e4ce --- /dev/null +++ b/control/battery/frmbattery.h @@ -0,0 +1,25 @@ +#ifndef FRMBATTERY_H +#define FRMBATTERY_H + +#include + +namespace Ui { +class frmBattery; +} + +class frmBattery : public QWidget +{ + Q_OBJECT + +public: + explicit frmBattery(QWidget *parent = 0); + ~frmBattery(); + +private: + Ui::frmBattery *ui; + +private slots: + void initForm(); +}; + +#endif // FRMBATTERY_H diff --git a/control/battery/frmbattery.ui b/control/battery/frmbattery.ui new file mode 100644 index 0000000..dc7048b --- /dev/null +++ b/control/battery/frmbattery.ui @@ -0,0 +1,56 @@ + + + frmBattery + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + 9 + 9 + 482 + 257 + + + + + + + 9 + 272 + 481 + 19 + + + + 100 + + + Qt::Horizontal + + + false + + + + + + Battery + QWidget +
battery.h
+ 1 +
+
+ + +
diff --git a/control/battery/main.cpp b/control/battery/main.cpp new file mode 100644 index 0000000..3f9f83f --- /dev/null +++ b/control/battery/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmbattery.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmBattery w; + w.setWindowTitle("电池电量控件 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/bin/battery.exe b/control/bin/battery.exe new file mode 100644 index 0000000..2fb646b Binary files /dev/null and b/control/bin/battery.exe differ diff --git a/control/bin/battery.ilk b/control/bin/battery.ilk new file mode 100644 index 0000000..1221afd Binary files /dev/null and b/control/bin/battery.ilk differ diff --git a/control/bin/battery.pdb b/control/bin/battery.pdb new file mode 100644 index 0000000..de0b629 Binary files /dev/null and b/control/bin/battery.pdb differ diff --git a/control/bin/cpumemorylabel.exe b/control/bin/cpumemorylabel.exe new file mode 100644 index 0000000..b5e1f3b Binary files /dev/null and b/control/bin/cpumemorylabel.exe differ diff --git a/control/bin/cpumemorylabel.ilk b/control/bin/cpumemorylabel.ilk new file mode 100644 index 0000000..4446929 Binary files /dev/null and b/control/bin/cpumemorylabel.ilk differ diff --git a/control/bin/cpumemorylabel.pdb b/control/bin/cpumemorylabel.pdb new file mode 100644 index 0000000..bca11bd Binary files /dev/null and b/control/bin/cpumemorylabel.pdb differ diff --git a/control/bin/devicebutton.exe b/control/bin/devicebutton.exe new file mode 100644 index 0000000..8326557 Binary files /dev/null and b/control/bin/devicebutton.exe differ diff --git a/control/bin/devicebutton.ilk b/control/bin/devicebutton.ilk new file mode 100644 index 0000000..7839556 Binary files /dev/null and b/control/bin/devicebutton.ilk differ diff --git a/control/bin/devicebutton.pdb b/control/bin/devicebutton.pdb new file mode 100644 index 0000000..d54b309 Binary files /dev/null and b/control/bin/devicebutton.pdb differ diff --git a/control/bin/devicesizetable.exe b/control/bin/devicesizetable.exe new file mode 100644 index 0000000..763bc52 Binary files /dev/null and b/control/bin/devicesizetable.exe differ diff --git a/control/bin/devicesizetable.ilk b/control/bin/devicesizetable.ilk new file mode 100644 index 0000000..3c60fe9 Binary files /dev/null and b/control/bin/devicesizetable.ilk differ diff --git a/control/bin/devicesizetable.pdb b/control/bin/devicesizetable.pdb new file mode 100644 index 0000000..cb98285 Binary files /dev/null and b/control/bin/devicesizetable.pdb differ diff --git a/control/bin/imageswitch.exe b/control/bin/imageswitch.exe new file mode 100644 index 0000000..78ead77 Binary files /dev/null and b/control/bin/imageswitch.exe differ diff --git a/control/bin/imageswitch.ilk b/control/bin/imageswitch.ilk new file mode 100644 index 0000000..2a4369d Binary files /dev/null and b/control/bin/imageswitch.ilk differ diff --git a/control/bin/imageswitch.pdb b/control/bin/imageswitch.pdb new file mode 100644 index 0000000..7325399 Binary files /dev/null and b/control/bin/imageswitch.pdb differ diff --git a/control/bin/ipaddress.exe b/control/bin/ipaddress.exe new file mode 100644 index 0000000..71bda87 Binary files /dev/null and b/control/bin/ipaddress.exe differ diff --git a/control/bin/ipaddress.ilk b/control/bin/ipaddress.ilk new file mode 100644 index 0000000..e122e88 Binary files /dev/null and b/control/bin/ipaddress.ilk differ diff --git a/control/bin/ipaddress.pdb b/control/bin/ipaddress.pdb new file mode 100644 index 0000000..f8835cf Binary files /dev/null and b/control/bin/ipaddress.pdb differ diff --git a/control/bin/lightbutton.exe b/control/bin/lightbutton.exe new file mode 100644 index 0000000..3776516 Binary files /dev/null and b/control/bin/lightbutton.exe differ diff --git a/control/bin/lightbutton.ilk b/control/bin/lightbutton.ilk new file mode 100644 index 0000000..6502fd3 Binary files /dev/null and b/control/bin/lightbutton.ilk differ diff --git a/control/bin/lightbutton.pdb b/control/bin/lightbutton.pdb new file mode 100644 index 0000000..0d74ac4 Binary files /dev/null and b/control/bin/lightbutton.pdb differ diff --git a/control/bin/navbutton.exe b/control/bin/navbutton.exe new file mode 100644 index 0000000..58e9526 Binary files /dev/null and b/control/bin/navbutton.exe differ diff --git a/control/bin/navbutton.ilk b/control/bin/navbutton.ilk new file mode 100644 index 0000000..2632a55 Binary files /dev/null and b/control/bin/navbutton.ilk differ diff --git a/control/bin/navbutton.pdb b/control/bin/navbutton.pdb new file mode 100644 index 0000000..130ee38 Binary files /dev/null and b/control/bin/navbutton.pdb differ diff --git a/control/bin/savelog.exe b/control/bin/savelog.exe new file mode 100644 index 0000000..f0310a4 Binary files /dev/null and b/control/bin/savelog.exe differ diff --git a/control/bin/savelog.ilk b/control/bin/savelog.ilk new file mode 100644 index 0000000..e30796d Binary files /dev/null and b/control/bin/savelog.ilk differ diff --git a/control/bin/savelog.pdb b/control/bin/savelog.pdb new file mode 100644 index 0000000..7abf2f6 Binary files /dev/null and b/control/bin/savelog.pdb differ diff --git a/control/bin/saveruntime.exe b/control/bin/saveruntime.exe new file mode 100644 index 0000000..8541720 Binary files /dev/null and b/control/bin/saveruntime.exe differ diff --git a/control/bin/saveruntime.ilk b/control/bin/saveruntime.ilk new file mode 100644 index 0000000..bf50209 Binary files /dev/null and b/control/bin/saveruntime.ilk differ diff --git a/control/bin/saveruntime.pdb b/control/bin/saveruntime.pdb new file mode 100644 index 0000000..03c3b02 Binary files /dev/null and b/control/bin/saveruntime.pdb differ diff --git a/control/bin/smoothcurve.exe b/control/bin/smoothcurve.exe new file mode 100644 index 0000000..2fb6b41 Binary files /dev/null and b/control/bin/smoothcurve.exe differ diff --git a/control/bin/smoothcurve.ilk b/control/bin/smoothcurve.ilk new file mode 100644 index 0000000..924f7cb Binary files /dev/null and b/control/bin/smoothcurve.ilk differ diff --git a/control/bin/smoothcurve.pdb b/control/bin/smoothcurve.pdb new file mode 100644 index 0000000..221bdaf Binary files /dev/null and b/control/bin/smoothcurve.pdb differ diff --git a/control/bin/zhtopy.exe b/control/bin/zhtopy.exe new file mode 100644 index 0000000..e4b35f4 Binary files /dev/null and b/control/bin/zhtopy.exe differ diff --git a/control/bin/zhtopy.ilk b/control/bin/zhtopy.ilk new file mode 100644 index 0000000..014d5ca Binary files /dev/null and b/control/bin/zhtopy.ilk differ diff --git a/control/bin/zhtopy.pdb b/control/bin/zhtopy.pdb new file mode 100644 index 0000000..6a90d40 Binary files /dev/null and b/control/bin/zhtopy.pdb differ diff --git a/control/control.pro b/control/control.pro new file mode 100644 index 0000000..973bbea --- /dev/null +++ b/control/control.pro @@ -0,0 +1,13 @@ +TEMPLATE = subdirs +SUBDIRS += battery +SUBDIRS += devicebutton +SUBDIRS += devicesizetable +SUBDIRS += imageswitch +SUBDIRS += ipaddress +SUBDIRS += lightbutton +SUBDIRS += navbutton +SUBDIRS += savelog +SUBDIRS += saveruntime +SUBDIRS += smoothcurve +SUBDIRS += zhtopy +SUBDIRS += cpumemorylabel \ No newline at end of file diff --git a/control/cpumemorylabel/cpumemorylabel.cpp b/control/cpumemorylabel/cpumemorylabel.cpp new file mode 100644 index 0000000..41f5a65 --- /dev/null +++ b/control/cpumemorylabel/cpumemorylabel.cpp @@ -0,0 +1,239 @@ +#pragma execution_character_set("utf-8") + +#include "cpumemorylabel.h" +#include "qtimer.h" +#include "qprocess.h" +#include "qdebug.h" + +#ifdef Q_OS_WIN +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x502 +#endif +#include "windows.h" +#endif + +#define MB (1024 * 1024) +#define KB (1024) + +CpuMemoryLabel::CpuMemoryLabel(QWidget *parent) : QLabel(parent) +{ + totalNew = idleNew = totalOld = idleOld = 0; + + cpuPercent = 0; + memoryPercent = 0; + memoryAll = 0; + memoryUse = 0; + + //获取CPU占用情况定时器 + timerCPU = new QTimer(this); + connect(timerCPU, SIGNAL(timeout()), this, SLOT(getCPU())); + + //获取内存占用情况定时器 + timerMemory = new QTimer(this); + connect(timerMemory, SIGNAL(timeout()), this, SLOT(getMemory())); + + //执行命令获取 + process = new QProcess(this); + connect(process, SIGNAL(readyRead()), this, SLOT(readData())); + + showText = true; +} + +CpuMemoryLabel::~CpuMemoryLabel() +{ + this->stop(); +} + +void CpuMemoryLabel::start(int interval) +{ + this->getCPU(); + this->getMemory(); + + if (!timerCPU->isActive()) { + timerCPU->start(interval); + } + if (!timerMemory->isActive()) { + timerMemory->start(interval + 1000); + } +} + +void CpuMemoryLabel::stop() +{ + process->close(); + if (timerCPU->isActive()) { + timerCPU->stop(); + } + if (timerMemory->isActive()) { + timerMemory->stop(); + } +} + +void CpuMemoryLabel::getCPU() +{ +#ifdef Q_OS_WIN +#if 0 + static FILETIME lastIdleTime; + static FILETIME lastKernelTime; + static FILETIME lastUserTime; + + FILETIME newIdleTime; + FILETIME newKernelTime; + FILETIME newUserTime; + + //采用GetSystemTimes获取的CPU占用和任务管理器的不一致 + GetSystemTimes(&newIdleTime, &newKernelTime, &newUserTime); + + int offset = 31; + quint64 a, b; + quint64 idle, kernel, user; + + a = (lastIdleTime.dwHighDateTime << offset) | lastIdleTime.dwLowDateTime; + b = (newIdleTime.dwHighDateTime << offset) | newIdleTime.dwLowDateTime; + idle = b - a; + + a = (lastKernelTime.dwHighDateTime << offset) | lastKernelTime.dwLowDateTime; + b = (newKernelTime.dwHighDateTime << offset) | newKernelTime.dwLowDateTime; + kernel = b - a; + + a = (lastUserTime.dwHighDateTime << offset) | lastUserTime.dwLowDateTime; + b = (newUserTime.dwHighDateTime << offset) | newUserTime.dwLowDateTime; + user = b - a; + + cpuPercent = float(kernel + user - idle) * 100 / float(kernel + user); + + lastIdleTime = newIdleTime; + lastKernelTime = newKernelTime; + lastUserTime = newUserTime; + this->setData(); +#else + //获取系统版本区分win10 + bool win10 = false; +#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0)) + win10 = (QSysInfo::productVersion().mid(0, 2).toInt() >= 10); +#else + win10 = (QSysInfo::WindowsVersion >= 192); +#endif + + QString cmd = "\\Processor(_Total)\\% Processor Time"; + if (win10) { + cmd = "\\Processor Information(_Total)\\% Processor Utility"; + } + + if (process->state() == QProcess::NotRunning) { + process->start("typeperf", QStringList() << cmd); + } +#endif + +#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM) + if (process->state() == QProcess::NotRunning) { + totalNew = idleNew = 0; + process->start("cat", QStringList() << "/proc/stat"); + } +#endif +} + +void CpuMemoryLabel::getMemory() +{ +#ifdef Q_OS_WIN + MEMORYSTATUSEX statex; + statex.dwLength = sizeof(statex); + GlobalMemoryStatusEx(&statex); + memoryPercent = statex.dwMemoryLoad; + memoryAll = statex.ullTotalPhys / MB; + memoryFree = statex.ullAvailPhys / MB; + memoryUse = memoryAll - memoryFree; + this->setData(); + +#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM) + if (process->state() == QProcess::NotRunning) { + process->start("cat", QStringList() << "/proc/meminfo"); + } +#endif +} + +void CpuMemoryLabel::readData() +{ +#ifdef Q_OS_WIN + while (!process->atEnd()) { + QString s = QLatin1String(process->readLine()); + s = s.split(",").last(); + s.replace("\r", ""); + s.replace("\n", ""); + s.replace("\"", ""); + if (!s.isEmpty() && s.length() < 10) { + cpuPercent = qRound(s.toFloat()); + } + } +#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM) + while (!process->atEnd()) { + QString s = QLatin1String(process->readLine()); + if (s.startsWith("cpu")) { + QStringList list = s.split(" "); + idleNew = list.at(5).toUInt(); + foreach (QString value, list) { + totalNew += value.toUInt(); + } + + quint64 total = totalNew - totalOld; + quint64 idle = idleNew - idleOld; + cpuPercent = 100 * (total - idle) / total; + totalOld = totalNew; + idleOld = idleNew; + break; + } else if (s.startsWith("MemTotal")) { + s.replace(" ", ""); + s = s.split(":").at(1); + memoryAll = s.left(s.length() - 3).toUInt() / KB; + } else if (s.startsWith("MemFree")) { + s.replace(" ", ""); + s = s.split(":").at(1); + memoryFree = s.left(s.length() - 3).toUInt() / KB; + } else if (s.startsWith("Buffers")) { + s.replace(" ", ""); + s = s.split(":").at(1); + memoryFree += s.left(s.length() - 3).toUInt() / KB; + } else if (s.startsWith("Cached")) { + s.replace(" ", ""); + s = s.split(":").at(1); + memoryFree += s.left(s.length() - 3).toUInt() / KB; + memoryUse = memoryAll - memoryFree; + memoryPercent = 100 * memoryUse / memoryAll; + break; + } + } +#endif + this->setData(); +} + +void CpuMemoryLabel::setData() +{ + cpuPercent = (cpuPercent < 0 ? 0 : cpuPercent); + cpuPercent = (cpuPercent > 100 ? 0 : cpuPercent); + QString msg = QString("CPU %1% Mem %2% ( 已用 %3 MB / 共 %4 MB )").arg(cpuPercent).arg(memoryPercent).arg(memoryUse).arg(memoryAll); + if (showText) { + this->setText(msg); + } + + Q_EMIT textChanged(msg); + Q_EMIT valueChanged(cpuPercent, memoryPercent, memoryAll, memoryUse, memoryFree); +} + +QSize CpuMemoryLabel::sizeHint() const +{ + return QSize(300, 30); +} + +QSize CpuMemoryLabel::minimumSizeHint() const +{ + return QSize(30, 10); +} + +bool CpuMemoryLabel::getShowText() const +{ + return this->showText; +} + +void CpuMemoryLabel::setShowText(bool showText) +{ + this->showText = showText; +} diff --git a/control/cpumemorylabel/cpumemorylabel.h b/control/cpumemorylabel/cpumemorylabel.h new file mode 100644 index 0000000..fee6d3e --- /dev/null +++ b/control/cpumemorylabel/cpumemorylabel.h @@ -0,0 +1,75 @@ +#ifndef CPUMEMORYLABEL_H +#define CPUMEMORYLABEL_H + +/** + * CPU内存显示控件 作者:feiyangqingyun(QQ:517216493) 2016-11-18 + * 1. 实时显示当前CPU占用率。 + * 2. 实时显示内存使用情况。 + * 3. 包括共多少内存、已使用多少内存。 + * 4. 全平台通用,包括windows、linux、ARM。 + * 5. 发出信号通知占用率和内存使用情况等,以便自行显示到其他地方。 + */ + +#include + +class QProcess; + +#ifdef quc +class Q_DECL_EXPORT CpuMemoryLabel : public QLabel +#else +class CpuMemoryLabel : public QLabel +#endif + +{ + Q_OBJECT + + Q_PROPERTY(bool showText READ getShowText WRITE setShowText) + +public: + explicit CpuMemoryLabel(QWidget *parent = 0); + ~CpuMemoryLabel(); + +private: + quint64 totalNew, idleNew, totalOld, idleOld; + + quint64 cpuPercent; //CPU百分比 + quint64 memoryPercent; //内存百分比 + quint64 memoryAll; //所有内存 + quint64 memoryUse; //已用内存 + quint64 memoryFree; //空闲内存 + + QTimer *timerCPU; //定时器获取CPU信息 + QTimer *timerMemory; //定时器获取内存信息 + QProcess *process; //执行命令行 + + bool showText; //自己显示值 + +private slots: + void getCPU(); //获取cpu + void getMemory(); //获取内存 + void readData(); //读取数据 + void setData(); //设置数据 + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //获取和设置是否显示文本 + bool getShowText() const; + void setShowText(bool showText); + +public Q_SLOTS: + //开始启动服务 + void start(int interval); + //停止服务 + void stop(); + +Q_SIGNALS: + //文本改变信号 + void textChanged(const QString &text); + //cpu和内存占用情况数值改变信号 + void valueChanged(quint64 cpuPercent, quint64 memoryPercent, quint64 memoryAll, quint64 memoryUse, quint64 memoryFree); +}; + +#endif // CPUMEMORYLABEL_H diff --git a/control/cpumemorylabel/cpumemorylabel.pro b/control/cpumemorylabel/cpumemorylabel.pro new file mode 100644 index 0000000..f115810 --- /dev/null +++ b/control/cpumemorylabel/cpumemorylabel.pro @@ -0,0 +1,17 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = cpumemorylabel +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmcpumemorylabel.cpp +SOURCES += cpumemorylabel.cpp + +HEADERS += frmcpumemorylabel.h +HEADERS += cpumemorylabel.h + +FORMS += frmcpumemorylabel.ui diff --git a/control/cpumemorylabel/frmcpumemorylabel.cpp b/control/cpumemorylabel/frmcpumemorylabel.cpp new file mode 100644 index 0000000..8dce52d --- /dev/null +++ b/control/cpumemorylabel/frmcpumemorylabel.cpp @@ -0,0 +1,42 @@ +#pragma execution_character_set("utf-8") + +#include "frmcpumemorylabel.h" +#include "ui_frmcpumemorylabel.h" + +frmCpuMemoryLabel::frmCpuMemoryLabel(QWidget *parent) : QWidget(parent), ui(new Ui::frmCpuMemoryLabel) +{ + ui->setupUi(this); + this->initForm(); +} + +frmCpuMemoryLabel::~frmCpuMemoryLabel() +{ + delete ui; +} + +void frmCpuMemoryLabel::initForm() +{ + QFont font; + font.setPixelSize(16); + setFont(font); + + QString qss1 = QString("QLabel{background-color:rgb(0,0,0);color:rgb(%1);}").arg("100,184,255"); + QString qss2 = QString("QLabel{background-color:rgb(0,0,0);color:rgb(%1);}").arg("255,107,107"); + QString qss3 = QString("QLabel{background-color:rgb(0,0,0);color:rgb(%1);}").arg("24,189,155"); + + ui->label1->setStyleSheet(qss1); + ui->label2->setStyleSheet(qss2); + ui->label3->setStyleSheet(qss3); + + connect(ui->label1, SIGNAL(textChanged(QString)), ui->label2, SLOT(setText(QString))); + connect(ui->label1, SIGNAL(valueChanged(quint64, quint64, quint64, quint64, quint64)), + this, SLOT(valueChanged(quint64, quint64, quint64, quint64, quint64))); + ui->label1->start(1000); +} + +void frmCpuMemoryLabel::valueChanged(quint64 cpuPercent, quint64 memoryPercent, quint64 memoryAll, quint64 memoryUse, quint64 memoryFree) +{ + //重新组织文字 + QString msg = QString("CPU: %1% 内存: %2% ( %3 MB / %4 MB )").arg(cpuPercent).arg(memoryPercent).arg(memoryUse).arg(memoryAll); + ui->label3->setText(msg); +} diff --git a/control/cpumemorylabel/frmcpumemorylabel.h b/control/cpumemorylabel/frmcpumemorylabel.h new file mode 100644 index 0000000..aa7826a --- /dev/null +++ b/control/cpumemorylabel/frmcpumemorylabel.h @@ -0,0 +1,27 @@ +#ifndef FRMCPUMEMORYLABEL_H +#define FRMCPUMEMORYLABEL_H + +#include + +namespace Ui { +class frmCpuMemoryLabel; +} + +class frmCpuMemoryLabel : public QWidget +{ + Q_OBJECT + +public: + explicit frmCpuMemoryLabel(QWidget *parent = 0); + ~frmCpuMemoryLabel(); + +private: + Ui::frmCpuMemoryLabel *ui; + +private slots: + void initForm(); + //cpu和内存占用情况数值改变信号 + void valueChanged(quint64 cpuPercent, quint64 memoryPercent, quint64 memoryAll, quint64 memoryUse, quint64 memoryFree); +}; + +#endif // FRMCPUMEMORYLABEL_H diff --git a/control/cpumemorylabel/frmcpumemorylabel.ui b/control/cpumemorylabel/frmcpumemorylabel.ui new file mode 100644 index 0000000..2b4e033 --- /dev/null +++ b/control/cpumemorylabel/frmcpumemorylabel.ui @@ -0,0 +1,73 @@ + + + frmCpuMemoryLabel + + + + 0 + 0 + 800 + 600 + + + + Form + + + + 6 + + + 6 + + + 6 + + + 6 + + + 6 + + + + + + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + CpuMemoryLabel + QLabel +
cpumemorylabel.h
+
+
+ + +
diff --git a/control/cpumemorylabel/main.cpp b/control/cpumemorylabel/main.cpp new file mode 100644 index 0000000..a24c237 --- /dev/null +++ b/control/cpumemorylabel/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmcpumemorylabel.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmCpuMemoryLabel w; + w.setWindowTitle("CPU内存显示控件 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/devicebutton/devicebutton.cpp b/control/devicebutton/devicebutton.cpp new file mode 100644 index 0000000..8ba812b --- /dev/null +++ b/control/devicebutton/devicebutton.cpp @@ -0,0 +1,258 @@ +#pragma execution_character_set("utf-8") + +#include "devicebutton.h" +#include "qpainter.h" +#include "qevent.h" +#include "qtimer.h" +#include "qdebug.h" + +DeviceButton::DeviceButton(QWidget *parent) : QWidget(parent) +{ + canMove = false; + text = "1"; + + colorNormal = "black"; + colorAlarm = "red"; + + buttonStyle = ButtonStyle_Police; + buttonColor = ButtonColor_Green; + + isPressed = false; + lastPoint = QPoint(); + + type = "police"; + imgPath = ":/image/devicebutton/devicebutton"; + imgName = QString("%1_green_%2.png").arg(imgPath).arg(type); + + isDark = false; + timer = new QTimer(this); + timer->setInterval(500); + connect(timer, SIGNAL(timeout()), this, SLOT(checkAlarm())); + + this->installEventFilter(this); +} + +DeviceButton::~DeviceButton() +{ + if (timer->isActive()) { + timer->stop(); + } +} + +void DeviceButton::paintEvent(QPaintEvent *) +{ + double width = this->width(); + double height = this->height(); + + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + + //绘制背景图 + QImage img(imgName); + if (!img.isNull()) { + img = img.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + painter.drawImage(0, 0, img); + } + + //计算字体 + QFont font; + font.setPixelSize(height * 0.37); + font.setBold(true); + + //自动计算文字绘制区域,绘制防区号 + QRectF rect = this->rect(); + if (buttonStyle == ButtonStyle_Police) { + double y = (30 * height / 60); + rect = QRectF(0, y, width, height - y); + } else if (buttonStyle == ButtonStyle_Bubble) { + double y = (8 * height / 60); + rect = QRectF(0, 0, width, height - y); + } else if (buttonStyle == ButtonStyle_Bubble2) { + double y = (13 * height / 60); + rect = QRectF(0, 0, width, height - y); + font.setPixelSize(width * 0.33); + } else if (buttonStyle == ButtonStyle_Msg) { + double y = (17 * height / 60); + rect = QRectF(0, 0, width, height - y); + } else if (buttonStyle == ButtonStyle_Msg2) { + double y = (17 * height / 60); + rect = QRectF(0, 0, width, height - y); + } + + //绘制文字标识 + painter.setFont(font); + painter.setPen(Qt::white); + painter.drawText(rect, Qt::AlignCenter, text); +} + +bool DeviceButton::eventFilter(QObject *watched, QEvent *event) +{ + //识别鼠标 按下+移动+松开+双击 等事件 + QMouseEvent *mouseEvent = static_cast(event); + if (event->type() == QEvent::MouseButtonPress) { + //限定鼠标左键 + if (mouseEvent->button() == Qt::LeftButton) { + lastPoint = mouseEvent->pos(); + isPressed = true; + Q_EMIT clicked(); + return true; + } + } else if (event->type() == QEvent::MouseMove) { + //允许拖动并且鼠标按下准备拖动 + if (canMove && isPressed) { + int dx = mouseEvent->pos().x() - lastPoint.x(); + int dy = mouseEvent->pos().y() - lastPoint.y(); + this->move(this->x() + dx, this->y() + dy); + return true; + } + } else if (event->type() == QEvent::MouseButtonRelease) { + isPressed = false; + } else if (event->type() == QEvent::MouseButtonDblClick) { + Q_EMIT doubleClicked(); + } + + return QWidget::eventFilter(watched, event); +} + +QSize DeviceButton::sizeHint() const +{ + return QSize(50, 50); +} + +QSize DeviceButton::minimumSizeHint() const +{ + return QSize(10, 10); +} + +void DeviceButton::checkAlarm() +{ + if (isDark) { + imgName = QString("%1_%2_%3.png").arg(imgPath).arg(colorNormal).arg(type); + } else { + imgName = QString("%1_%2_%3.png").arg(imgPath).arg(colorAlarm).arg(type); + } + + isDark = !isDark; + this->update(); +} + +bool DeviceButton::getCanMove() const +{ + return this->canMove; +} + +void DeviceButton::setCanMove(bool canMove) +{ + this->canMove = canMove; +} + +QString DeviceButton::getText() const +{ + return this->text; +} + +void DeviceButton::setText(const QString &text) +{ + if (this->text != text) { + this->text = text; + this->update(); + } +} + +QString DeviceButton::getColorNormal() const +{ + return this->colorNormal; +} + +void DeviceButton::setColorNormal(const QString &colorNormal) +{ + if (this->colorNormal != colorNormal) { + this->colorNormal = colorNormal; + this->update(); + } +} + +QString DeviceButton::getColorAlarm() const +{ + return this->colorAlarm; +} + +void DeviceButton::setColorAlarm(const QString &colorAlarm) +{ + if (this->colorAlarm != colorAlarm) { + this->colorAlarm = colorAlarm; + this->update(); + } +} + +DeviceButton::ButtonStyle DeviceButton::getButtonStyle() const +{ + return this->buttonStyle; +} + +void DeviceButton::setButtonStyle(const DeviceButton::ButtonStyle &buttonStyle) +{ + this->buttonStyle = buttonStyle; + if (buttonStyle == ButtonStyle_Circle) { + type = "circle"; + } else if (buttonStyle == ButtonStyle_Police) { + type = "police"; + } else if (buttonStyle == ButtonStyle_Bubble) { + type = "bubble"; + } else if (buttonStyle == ButtonStyle_Bubble2) { + type = "bubble2"; + } else if (buttonStyle == ButtonStyle_Msg) { + type = "msg"; + } else if (buttonStyle == ButtonStyle_Msg2) { + type = "msg2"; + } else { + type = "circle"; + } + + setButtonColor(buttonColor); +} + +DeviceButton::ButtonColor DeviceButton::getButtonColor() const +{ + return this->buttonColor; +} + +void DeviceButton::setButtonColor(const DeviceButton::ButtonColor &buttonColor) +{ + //先停止定时器 + this->buttonColor = buttonColor; + isDark = false; + if (timer->isActive()) { + timer->stop(); + } + + QString color; + if (buttonColor == ButtonColor_Green) { + color = "green"; + } else if (buttonColor == ButtonColor_Blue) { + color = "blue"; + } else if (buttonColor == ButtonColor_Gray) { + color = "gray"; + } else if (buttonColor == ButtonColor_Black) { + color = "black"; + } else if (buttonColor == ButtonColor_Purple) { + color = "purple"; + } else if (buttonColor == ButtonColor_Yellow) { + color = "yellow"; + } else if (buttonColor == ButtonColor_Red) { + color = "red"; + } else { + color = "green"; + } + + //如果和报警颜色一致则主动启动定时器切换报警颜色 + imgName = QString("%1_%2_%3.png").arg(imgPath).arg(color).arg(type); + if (color == colorAlarm) { + checkAlarm(); + if (!timer->isActive()) { + timer->start(); + } + } + + this->update(); +} diff --git a/control/devicebutton/devicebutton.h b/control/devicebutton/devicebutton.h new file mode 100644 index 0000000..4a65ca7 --- /dev/null +++ b/control/devicebutton/devicebutton.h @@ -0,0 +1,123 @@ +#ifndef DEVICEBUTTON_H +#define DEVICEBUTTON_H + +/** + * 设备按钮控件 作者:feiyangqingyun(QQ:517216493) 2018-07-02 + * 1. 可设置按钮样式 圆形、警察、气泡、气泡2、消息、消息2。 + * 2. 可设置按钮颜色 布防、撤防、报警、旁路、故障。 + * 3. 可设置报警切换及对应报警切换的颜色。 + * 4. 可设置显示的防区号。 + * 5. 可设置是否可鼠标拖动。 + * 6. 发出单击和双击信号。 + */ + +#include + +#ifdef quc +class Q_DECL_EXPORT DeviceButton : public QWidget +#else +class DeviceButton : public QWidget +#endif + +{ + Q_OBJECT + Q_ENUMS(ButtonStyle) + Q_ENUMS(ButtonColor) + + Q_PROPERTY(bool canMove READ getCanMove WRITE setCanMove) + Q_PROPERTY(QString text READ getText WRITE setText) + + Q_PROPERTY(QString colorNormal READ getColorNormal WRITE setColorNormal) + Q_PROPERTY(QString colorAlarm READ getColorAlarm WRITE setColorAlarm) + + Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle) + Q_PROPERTY(ButtonColor buttonColor READ getButtonColor WRITE setButtonColor) + +public: + //设备按钮样式 + enum ButtonStyle { + ButtonStyle_Circle = 0, //圆形 + ButtonStyle_Police = 1, //警察 + ButtonStyle_Bubble = 2, //气泡 + ButtonStyle_Bubble2 = 3, //气泡2 + ButtonStyle_Msg = 4, //消息 + ButtonStyle_Msg2 = 5 //消息2 + }; + + //设备按钮颜色 + enum ButtonColor { + ButtonColor_Green = 0, //绿色(激活状态) + ButtonColor_Blue = 1, //蓝色(在线状态) + ButtonColor_Red = 2, //红色(报警状态) + ButtonColor_Gray = 3, //灰色(离线状态) + ButtonColor_Black = 4, //黑色(故障状态) + ButtonColor_Purple = 5, //紫色(其他状态) + ButtonColor_Yellow = 6 //黄色(其他状态) + }; + + explicit DeviceButton(QWidget *parent = 0); + ~DeviceButton(); + +protected: + void paintEvent(QPaintEvent *); + bool eventFilter(QObject *watched, QEvent *event); + +private: + bool canMove; //是否可移动 + QString text; //显示文字 + + QString colorNormal; //正常颜色 + QString colorAlarm; //报警颜色 + + ButtonStyle buttonStyle;//按钮样式 + ButtonColor buttonColor;//按钮颜色 + + bool isPressed; //鼠标是否按下 + QPoint lastPoint; //鼠标按下最后坐标 + + QString type; //图片末尾类型 + QString imgPath; //背景图片路径 + QString imgName; //背景图片名称 + + bool isDark; //是否加深报警 + QTimer *timer; //报警闪烁定时器 + +private slots: + void checkAlarm(); //切换报警状态 + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //获取和设置可移动 + bool getCanMove() const; + void setCanMove(bool canMove); + + //获取和设置显示文字 + QString getText() const; + void setText(const QString &text); + + //获取和设置正常颜色 + QString getColorNormal() const; + void setColorNormal(const QString &colorNormal); + + //获取和设置报警颜色 + QString getColorAlarm() const; + void setColorAlarm(const QString &colorAlarm); + + //获取和设置样式 + ButtonStyle getButtonStyle() const; + void setButtonStyle(const ButtonStyle &buttonStyle); + + //获取和设置颜色 + ButtonColor getButtonColor() const; + void setButtonColor(const ButtonColor &buttonColor); + +Q_SIGNALS: + //鼠标单击双击事件 + void clicked(); + void doubleClicked(); +}; + +#endif //DEVICEBUTTON_H diff --git a/control/devicebutton/devicebutton.pro b/control/devicebutton/devicebutton.pro new file mode 100644 index 0000000..d8dc57b --- /dev/null +++ b/control/devicebutton/devicebutton.pro @@ -0,0 +1,19 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = devicebutton +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmdevicebutton.cpp +SOURCES += devicebutton.cpp + +HEADERS += frmdevicebutton.h +HEADERS += devicebutton.h + +FORMS += frmdevicebutton.ui + +RESOURCES += main.qrc diff --git a/control/devicebutton/frmdevicebutton.cpp b/control/devicebutton/frmdevicebutton.cpp new file mode 100644 index 0000000..967b1a5 --- /dev/null +++ b/control/devicebutton/frmdevicebutton.cpp @@ -0,0 +1,71 @@ +#include "frmdevicebutton.h" +#include "ui_frmdevicebutton.h" +#include "devicebutton.h" +#include "qdebug.h" + +frmDeviceButton::frmDeviceButton(QWidget *parent) : QWidget(parent), ui(new Ui::frmDeviceButton) +{ + ui->setupUi(this); + this->initForm(); +} + +frmDeviceButton::~frmDeviceButton() +{ + delete ui; +} + +void frmDeviceButton::initForm() +{ + //设置背景地图 + ui->labMap->setStyleSheet("border-image:url(:/image/bg_call.jpg);"); + + btn1 = new DeviceButton(ui->labMap); + btn1->setText("#1"); + btn1->setGeometry(5, 5, 35, 35); + + btn2 = new DeviceButton(ui->labMap); + btn2->setText("#2"); + btn2->setGeometry(45, 5, 35, 35); + + btn3 = new DeviceButton(ui->labMap); + btn3->setText("#3"); + btn3->setGeometry(85, 5, 35, 35); + + btnStyle << ui->btnCircle << ui->btnPolice << ui->btnBubble << ui->btnBubble2 << ui->btnMsg << ui->btnMsg2; + foreach (QPushButton *btn, btnStyle) { + connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStyle())); + } + + btnColor << ui->btnGreen << ui->btnBlue << ui->btnRed << ui->btnGray << ui->btnBlack << ui->btnPurple << ui->btnYellow; + foreach (QPushButton *btn, btnColor) { + connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeColor())); + } +} + +void frmDeviceButton::changeStyle() +{ + QPushButton *btn = (QPushButton *)sender(); + int index = btnStyle.indexOf(btn); + DeviceButton::ButtonStyle style = (DeviceButton::ButtonStyle)index; + btn1->setButtonStyle(style); + btn2->setButtonStyle(style); + btn3->setButtonStyle(style); +} + +void frmDeviceButton::changeColor() +{ + QPushButton *btn = (QPushButton *)sender(); + int index = btnColor.indexOf(btn); + DeviceButton::ButtonColor style = (DeviceButton::ButtonColor)index; + btn1->setButtonColor(style); + btn2->setButtonColor(style); + btn3->setButtonColor(style); +} + +void frmDeviceButton::on_ckCanMove_stateChanged(int arg1) +{ + bool canMove = (arg1 != 0); + btn1->setCanMove(canMove); + btn2->setCanMove(canMove); + btn3->setCanMove(canMove); +} diff --git a/control/devicebutton/frmdevicebutton.h b/control/devicebutton/frmdevicebutton.h new file mode 100644 index 0000000..b8b45ca --- /dev/null +++ b/control/devicebutton/frmdevicebutton.h @@ -0,0 +1,36 @@ +#ifndef FRMDEVICEBUTTON_H +#define FRMDEVICEBUTTON_H + +#include + +class DeviceButton; +class QPushButton; + +namespace Ui { +class frmDeviceButton; +} + +class frmDeviceButton : public QWidget +{ + Q_OBJECT + +public: + explicit frmDeviceButton(QWidget *parent = 0); + ~frmDeviceButton(); + +private slots: + void initForm(); + void changeStyle(); + void changeColor(); + void on_ckCanMove_stateChanged(int arg1); + +private: + Ui::frmDeviceButton *ui; + DeviceButton *btn1; + DeviceButton *btn2; + DeviceButton *btn3; + QList btnStyle; + QList btnColor; +}; + +#endif // FRMDEVICEBUTTON_H diff --git a/control/devicebutton/frmdevicebutton.ui b/control/devicebutton/frmdevicebutton.ui new file mode 100644 index 0000000..6ce13da --- /dev/null +++ b/control/devicebutton/frmdevicebutton.ui @@ -0,0 +1,174 @@ + + + frmDeviceButton + + + + 0 + 0 + 900 + 600 + + + + Form + + + + + + QFrame::Box + + + QFrame::Sunken + + + + + + Qt::AlignCenter + + + + + + + + 100 + 16777215 + + + + QFrame::Box + + + QFrame::Sunken + + + + + + 圆形 + + + + + + + 警察 + + + + + + + 气泡 + + + + + + + 气泡2 + + + + + + + 消息 + + + + + + + 消息2 + + + + + + + Qt::Horizontal + + + + + + + 绿色 + + + + + + + 蓝色 + + + + + + + 红色 + + + + + + + 灰色 + + + + + + + 黑色 + + + + + + + 紫色 + + + + + + + 黄色 + + + + + + + 可移动 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/control/devicebutton/image/bg_call.jpg b/control/devicebutton/image/bg_call.jpg new file mode 100644 index 0000000..480dd16 Binary files /dev/null and b/control/devicebutton/image/bg_call.jpg differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_black_bubble.png b/control/devicebutton/image/devicebutton/devicebutton_black_bubble.png new file mode 100644 index 0000000..4bc31f5 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_black_bubble.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_black_bubble2.png b/control/devicebutton/image/devicebutton/devicebutton_black_bubble2.png new file mode 100644 index 0000000..d98c28c Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_black_bubble2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_black_circle.png b/control/devicebutton/image/devicebutton/devicebutton_black_circle.png new file mode 100644 index 0000000..d48b695 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_black_circle.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_black_msg.png b/control/devicebutton/image/devicebutton/devicebutton_black_msg.png new file mode 100644 index 0000000..d25a537 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_black_msg.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_black_msg2.png b/control/devicebutton/image/devicebutton/devicebutton_black_msg2.png new file mode 100644 index 0000000..8335e7a Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_black_msg2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_black_police.png b/control/devicebutton/image/devicebutton/devicebutton_black_police.png new file mode 100644 index 0000000..ab56439 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_black_police.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_blue_bubble.png b/control/devicebutton/image/devicebutton/devicebutton_blue_bubble.png new file mode 100644 index 0000000..e8eea64 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_blue_bubble.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_blue_bubble2.png b/control/devicebutton/image/devicebutton/devicebutton_blue_bubble2.png new file mode 100644 index 0000000..d74c85a Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_blue_bubble2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_blue_circle.png b/control/devicebutton/image/devicebutton/devicebutton_blue_circle.png new file mode 100644 index 0000000..ab67e8d Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_blue_circle.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_blue_msg.png b/control/devicebutton/image/devicebutton/devicebutton_blue_msg.png new file mode 100644 index 0000000..c7f23ef Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_blue_msg.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_blue_msg2.png b/control/devicebutton/image/devicebutton/devicebutton_blue_msg2.png new file mode 100644 index 0000000..f05573c Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_blue_msg2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_blue_police.png b/control/devicebutton/image/devicebutton/devicebutton_blue_police.png new file mode 100644 index 0000000..c226555 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_blue_police.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_gray_bubble.png b/control/devicebutton/image/devicebutton/devicebutton_gray_bubble.png new file mode 100644 index 0000000..6942dde Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_gray_bubble.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_gray_bubble2.png b/control/devicebutton/image/devicebutton/devicebutton_gray_bubble2.png new file mode 100644 index 0000000..997e9f9 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_gray_bubble2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_gray_circle.png b/control/devicebutton/image/devicebutton/devicebutton_gray_circle.png new file mode 100644 index 0000000..834538a Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_gray_circle.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_gray_msg.png b/control/devicebutton/image/devicebutton/devicebutton_gray_msg.png new file mode 100644 index 0000000..143cdad Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_gray_msg.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_gray_msg2.png b/control/devicebutton/image/devicebutton/devicebutton_gray_msg2.png new file mode 100644 index 0000000..df05e7d Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_gray_msg2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_gray_police.png b/control/devicebutton/image/devicebutton/devicebutton_gray_police.png new file mode 100644 index 0000000..870d772 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_gray_police.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_green_bubble.png b/control/devicebutton/image/devicebutton/devicebutton_green_bubble.png new file mode 100644 index 0000000..b388381 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_green_bubble.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_green_bubble2.png b/control/devicebutton/image/devicebutton/devicebutton_green_bubble2.png new file mode 100644 index 0000000..3c9d541 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_green_bubble2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_green_circle.png b/control/devicebutton/image/devicebutton/devicebutton_green_circle.png new file mode 100644 index 0000000..a7083b3 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_green_circle.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_green_msg.png b/control/devicebutton/image/devicebutton/devicebutton_green_msg.png new file mode 100644 index 0000000..663d93c Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_green_msg.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_green_msg2.png b/control/devicebutton/image/devicebutton/devicebutton_green_msg2.png new file mode 100644 index 0000000..a97ae1e Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_green_msg2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_green_police.png b/control/devicebutton/image/devicebutton/devicebutton_green_police.png new file mode 100644 index 0000000..8a30d20 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_green_police.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_purple_bubble.png b/control/devicebutton/image/devicebutton/devicebutton_purple_bubble.png new file mode 100644 index 0000000..87f3807 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_purple_bubble.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_purple_bubble2.png b/control/devicebutton/image/devicebutton/devicebutton_purple_bubble2.png new file mode 100644 index 0000000..22bb8dc Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_purple_bubble2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_purple_circle.png b/control/devicebutton/image/devicebutton/devicebutton_purple_circle.png new file mode 100644 index 0000000..28daae0 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_purple_circle.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_purple_msg.png b/control/devicebutton/image/devicebutton/devicebutton_purple_msg.png new file mode 100644 index 0000000..6311a43 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_purple_msg.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_purple_msg2.png b/control/devicebutton/image/devicebutton/devicebutton_purple_msg2.png new file mode 100644 index 0000000..54b9812 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_purple_msg2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_purple_police.png b/control/devicebutton/image/devicebutton/devicebutton_purple_police.png new file mode 100644 index 0000000..af8ecc1 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_purple_police.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_red_bubble.png b/control/devicebutton/image/devicebutton/devicebutton_red_bubble.png new file mode 100644 index 0000000..1d70d71 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_red_bubble.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_red_bubble2.png b/control/devicebutton/image/devicebutton/devicebutton_red_bubble2.png new file mode 100644 index 0000000..8d234d9 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_red_bubble2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_red_circle.png b/control/devicebutton/image/devicebutton/devicebutton_red_circle.png new file mode 100644 index 0000000..4fadef6 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_red_circle.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_red_msg.png b/control/devicebutton/image/devicebutton/devicebutton_red_msg.png new file mode 100644 index 0000000..50dd231 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_red_msg.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_red_msg2.png b/control/devicebutton/image/devicebutton/devicebutton_red_msg2.png new file mode 100644 index 0000000..50f0f99 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_red_msg2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_red_police.png b/control/devicebutton/image/devicebutton/devicebutton_red_police.png new file mode 100644 index 0000000..c4f9dd4 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_red_police.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_yellow_bubble.png b/control/devicebutton/image/devicebutton/devicebutton_yellow_bubble.png new file mode 100644 index 0000000..1d06d6f Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_yellow_bubble.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_yellow_bubble2.png b/control/devicebutton/image/devicebutton/devicebutton_yellow_bubble2.png new file mode 100644 index 0000000..d48de6c Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_yellow_bubble2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_yellow_circle.png b/control/devicebutton/image/devicebutton/devicebutton_yellow_circle.png new file mode 100644 index 0000000..7c5ed59 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_yellow_circle.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_yellow_msg.png b/control/devicebutton/image/devicebutton/devicebutton_yellow_msg.png new file mode 100644 index 0000000..92c6a5a Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_yellow_msg.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_yellow_msg2.png b/control/devicebutton/image/devicebutton/devicebutton_yellow_msg2.png new file mode 100644 index 0000000..4f41702 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_yellow_msg2.png differ diff --git a/control/devicebutton/image/devicebutton/devicebutton_yellow_police.png b/control/devicebutton/image/devicebutton/devicebutton_yellow_police.png new file mode 100644 index 0000000..8c637f3 Binary files /dev/null and b/control/devicebutton/image/devicebutton/devicebutton_yellow_police.png differ diff --git a/control/devicebutton/main.cpp b/control/devicebutton/main.cpp new file mode 100644 index 0000000..c9b0997 --- /dev/null +++ b/control/devicebutton/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmdevicebutton.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmDeviceButton w; + w.setWindowTitle("设备按钮控件 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/devicebutton/main.qrc b/control/devicebutton/main.qrc new file mode 100644 index 0000000..8eaad14 --- /dev/null +++ b/control/devicebutton/main.qrc @@ -0,0 +1,47 @@ + + + image/bg_call.jpg + image/devicebutton/devicebutton_black_bubble.png + image/devicebutton/devicebutton_black_bubble2.png + image/devicebutton/devicebutton_black_circle.png + image/devicebutton/devicebutton_black_msg.png + image/devicebutton/devicebutton_black_msg2.png + image/devicebutton/devicebutton_black_police.png + image/devicebutton/devicebutton_blue_bubble.png + image/devicebutton/devicebutton_blue_bubble2.png + image/devicebutton/devicebutton_blue_circle.png + image/devicebutton/devicebutton_blue_msg.png + image/devicebutton/devicebutton_blue_msg2.png + image/devicebutton/devicebutton_blue_police.png + image/devicebutton/devicebutton_gray_bubble.png + image/devicebutton/devicebutton_gray_bubble2.png + image/devicebutton/devicebutton_gray_circle.png + image/devicebutton/devicebutton_gray_msg.png + image/devicebutton/devicebutton_gray_msg2.png + image/devicebutton/devicebutton_gray_police.png + image/devicebutton/devicebutton_green_bubble.png + image/devicebutton/devicebutton_green_bubble2.png + image/devicebutton/devicebutton_green_circle.png + image/devicebutton/devicebutton_green_msg.png + image/devicebutton/devicebutton_green_msg2.png + image/devicebutton/devicebutton_green_police.png + image/devicebutton/devicebutton_red_bubble.png + image/devicebutton/devicebutton_red_bubble2.png + image/devicebutton/devicebutton_red_circle.png + image/devicebutton/devicebutton_red_msg.png + image/devicebutton/devicebutton_red_msg2.png + image/devicebutton/devicebutton_red_police.png + image/devicebutton/devicebutton_purple_bubble.png + image/devicebutton/devicebutton_purple_bubble2.png + image/devicebutton/devicebutton_purple_circle.png + image/devicebutton/devicebutton_purple_msg.png + image/devicebutton/devicebutton_purple_msg2.png + image/devicebutton/devicebutton_purple_police.png + image/devicebutton/devicebutton_yellow_bubble.png + image/devicebutton/devicebutton_yellow_bubble2.png + image/devicebutton/devicebutton_yellow_circle.png + image/devicebutton/devicebutton_yellow_msg.png + image/devicebutton/devicebutton_yellow_msg2.png + image/devicebutton/devicebutton_yellow_police.png + + diff --git a/control/devicesizetable/devicesizetable.cpp b/control/devicesizetable/devicesizetable.cpp new file mode 100644 index 0000000..8d04ce1 --- /dev/null +++ b/control/devicesizetable/devicesizetable.cpp @@ -0,0 +1,294 @@ +#pragma execution_character_set("utf-8") + +#include "devicesizetable.h" +#include "qprocess.h" +#include "qtablewidget.h" +#include "qheaderview.h" +#include "qfileinfo.h" +#include "qdir.h" +#include "qprogressbar.h" +#include "qtimer.h" +#include "qdebug.h" + +#ifdef Q_OS_WIN +#include "windows.h" +#endif +#define GB (1024 * 1024 * 1024) +#define MB (1024 * 1024) +#define KB (1024) + +DeviceSizeTable::DeviceSizeTable(QWidget *parent) : QTableWidget(parent) +{ + bgColor = QColor(255, 255, 255); + + chunkColor1 = QColor(100, 184, 255); + chunkColor2 = QColor(24, 189, 155); + chunkColor3 = QColor(255, 107, 107); + + textColor1 = QColor(10, 10, 10); + textColor2 = QColor(255, 255, 255); + textColor3 = QColor(255, 255, 255); + +#if defined(Q_OS_UNIX) && !defined(Q_OS_WASM) + process = new QProcess(this); + connect(process, SIGNAL(readyRead()), this, SLOT(readData())); +#endif + + this->clear(); + + //设置列数和列宽 + this->setColumnCount(5); + this->setColumnWidth(0, 100); + this->setColumnWidth(1, 120); + this->setColumnWidth(2, 120); + this->setColumnWidth(3, 120); + this->setColumnWidth(4, 120); + + this->setStyleSheet("QTableWidget::item{padding:0px;}"); + + QStringList headText; + headText << "盘符" << "已用空间" << "可用空间" << "总大小" << "已用百分比" ; + + this->setHorizontalHeaderLabels(headText); + this->setSelectionBehavior(QAbstractItemView::SelectRows); + this->setEditTriggers(QAbstractItemView::NoEditTriggers); + this->setSelectionMode(QAbstractItemView::SingleSelection); + this->verticalHeader()->setVisible(true); + this->horizontalHeader()->setStretchLastSection(true); + QMetaObject::invokeMethod(this, "load", Qt::QueuedConnection); + //QTimer::singleShot(10, this, SLOT(load())); +} + +void DeviceSizeTable::readData() +{ +#if defined(Q_OS_UNIX) && !defined(Q_OS_WASM) + while (!process->atEnd()) { + QString result = QLatin1String(process->readLine()); +#ifdef __arm__ + if (result.startsWith("/dev/root")) { + checkSize(result, "本地存储"); + } else if (result.startsWith("/dev/mmcblk")) { + checkSize(result, "本地存储"); + } else if (result.startsWith("/dev/mmcblk1p")) { + checkSize(result, "SD卡"); + QStringList list = result.split(" "); + Q_EMIT sdcardReceive(list.at(0)); + } else if (result.startsWith("/dev/sd")) { + checkSize(result, "U盘"); + QStringList list = result.split(" "); + Q_EMIT udiskReceive(list.at(0)); + } +#else + if (result.startsWith("/dev/sd")) { + checkSize(result, ""); + QStringList list = result.split(" "); + Q_EMIT udiskReceive(list.at(0)); + } +#endif + } +#endif +} + +void DeviceSizeTable::checkSize(const QString &result, const QString &name) +{ + QString dev, use, free, all; + int percent = 0; + QStringList list = result.split(" "); + int index = 0; + + for (int i = 0; i < list.count(); ++i) { + QString s = list.at(i).trimmed(); + if (s.isEmpty()) { + continue; + } + + index++; + if (index == 1) { + dev = s; + } else if (index == 2) { + all = s; + } else if (index == 3) { + use = s; + } else if (index == 4) { + free = s; + } else if (index == 5) { + percent = s.left(s.length() - 1).toInt(); + break; + } + } + + if (name.length() > 0) { + dev = name; + } + + insertSize(dev, use, free, all, percent); +} + +void DeviceSizeTable::insertSize(const QString &name, const QString &use, const QString &free, const QString &all, int percent) +{ + int row = this->rowCount(); + this->insertRow(row); + + QTableWidgetItem *itemname = new QTableWidgetItem(name); + QTableWidgetItem *itemuse = new QTableWidgetItem(use); + itemuse->setTextAlignment(Qt::AlignCenter); + QTableWidgetItem *itemfree = new QTableWidgetItem(free); + itemfree->setTextAlignment(Qt::AlignCenter); + QTableWidgetItem *itemall = new QTableWidgetItem(all); + itemall->setTextAlignment(Qt::AlignCenter); + + this->setItem(row, 0, itemname); + this->setItem(row, 1, itemuse); + this->setItem(row, 2, itemfree); + this->setItem(row, 3, itemall); + + QProgressBar *bar = new QProgressBar; + bar->setRange(0, 100); + bar->setValue(percent); + + QString qss = QString("QProgressBar{background:%1;border-width:0px;border-radius:0px;text-align:center;}" + "QProgressBar::chunk{border-radius:0px;}").arg(bgColor.name()); + + if (percent < 50) { + qss += QString("QProgressBar{color:%1;}QProgressBar::chunk{background:%2;}").arg(textColor1.name()).arg(chunkColor1.name()); + } else if (percent < 90) { + qss += QString("QProgressBar{color:%1;}QProgressBar::chunk{background:%2;}").arg(textColor2.name()).arg(chunkColor2.name()); + } else { + qss += QString("QProgressBar{color:%1;}QProgressBar::chunk{background:%2;}").arg(textColor3.name()).arg(chunkColor3.name()); + } + + bar->setStyleSheet(qss); + this->setCellWidget(row, 4, bar); +} + +QSize DeviceSizeTable::sizeHint() const +{ + return QSize(500, 300); +} + +QSize DeviceSizeTable::minimumSizeHint() const +{ + return QSize(200, 150); +} + +QColor DeviceSizeTable::getBgColor() const +{ + return this->bgColor; +} + +void DeviceSizeTable::setBgColor(const QColor &bgColor) +{ + if (this->bgColor != bgColor) { + this->bgColor = bgColor; + this->load(); + } +} + +QColor DeviceSizeTable::getChunkColor1() const +{ + return this->chunkColor1; +} + +void DeviceSizeTable::setChunkColor1(const QColor &chunkColor1) +{ + if (this->chunkColor1 != chunkColor1) { + this->chunkColor1 = chunkColor1; + this->load(); + } +} + +QColor DeviceSizeTable::getChunkColor2() const +{ + return this->chunkColor2; +} + +void DeviceSizeTable::setChunkColor2(const QColor &chunkColor2) +{ + if (this->chunkColor2 != chunkColor2) { + this->chunkColor2 = chunkColor2; + this->load(); + } +} + +QColor DeviceSizeTable::getChunkColor3() const +{ + return this->chunkColor3; +} + +void DeviceSizeTable::setChunkColor3(const QColor &chunkColor3) +{ + if (this->chunkColor3 != chunkColor3) { + this->chunkColor3 = chunkColor3; + this->load(); + } +} + +QColor DeviceSizeTable::getTextColor1() const +{ + return this->textColor1; +} + +void DeviceSizeTable::setTextColor1(const QColor &textColor1) +{ + if (this->textColor1 != textColor1) { + this->textColor1 = textColor1; + this->load(); + } +} + +QColor DeviceSizeTable::getTextColor2() const +{ + return this->textColor2; +} + +void DeviceSizeTable::setTextColor2(const QColor &textColor2) +{ + if (this->textColor2 != textColor2) { + this->textColor2 = textColor2; + this->load(); + } +} + +QColor DeviceSizeTable::getTextColor3() const +{ + return this->textColor3; +} + +void DeviceSizeTable::setTextColor3(const QColor &textColor3) +{ + if (this->textColor3 != textColor3) { + this->textColor3 = textColor3; + this->load(); + } +} + +void DeviceSizeTable::load() +{ + //清空原有数据 + int row = this->rowCount(); + for (int i = 0; i < row; ++i) { + this->removeRow(0); + } + +#ifdef Q_OS_WIN + QFileInfoList list = QDir::drives(); + foreach (QFileInfo dir, list) { + QString dirName = dir.absolutePath(); + LPCWSTR lpcwstrDriver = (LPCWSTR)dirName.utf16(); + ULARGE_INTEGER liFreeBytesAvailable, liTotalBytes, liTotalFreeBytes; + + if (GetDiskFreeSpaceEx(lpcwstrDriver, &liFreeBytesAvailable, &liTotalBytes, &liTotalFreeBytes)) { + QString use = QString::number((double)(liTotalBytes.QuadPart - liTotalFreeBytes.QuadPart) / GB, 'f', 1); + use += "G"; + QString free = QString::number((double) liTotalFreeBytes.QuadPart / GB, 'f', 1); + free += "G"; + QString all = QString::number((double) liTotalBytes.QuadPart / GB, 'f', 1); + all += "G"; + int percent = 100 - ((double)liTotalFreeBytes.QuadPart / liTotalBytes.QuadPart) * 100; + insertSize(dirName, use, free, all, percent); + } + } +#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM) + process->start("df", QStringList() << "-h"); +#endif +} diff --git a/control/devicesizetable/devicesizetable.h b/control/devicesizetable/devicesizetable.h new file mode 100644 index 0000000..b0aef22 --- /dev/null +++ b/control/devicesizetable/devicesizetable.h @@ -0,0 +1,96 @@ +#ifndef DEVICESIZETABLE_H +#define DEVICESIZETABLE_H + +/** + * 本地存储空间大小控件 作者:feiyangqingyun(QQ:517216493) 2016-11-30 + * 1. 可自动加载本地存储设备的总容量/已用容量。 + * 2. 进度条显示已用容量。 + * 3. 支持所有操作系统。 + * 4. 增加U盘或者SD卡到达信号。 + */ + +#include + +class QProcess; + +#ifdef quc +class Q_DECL_EXPORT DeviceSizeTable : public QTableWidget +#else +class DeviceSizeTable : public QTableWidget +#endif + +{ + Q_OBJECT + + Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) + Q_PROPERTY(QColor chunkColor1 READ getChunkColor1 WRITE setChunkColor1) + Q_PROPERTY(QColor chunkColor2 READ getChunkColor2 WRITE setChunkColor2) + Q_PROPERTY(QColor chunkColor3 READ getChunkColor3 WRITE setChunkColor3) + + Q_PROPERTY(QColor textColor1 READ getTextColor1 WRITE setTextColor1) + Q_PROPERTY(QColor textColor2 READ getTextColor2 WRITE setTextColor2) + Q_PROPERTY(QColor textColor3 READ getTextColor3 WRITE setTextColor3) + +public: + explicit DeviceSizeTable(QWidget *parent = 0); + +private: + QProcess *process; //执行命令进程 + + QColor bgColor; //背景颜色 + QColor chunkColor1; //进度颜色1 + QColor chunkColor2; //进度颜色2 + QColor chunkColor3; //进度颜色3 + + QColor textColor1; //文字颜色1 + QColor textColor2; //文字颜色2 + QColor textColor3; //文字颜色3 + +private slots: + void readData(); + void checkSize(const QString &result, const QString &name); + void insertSize(const QString &name, const QString &use, const QString &free, const QString &all, int percent); + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //获取和设置背景颜色 + QColor getBgColor() const; + void setBgColor(const QColor &bgColor); + + //获取和设置进度颜色1 + QColor getChunkColor1() const; + void setChunkColor1(const QColor &chunkColor1); + + //获取和设置进度颜色2 + QColor getChunkColor2() const; + void setChunkColor2(const QColor &chunkColor2); + + //获取和设置进度颜色3 + QColor getChunkColor3() const; + void setChunkColor3(const QColor &chunkColor3); + + //获取和设置文字颜色1 + QColor getTextColor1() const; + void setTextColor1(const QColor &textColor1); + + //获取和设置文字颜色2 + QColor getTextColor2() const; + void setTextColor2(const QColor &textColor2); + + //获取和设置文字颜色3 + QColor getTextColor3() const; + void setTextColor3(const QColor &textColor3); + +public Q_SLOTS: + //载入容量 + void load(); + +Q_SIGNALS: + void sdcardReceive(const QString &sdcardName); + void udiskReceive(const QString &udiskName); +}; + +#endif // DEVICESIZETABLE_H diff --git a/control/devicesizetable/devicesizetable.pro b/control/devicesizetable/devicesizetable.pro new file mode 100644 index 0000000..cb65c11 --- /dev/null +++ b/control/devicesizetable/devicesizetable.pro @@ -0,0 +1,17 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = devicesizetable +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmdevicesizetable.cpp +SOURCES += devicesizetable.cpp + +HEADERS += frmdevicesizetable.h +HEADERS += devicesizetable.h + +FORMS += frmdevicesizetable.ui diff --git a/control/devicesizetable/frmdevicesizetable.cpp b/control/devicesizetable/frmdevicesizetable.cpp new file mode 100644 index 0000000..58b9140 --- /dev/null +++ b/control/devicesizetable/frmdevicesizetable.cpp @@ -0,0 +1,15 @@ +#pragma execution_character_set("utf-8") + +#include "frmdevicesizetable.h" +#include "ui_frmdevicesizetable.h" + +frmDeviceSizeTable::frmDeviceSizeTable(QWidget *parent) : QWidget(parent), ui(new Ui::frmDeviceSizeTable) +{ + ui->setupUi(this); + ui->tableWidget->verticalHeader()->setDefaultSectionSize(25); +} + +frmDeviceSizeTable::~frmDeviceSizeTable() +{ + delete ui; +} diff --git a/control/devicesizetable/frmdevicesizetable.h b/control/devicesizetable/frmdevicesizetable.h new file mode 100644 index 0000000..af26c51 --- /dev/null +++ b/control/devicesizetable/frmdevicesizetable.h @@ -0,0 +1,22 @@ +#ifndef FRMDEVICESIZETABLE_H +#define FRMDEVICESIZETABLE_H + +#include + +namespace Ui { +class frmDeviceSizeTable; +} + +class frmDeviceSizeTable : public QWidget +{ + Q_OBJECT + +public: + explicit frmDeviceSizeTable(QWidget *parent = 0); + ~frmDeviceSizeTable(); + +private: + Ui::frmDeviceSizeTable *ui; +}; + +#endif // FRMDEVICESIZETABLE_H diff --git a/control/devicesizetable/frmdevicesizetable.ui b/control/devicesizetable/frmdevicesizetable.ui new file mode 100644 index 0000000..22352f4 --- /dev/null +++ b/control/devicesizetable/frmdevicesizetable.ui @@ -0,0 +1,122 @@ + + + frmDeviceSizeTable + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + + + + + + + + + + + + + + AlignCenter + + + + + AlignCenter + + + + + AlignCenter + + + + + + AlignCenter + + + + + AlignCenter + + + + + AlignCenter + + + + + + AlignCenter + + + + + AlignCenter + + + + + AlignCenter + + + + + + AlignCenter + + + + + AlignCenter + + + + + AlignCenter + + + + + + AlignCenter + + + + + AlignCenter + + + + + AlignCenter + + + + + + + + + DeviceSizeTable + QTableWidget +
devicesizetable.h
+
+
+ + +
diff --git a/control/devicesizetable/main.cpp b/control/devicesizetable/main.cpp new file mode 100644 index 0000000..5ee7659 --- /dev/null +++ b/control/devicesizetable/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmdevicesizetable.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmDeviceSizeTable w; + w.setWindowTitle("磁盘容量 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/imageswitch/frmimageswitch.cpp b/control/imageswitch/frmimageswitch.cpp new file mode 100644 index 0000000..c9eb586 --- /dev/null +++ b/control/imageswitch/frmimageswitch.cpp @@ -0,0 +1,41 @@ +#pragma execution_character_set("utf-8") + +#include "frmimageswitch.h" +#include "ui_frmimageswitch.h" +#include "qdebug.h" + +frmImageSwitch::frmImageSwitch(QWidget *parent) : QWidget(parent), ui(new Ui::frmImageSwitch) +{ + ui->setupUi(this); + this->initForm(); +} + +frmImageSwitch::~frmImageSwitch() +{ + delete ui; +} + +void frmImageSwitch::initForm() +{ + ui->imageSwitch1->setChecked(true); + ui->imageSwitch2->setChecked(true); + ui->imageSwitch3->setChecked(true); + + ui->imageSwitch1->setFixedSize(87, 30); + ui->imageSwitch2->setFixedSize(87, 30); + ui->imageSwitch3->setFixedSize(87, 30); + + ui->imageSwitch1->setButtonStyle(ImageSwitch::ButtonStyle_1); + ui->imageSwitch2->setButtonStyle(ImageSwitch::ButtonStyle_2); + ui->imageSwitch3->setButtonStyle(ImageSwitch::ButtonStyle_3); + + //绑定选中切换信号 + connect(ui->imageSwitch1, SIGNAL(checkedChanged(bool)), this, SLOT(checkedChanged(bool))); + connect(ui->imageSwitch2, SIGNAL(checkedChanged(bool)), this, SLOT(checkedChanged(bool))); + connect(ui->imageSwitch3, SIGNAL(checkedChanged(bool)), this, SLOT(checkedChanged(bool))); +} + +void frmImageSwitch::checkedChanged(bool checked) +{ + qDebug() << sender() << checked; +} diff --git a/control/imageswitch/frmimageswitch.h b/control/imageswitch/frmimageswitch.h new file mode 100644 index 0000000..c6e087a --- /dev/null +++ b/control/imageswitch/frmimageswitch.h @@ -0,0 +1,26 @@ +#ifndef FRMIMAGESWITCH_H +#define FRMIMAGESWITCH_H + +#include + +namespace Ui { +class frmImageSwitch; +} + +class frmImageSwitch : public QWidget +{ + Q_OBJECT + +public: + explicit frmImageSwitch(QWidget *parent = 0); + ~frmImageSwitch(); + +private: + Ui::frmImageSwitch *ui; + +private slots: + void initForm(); + void checkedChanged(bool checked); +}; + +#endif // FRMIMAGESWITCH_H diff --git a/control/imageswitch/frmimageswitch.ui b/control/imageswitch/frmimageswitch.ui new file mode 100644 index 0000000..b0d052b --- /dev/null +++ b/control/imageswitch/frmimageswitch.ui @@ -0,0 +1,63 @@ + + + frmImageSwitch + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + ImageSwitch + QWidget +
imageswitch.h
+
+
+ + +
diff --git a/control/imageswitch/image/imageswitch/btncheckoff1.png b/control/imageswitch/image/imageswitch/btncheckoff1.png new file mode 100644 index 0000000..bfa8ebb Binary files /dev/null and b/control/imageswitch/image/imageswitch/btncheckoff1.png differ diff --git a/control/imageswitch/image/imageswitch/btncheckoff2.png b/control/imageswitch/image/imageswitch/btncheckoff2.png new file mode 100644 index 0000000..32f43f2 Binary files /dev/null and b/control/imageswitch/image/imageswitch/btncheckoff2.png differ diff --git a/control/imageswitch/image/imageswitch/btncheckoff3.png b/control/imageswitch/image/imageswitch/btncheckoff3.png new file mode 100644 index 0000000..45bb934 Binary files /dev/null and b/control/imageswitch/image/imageswitch/btncheckoff3.png differ diff --git a/control/imageswitch/image/imageswitch/btncheckon1.png b/control/imageswitch/image/imageswitch/btncheckon1.png new file mode 100644 index 0000000..2bab009 Binary files /dev/null and b/control/imageswitch/image/imageswitch/btncheckon1.png differ diff --git a/control/imageswitch/image/imageswitch/btncheckon2.png b/control/imageswitch/image/imageswitch/btncheckon2.png new file mode 100644 index 0000000..4d5b59a Binary files /dev/null and b/control/imageswitch/image/imageswitch/btncheckon2.png differ diff --git a/control/imageswitch/image/imageswitch/btncheckon3.png b/control/imageswitch/image/imageswitch/btncheckon3.png new file mode 100644 index 0000000..a8de834 Binary files /dev/null and b/control/imageswitch/image/imageswitch/btncheckon3.png differ diff --git a/control/imageswitch/imageswitch.cpp b/control/imageswitch/imageswitch.cpp new file mode 100644 index 0000000..932196b --- /dev/null +++ b/control/imageswitch/imageswitch.cpp @@ -0,0 +1,92 @@ +#pragma execution_character_set("utf-8") + +#include "imageswitch.h" +#include "qpainter.h" +#include "qdebug.h" + +ImageSwitch::ImageSwitch(QWidget *parent) : QWidget(parent) +{ + isChecked = false; + buttonStyle = ButtonStyle_2; + + imgOffFile = ":/image/imageswitch/btncheckoff2.png"; + imgOnFile = ":/image/imageswitch/btncheckon2.png"; + imgFile = imgOffFile; +} + +void ImageSwitch::mousePressEvent(QMouseEvent *) +{ + imgFile = isChecked ? imgOffFile : imgOnFile; + isChecked = !isChecked; + Q_EMIT checkedChanged(isChecked); + this->update(); +} + +void ImageSwitch::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + painter.setRenderHints(QPainter::SmoothPixmapTransform); + QImage img(imgFile); + img = img.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + + //按照比例自动居中绘制 + int pixX = rect().center().x() - img.width() / 2; + int pixY = rect().center().y() - img.height() / 2; + QPoint point(pixX, pixY); + painter.drawImage(point, img); +} + +QSize ImageSwitch::sizeHint() const +{ + return QSize(87, 28); +} + +QSize ImageSwitch::minimumSizeHint() const +{ + return QSize(87, 28); +} + +bool ImageSwitch::getChecked() const +{ + return isChecked; +} + +void ImageSwitch::setChecked(bool isChecked) +{ + if (this->isChecked != isChecked) { + this->isChecked = isChecked; + imgFile = isChecked ? imgOnFile : imgOffFile; + this->update(); + } +} + +ImageSwitch::ButtonStyle ImageSwitch::getButtonStyle() const +{ + return this->buttonStyle; +} + +void ImageSwitch::setButtonStyle(const ImageSwitch::ButtonStyle &buttonStyle) +{ + if (this->buttonStyle != buttonStyle) { + this->buttonStyle = buttonStyle; + + if (buttonStyle == ButtonStyle_1) { + imgOffFile = ":/image/imageswitch/btncheckoff1.png"; + imgOnFile = ":/image/imageswitch/btncheckon1.png"; + this->resize(87, 28); + } else if (buttonStyle == ButtonStyle_2) { + imgOffFile = ":/image/imageswitch/btncheckoff2.png"; + imgOnFile = ":/image/imageswitch/btncheckon2.png"; + this->resize(87, 28); + } else if (buttonStyle == ButtonStyle_3) { + imgOffFile = ":/image/imageswitch/btncheckoff3.png"; + imgOnFile = ":/image/imageswitch/btncheckon3.png"; + this->resize(96, 38); + } + + imgFile = isChecked ? imgOnFile : imgOffFile; + setChecked(isChecked); + this->update(); + updateGeometry(); + } +} diff --git a/control/imageswitch/imageswitch.h b/control/imageswitch/imageswitch.h new file mode 100644 index 0000000..b915723 --- /dev/null +++ b/control/imageswitch/imageswitch.h @@ -0,0 +1,63 @@ +#ifndef IMAGESWITCH_H +#define IMAGESWITCH_H + +/** + * 图片开关控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25 + * 1. 自带三种开关按钮样式。 + * 2. 可自定义开关图片。 + */ + +#include + +#ifdef quc +class Q_DECL_EXPORT ImageSwitch : public QWidget +#else +class ImageSwitch : public QWidget +#endif + +{ + Q_OBJECT + Q_ENUMS(ButtonStyle) + + Q_PROPERTY(bool isChecked READ getChecked WRITE setChecked) + Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle) + +public: + enum ButtonStyle { + ButtonStyle_1 = 0, //开关样式1 + ButtonStyle_2 = 1, //开关样式2 + ButtonStyle_3 = 2 //开关样式3 + }; + + explicit ImageSwitch(QWidget *parent = 0); + +protected: + void mousePressEvent(QMouseEvent *); + void paintEvent(QPaintEvent *event); + +private: + bool isChecked; //是否选中 + ButtonStyle buttonStyle; //按钮样式 + + QString imgOffFile; //关闭图片 + QString imgOnFile; //开启图片 + QString imgFile; //当前图片 + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //获取和设置是否选中 + bool getChecked() const; + void setChecked(bool isChecked); + + //获取和设置按钮样式 + ButtonStyle getButtonStyle() const; + void setButtonStyle(const ImageSwitch::ButtonStyle &buttonStyle); + +Q_SIGNALS: + void checkedChanged(bool checked); +}; + +#endif // IMAGESWITCH_H diff --git a/control/imageswitch/imageswitch.pro b/control/imageswitch/imageswitch.pro new file mode 100644 index 0000000..8190c28 --- /dev/null +++ b/control/imageswitch/imageswitch.pro @@ -0,0 +1,19 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = imageswitch +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmimageswitch.cpp +SOURCES += imageswitch.cpp + +HEADERS += frmimageswitch.h +HEADERS += imageswitch.h + +FORMS += frmimageswitch.ui + +RESOURCES += main.qrc diff --git a/control/imageswitch/main.cpp b/control/imageswitch/main.cpp new file mode 100644 index 0000000..7d42f30 --- /dev/null +++ b/control/imageswitch/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmimageswitch.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmImageSwitch w; + w.setWindowTitle("图片背景开关 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/imageswitch/main.qrc b/control/imageswitch/main.qrc new file mode 100644 index 0000000..7cb0b05 --- /dev/null +++ b/control/imageswitch/main.qrc @@ -0,0 +1,10 @@ + + + image/imageswitch/btncheckoff1.png + image/imageswitch/btncheckoff2.png + image/imageswitch/btncheckoff3.png + image/imageswitch/btncheckon1.png + image/imageswitch/btncheckon2.png + image/imageswitch/btncheckon3.png + + diff --git a/control/ipaddress/frmipaddress.cpp b/control/ipaddress/frmipaddress.cpp new file mode 100644 index 0000000..283cb52 --- /dev/null +++ b/control/ipaddress/frmipaddress.cpp @@ -0,0 +1,31 @@ +#pragma execution_character_set("utf-8") + +#include "frmipaddress.h" +#include "ui_frmipaddress.h" +#include "qdebug.h" + +frmIPAddress::frmIPAddress(QWidget *parent) : QWidget(parent), ui(new Ui::frmIPAddress) +{ + ui->setupUi(this); + on_btnSetIP_clicked(); +} + +frmIPAddress::~frmIPAddress() +{ + delete ui; +} + +void frmIPAddress::on_btnSetIP_clicked() +{ + ui->widgetIP->setIP("192.168.1.56"); +} + +void frmIPAddress::on_btnGetIP_clicked() +{ + qDebug() << ui->widgetIP->getIP(); +} + +void frmIPAddress::on_btnClear_clicked() +{ + ui->widgetIP->clear(); +} diff --git a/control/ipaddress/frmipaddress.h b/control/ipaddress/frmipaddress.h new file mode 100644 index 0000000..616e102 --- /dev/null +++ b/control/ipaddress/frmipaddress.h @@ -0,0 +1,27 @@ +#ifndef FRMADDRESS_H +#define FRMADDRESS_H + +#include + +namespace Ui { +class frmIPAddress; +} + +class frmIPAddress : public QWidget +{ + Q_OBJECT + +public: + explicit frmIPAddress(QWidget *parent = 0); + ~frmIPAddress(); + +private: + Ui::frmIPAddress *ui; + +private slots: + void on_btnSetIP_clicked(); + void on_btnGetIP_clicked(); + void on_btnClear_clicked(); +}; + +#endif // FRMADDRESS_H diff --git a/control/ipaddress/frmipaddress.ui b/control/ipaddress/frmipaddress.ui new file mode 100644 index 0000000..90a001c --- /dev/null +++ b/control/ipaddress/frmipaddress.ui @@ -0,0 +1,64 @@ + + + frmIPAddress + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + 10 + 10 + 281 + 71 + + + + + + + + + + 填入IP + + + + + + + 获取IP + + + + + + + 清空 + + + + + + + + + + IPAddress + QWidget +
ipaddress.h
+ 1 +
+
+ + +
diff --git a/control/ipaddress/ipaddress.cpp b/control/ipaddress/ipaddress.cpp new file mode 100644 index 0000000..5d52471 --- /dev/null +++ b/control/ipaddress/ipaddress.cpp @@ -0,0 +1,210 @@ +#pragma execution_character_set("utf-8") + +#include "ipaddress.h" +#include "qlabel.h" +#include "qlineedit.h" +#include "qboxlayout.h" +#include "qregexp.h" +#include "qvalidator.h" +#include "qevent.h" +#include "qdebug.h" + +IPAddress::IPAddress(QWidget *parent) : QWidget(parent) +{ + bgColor = "#FFFFFF"; + borderColor = "#A6B5B8"; + borderRadius = 3; + + //用于显示小圆点的标签,居中对齐 + labDot1 = new QLabel; + labDot1->setAlignment(Qt::AlignCenter); + labDot1->setText("."); + + labDot2 = new QLabel; + labDot2->setAlignment(Qt::AlignCenter); + labDot2->setText("."); + + labDot3 = new QLabel; + labDot3->setAlignment(Qt::AlignCenter); + labDot3->setText("."); + + //用于输入IP地址的文本框,居中对齐 + txtIP1 = new QLineEdit; + txtIP1->setObjectName("txtIP1"); + txtIP1->setAlignment(Qt::AlignCenter); + txtIP1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + connect(txtIP1, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); + + txtIP2 = new QLineEdit; + txtIP2->setObjectName("txtIP2"); + txtIP2->setAlignment(Qt::AlignCenter); + txtIP2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + connect(txtIP2, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); + + txtIP3 = new QLineEdit; + txtIP3->setObjectName("txtIP3"); + txtIP3->setAlignment(Qt::AlignCenter); + txtIP3->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + connect(txtIP3, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); + + txtIP4 = new QLineEdit; + txtIP4->setObjectName("txtIP4"); + txtIP4->setAlignment(Qt::AlignCenter); + txtIP4->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + connect(txtIP4, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); + + //设置IP地址校验过滤 + QString pattern = "(2[0-5]{2}|2[0-4][0-9]|1?[0-9]{1,2})"; + //确切的说 QRegularExpression QRegularExpressionValidator 从5.0 5.1开始就有 +#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) + QRegularExpression regExp(pattern); + QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp, this); +#else + QRegExp regExp(pattern); + QRegExpValidator *validator = new QRegExpValidator(regExp, this); +#endif + + txtIP1->setValidator(validator); + txtIP2->setValidator(validator); + txtIP3->setValidator(validator); + txtIP4->setValidator(validator); + + //绑定事件过滤器,识别键盘按下 + txtIP1->installEventFilter(this); + txtIP2->installEventFilter(this); + txtIP3->installEventFilter(this); + txtIP4->installEventFilter(this); + + QFrame *frame = new QFrame; + frame->setObjectName("frameIP"); + + QStringList qss; + qss.append(QString("QFrame#frameIP{border:1px solid %1;border-radius:%2px;}").arg(borderColor).arg(borderRadius)); + qss.append(QString("QLabel{min-width:15px;background-color:%1;}").arg(bgColor)); + qss.append(QString("QLineEdit{background-color:%1;border:none;}").arg(bgColor)); + qss.append(QString("QLineEdit#txtIP1{border-top-left-radius:%1px;border-bottom-left-radius:%1px;}").arg(borderRadius)); + qss.append(QString("QLineEdit#txtIP4{border-top-right-radius:%1px;border-bottom-right-radius:%1px;}").arg(borderRadius)); + frame->setStyleSheet(qss.join("")); + + QVBoxLayout *verticalLayout = new QVBoxLayout(this); + verticalLayout->setContentsMargins(0, 0, 0, 0); + verticalLayout->setSpacing(0); + verticalLayout->addWidget(frame); + + //将控件按照横向布局排列 + QHBoxLayout *layout = new QHBoxLayout(frame); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + layout->addWidget(txtIP1); + layout->addWidget(labDot1); + layout->addWidget(txtIP2); + layout->addWidget(labDot2); + layout->addWidget(txtIP3); + layout->addWidget(labDot3); + layout->addWidget(txtIP4); +} + +bool IPAddress::eventFilter(QObject *watched, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QLineEdit *txt = (QLineEdit *)watched; + if (txt == txtIP1 || txt == txtIP2 || txt == txtIP3 || txt == txtIP4) { + QKeyEvent *key = (QKeyEvent *)event; + + //如果当前按下了小数点则移动焦点到下一个输入框 + if (key->text() == ".") { + this->focusNextChild(); + } + + //如果按下了退格键并且当前文本框已经没有了内容则焦点往前移 + if (key->key() == Qt::Key_Backspace) { + if (txt->text().length() <= 1) { + this->focusNextPrevChild(false); + } + } + } + } + + return QWidget::eventFilter(watched, event); +} + +void IPAddress::textChanged(const QString &text) +{ + int len = text.length(); + int value = text.toInt(); + + //判断当前是否输入完成一个网段,是的话则自动移动到下一个输入框 + if (len == 3) { + if (value >= 100 && value <= 255) { + this->focusNextChild(); + } + } + + //拼接成完整IP地址 + ip = QString("%1.%2.%3.%4").arg(txtIP1->text()).arg(txtIP2->text()).arg(txtIP3->text()).arg(txtIP4->text()); +} + +QSize IPAddress::sizeHint() const +{ + return QSize(250, 20); +} + +QSize IPAddress::minimumSizeHint() const +{ + return QSize(30, 10); +} + +QString IPAddress::getIP() const +{ + return this->ip; +} + +void IPAddress::setIP(const QString &ip) +{ + //先检测IP地址是否合法 + QRegExp regExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); + if (!regExp.exactMatch(ip)) { + return; + } + + if (this->ip != ip) { + this->ip = ip; + + //将IP地址填入各个网段 + QStringList list = ip.split("."); + txtIP1->setText(list.at(0)); + txtIP2->setText(list.at(1)); + txtIP3->setText(list.at(2)); + txtIP4->setText(list.at(3)); + } +} + +void IPAddress::clear() +{ + txtIP1->clear(); + txtIP2->clear(); + txtIP3->clear(); + txtIP4->clear(); + txtIP1->setFocus(); +} + +void IPAddress::setBgColor(const QString &bgColor) +{ + if (this->bgColor != bgColor) { + this->bgColor = bgColor; + } +} + +void IPAddress::setBorderColor(const QString &borderColor) +{ + if (this->borderColor != borderColor) { + this->borderColor = borderColor; + } +} + +void IPAddress::setBorderRadius(int borderRadius) +{ + if (this->borderRadius != borderRadius) { + this->borderRadius = borderRadius; + } +} diff --git a/control/ipaddress/ipaddress.h b/control/ipaddress/ipaddress.h new file mode 100644 index 0000000..1706f72 --- /dev/null +++ b/control/ipaddress/ipaddress.h @@ -0,0 +1,74 @@ +#ifndef IPADDRESS_H +#define IPADDRESS_H + +/** + * IP地址输入框控件 作者:feiyangqingyun(QQ:517216493) 2017-08-11 + * 1. 可设置IP地址,自动填入框。 + * 2. 可清空IP地址。 + * 3. 支持按下小圆点自动切换。 + * 4. 支持退格键自动切换。 + * 5. 支持IP地址过滤。 + * 6. 可设置背景色、边框颜色、边框圆角角度。 + */ + +#include + +class QLabel; +class QLineEdit; + +#ifdef quc +class Q_DECL_EXPORT IPAddress : public QWidget +#else +class IPAddress : public QWidget +#endif + +{ + Q_OBJECT + + Q_PROPERTY(QString ip READ getIP WRITE setIP) + +public: + explicit IPAddress(QWidget *parent = 0); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + +private: + QLabel *labDot1; //第一个小圆点 + QLabel *labDot2; //第二个小圆点 + QLabel *labDot3; //第三个小圆点 + + QLineEdit *txtIP1; //IP地址网段输入框1 + QLineEdit *txtIP2; //IP地址网段输入框2 + QLineEdit *txtIP3; //IP地址网段输入框3 + QLineEdit *txtIP4; //IP地址网段输入框4 + + QString ip; //IP地址 + QString bgColor; //背景颜色 + QString borderColor;//边框颜色 + int borderRadius; //边框圆角角度 + +private slots: + void textChanged(const QString &text); + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //获取和设置IP地址 + QString getIP() const; + void setIP(const QString &ip); + + //清空 + void clear(); + + //设置背景颜色 + void setBgColor(const QString &bgColor); + //设置边框颜色 + void setBorderColor(const QString &borderColor); + //设置边框圆角角度 + void setBorderRadius(int borderRadius); +}; + +#endif // IPADDRESS_H diff --git a/control/ipaddress/ipaddress.pro b/control/ipaddress/ipaddress.pro new file mode 100644 index 0000000..67143f4 --- /dev/null +++ b/control/ipaddress/ipaddress.pro @@ -0,0 +1,17 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = ipaddress +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmipaddress.cpp +SOURCES += ipaddress.cpp + +HEADERS += frmipaddress.h +HEADERS += ipaddress.h + +FORMS += frmipaddress.ui diff --git a/control/ipaddress/main.cpp b/control/ipaddress/main.cpp new file mode 100644 index 0000000..f0de2b3 --- /dev/null +++ b/control/ipaddress/main.cpp @@ -0,0 +1,32 @@ +#include "frmipaddress.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmIPAddress w; + w.setWindowTitle("IP地址控件 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/lightbutton/frmlightbutton.cpp b/control/lightbutton/frmlightbutton.cpp new file mode 100644 index 0000000..a52567e --- /dev/null +++ b/control/lightbutton/frmlightbutton.cpp @@ -0,0 +1,56 @@ +#pragma execution_character_set("utf-8") + +#include "frmlightbutton.h" +#include "ui_frmlightbutton.h" +#include "qdatetime.h" +#include "qtimer.h" + +frmLightButton::frmLightButton(QWidget *parent) : QWidget(parent), ui(new Ui::frmLightButton) +{ + ui->setupUi(this); + this->initForm(); +} + +frmLightButton::~frmLightButton() +{ + delete ui; +} + +void frmLightButton::initForm() +{ + ui->lightButton2->setBgColor(QColor(255, 107, 107)); + ui->lightButton3->setBgColor(QColor(24, 189, 155)); + + type = 0; + + QTimer *timer = new QTimer(this); + timer->setInterval(1000); + connect(timer, SIGNAL(timeout()), this, SLOT(updateValue())); + timer->start(); + updateValue(); + + //以下方法启动报警 + //ui->lightButton1->setAlarmColor(QColor(255, 0, 0)); + //ui->lightButton1->setNormalColor(QColor(0, 0, 0)); + //ui->lightButton1->startAlarm(); +} + +void frmLightButton::updateValue() +{ + if (type == 0) { + ui->lightButton1->setLightGreen(); + ui->lightButton2->setLightRed(); + ui->lightButton3->setLightBlue(); + type = 1; + } else if (type == 1) { + ui->lightButton1->setLightBlue(); + ui->lightButton2->setLightGreen(); + ui->lightButton3->setLightRed(); + type = 2; + } else if (type == 2) { + ui->lightButton1->setLightRed(); + ui->lightButton2->setLightBlue(); + ui->lightButton3->setLightGreen(); + type = 0; + } +} diff --git a/control/lightbutton/frmlightbutton.h b/control/lightbutton/frmlightbutton.h new file mode 100644 index 0000000..af5bc16 --- /dev/null +++ b/control/lightbutton/frmlightbutton.h @@ -0,0 +1,27 @@ +#ifndef FRMLIGHTBUTTON_H +#define FRMLIGHTBUTTON_H + +#include + +namespace Ui { +class frmLightButton; +} + +class frmLightButton : public QWidget +{ + Q_OBJECT + +public: + explicit frmLightButton(QWidget *parent = 0); + ~frmLightButton(); + +private: + Ui::frmLightButton *ui; + int type; + +private slots: + void initForm(); + void updateValue(); +}; + +#endif // FRMLIGHTBUTTON_H diff --git a/control/lightbutton/frmlightbutton.ui b/control/lightbutton/frmlightbutton.ui new file mode 100644 index 0000000..1938fc9 --- /dev/null +++ b/control/lightbutton/frmlightbutton.ui @@ -0,0 +1,38 @@ + + + frmLightButton + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + + + + + + + + + + + + LightButton + QWidget +
lightbutton.h
+ 1 +
+
+ + +
diff --git a/control/lightbutton/lightbutton.cpp b/control/lightbutton/lightbutton.cpp new file mode 100644 index 0000000..bba01b4 --- /dev/null +++ b/control/lightbutton/lightbutton.cpp @@ -0,0 +1,447 @@ +#pragma execution_character_set("utf-8") + +#include "lightbutton.h" +#include "qpainter.h" +#include "qpainterpath.h" +#include "qevent.h" +#include "qtimer.h" +#include "qdebug.h" + +LightButton::LightButton(QWidget *parent) : QWidget(parent) +{ + text = ""; + textColor = QColor(255, 255, 255); + alarmColor = QColor(255, 107, 107); + normalColor = QColor(10, 10, 10); + + borderOutColorStart = QColor(255, 255, 255); + borderOutColorEnd = QColor(166, 166, 166); + + borderInColorStart = QColor(166, 166, 166); + borderInColorEnd = QColor(255, 255, 255); + + bgColor = QColor(100, 184, 255); + + showRect = false; + showOverlay = true; + overlayColor = QColor(255, 255, 255); + + canMove = false; + pressed = false; + this->installEventFilter(this); + + isAlarm = false; + timerAlarm = new QTimer(this); + connect(timerAlarm, SIGNAL(timeout()), this, SLOT(alarm())); + timerAlarm->setInterval(500); +} + +bool LightButton::eventFilter(QObject *watched, QEvent *event) +{ + QMouseEvent *mouseEvent = (QMouseEvent *)event; + if (mouseEvent->type() == QEvent::MouseButtonPress) { + if (this->rect().contains(mouseEvent->pos()) && (mouseEvent->button() == Qt::LeftButton)) { + lastPoint = mouseEvent->pos(); + pressed = true; + } + } else if (mouseEvent->type() == QEvent::MouseMove && pressed) { + if (canMove) { + int dx = mouseEvent->pos().x() - lastPoint.x(); + int dy = mouseEvent->pos().y() - lastPoint.y(); + this->move(this->x() + dx, this->y() + dy); + } + } else if (mouseEvent->type() == QEvent::MouseButtonRelease && pressed) { + pressed = false; + Q_EMIT clicked(); + } + + return QWidget::eventFilter(watched, event); +} + +void LightButton::paintEvent(QPaintEvent *) +{ + int width = this->width(); + int height = this->height(); + int side = qMin(width, height); + + //绘制准备工作,启用反锯齿,平移坐标轴中心,等比例缩放 + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); + + if (showRect) { + //绘制矩形区域 + painter.setPen(Qt::NoPen); + painter.setBrush(bgColor); + painter.drawRoundedRect(this->rect(), 5, 5); + + //绘制文字 + if (!text.isEmpty()) { + QFont font; + font.setPixelSize(side - 20); + painter.setFont(font); + painter.setPen(textColor); + painter.drawText(this->rect(), Qt::AlignCenter, text); + } + } else { + painter.translate(width / 2, height / 2); + painter.scale(side / 200.0, side / 200.0); + + //绘制外边框 + drawBorderOut(&painter); + //绘制内边框 + drawBorderIn(&painter); + //绘制内部指示颜色 + drawBg(&painter); + //绘制居中文字 + drawText(&painter); + //绘制遮罩层 + drawOverlay(&painter); + } +} + +void LightButton::drawBorderOut(QPainter *painter) +{ + int radius = 99; + painter->save(); + painter->setPen(Qt::NoPen); + QLinearGradient borderGradient(0, -radius, 0, radius); + borderGradient.setColorAt(0, borderOutColorStart); + borderGradient.setColorAt(1, borderOutColorEnd); + painter->setBrush(borderGradient); + painter->drawEllipse(-radius, -radius, radius * 2, radius * 2); + painter->restore(); +} + +void LightButton::drawBorderIn(QPainter *painter) +{ + int radius = 90; + painter->save(); + painter->setPen(Qt::NoPen); + QLinearGradient borderGradient(0, -radius, 0, radius); + borderGradient.setColorAt(0, borderInColorStart); + borderGradient.setColorAt(1, borderInColorEnd); + painter->setBrush(borderGradient); + painter->drawEllipse(-radius, -radius, radius * 2, radius * 2); + painter->restore(); +} + +void LightButton::drawBg(QPainter *painter) +{ + int radius = 80; + painter->save(); + painter->setPen(Qt::NoPen); + painter->setBrush(bgColor); + painter->drawEllipse(-radius, -radius, radius * 2, radius * 2); + painter->restore(); +} + +void LightButton::drawText(QPainter *painter) +{ + if (text.isEmpty()) { + return; + } + + int radius = 100; + painter->save(); + + QFont font; + font.setPixelSize(85); + painter->setFont(font); + painter->setPen(textColor); + QRect rect(-radius, -radius, radius * 2, radius * 2); + painter->drawText(rect, Qt::AlignCenter, text); + painter->restore(); +} + +void LightButton::drawOverlay(QPainter *painter) +{ + if (!showOverlay) { + return; + } + + int radius = 80; + painter->save(); + painter->setPen(Qt::NoPen); + + QPainterPath smallCircle; + QPainterPath bigCircle; + radius -= 1; + smallCircle.addEllipse(-radius, -radius, radius * 2, radius * 2); + radius *= 2; + bigCircle.addEllipse(-radius, -radius + 140, radius * 2, radius * 2); + + //高光的形状为小圆扣掉大圆的部分 + QPainterPath highlight = smallCircle - bigCircle; + + QLinearGradient linearGradient(0, -radius / 2, 0, 0); + overlayColor.setAlpha(100); + linearGradient.setColorAt(0.0, overlayColor); + overlayColor.setAlpha(30); + linearGradient.setColorAt(1.0, overlayColor); + painter->setBrush(linearGradient); + painter->rotate(-20); + painter->drawPath(highlight); + + painter->restore(); +} + +QSize LightButton::sizeHint() const +{ + return QSize(100, 100); +} + +QSize LightButton::minimumSizeHint() const +{ + return QSize(10, 10); +} + +QString LightButton::getText() const +{ + return this->text; +} + +void LightButton::setText(const QString &text) +{ + if (this->text != text) { + this->text = text; + this->update(); + } +} + +QColor LightButton::getTextColor() const +{ + return this->textColor; +} + +void LightButton::setTextColor(const QColor &textColor) +{ + if (this->textColor != textColor) { + this->textColor = textColor; + this->update(); + } +} + +QColor LightButton::getAlarmColor() const +{ + return this->alarmColor; +} + +void LightButton::setAlarmColor(const QColor &alarmColor) +{ + if (this->alarmColor != alarmColor) { + this->alarmColor = alarmColor; + this->update(); + } +} + +QColor LightButton::getNormalColor() const +{ + return this->normalColor; +} + +void LightButton::setNormalColor(const QColor &normalColor) +{ + if (this->normalColor != normalColor) { + this->normalColor = normalColor; + this->update(); + } +} + +QColor LightButton::getBorderOutColorStart() const +{ + return this->borderOutColorStart; +} + +void LightButton::setBorderOutColorStart(const QColor &borderOutColorStart) +{ + if (this->borderOutColorStart != borderOutColorStart) { + this->borderOutColorStart = borderOutColorStart; + this->update(); + } +} + +QColor LightButton::getBorderOutColorEnd() const +{ + return this->borderOutColorEnd; +} + +void LightButton::setBorderOutColorEnd(const QColor &borderOutColorEnd) +{ + if (this->borderOutColorEnd != borderOutColorEnd) { + this->borderOutColorEnd = borderOutColorEnd; + this->update(); + } +} + +QColor LightButton::getBorderInColorStart() const +{ + return this->borderInColorStart; +} + +void LightButton::setBorderInColorStart(const QColor &borderInColorStart) +{ + if (this->borderInColorStart != borderInColorStart) { + this->borderInColorStart = borderInColorStart; + this->update(); + } +} + +QColor LightButton::getBorderInColorEnd() const +{ + return this->borderInColorEnd; +} + +void LightButton::setBorderInColorEnd(const QColor &borderInColorEnd) +{ + if (this->borderInColorEnd != borderInColorEnd) { + this->borderInColorEnd = borderInColorEnd; + this->update(); + } +} + +QColor LightButton::getBgColor() const +{ + return this->bgColor; +} + +void LightButton::setBgColor(const QColor &bgColor) +{ + if (this->bgColor != bgColor) { + this->bgColor = bgColor; + this->update(); + } +} + +bool LightButton::getCanMove() const +{ + return this->canMove; +} + +void LightButton::setCanMove(bool canMove) +{ + if (this->canMove != canMove) { + this->canMove = canMove; + this->update(); + } +} + +bool LightButton::getShowRect() const +{ + return this->showRect; +} + +void LightButton::setShowRect(bool showRect) +{ + if (this->showRect != showRect) { + this->showRect = showRect; + this->update(); + } +} + +bool LightButton::getShowOverlay() const +{ + return this->showOverlay; +} + +void LightButton::setShowOverlay(bool showOverlay) +{ + if (this->showOverlay != showOverlay) { + this->showOverlay = showOverlay; + this->update(); + } +} + +QColor LightButton::getOverlayColor() const +{ + return this->overlayColor; +} + +void LightButton::setOverlayColor(const QColor &overlayColor) +{ + if (this->overlayColor != overlayColor) { + this->overlayColor = overlayColor; + this->update(); + } +} + +void LightButton::setGreen() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(0, 166, 0)); +} + +void LightButton::setRed() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(255, 0, 0)); +} + +void LightButton::setYellow() +{ + textColor = QColor(25, 50, 7); + setBgColor(QColor(238, 238, 0)); +} + +void LightButton::setBlack() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(10, 10, 10)); +} + +void LightButton::setGray() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(129, 129, 129)); +} + +void LightButton::setBlue() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(0, 0, 166)); +} + +void LightButton::setLightBlue() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(100, 184, 255)); +} + +void LightButton::setLightRed() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(255, 107, 107)); +} + +void LightButton::setLightGreen() +{ + textColor = QColor(255, 255, 255); + setBgColor(QColor(24, 189, 155)); +} + +void LightButton::startAlarm() +{ + if (!timerAlarm->isActive()) { + timerAlarm->start(); + } +} + +void LightButton::stopAlarm() +{ + if (timerAlarm->isActive()) { + timerAlarm->stop(); + } +} + +void LightButton::alarm() +{ + if (isAlarm) { + textColor = QColor(255, 255, 255); + bgColor = normalColor; + } else { + textColor = QColor(255, 255, 255); + bgColor = alarmColor; + } + + this->update(); + isAlarm = !isAlarm; +} diff --git a/control/lightbutton/lightbutton.h b/control/lightbutton/lightbutton.h new file mode 100644 index 0000000..a390c5c --- /dev/null +++ b/control/lightbutton/lightbutton.h @@ -0,0 +1,166 @@ +#ifndef LIGHTBUTTON_H +#define LIGHTBUTTON_H + +/** + * 高亮发光按钮控件 作者:feiyangqingyun(QQ:517216493) 2016-10-16 + * 1. 可设置文本,居中显示。 + * 2. 可设置文本颜色。 + * 3. 可设置外边框渐变颜色。 + * 4. 可设置里边框渐变颜色。 + * 5. 可设置背景色。 + * 6. 可直接调用内置的设置 绿色、红色、黄色、黑色、蓝色 等公有槽函数。 + * 7. 可设置是否在容器中可移动,当成一个对象使用。 + * 8. 可设置是否显示矩形。 + * 9. 可设置报警颜色、非报警颜色。 + * 10. 可控制启动报警和停止报警,报警时闪烁。 + */ + +#include + +#ifdef quc +class Q_DECL_EXPORT LightButton : public QWidget +#else +class LightButton : public QWidget +#endif + +{ + Q_OBJECT + + Q_PROPERTY(QString text READ getText WRITE setText) + Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) + Q_PROPERTY(QColor alarmColor READ getAlarmColor WRITE setAlarmColor) + Q_PROPERTY(QColor normalColor READ getNormalColor WRITE setNormalColor) + + Q_PROPERTY(QColor borderOutColorStart READ getBorderOutColorStart WRITE setBorderOutColorStart) + Q_PROPERTY(QColor borderOutColorEnd READ getBorderOutColorEnd WRITE setBorderOutColorEnd) + Q_PROPERTY(QColor borderInColorStart READ getBorderInColorStart WRITE setBorderInColorStart) + Q_PROPERTY(QColor borderInColorEnd READ getBorderInColorEnd WRITE setBorderInColorEnd) + Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) + + Q_PROPERTY(bool canMove READ getCanMove WRITE setCanMove) + Q_PROPERTY(bool showRect READ getShowRect WRITE setShowRect) + Q_PROPERTY(bool showOverlay READ getShowOverlay WRITE setShowOverlay) + Q_PROPERTY(QColor overlayColor READ getOverlayColor WRITE setOverlayColor) + +public: + explicit LightButton(QWidget *parent = 0); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + void paintEvent(QPaintEvent *); + void drawBorderOut(QPainter *painter); + void drawBorderIn(QPainter *painter); + void drawBg(QPainter *painter); + void drawText(QPainter *painter); + void drawOverlay(QPainter *painter); + +private: + QString text; //文本 + QColor textColor; //文字颜色 + QColor alarmColor; //报警颜色 + QColor normalColor; //正常颜色 + + QColor borderOutColorStart; //外边框渐变开始颜色 + QColor borderOutColorEnd; //外边框渐变结束颜色 + QColor borderInColorStart; //里边框渐变开始颜色 + QColor borderInColorEnd; //里边框渐变结束颜色 + QColor bgColor; //背景颜色 + + bool showRect; //显示成矩形 + bool canMove; //是否能够移动 + bool showOverlay; //是否显示遮罩层 + QColor overlayColor; //遮罩层颜色 + + bool pressed; //鼠标是否按下 + QPoint lastPoint; //鼠标最后按下坐标 + + bool isAlarm; //是否报警 + QTimer *timerAlarm; //定时器切换颜色 + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //获取和设置文本 + QString getText() const; + void setText(const QString &text); + + //获取和设置文本颜色 + QColor getTextColor() const; + void setTextColor(const QColor &textColor); + + //获取和设置报警颜色 + QColor getAlarmColor() const; + void setAlarmColor(const QColor &alarmColor); + + //获取和设置正常颜色 + QColor getNormalColor() const; + void setNormalColor(const QColor &normalColor); + + //获取和设置外边框渐变颜色 + QColor getBorderOutColorStart() const; + void setBorderOutColorStart(const QColor &borderOutColorStart); + + QColor getBorderOutColorEnd() const; + void setBorderOutColorEnd(const QColor &borderOutColorEnd); + + //获取和设置里边框渐变颜色 + QColor getBorderInColorStart() const; + void setBorderInColorStart(const QColor &borderInColorStart); + + QColor getBorderInColorEnd() const; + void setBorderInColorEnd(const QColor &borderInColorEnd); + + //获取和设置背景色 + QColor getBgColor() const; + void setBgColor(const QColor &bgColor); + + //获取和设置是否可移动 + bool getCanMove() const; + void setCanMove(bool canMove); + + //获取和设置是否显示矩形 + bool getShowRect() const; + void setShowRect(bool showRect); + + //获取和设置是否显示遮罩层 + bool getShowOverlay() const; + void setShowOverlay(bool showOverlay); + + //获取和设置遮罩层颜色 + QColor getOverlayColor() const; + void setOverlayColor(const QColor &overlayColor); + +public Q_SLOTS: + //设置为绿色 + void setGreen(); + //设置为红色 + void setRed(); + //设置为黄色 + void setYellow(); + //设置为黑色 + void setBlack(); + //设置为灰色 + void setGray(); + //设置为蓝色 + void setBlue(); + + //设置为淡蓝色 + void setLightBlue(); + //设置为淡红色 + void setLightRed(); + //设置为淡绿色 + void setLightGreen(); + + //设置报警闪烁 + void startAlarm(); + void stopAlarm(); + void alarm(); + +Q_SIGNALS: + //单击信号 + void clicked(); +}; + +#endif // LIGHTBUTTON_H diff --git a/control/lightbutton/lightbutton.pro b/control/lightbutton/lightbutton.pro new file mode 100644 index 0000000..7c380ef --- /dev/null +++ b/control/lightbutton/lightbutton.pro @@ -0,0 +1,17 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = lightbutton +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmlightbutton.cpp +SOURCES += lightbutton.cpp + +HEADERS += frmlightbutton.h +HEADERS += lightbutton.h + +FORMS += frmlightbutton.ui diff --git a/control/lightbutton/main.cpp b/control/lightbutton/main.cpp new file mode 100644 index 0000000..e3a36f8 --- /dev/null +++ b/control/lightbutton/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmlightbutton.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmLightButton w; + w.setWindowTitle("高亮发光按钮 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/navbutton/font/fontawesome-webfont.ttf b/control/navbutton/font/fontawesome-webfont.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/control/navbutton/font/fontawesome-webfont.ttf differ diff --git a/control/navbutton/frmnavbutton.cpp b/control/navbutton/frmnavbutton.cpp new file mode 100644 index 0000000..47fad9c --- /dev/null +++ b/control/navbutton/frmnavbutton.cpp @@ -0,0 +1,415 @@ +#pragma execution_character_set("utf-8") + +#include "frmnavbutton.h" +#include "ui_frmnavbutton.h" +#include "navbutton.h" +#include "iconhelper.h" +#include "qdebug.h" + +frmNavButton::frmNavButton(QWidget *parent) : QWidget(parent), ui(new Ui::frmNavButton) +{ + ui->setupUi(this); + this->initForm(); + this->initBtn1(); + this->initBtn2(); + this->initBtn3(); + this->initBtn4(); + this->initBtn5(); + this->initBtn6(); + this->initBtn7(); +} + +frmNavButton::~frmNavButton() +{ + delete ui; +} + +void frmNavButton::initForm() +{ + icons << 0xf17b << 0xf002 << 0xf013 << 0xf021 << 0xf0e0 << 0xf135; + + ui->navButton11->setChecked(true); + ui->navButton23->setChecked(true); + ui->navButton31->setChecked(true); + ui->navButton44->setChecked(true); + ui->navButton53->setChecked(true); + ui->navButton61->setChecked(true); + ui->navButton75->setChecked(true); + + //设置整体圆角 + ui->widgetNav5->setStyleSheet(".QWidget{background:#292929;border:1px solid #292929;border-radius:20px;}"); +} + +void frmNavButton::initBtn1() +{ + quint32 size = 15; + quint32 pixWidth = 15; + quint32 pixHeight = 15; + + //从图形字体获得图片,也可以从资源文件或者路径文件获取 + int icon = 0xf061; + QPixmap iconNormal = IconHelper::getPixmap(QColor(100, 100, 100).name(), icon, size, pixWidth, pixHeight); + QPixmap iconHover = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); + QPixmap iconCheck = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); + + btns1 << ui->navButton11 << ui->navButton12 << ui->navButton13 << ui->navButton14; + for (int i = 0; i < btns1.count(); i++) { + NavButton *btn = btns1.at(i); + btn->setPaddingLeft(32); + btn->setLineSpace(6); + + btn->setShowIcon(true); + btn->setIconSpace(15); + btn->setIconSize(QSize(10, 10)); + btn->setIconNormal(iconNormal); + btn->setIconHover(iconHover); + btn->setIconCheck(iconCheck); + + connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick1())); + } +} + +void frmNavButton::initBtn2() +{ + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; + + QColor normalBgColor = QColor("#2D9191"); + QColor hoverBgColor = QColor("#187294"); + QColor checkBgColor = QColor("#145C75"); + QColor normalTextColor = QColor("#FFFFFF"); + QColor hoverTextColor = QColor("#FFFFFF"); + QColor checkTextColor = QColor("#FFFFFF"); + + btns2 << ui->navButton21 << ui->navButton22 << ui->navButton23 << ui->navButton24; + for (int i = 0; i < btns2.count(); i++) { + NavButton *btn = btns2.at(i); + btn->setPaddingLeft(35); + btn->setLineSpace(0); + btn->setLineWidth(8); + btn->setLineColor(QColor(255, 107, 107)); + btn->setShowTriangle(true); + + btn->setShowIcon(true); + btn->setIconSpace(10); + btn->setIconSize(QSize(22, 22)); + + //分开设置图标 + int icon = icons.at(i); + QPixmap iconNormal = IconHelper::getPixmap(normalTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconHover = IconHelper::getPixmap(hoverTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconCheck = IconHelper::getPixmap(checkTextColor.name(), icon, size, pixWidth, pixHeight); + + btn->setIconNormal(iconNormal); + btn->setIconHover(iconHover); + btn->setIconCheck(iconCheck); + + btn->setNormalBgColor(normalBgColor); + btn->setHoverBgColor(hoverBgColor); + btn->setCheckBgColor(checkBgColor); + btn->setNormalTextColor(normalTextColor); + btn->setHoverTextColor(hoverTextColor); + btn->setCheckTextColor(checkTextColor); + + connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick2())); + } +} + +void frmNavButton::initBtn3() +{ + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; + + QColor normalBgColor = QColor("#292F38"); + QColor hoverBgColor = QColor("#1D2025"); + QColor checkBgColor = QColor("#1D2025"); + QColor normalTextColor = QColor("#54626F"); + QColor hoverTextColor = QColor("#FDFDFD"); + QColor checkTextColor = QColor("#FDFDFD"); + + btns3 << ui->navButton31 << ui->navButton32 << ui->navButton33 << ui->navButton34; + for (int i = 0; i < btns3.count(); i++) { + NavButton *btn = btns3.at(i); + btn->setPaddingLeft(35); + btn->setLineWidth(10); + btn->setLineColor(QColor("#029FEA")); + btn->setShowTriangle(true); + btn->setTextAlign(NavButton::TextAlign_Left); + btn->setTrianglePosition(NavButton::TrianglePosition_Left); + btn->setLinePosition(NavButton::LinePosition_Right); + + btn->setShowIcon(true); + btn->setIconSpace(10); + btn->setIconSize(QSize(22, 22)); + + //分开设置图标 + int icon = icons.at(i); + QPixmap iconNormal = IconHelper::getPixmap(normalTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconHover = IconHelper::getPixmap(hoverTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconCheck = IconHelper::getPixmap(checkTextColor.name(), icon, size, pixWidth, pixHeight); + + btn->setIconNormal(iconNormal); + btn->setIconHover(iconHover); + btn->setIconCheck(iconCheck); + + btn->setNormalBgColor(normalBgColor); + btn->setHoverBgColor(hoverBgColor); + btn->setCheckBgColor(checkBgColor); + btn->setNormalTextColor(normalTextColor); + btn->setHoverTextColor(hoverTextColor); + btn->setCheckTextColor(checkTextColor); + + connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick3())); + } +} + +void frmNavButton::initBtn4() +{ + quint32 size = 15; + quint32 pixWidth = 15; + quint32 pixHeight = 15; + + int icon = 0xf105; + QPixmap iconNormal = IconHelper::getPixmap(QColor(100, 100, 100).name(), icon, size, pixWidth, pixHeight); + QPixmap iconHover = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); + QPixmap iconCheck = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); + + btns4 << ui->navButton41 << ui->navButton42 << ui->navButton43 << ui->navButton44; + for (int i = 0; i < btns4.count(); i++) { + NavButton *btn = btns4.at(i); + btn->setLineSpace(10); + btn->setLineWidth(10); + btn->setPaddingRight(35); + btn->setShowTriangle(true); + btn->setTextAlign(NavButton::TextAlign_Right); + btn->setTrianglePosition(NavButton::TrianglePosition_Left); + btn->setLinePosition(NavButton::LinePosition_Right); + + btn->setShowIcon(true); + btn->setIconSpace(20); + btn->setIconSize(QSize(15, 15)); + btn->setIconNormal(iconNormal); + btn->setIconHover(iconHover); + btn->setIconCheck(iconCheck); + + connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick4())); + } +} + +void frmNavButton::initBtn5() +{ + QFont font; + font.setPixelSize(15); + font.setBold(true); + + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; + + QColor normalBgColor = QColor("#292929"); + QColor hoverBgColor = QColor("#064077"); + QColor checkBgColor = QColor("#10689A"); + QColor normalTextColor = QColor("#FFFFFF"); + QColor hoverTextColor = Qt::yellow; + QColor checkTextColor = QColor("#FFFFFF"); + + btns5 << ui->navButton51 << ui->navButton52 << ui->navButton53 << ui->navButton54 << ui->navButton55; + for (int i = 0; i < btns5.count(); i++) { + NavButton *btn = btns5.at(i); + btn->setFont(font); + btn->setPaddingLeft(20); + btn->setShowLine(false); + btn->setTextAlign(NavButton::TextAlign_Center); + btn->setLinePosition(NavButton::LinePosition_Bottom); + + btn->setShowIcon(true); + btn->setIconSpace(15); + btn->setIconSize(QSize(22, 22)); + + //分开设置图标 + int icon = icons.at(i); + QPixmap iconNormal = IconHelper::getPixmap(normalTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconHover = IconHelper::getPixmap(hoverTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconCheck = IconHelper::getPixmap(checkTextColor.name(), icon, size, pixWidth, pixHeight); + + btn->setIconNormal(iconNormal); + btn->setIconHover(iconHover); + btn->setIconCheck(iconCheck); + + btn->setNormalBgColor(normalBgColor); + btn->setHoverBgColor(hoverBgColor); + btn->setCheckBgColor(checkBgColor); + btn->setNormalTextColor(normalTextColor); + btn->setHoverTextColor(hoverTextColor); + btn->setCheckTextColor(checkTextColor); + + connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick5())); + } +} + +void frmNavButton::initBtn6() +{ + QFont font; + font.setPixelSize(15); + font.setBold(true); + + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; + + QColor normalBgColor = QColor("#E6393D"); + QColor hoverBgColor = QColor("#EE0000"); + QColor checkBgColor = QColor("#A40001"); + QColor normalTextColor = QColor("#FFFFFF"); + QColor hoverTextColor = QColor("#FFFFFF"); + QColor checkTextColor = QColor("#FFFFFF"); + + btns6 << ui->navButton61 << ui->navButton62 << ui->navButton63 << ui->navButton64 << ui->navButton65; + for (int i = 0; i < btns6.count(); i++) { + NavButton *btn = btns6.at(i); + btn->setFont(font); + btn->setPaddingLeft(20); + btn->setShowLine(false); + btn->setTextAlign(NavButton::TextAlign_Center); + btn->setLinePosition(NavButton::LinePosition_Bottom); + + btn->setShowIcon(true); + btn->setIconSpace(15); + btn->setIconSize(QSize(22, 22)); + + //分开设置图标 + int icon = icons.at(i); + QPixmap iconNormal = IconHelper::getPixmap(normalTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconHover = IconHelper::getPixmap(hoverTextColor.name(), icon, size, pixWidth, pixHeight); + QPixmap iconCheck = IconHelper::getPixmap(checkTextColor.name(), icon, size, pixWidth, pixHeight); + + btn->setIconNormal(iconNormal); + btn->setIconHover(iconHover); + btn->setIconCheck(iconCheck); + + btn->setNormalBgColor(normalBgColor); + btn->setHoverBgColor(hoverBgColor); + btn->setCheckBgColor(checkBgColor); + btn->setNormalTextColor(normalTextColor); + btn->setHoverTextColor(hoverTextColor); + btn->setCheckTextColor(checkTextColor); + + connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick6())); + } +} + +void frmNavButton::initBtn7() +{ + QFont font; + font.setPixelSize(15); + font.setBold(true); + + QColor normalTextColor = QColor("#FFFFFF"); + QColor hoverTextColor = QColor("#FFFFFF"); + QColor checkTextColor = QColor("#FFFFFF"); + + //设置背景色为画刷 + QLinearGradient normalBgBrush(0, 0, 0, ui->navButton71->height()); + normalBgBrush.setColorAt(0.0, QColor("#3985BF")); + normalBgBrush.setColorAt(0.5, QColor("#2972A9")); + normalBgBrush.setColorAt(1.0, QColor("#1C6496")); + + QLinearGradient hoverBgBrush(0, 0, 0, ui->navButton71->height()); + hoverBgBrush.setColorAt(0.0, QColor("#4897D1")); + hoverBgBrush.setColorAt(0.5, QColor("#3283BC")); + hoverBgBrush.setColorAt(1.0, QColor("#3088C3")); + + btns7 << ui->navButton71 << ui->navButton72 << ui->navButton73 << ui->navButton74 << ui->navButton75 << ui->navButton76; + for (int i = 0; i < btns7.count(); i++) { + NavButton *btn = btns7.at(i); + btn->setFont(font); + btn->setPaddingLeft(0); + btn->setLineSpace(0); + btn->setShowTriangle(true); + btn->setTextAlign(NavButton::TextAlign_Center); + btn->setTrianglePosition(NavButton::TrianglePosition_Bottom); + btn->setLinePosition(NavButton::LinePosition_Top); + + btn->setNormalTextColor(normalTextColor); + btn->setHoverTextColor(hoverTextColor); + btn->setCheckTextColor(checkTextColor); + + btn->setNormalBgBrush(normalBgBrush); + btn->setHoverBgBrush(hoverBgBrush); + btn->setCheckBgBrush(hoverBgBrush); + + connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick7())); + } +} + +void frmNavButton::buttonClick1() +{ + NavButton *b = (NavButton *)sender(); + qDebug() << "当前按下" << b->text(); + for (int i = 0; i < btns1.count(); i++) { + NavButton *btn = btns1.at(i); + btn->setChecked(b == btn); + } +} + +void frmNavButton::buttonClick2() +{ + NavButton *b = (NavButton *)sender(); + qDebug() << "当前按下" << b->text(); + for (int i = 0; i < btns2.count(); i++) { + NavButton *btn = btns2.at(i); + btn->setChecked(b == btn); + } +} + +void frmNavButton::buttonClick3() +{ + NavButton *b = (NavButton *)sender(); + qDebug() << "当前按下" << b->text(); + for (int i = 0; i < btns3.count(); i++) { + NavButton *btn = btns3.at(i); + btn->setChecked(b == btn); + } +} + +void frmNavButton::buttonClick4() +{ + NavButton *b = (NavButton *)sender(); + qDebug() << "当前按下" << b->text(); + for (int i = 0; i < btns4.count(); i++) { + NavButton *btn = btns4.at(i); + btn->setChecked(b == btn); + } +} + +void frmNavButton::buttonClick5() +{ + NavButton *b = (NavButton *)sender(); + qDebug() << "当前按下" << b->text(); + for (int i = 0; i < btns5.count(); i++) { + NavButton *btn = btns5.at(i); + btn->setChecked(b == btn); + } +} + +void frmNavButton::buttonClick6() +{ + NavButton *b = (NavButton *)sender(); + qDebug() << "当前按下" << b->text(); + for (int i = 0; i < btns6.count(); i++) { + NavButton *btn = btns6.at(i); + btn->setChecked(b == btn); + } +} + +void frmNavButton::buttonClick7() +{ + NavButton *b = (NavButton *)sender(); + qDebug() << "当前按下" << b->text(); + for (int i = 0; i < btns7.count(); i++) { + NavButton *btn = btns7.at(i); + btn->setChecked(b == btn); + } +} diff --git a/control/navbutton/frmnavbutton.h b/control/navbutton/frmnavbutton.h new file mode 100644 index 0000000..2a4c62d --- /dev/null +++ b/control/navbutton/frmnavbutton.h @@ -0,0 +1,50 @@ +#ifndef FRMNAVBUTTON_H +#define FRMNAVBUTTON_H + +#include + +class NavButton; + +namespace Ui { +class frmNavButton; +} + +class frmNavButton : public QWidget +{ + Q_OBJECT + +public: + explicit frmNavButton(QWidget *parent = 0); + ~frmNavButton(); + +private: + Ui::frmNavButton *ui; + QList icons; + QList btns1; + QList btns2; + QList btns3; + QList btns4; + QList btns5; + QList btns6; + QList btns7; + +private slots: + void initForm(); + void initBtn1(); + void initBtn2(); + void initBtn3(); + void initBtn4(); + void initBtn5(); + void initBtn6(); + void initBtn7(); + + void buttonClick1(); + void buttonClick2(); + void buttonClick3(); + void buttonClick4(); + void buttonClick5(); + void buttonClick6(); + void buttonClick7(); +}; + +#endif // FRMNAVBUTTON_H diff --git a/control/navbutton/frmnavbutton.ui b/control/navbutton/frmnavbutton.ui new file mode 100644 index 0000000..4d683ff --- /dev/null +++ b/control/navbutton/frmnavbutton.ui @@ -0,0 +1,562 @@ + + + frmNavButton + + + + 0 + 0 + 800 + 605 + + + + Form + + + + + 11 + 245 + 511 + 40 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 首页 + + + + + + + + 0 + 0 + + + + 论坛 + + + + + + + + 0 + 0 + + + + Qt下载 + + + + + + + + 0 + 0 + + + + 作品展 + + + + + + + + 0 + 0 + + + + 群组 + + + + + + + + 0 + 0 + + + + 个人中心 + + + + + + + + + 11 + 11 + 120 + 133 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 学生管理 + + + + + + + 教师管理 + + + + + + + 成绩管理 + + + + + + + 记录查询 + + + + + + + + + 140 + 11 + 120 + 133 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 访客登记 + + + + + + + 记录查询 + + + + + + + 系统设置 + + + + + + + 系统重启 + + + + + + + + + 11 + 151 + 511 + 40 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 首页 + + + + + + + + 0 + 0 + + + + 论坛 + + + + + + + + 0 + 0 + + + + 作品 + + + + + + + + 0 + 0 + + + + 群组 + + + + + + + + 0 + 0 + + + + 帮助 + + + + + + + + + 11 + 198 + 511 + 40 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 首页 + + + + + + + + 0 + 0 + + + + 论坛 + + + + + + + + 0 + 0 + + + + 作品 + + + + + + + + 0 + 0 + + + + 群组 + + + + + + + + 0 + 0 + + + + 帮助 + + + + + + + + + 270 + 11 + 120 + 133 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 学生管理 + + + + + + + 教师管理 + + + + + + + 成绩管理 + + + + + + + 记录查询 + + + + + + + + + 400 + 11 + 120 + 133 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 学生管理 + + + + + + + 教师管理 + + + + + + + 成绩管理 + + + + + + + 记录查询 + + + + + + + + + NavButton + QPushButton +
navbutton.h
+
+
+ + +
diff --git a/control/navbutton/iconhelper.cpp b/control/navbutton/iconhelper.cpp new file mode 100644 index 0000000..1e703e6 --- /dev/null +++ b/control/navbutton/iconhelper.cpp @@ -0,0 +1,387 @@ +#include "iconhelper.h" + +IconHelper *IconHelper::iconFontAliBaBa = 0; +IconHelper *IconHelper::iconFontAwesome = 0; +IconHelper *IconHelper::iconFontAwesome6 = 0; +IconHelper *IconHelper::iconFontWeather = 0; +int IconHelper::iconFontIndex = -1; + +void IconHelper::initFont() +{ + static bool isInit = false; + if (!isInit) { + isInit = true; + if (iconFontAliBaBa == 0) { + iconFontAliBaBa = new IconHelper(":/font/iconfont.ttf", "iconfont"); + } + if (iconFontAwesome == 0) { + iconFontAwesome = new IconHelper(":/font/fontawesome-webfont.ttf", "FontAwesome"); + } + if (iconFontAwesome6 == 0) { + iconFontAwesome6 = new IconHelper(":/font/fa-regular-400.ttf", "Font Awesome 6 Pro Regular"); + } + if (iconFontWeather == 0) { + iconFontWeather = new IconHelper(":/font/pe-icon-set-weather.ttf", "pe-icon-set-weather"); + } + } +} + +void IconHelper::setIconFontIndex(int index) +{ + iconFontIndex = index; +} + +QFont IconHelper::getIconFontAliBaBa() +{ + initFont(); + return iconFontAliBaBa->getIconFont(); +} + +QFont IconHelper::getIconFontAwesome() +{ + initFont(); + return iconFontAwesome->getIconFont(); +} + +QFont IconHelper::getIconFontAwesome6() +{ + initFont(); + return iconFontAwesome6->getIconFont(); +} + +QFont IconHelper::getIconFontWeather() +{ + initFont(); + return iconFontWeather->getIconFont(); +} + +IconHelper *IconHelper::getIconHelper(int icon) +{ + initFont(); + + //指定了字体索引则取对应索引的字体类 + //没指定则自动根据不同的字体的值选择对应的类 + //由于部分值范围冲突所以可以指定索引来取 + //fontawesome 0xf000-0xf2e0 + //fontawesome6 0xe000-0xe33d 0xf000-0xf8ff + //iconfont 0xe501-0xe793 0xe8d5-0xea5d 0xeb00-0xec00 + //weather 0xe900-0xe9cf + + IconHelper *iconHelper = iconFontAwesome; + if (iconFontIndex < 0) { + if ((icon >= 0xe501 && icon <= 0xe793) || (icon >= 0xe8d5 && icon <= 0xea5d) || (icon >= 0xeb00 && icon <= 0xec00)) { + iconHelper = iconFontAliBaBa; + } + } else if (iconFontIndex == 0) { + iconHelper = iconFontAliBaBa; + } else if (iconFontIndex == 1) { + iconHelper = iconFontAwesome; + } else if (iconFontIndex == 2) { + iconHelper = iconFontAwesome6; + } else if (iconFontIndex == 3) { + iconHelper = iconFontWeather; + } + + return iconHelper; +} + +void IconHelper::setIcon(QLabel *lab, int icon, quint32 size) +{ + getIconHelper(icon)->setIcon1(lab, icon, size); +} + +void IconHelper::setIcon(QAbstractButton *btn, int icon, quint32 size) +{ + getIconHelper(icon)->setIcon1(btn, icon, size); +} + +void IconHelper::setPixmap(QAbstractButton *btn, const QColor &color, int icon, quint32 size, + quint32 width, quint32 height, int flags) +{ + getIconHelper(icon)->setPixmap1(btn, color, icon, size, width, height, flags); +} + +QPixmap IconHelper::getPixmap(const QColor &color, int icon, quint32 size, + quint32 width, quint32 height, int flags) +{ + return getIconHelper(icon)->getPixmap1(color, icon, size, width, height, flags); +} + +void IconHelper::setStyle(QWidget *widget, QList btns, + QList icons, const IconHelper::StyleColor &styleColor) +{ + int icon = icons.first(); + getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor); +} + +void IconHelper::setStyle(QWidget *widget, QList btns, + QList icons, const IconHelper::StyleColor &styleColor) +{ + int icon = icons.first(); + getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor); +} + +void IconHelper::setStyle(QWidget *widget, QList btns, + QList icons, const IconHelper::StyleColor &styleColor) +{ + int icon = icons.first(); + getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor); +} + + +IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject *parent) : QObject(parent) +{ + //判断图形字体是否存在,不存在则加入 + QFontDatabase fontDb; + if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) { + int fontId = fontDb.addApplicationFont(fontFile); + QStringList listName = fontDb.applicationFontFamilies(fontId); + if (listName.count() == 0) { + qDebug() << QString("load %1 error").arg(fontName); + } + } + + //再次判断是否包含字体名称防止加载失败 + if (fontDb.families().contains(fontName)) { + iconFont = QFont(fontName); +#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0)) + iconFont.setHintingPreference(QFont::PreferNoHinting); +#endif + } +} + +bool IconHelper::eventFilter(QObject *watched, QEvent *event) +{ + //根据不同的 + if (watched->inherits("QAbstractButton")) { + QAbstractButton *btn = (QAbstractButton *)watched; + int index = btns.indexOf(btn); + if (index >= 0) { + //不同的事件设置不同的图标,同时区分选中的和没有选中的 + if (btn->isChecked()) { + if (event->type() == QEvent::MouseButtonPress) { + QMouseEvent *mouseEvent = (QMouseEvent *)event; + if (mouseEvent->button() == Qt::LeftButton) { + btn->setIcon(QIcon(pixChecked.at(index))); + } + } else if (event->type() == QEvent::Enter) { + btn->setIcon(QIcon(pixChecked.at(index))); + } else if (event->type() == QEvent::Leave) { + btn->setIcon(QIcon(pixChecked.at(index))); + } + } else { + if (event->type() == QEvent::MouseButtonPress) { + QMouseEvent *mouseEvent = (QMouseEvent *)event; + if (mouseEvent->button() == Qt::LeftButton) { + btn->setIcon(QIcon(pixPressed.at(index))); + } + } else if (event->type() == QEvent::Enter) { + btn->setIcon(QIcon(pixHover.at(index))); + } else if (event->type() == QEvent::Leave) { + btn->setIcon(QIcon(pixNormal.at(index))); + } + } + } + } + + return QObject::eventFilter(watched, event); +} + +void IconHelper::toggled(bool checked) +{ + //选中和不选中设置不同的图标 + QAbstractButton *btn = (QAbstractButton *)sender(); + int index = btns.indexOf(btn); + if (checked) { + btn->setIcon(QIcon(pixChecked.at(index))); + } else { + btn->setIcon(QIcon(pixNormal.at(index))); + } +} + +QFont IconHelper::getIconFont() +{ + return this->iconFont; +} + +void IconHelper::setIcon1(QLabel *lab, int icon, quint32 size) +{ + iconFont.setPixelSize(size); + lab->setFont(iconFont); + lab->setText((QChar)icon); +} + +void IconHelper::setIcon1(QAbstractButton *btn, int icon, quint32 size) +{ + iconFont.setPixelSize(size); + btn->setFont(iconFont); + btn->setText((QChar)icon); +} + +void IconHelper::setPixmap1(QAbstractButton *btn, const QColor &color, int icon, quint32 size, + quint32 width, quint32 height, int flags) +{ + btn->setIcon(getPixmap1(color, icon, size, width, height, flags)); +} + +QPixmap IconHelper::getPixmap1(const QColor &color, int icon, quint32 size, + quint32 width, quint32 height, int flags) +{ + //主动绘制图形字体到图片 + QPixmap pix(width, height); + pix.fill(Qt::transparent); + + QPainter painter; + painter.begin(&pix); + painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); + painter.setPen(color); + + iconFont.setPixelSize(size); + painter.setFont(iconFont); + painter.drawText(pix.rect(), flags, (QChar)icon); + painter.end(); + return pix; +} + +void IconHelper::setStyle1(QWidget *widget, QList btns, QList icons, const IconHelper::StyleColor &styleColor) +{ + QList list; + foreach (QPushButton *btn, btns) { + list << btn; + } + + setStyle(widget, list, icons, styleColor); +} + +void IconHelper::setStyle1(QWidget *widget, QList btns, QList icons, const IconHelper::StyleColor &styleColor) +{ + QList list; + foreach (QToolButton *btn, btns) { + list << btn; + } + + setStyle(widget, list, icons, styleColor); +} + +void IconHelper::setStyle1(QWidget *widget, QList btns, QList icons, const IconHelper::StyleColor &styleColor) +{ + int btnCount = btns.count(); + int iconCount = icons.count(); + if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) { + return; + } + + QString position = styleColor.position; + quint32 btnWidth = styleColor.btnWidth; + quint32 btnHeight = styleColor.btnHeight; + quint32 iconSize = styleColor.iconSize; + quint32 iconWidth = styleColor.iconWidth; + quint32 iconHeight = styleColor.iconHeight; + quint32 borderWidth = styleColor.borderWidth; + + //根据不同的位置计算边框 + QString strBorder; + if (position == "top") { + strBorder = QString("border-width:%1px 0px 0px 0px;padding-top:%1px;padding-bottom:%2px;") + .arg(borderWidth).arg(borderWidth * 2); + } else if (position == "right") { + strBorder = QString("border-width:0px %1px 0px 0px;padding-right:%1px;padding-left:%2px;") + .arg(borderWidth).arg(borderWidth * 2); + } else if (position == "bottom") { + strBorder = QString("border-width:0px 0px %1px 0px;padding-bottom:%1px;padding-top:%2px;") + .arg(borderWidth).arg(borderWidth * 2); + } else if (position == "left") { + strBorder = QString("border-width:0px 0px 0px %1px;padding-left:%1px;padding-right:%2px;") + .arg(borderWidth).arg(borderWidth * 2); + } + + //如果图标是左侧显示则需要让没有选中的按钮左侧也有加深的边框,颜色为背景颜色 + //如果图标在文字上面而设置的边框是 top bottom 也需要启用加深边框 + QStringList qss; + if (styleColor.defaultBorder) { + qss << QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:solid;border-radius:0px;%2border-color:%3;color:%4;background:%5;}") + .arg(position).arg(strBorder).arg(styleColor.normalBgColor).arg(styleColor.normalTextColor).arg(styleColor.normalBgColor); + } else { + qss << QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:none;border-radius:0px;padding:5px;color:%2;background:%3;}") + .arg(position).arg(styleColor.normalTextColor).arg(styleColor.normalBgColor); + } + + //悬停+按下+选中 + qss << QString("QWidget[flag=\"%1\"] QAbstractButton:hover{border-style:solid;%2border-color:%3;color:%4;background:%5;}") + .arg(position).arg(strBorder).arg(styleColor.borderColor).arg(styleColor.hoverTextColor).arg(styleColor.hoverBgColor); + qss << QString("QWidget[flag=\"%1\"] QAbstractButton:pressed{border-style:solid;%2border-color:%3;color:%4;background:%5;}") + .arg(position).arg(strBorder).arg(styleColor.borderColor).arg(styleColor.pressedTextColor).arg(styleColor.pressedBgColor); + qss << QString("QWidget[flag=\"%1\"] QAbstractButton:checked{border-style:solid;%2border-color:%3;color:%4;background:%5;}") + .arg(position).arg(strBorder).arg(styleColor.borderColor).arg(styleColor.checkedTextColor).arg(styleColor.checkedBgColor); + + //窗体背景颜色+按钮背景颜色 + qss << QString("QWidget#%1{background:%2;}") + .arg(widget->objectName()).arg(styleColor.normalBgColor); + qss << QString("QWidget>QAbstractButton{border-width:0px;background-color:%1;color:%2;}") + .arg(styleColor.normalBgColor).arg(styleColor.normalTextColor); + qss << QString("QWidget>QAbstractButton:hover{background-color:%1;color:%2;}") + .arg(styleColor.hoverBgColor).arg(styleColor.hoverTextColor); + qss << QString("QWidget>QAbstractButton:pressed{background-color:%1;color:%2;}") + .arg(styleColor.pressedBgColor).arg(styleColor.pressedTextColor); + qss << QString("QWidget>QAbstractButton:checked{background-color:%1;color:%2;}") + .arg(styleColor.checkedBgColor).arg(styleColor.checkedTextColor); + + //按钮宽度高度 + if (btnWidth > 0) { + qss << QString("QWidget>QAbstractButton{min-width:%1px;}").arg(btnWidth); + } + if (btnHeight > 0) { + qss << QString("QWidget>QAbstractButton{min-height:%1px;}").arg(btnHeight); + } + + //设置样式表 + widget->setStyleSheet(qss.join("")); + + //可能会重复调用设置所以先要移除上一次的 + for (int i = 0; i < btnCount; ++i) { + for (int j = 0; j < this->btns.count(); j++) { + if (this->btns.at(j) == btns.at(i)) { + disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); + this->btns.at(j)->removeEventFilter(this); + this->btns.removeAt(j); + this->pixNormal.removeAt(j); + this->pixHover.removeAt(j); + this->pixPressed.removeAt(j); + this->pixChecked.removeAt(j); + break; + } + } + } + + //存储对应按钮对象,方便鼠标移上去的时候切换图片 + int checkedIndex = -1; + for (int i = 0; i < btnCount; ++i) { + int icon = icons.at(i); + QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); + QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); + QPixmap pixPressed = getPixmap1(styleColor.pressedTextColor, icon, iconSize, iconWidth, iconHeight); + QPixmap pixChecked = getPixmap1(styleColor.checkedTextColor, icon, iconSize, iconWidth, iconHeight); + + //记住最后选中的按钮 + QAbstractButton *btn = btns.at(i); + if (btn->isChecked()) { + checkedIndex = i; + } + + btn->setIcon(QIcon(pixNormal)); + btn->setIconSize(QSize(iconWidth, iconHeight)); + btn->installEventFilter(this); + connect(btn, SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); + + this->btns << btn; + this->pixNormal << pixNormal; + this->pixHover << pixHover; + this->pixPressed << pixPressed; + this->pixChecked << pixChecked; + } + + //主动触发一下选中的按钮 + if (checkedIndex >= 0) { + QMetaObject::invokeMethod(btns.at(checkedIndex), "toggled", Q_ARG(bool, true)); + } +} diff --git a/control/navbutton/iconhelper.h b/control/navbutton/iconhelper.h new file mode 100644 index 0000000..adcf69e --- /dev/null +++ b/control/navbutton/iconhelper.h @@ -0,0 +1,189 @@ +#ifndef ICONHELPER_H +#define ICONHELPER_H + +/** + * 超级图形字体类 作者:feiyangqingyun(QQ:517216493) 2016-11-23 + * 1. 可传入多种图形字体文件,一个类通用所有图形字体。 + * 2. 默认已经内置了阿里巴巴图形字体FontAliBaBa、国际知名图形字体FontAwesome、天气图形字体FontWeather。 + * 3. 可设置 QLabel、QAbstractButton 文本为图形字体。 + * 4. 可设置图形字体作为 QAbstractButton 按钮图标。 + * 5. 内置万能的方法 getPixmap 将图形字体值转换为图片。 + * 6. 无论是设置文本、图标、图片等都可以设置图标的大小、尺寸、颜色等参数。 + * 7. 内置超级导航栏样式设置,将图形字体作为图标设置到按钮。 + * 8. 支持各种颜色设置比如正常颜色、悬停颜色、按下颜色、选中颜色。 + * 9. 可设置导航的位置为 left、right、top、bottom 四种。 + * 10. 可设置导航加深边框颜色和粗细大小。 + * 11. 导航面板的各种切换效果比如鼠标悬停、按下、选中等都自动处理掉样式设置。 + * 12. 全局静态方法,接口丰富,使用极其简单方便。 + */ + +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) +#include +#endif + +#ifdef quc +class Q_DECL_EXPORT IconHelper : public QObject +#else +class IconHelper : public QObject +#endif + +{ + Q_OBJECT + +private: + //阿里巴巴图形字体类 + static IconHelper *iconFontAliBaBa; + //FontAwesome图形字体类 + static IconHelper *iconFontAwesome; + //FontAwesome6图形字体类 + static IconHelper *iconFontAwesome6; + //天气图形字体类 + static IconHelper *iconFontWeather; + //图形字体索引 + static int iconFontIndex; + +public: + //样式颜色结构体 + struct StyleColor { + QString position; //位置 left right top bottom + bool defaultBorder; //默认有边框 + + quint32 btnWidth; //按钮宽度 + quint32 btnHeight; //按钮高度 + + quint32 iconSize; //图标字体尺寸 + quint32 iconWidth; //图标图片宽度 + quint32 iconHeight; //图标图片高度 + + quint32 borderWidth; //边框宽度 + QString borderColor; //边框颜色 + + QString normalBgColor; //正常背景颜色 + QString normalTextColor; //正常文字颜色 + QString hoverBgColor; //悬停背景颜色 + QString hoverTextColor; //悬停文字颜色 + QString pressedBgColor; //按下背景颜色 + QString pressedTextColor; //按下文字颜色 + QString checkedBgColor; //选中背景颜色 + QString checkedTextColor; //选中文字颜色 + + StyleColor() { + position = "left"; + defaultBorder = false; + + btnWidth = 0; + btnHeight = 0; + + iconSize = 12; + iconWidth = 15; + iconHeight = 15; + + borderWidth = 3; + borderColor = "#029FEA"; + + normalBgColor = "#292F38"; + normalTextColor = "#54626F"; + hoverBgColor = "#40444D"; + hoverTextColor = "#FDFDFD"; + pressedBgColor = "#404244"; + pressedTextColor = "#FDFDFD"; + checkedBgColor = "#44494F"; + checkedTextColor = "#FDFDFD"; + } + + //设置常规颜色 普通状态+加深状态 + void setColor(const QString &normalBgColor, + const QString &normalTextColor, + const QString &darkBgColor, + const QString &darkTextColor) { + this->normalBgColor = normalBgColor; + this->normalTextColor = normalTextColor; + this->hoverBgColor = darkBgColor; + this->hoverTextColor = darkTextColor; + this->pressedBgColor = darkBgColor; + this->pressedTextColor = darkTextColor; + this->checkedBgColor = darkBgColor; + this->checkedTextColor = darkTextColor; + } + }; + + + //初始化图形字体 + static void initFont(); + //设置引用图形字体文件索引 + static void setIconFontIndex(int index); + + //获取图形字体 + static QFont getIconFontAliBaBa(); + static QFont getIconFontAwesome(); + static QFont getIconFontAwesome6(); + static QFont getIconFontWeather(); + + //根据值获取图形字体类 + static IconHelper *getIconHelper(int icon); + + //设置图形字体到标签 + static void setIcon(QLabel *lab, int icon, quint32 size = 12); + //设置图形字体到按钮 + static void setIcon(QAbstractButton *btn, int icon, quint32 size = 12); + + //设置图形字体到图标 + static void setPixmap(QAbstractButton *btn, const QColor &color, + int icon, quint32 size = 12, + quint32 width = 15, quint32 height = 15, + int flags = Qt::AlignCenter); + //获取指定图形字体,可以指定文字大小,图片宽高,文字对齐 + static QPixmap getPixmap(const QColor &color, int icon, quint32 size = 12, + quint32 width = 15, quint32 height = 15, + int flags = Qt::AlignCenter); + + //指定导航面板样式,带图标和效果切换+悬停颜色+按下颜色+选中颜色 + static void setStyle(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); + static void setStyle(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); + static void setStyle(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); + + //默认构造函数,传入字体文件+字体名称 + explicit IconHelper(const QString &fontFile, const QString &fontName, QObject *parent = 0); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + +private: + QFont iconFont; //图形字体 + QList btns; //按钮队列 + QList pixNormal; //正常图片队列 + QList pixHover; //悬停图片队列 + QList pixPressed; //按下图片队列 + QList pixChecked; //选中图片队列 + +private slots: + //按钮选中状态切换处理 + void toggled(bool checked); + +public: + //获取图形字体 + QFont getIconFont(); + + //设置图形字体到标签 + void setIcon1(QLabel *lab, int icon, quint32 size = 12); + //设置图形字体到按钮 + void setIcon1(QAbstractButton *btn, int icon, quint32 size = 12); + + //设置图形字体到图标 + void setPixmap1(QAbstractButton *btn, const QColor &color, + int icon, quint32 size = 12, + quint32 width = 15, quint32 height = 15, + int flags = Qt::AlignCenter); + //获取指定图形字体,可以指定文字大小,图片宽高,文字对齐 + QPixmap getPixmap1(const QColor &color, int icon, quint32 size = 12, + quint32 width = 15, quint32 height = 15, + int flags = Qt::AlignCenter); + + //指定导航面板样式,带图标和效果切换+悬停颜色+按下颜色+选中颜色 + void setStyle1(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); + void setStyle1(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); + void setStyle1(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); +}; + +#endif // ICONHELPER_H diff --git a/control/navbutton/main.cpp b/control/navbutton/main.cpp new file mode 100644 index 0000000..0ea7084 --- /dev/null +++ b/control/navbutton/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmnavbutton.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmNavButton w; + w.setWindowTitle("导航按钮控件 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/navbutton/main.qrc b/control/navbutton/main.qrc new file mode 100644 index 0000000..de5ece3 --- /dev/null +++ b/control/navbutton/main.qrc @@ -0,0 +1,5 @@ + + + font/fontawesome-webfont.ttf + + diff --git a/control/navbutton/navbutton.cpp b/control/navbutton/navbutton.cpp new file mode 100644 index 0000000..b2a3438 --- /dev/null +++ b/control/navbutton/navbutton.cpp @@ -0,0 +1,631 @@ +#pragma execution_character_set("utf-8") + +#include "navbutton.h" +#include "qpainter.h" +#include "qdebug.h" + +NavButton::NavButton(QWidget *parent) : QPushButton(parent) +{ + paddingLeft = 20; + paddingRight = 5; + paddingTop = 5; + paddingBottom = 5; + textAlign = TextAlign_Left; + + showTriangle = false; + triangleLen = 5; + trianglePosition = TrianglePosition_Right; + triangleColor = QColor(255, 255, 255); + + showIcon = false; + iconSpace = 10; + iconSize = QSize(16, 16); + iconNormal = QPixmap(); + iconHover = QPixmap(); + iconCheck = QPixmap(); + + showLine = true; + lineSpace = 0; + lineWidth = 5; + linePosition = LinePosition_Left; + lineColor = QColor(0, 187, 158); + + normalBgColor = QColor(230, 230, 230); + hoverBgColor = QColor(130, 130, 130); + checkBgColor = QColor(80, 80, 80); + normalTextColor = QColor(100, 100, 100); + hoverTextColor = QColor(255, 255, 255); + checkTextColor = QColor(255, 255, 255); + + normalBgBrush = Qt::NoBrush; + hoverBgBrush = Qt::NoBrush; + checkBgBrush = Qt::NoBrush; + + hover = false; + setCheckable(true); + setText("导航按钮"); +} + +void NavButton::enterEvent(QEvent *) +{ + hover = true; + this->update(); +} + +void NavButton::leaveEvent(QEvent *) +{ + hover = false; + this->update(); +} + +void NavButton::paintEvent(QPaintEvent *) +{ + //绘制准备工作,启用反锯齿 + QPainter painter(this); + painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); + + //绘制背景 + drawBg(&painter); + //绘制文字 + drawText(&painter); + //绘制图标 + drawIcon(&painter); + //绘制边框线条 + drawLine(&painter); + //绘制倒三角 + drawTriangle(&painter); +} + +void NavButton::drawBg(QPainter *painter) +{ + painter->save(); + painter->setPen(Qt::NoPen); + + int width = this->width(); + int height = this->height(); + + QRect bgRect; + if (linePosition == LinePosition_Left) { + bgRect = QRect(lineSpace, 0, width - lineSpace, height); + } else if (linePosition == LinePosition_Right) { + bgRect = QRect(0, 0, width - lineSpace, height); + } else if (linePosition == LinePosition_Top) { + bgRect = QRect(0, lineSpace, width, height - lineSpace); + } else if (linePosition == LinePosition_Bottom) { + bgRect = QRect(0, 0, width, height - lineSpace); + } + + //如果画刷存在则取画刷 + QBrush bgBrush; + if (isChecked()) { + bgBrush = checkBgBrush; + } else if (hover) { + bgBrush = hoverBgBrush; + } else { + bgBrush = normalBgBrush; + } + + if (bgBrush != Qt::NoBrush) { + painter->setBrush(bgBrush); + } else { + //根据当前状态选择对应颜色 + QColor bgColor; + if (isChecked()) { + bgColor = checkBgColor; + } else if (hover) { + bgColor = hoverBgColor; + } else { + bgColor = normalBgColor; + } + + painter->setBrush(bgColor); + } + + painter->drawRect(bgRect); + + painter->restore(); +} + +void NavButton::drawText(QPainter *painter) +{ + painter->save(); + painter->setBrush(Qt::NoBrush); + + //根据当前状态选择对应颜色 + QColor textColor; + if (isChecked()) { + textColor = checkTextColor; + } else if (hover) { + textColor = hoverTextColor; + } else { + textColor = normalTextColor; + } + + QRect textRect = QRect(paddingLeft, paddingTop, width() - paddingLeft - paddingRight, height() - paddingTop - paddingBottom); + painter->setPen(textColor); + painter->drawText(textRect, textAlign | Qt::AlignVCenter, text()); + + painter->restore(); +} + +void NavButton::drawIcon(QPainter *painter) +{ + if (!showIcon) { + return; + } + + painter->save(); + + QPixmap pix; + if (isChecked()) { + pix = iconCheck; + } else if (hover) { + pix = iconHover; + } else { + pix = iconNormal; + } + + if (!pix.isNull()) { + //等比例平滑缩放图标 + pix = pix.scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); + painter->drawPixmap(iconSpace, (height() - iconSize.height()) / 2, pix); + } + + painter->restore(); +} + +void NavButton::drawLine(QPainter *painter) +{ + if (!showLine) { + return; + } + + if (!isChecked()) { + return; + } + + painter->save(); + + QPen pen; + pen.setWidth(lineWidth); + pen.setColor(lineColor); + painter->setPen(pen); + + //根据线条位置设置线条坐标 + QPoint pointStart, pointEnd; + if (linePosition == LinePosition_Left) { + pointStart = QPoint(0, 0); + pointEnd = QPoint(0, height()); + } else if (linePosition == LinePosition_Right) { + pointStart = QPoint(width(), 0); + pointEnd = QPoint(width(), height()); + } else if (linePosition == LinePosition_Top) { + pointStart = QPoint(0, 0); + pointEnd = QPoint(width(), 0); + } else if (linePosition == LinePosition_Bottom) { + pointStart = QPoint(0, height()); + pointEnd = QPoint(width(), height()); + } + + painter->drawLine(pointStart, pointEnd); + + painter->restore(); +} + +void NavButton::drawTriangle(QPainter *painter) +{ + if (!showTriangle) { + return; + } + + //选中或者悬停显示 + if (!hover && !isChecked()) { + return; + } + + painter->save(); + painter->setPen(Qt::NoPen); + painter->setBrush(triangleColor); + + //绘制在右侧中间,根据设定的倒三角的边长设定三个点位置 + int width = this->width(); + int height = this->height(); + int midWidth = width / 2; + int midHeight = height / 2; + + QPolygon pts; + if (trianglePosition == TrianglePosition_Left) { + pts.setPoints(3, triangleLen, midHeight, 0, midHeight - triangleLen, 0, midHeight + triangleLen); + } else if (trianglePosition == TrianglePosition_Right) { + pts.setPoints(3, width - triangleLen, midHeight, width, midHeight - triangleLen, width, midHeight + triangleLen); + } else if (trianglePosition == TrianglePosition_Top) { + pts.setPoints(3, midWidth, triangleLen, midWidth - triangleLen, 0, midWidth + triangleLen, 0); + } else if (trianglePosition == TrianglePosition_Bottom) { + pts.setPoints(3, midWidth, height - triangleLen, midWidth - triangleLen, height, midWidth + triangleLen, height); + } + + painter->drawPolygon(pts); + + painter->restore(); +} + +QSize NavButton::sizeHint() const +{ + return QSize(100, 30); +} + +QSize NavButton::minimumSizeHint() const +{ + return QSize(20, 10); +} + +int NavButton::getPaddingLeft() const +{ + return this->paddingLeft; +} + +void NavButton::setPaddingLeft(int paddingLeft) +{ + if (this->paddingLeft != paddingLeft) { + this->paddingLeft = paddingLeft; + this->update(); + } +} + +int NavButton::getPaddingRight() const +{ + return this->paddingRight; +} + +void NavButton::setPaddingRight(int paddingRight) +{ + if (this->paddingRight != paddingRight) { + this->paddingRight = paddingRight; + this->update(); + } +} + +int NavButton::getPaddingTop() const +{ + return this->paddingTop; +} + +void NavButton::setPaddingTop(int paddingTop) +{ + if (this->paddingTop != paddingTop) { + this->paddingTop = paddingTop; + this->update(); + } +} + +int NavButton::getPaddingBottom() const +{ + return this->paddingBottom; +} + +void NavButton::setPaddingBottom(int paddingBottom) +{ + if (this->paddingBottom != paddingBottom) { + this->paddingBottom = paddingBottom; + this->update(); + } +} + +void NavButton::setPadding(int padding) +{ + setPadding(padding, padding, padding, padding); +} + +void NavButton::setPadding(int paddingLeft, int paddingRight, int paddingTop, int paddingBottom) +{ + this->paddingLeft = paddingLeft; + this->paddingRight = paddingRight; + this->paddingTop = paddingTop; + this->paddingBottom = paddingBottom; + this->update(); +} + +NavButton::TextAlign NavButton::getTextAlign() const +{ + return this->textAlign; +} + +void NavButton::setTextAlign(const NavButton::TextAlign &textAlign) +{ + if (this->textAlign != textAlign) { + this->textAlign = textAlign; + this->update(); + } +} + +bool NavButton::getShowTriangle() const +{ + return this->showTriangle; +} + +void NavButton::setShowTriangle(bool showTriangle) +{ + if (this->showTriangle != showTriangle) { + this->showTriangle = showTriangle; + this->update(); + } +} + +int NavButton::getTriangleLen() const +{ + return this->triangleLen; +} + +void NavButton::setTriangleLen(int triangleLen) +{ + if (this->triangleLen != triangleLen) { + this->triangleLen = triangleLen; + this->update(); + } +} + +NavButton::TrianglePosition NavButton::getTrianglePosition() const +{ + return this->trianglePosition; +} + +void NavButton::setTrianglePosition(const NavButton::TrianglePosition &trianglePosition) +{ + if (this->trianglePosition != trianglePosition) { + this->trianglePosition = trianglePosition; + this->update(); + } +} + +QColor NavButton::getTriangleColor() const +{ + return this->triangleColor; +} + +void NavButton::setTriangleColor(const QColor &triangleColor) +{ + if (this->triangleColor != triangleColor) { + this->triangleColor = triangleColor; + this->update(); + } +} + +bool NavButton::getShowIcon() const +{ + return this->showIcon; +} + +void NavButton::setShowIcon(bool showIcon) +{ + if (this->showIcon != showIcon) { + this->showIcon = showIcon; + this->update(); + } +} + +int NavButton::getIconSpace() const +{ + return this->iconSpace; +} + +void NavButton::setIconSpace(int iconSpace) +{ + if (this->iconSpace != iconSpace) { + this->iconSpace = iconSpace; + this->update(); + } +} + +QSize NavButton::getIconSize() const +{ + return this->iconSize; +} + +void NavButton::setIconSize(const QSize &iconSize) +{ + if (this->iconSize != iconSize) { + this->iconSize = iconSize; + this->update(); + } +} + +QPixmap NavButton::getIconNormal() const +{ + return this->iconNormal; +} + +void NavButton::setIconNormal(const QPixmap &iconNormal) +{ + this->iconNormal = iconNormal; + this->update(); +} + +QPixmap NavButton::getIconHover() const +{ + return this->iconHover; +} + +void NavButton::setIconHover(const QPixmap &iconHover) +{ + this->iconHover = iconHover; + this->update(); +} + +QPixmap NavButton::getIconCheck() const +{ + return this->iconCheck; +} + +void NavButton::setIconCheck(const QPixmap &iconCheck) +{ + this->iconCheck = iconCheck; + this->update(); +} + +bool NavButton::getShowLine() const +{ + return this->showLine; +} + +void NavButton::setShowLine(bool showLine) +{ + if (this->showLine != showLine) { + this->showLine = showLine; + this->update(); + } +} + +int NavButton::getLineSpace() const +{ + return this->lineSpace; +} + +void NavButton::setLineSpace(int lineSpace) +{ + if (this->lineSpace != lineSpace) { + this->lineSpace = lineSpace; + this->update(); + } +} + +int NavButton::getLineWidth() const +{ + return this->lineWidth; +} + +void NavButton::setLineWidth(int lineWidth) +{ + if (this->lineWidth != lineWidth) { + this->lineWidth = lineWidth; + this->update(); + } +} + +NavButton::LinePosition NavButton::getLinePosition() const +{ + return this->linePosition; +} + +void NavButton::setLinePosition(const NavButton::LinePosition &linePosition) +{ + if (this->linePosition != linePosition) { + this->linePosition = linePosition; + this->update(); + } +} + +QColor NavButton::getLineColor() const +{ + return this->lineColor; +} + +void NavButton::setLineColor(const QColor &lineColor) +{ + if (this->lineColor != lineColor) { + this->lineColor = lineColor; + this->update(); + } +} + +QColor NavButton::getNormalBgColor() const +{ + return this->normalBgColor; +} + +void NavButton::setNormalBgColor(const QColor &normalBgColor) +{ + if (this->normalBgColor != normalBgColor) { + this->normalBgColor = normalBgColor; + this->update(); + } +} + +QColor NavButton::getHoverBgColor() const +{ + return this->hoverBgColor; +} + +void NavButton::setHoverBgColor(const QColor &hoverBgColor) +{ + if (this->hoverBgColor != hoverBgColor) { + this->hoverBgColor = hoverBgColor; + this->update(); + } +} + +QColor NavButton::getCheckBgColor() const +{ + return this->checkBgColor; +} + +void NavButton::setCheckBgColor(const QColor &checkBgColor) +{ + if (this->checkBgColor != checkBgColor) { + this->checkBgColor = checkBgColor; + this->update(); + } +} + +QColor NavButton::getNormalTextColor() const +{ + return this->normalTextColor; +} + +void NavButton::setNormalTextColor(const QColor &normalTextColor) +{ + if (this->normalTextColor != normalTextColor) { + this->normalTextColor = normalTextColor; + this->update(); + } +} + + +QColor NavButton::getHoverTextColor() const +{ + return this->hoverTextColor; +} + +void NavButton::setHoverTextColor(const QColor &hoverTextColor) +{ + if (this->hoverTextColor != hoverTextColor) { + this->hoverTextColor = hoverTextColor; + this->update(); + } +} + +QColor NavButton::getCheckTextColor() const +{ + return this->checkTextColor; +} + +void NavButton::setCheckTextColor(const QColor &checkTextColor) +{ + if (this->checkTextColor != checkTextColor) { + this->checkTextColor = checkTextColor; + this->update(); + } +} + +void NavButton::setNormalBgBrush(const QBrush &normalBgBrush) +{ + if (this->normalBgBrush != normalBgBrush) { + this->normalBgBrush = normalBgBrush; + this->update(); + } +} + +void NavButton::setHoverBgBrush(const QBrush &hoverBgBrush) +{ + if (this->hoverBgBrush != hoverBgBrush) { + this->hoverBgBrush = hoverBgBrush; + this->update(); + } +} + +void NavButton::setCheckBgBrush(const QBrush &checkBgBrush) +{ + if (this->checkBgBrush != checkBgBrush) { + this->checkBgBrush = checkBgBrush; + this->update(); + } +} diff --git a/control/navbutton/navbutton.h b/control/navbutton/navbutton.h new file mode 100644 index 0000000..32570eb --- /dev/null +++ b/control/navbutton/navbutton.h @@ -0,0 +1,263 @@ +#ifndef NAVBUTTON_H +#define NAVBUTTON_H + +/** + * 导航按钮控件 作者:feiyangqingyun(QQ:517216493) 2017-12-19 + * 1. 可设置文字的左侧、右侧、顶部、底部间隔。 + * 2. 可设置文字对齐方式。 + * 3. 可设置显示倒三角、倒三角边长、倒三角位置、倒三角颜色。 + * 4. 可设置显示图标、图标间隔、图标尺寸、正常状态图标、悬停状态图标、选中状态图标。 + * 5. 可设置显示边框线条、线条宽度、线条间隔、线条位置、线条颜色。 + * 6. 可设置正常背景颜色、悬停背景颜色、选中背景颜色。 + * 7. 可设置正常文字颜色、悬停文字颜色、选中文字颜色。 + * 8. 可设置背景颜色为画刷颜色。 + */ + +#include + +#ifdef quc +class Q_DECL_EXPORT NavButton : public QPushButton +#else +class NavButton : public QPushButton +#endif + +{ + Q_OBJECT + Q_ENUMS(TextAlign) + Q_ENUMS(TrianglePosition) + Q_ENUMS(LinePosition) + Q_ENUMS(IconPosition) + + Q_PROPERTY(int paddingLeft READ getPaddingLeft WRITE setPaddingLeft) + Q_PROPERTY(int paddingRight READ getPaddingRight WRITE setPaddingRight) + Q_PROPERTY(int paddingTop READ getPaddingTop WRITE setPaddingTop) + Q_PROPERTY(int paddingBottom READ getPaddingBottom WRITE setPaddingBottom) + Q_PROPERTY(TextAlign textAlign READ getTextAlign WRITE setTextAlign) + + Q_PROPERTY(bool showTriangle READ getShowTriangle WRITE setShowTriangle) + Q_PROPERTY(int triangleLen READ getTriangleLen WRITE setTriangleLen) + Q_PROPERTY(TrianglePosition trianglePosition READ getTrianglePosition WRITE setTrianglePosition) + Q_PROPERTY(QColor triangleColor READ getTriangleColor WRITE setTriangleColor) + + Q_PROPERTY(bool showIcon READ getShowIcon WRITE setShowIcon) + Q_PROPERTY(int iconSpace READ getIconSpace WRITE setIconSpace) + Q_PROPERTY(QSize iconSize READ getIconSize WRITE setIconSize) + Q_PROPERTY(QPixmap iconNormal READ getIconNormal WRITE setIconNormal) + Q_PROPERTY(QPixmap iconHover READ getIconHover WRITE setIconHover) + Q_PROPERTY(QPixmap iconCheck READ getIconCheck WRITE setIconCheck) + + Q_PROPERTY(bool showLine READ getShowLine WRITE setShowLine) + Q_PROPERTY(int lineSpace READ getLineSpace WRITE setLineSpace) + Q_PROPERTY(int lineWidth READ getLineWidth WRITE setLineWidth) + Q_PROPERTY(LinePosition linePosition READ getLinePosition WRITE setLinePosition) + Q_PROPERTY(QColor lineColor READ getLineColor WRITE setLineColor) + + Q_PROPERTY(QColor normalBgColor READ getNormalBgColor WRITE setNormalBgColor) + Q_PROPERTY(QColor hoverBgColor READ getHoverBgColor WRITE setHoverBgColor) + Q_PROPERTY(QColor checkBgColor READ getCheckBgColor WRITE setCheckBgColor) + Q_PROPERTY(QColor normalTextColor READ getNormalTextColor WRITE setNormalTextColor) + Q_PROPERTY(QColor hoverTextColor READ getHoverTextColor WRITE setHoverTextColor) + Q_PROPERTY(QColor checkTextColor READ getCheckTextColor WRITE setCheckTextColor) + +public: + enum TextAlign { + TextAlign_Left = 0x0001, //左侧对齐 + TextAlign_Right = 0x0002, //右侧对齐 + TextAlign_Top = 0x0020, //顶部对齐 + TextAlign_Bottom = 0x0040, //底部对齐 + TextAlign_Center = 0x0004 //居中对齐 + }; + + enum TrianglePosition { + TrianglePosition_Left = 0, //左侧 + TrianglePosition_Right = 1, //右侧 + TrianglePosition_Top = 2, //顶部 + TrianglePosition_Bottom = 3 //底部 + }; + + enum IconPosition { + IconPosition_Left = 0, //左侧 + IconPosition_Right = 1, //右侧 + IconPosition_Top = 2, //顶部 + IconPosition_Bottom = 3 //底部 + }; + + enum LinePosition { + LinePosition_Left = 0, //左侧 + LinePosition_Right = 1, //右侧 + LinePosition_Top = 2, //顶部 + LinePosition_Bottom = 3 //底部 + }; + + explicit NavButton(QWidget *parent = 0); + +protected: + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + void paintEvent(QPaintEvent *); + void drawBg(QPainter *painter); + void drawText(QPainter *painter); + void drawIcon(QPainter *painter); + void drawLine(QPainter *painter); + void drawTriangle(QPainter *painter); + +private: + int paddingLeft; //文字左侧间隔 + int paddingRight; //文字右侧间隔 + int paddingTop; //文字顶部间隔 + int paddingBottom; //文字底部间隔 + TextAlign textAlign; //文字对齐 + + bool showTriangle; //显示倒三角 + int triangleLen; //倒三角边长 + TrianglePosition trianglePosition;//倒三角位置 + QColor triangleColor; //倒三角颜色 + + bool showIcon; //显示图标 + int iconSpace; //图标间隔 + QSize iconSize; //图标尺寸 + QPixmap iconNormal; //正常图标 + QPixmap iconHover; //悬停图标 + QPixmap iconCheck; //选中图标 + + bool showLine; //显示线条 + int lineSpace; //线条间隔 + int lineWidth; //线条宽度 + LinePosition linePosition; //线条位置 + QColor lineColor; //线条颜色 + + QColor normalBgColor; //正常背景颜色 + QColor hoverBgColor; //悬停背景颜色 + QColor checkBgColor; //选中背景颜色 + QColor normalTextColor; //正常文字颜色 + QColor hoverTextColor; //悬停文字颜色 + QColor checkTextColor; //选中文字颜色 + + QBrush normalBgBrush; //正常背景画刷 + QBrush hoverBgBrush; //悬停背景画刷 + QBrush checkBgBrush; //选中背景画刷 + + bool hover; //悬停标志位 + +public: + //默认尺寸和最小尺寸 + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //获取和设置文字左侧间隔 + int getPaddingLeft() const; + void setPaddingLeft(int paddingLeft); + + //获取和设置文字左侧间隔 + int getPaddingRight() const; + void setPaddingRight(int paddingRight); + + //获取和设置文字顶部间隔 + int getPaddingTop() const; + void setPaddingTop(int paddingTop); + + //获取和设置文字底部间隔 + int getPaddingBottom() const; + void setPaddingBottom(int paddingBottom); + + //设置边距 + void setPadding(int padding); + void setPadding(int paddingLeft, int paddingRight, int paddingTop, int paddingBottom); + + //获取和设置文字对齐 + TextAlign getTextAlign() const; + void setTextAlign(const TextAlign &textAlign); + + //获取和设置显示倒三角 + bool getShowTriangle() const; + void setShowTriangle(bool showTriangle); + + //获取和设置倒三角边长 + int getTriangleLen() const; + void setTriangleLen(int triangleLen); + + //获取和设置倒三角位置 + TrianglePosition getTrianglePosition() const; + void setTrianglePosition(const TrianglePosition &trianglePosition); + + //获取和设置倒三角颜色 + QColor getTriangleColor() const; + void setTriangleColor(const QColor &triangleColor); + + //获取和设置显示图标 + bool getShowIcon() const; + void setShowIcon(bool showIcon); + + //获取和设置图标间隔 + int getIconSpace() const; + void setIconSpace(int iconSpace); + + //获取和设置图标尺寸 + QSize getIconSize() const; + void setIconSize(const QSize &iconSize); + + //获取和设置正常图标 + QPixmap getIconNormal() const; + void setIconNormal(const QPixmap &iconNormal); + + //获取和设置悬停图标 + QPixmap getIconHover() const; + void setIconHover(const QPixmap &iconHover); + + //获取和设置按下图标 + QPixmap getIconCheck() const; + void setIconCheck(const QPixmap &iconCheck); + + //获取和设置显示线条 + bool getShowLine() const; + void setShowLine(bool showLine); + + //获取和设置线条间隔 + int getLineSpace() const; + void setLineSpace(int lineSpace); + + //获取和设置线条宽度 + int getLineWidth() const; + void setLineWidth(int lineWidth); + + //获取和设置线条位置 + LinePosition getLinePosition() const; + void setLinePosition(const LinePosition &linePosition); + + //获取和设置线条颜色 + QColor getLineColor() const; + void setLineColor(const QColor &lineColor); + + //获取和设置正常背景颜色 + QColor getNormalBgColor() const; + void setNormalBgColor(const QColor &normalBgColor); + + //获取和设置悬停背景颜色 + QColor getHoverBgColor() const; + void setHoverBgColor(const QColor &hoverBgColor); + + //获取和设置选中背景颜色 + QColor getCheckBgColor() const; + void setCheckBgColor(const QColor &checkBgColor); + + //获取和设置正常文字颜色 + QColor getNormalTextColor() const; + void setNormalTextColor(const QColor &normalTextColor); + + //获取和设置悬停文字颜色 + QColor getHoverTextColor() const; + void setHoverTextColor(const QColor &hoverTextColor); + + //获取和设置选中文字颜色 + QColor getCheckTextColor() const; + void setCheckTextColor(const QColor &checkTextColor); + + //设置正常背景画刷 + void setNormalBgBrush(const QBrush &normalBgBrush); + //设置悬停背景画刷 + void setHoverBgBrush(const QBrush &hoverBgBrush); + //设置选中背景画刷 + void setCheckBgBrush(const QBrush &checkBgBrush); +}; + +#endif // NAVBUTTON_H diff --git a/control/navbutton/navbutton.pro b/control/navbutton/navbutton.pro new file mode 100644 index 0000000..aa4d310 --- /dev/null +++ b/control/navbutton/navbutton.pro @@ -0,0 +1,21 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = navbutton +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += iconhelper.cpp +SOURCES += frmnavbutton.cpp +SOURCES += navbutton.cpp + +HEADERS += frmnavbutton.h +HEADERS += iconhelper.h +HEADERS += navbutton.h + +FORMS += frmnavbutton.ui + +RESOURCES += main.qrc diff --git a/control/savelog/frmsavelog.cpp b/control/savelog/frmsavelog.cpp new file mode 100644 index 0000000..26071cb --- /dev/null +++ b/control/savelog/frmsavelog.cpp @@ -0,0 +1,183 @@ +#pragma execution_character_set("utf-8") + +#include "frmsavelog.h" +#include "ui_frmsavelog.h" +#include "savelog.h" +#include "qdatetime.h" +#include "qtimer.h" +#include "qdebug.h" + +frmSaveLog::frmSaveLog(QWidget *parent) : QWidget(parent), ui(new Ui::frmSaveLog) +{ + ui->setupUi(this); + this->initForm(); +} + +frmSaveLog::~frmSaveLog() +{ + delete ui; +} + +void frmSaveLog::initForm() +{ + //启动定时器追加数据 + count = 0; + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(append())); + timer->setInterval(100); + + //添加消息类型 + QStringList types, datas; + types << "Debug" << "Info" << "Warning" << "Critical" << "Fatal"; + datas << "1" << "2" << "4" << "8" << "16"; + ui->cboxType->addItems(types); + + //添加消息类型到列表用于勾选设置哪些类型需要重定向 + int count = types.count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem *item = new QListWidgetItem; + item->setText(types.at(i)); + item->setData(Qt::UserRole, datas.at(i)); + item->setCheckState(Qt::Checked); + ui->listType->addItem(item); + } + + //添加日志文件大小下拉框 + ui->cboxSize->addItem("不启用", 0); + ui->cboxSize->addItem("5kb", 5); + ui->cboxSize->addItem("10kb", 10); + ui->cboxSize->addItem("30kb", 30); + ui->cboxSize->addItem("1mb", 1024); + + ui->cboxRow->addItem("不启用", 0); + ui->cboxRow->addItem("100条", 100); + ui->cboxRow->addItem("500条", 500); + ui->cboxRow->addItem("2000条", 2000); + ui->cboxRow->addItem("10000条", 10000); + + //设置是否开启日志上下文打印比如行号、函数等 + SaveLog::Instance()->setUseContext(false); + //设置文件存储目录 + SaveLog::Instance()->setPath(qApp->applicationDirPath() + "/log"); +} + +void frmSaveLog::append(const QString &flag) +{ + if (count >= 100) { + count = 0; + ui->txtMain->clear(); + } + + QString str1; + int type = ui->cboxType->currentIndex(); + if (!ui->ckSave->isChecked()) { + if (type == 0) { + str1 = "Debug "; + } else if (type == 1) { + str1 = "Infox "; + } else if (type == 2) { + str1 = "Warnx "; + } else if (type == 3) { + str1 = "Error "; + } else if (type == 4) { + str1 = "Fatal "; + } + } + + QString str2 = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss"); + QString str3 = flag.isEmpty() ? "自动插入消息" : flag; + QString msg = QString("%1当前时间: %2 %3").arg(str1).arg(str2).arg(str3); + + //开启网络重定向换成英文方便接收解析不乱码 + //对方接收解析的工具未必是utf8 + if (ui->ckNet->isChecked()) { + msg = QString("%1time: %2 %3").arg(str1).arg(str2).arg("(QQ: 517216493 WX: feiyangqingyun)"); + } + + count++; + ui->txtMain->append(msg); + + //根据不同的类型打印 + //TMD转换要分两部走不然msvc的debug版本会乱码(英文也一样) + //char *data = msg.toUtf8().data(); + QByteArray buffer = msg.toUtf8(); + const char *data = buffer.constData(); + if (type == 0) { + qDebug(data); + } else if (type == 1) { +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + qInfo(data); +#endif + } else if (type == 2) { + qWarning(data); + } else if (type == 3) { + qCritical(data); + } else if (type == 4) { + //调用下面这个打印完会直接退出程序 + qFatal(data); + } +} + +void frmSaveLog::on_btnLog_clicked() +{ + append("手动插入消息"); +} + +void frmSaveLog::on_ckTimer_stateChanged(int arg1) +{ + if (arg1 == 0) { + timer->stop(); + } else { + timer->start(); + on_btnLog_clicked(); + } +} + +void frmSaveLog::on_ckNet_stateChanged(int arg1) +{ + SaveLog::Instance()->setListenPort(ui->txtPort->text().toInt()); + SaveLog::Instance()->setToNet(ui->ckNet->isChecked()); + on_btnLog_clicked(); +} + +void frmSaveLog::on_ckSave_stateChanged(int arg1) +{ + if (arg1 == 0) { + SaveLog::Instance()->stop(); + } else { + SaveLog::Instance()->start(); + on_btnLog_clicked(); + } +} + +void frmSaveLog::on_cboxSize_currentIndexChanged(int index) +{ + int size = ui->cboxSize->itemData(index).toInt(); + SaveLog::Instance()->setMaxSize(size); + on_btnLog_clicked(); +} + +void frmSaveLog::on_cboxRow_currentIndexChanged(int index) +{ + int row = ui->cboxRow->itemData(index).toInt(); + SaveLog::Instance()->setMaxRow(row); + on_btnLog_clicked(); +} + +void frmSaveLog::on_listType_itemPressed(QListWidgetItem *item) +{ + //切换选中行状态 + item->setCheckState(item->checkState() == Qt::Checked ? Qt::Unchecked : Qt::Checked); + + //找到所有勾选的类型进行设置 + quint8 types = 0; + int count = ui->listType->count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem *item = ui->listType->item(i); + if (item->checkState() == Qt::Checked) { + types += item->data(Qt::UserRole).toInt(); + } + } + + SaveLog::Instance()->setMsgType((MsgType)types); +} diff --git a/control/savelog/frmsavelog.h b/control/savelog/frmsavelog.h new file mode 100644 index 0000000..2c54e94 --- /dev/null +++ b/control/savelog/frmsavelog.h @@ -0,0 +1,39 @@ +#ifndef FRMSAVELOG_H +#define FRMSAVELOG_H + +#include +#include + +namespace Ui { +class frmSaveLog; +} + +class frmSaveLog : public QWidget +{ + Q_OBJECT + +public: + explicit frmSaveLog(QWidget *parent = 0); + ~frmSaveLog(); + +private: + Ui::frmSaveLog *ui; + int count; + QTimer *timer; + +private slots: + void initForm(); + void append(const QString &flag = QString()); + +private slots: + void on_btnLog_clicked(); + void on_ckTimer_stateChanged(int arg1); + void on_ckNet_stateChanged(int arg1); + void on_ckSave_stateChanged(int arg1); + + void on_cboxSize_currentIndexChanged(int index); + void on_cboxRow_currentIndexChanged(int index); + void on_listType_itemPressed(QListWidgetItem *item); +}; + +#endif // FRMSAVELOG_H diff --git a/control/savelog/frmsavelog.ui b/control/savelog/frmsavelog.ui new file mode 100644 index 0000000..0241ecc --- /dev/null +++ b/control/savelog/frmsavelog.ui @@ -0,0 +1,134 @@ + + + frmSaveLog + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + QFrame::Box + + + QFrame::Sunken + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + 文件大小 + + + + + + + 文件行数 + + + + + + + 消息类型 + + + + + + + 监听端口 + + + + + + + 6000 + + + + + + + + + + + + 开启日志重定向 + + + + + + + 日志输出到网络 + + + + + + + 定时器打印消息 + + + + + + + 手动插入消息 + + + + + + + + + + + diff --git a/control/savelog/main.cpp b/control/savelog/main.cpp new file mode 100644 index 0000000..d3c50ff --- /dev/null +++ b/control/savelog/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmsavelog.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmSaveLog w; + w.setWindowTitle("日志重定向示例 V2022 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/savelog/savelog.cpp b/control/savelog/savelog.cpp new file mode 100644 index 0000000..65b37df --- /dev/null +++ b/control/savelog/savelog.cpp @@ -0,0 +1,372 @@ +#pragma execution_character_set("utf-8") + +#include "savelog.h" +#include "qmutex.h" +#include "qdir.h" +#include "qfile.h" +#include "qtcpsocket.h" +#include "qtcpserver.h" +#include "qdatetime.h" +#include "qapplication.h" +#include "qtimer.h" +#include "qtextstream.h" +#include "qstringlist.h" + +#define QDATE qPrintable(QDate::currentDate().toString("yyyy-MM-dd")) +#define QDATETIMS qPrintable(QDateTime::currentDateTime().toString("yyyy-MM-dd-HH-mm-ss")) + +//日志重定向 +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) +void Log(QtMsgType type, const QMessageLogContext &context, const QString &msg) +#else +void Log(QtMsgType type, const char *msg) +#endif +{ + //加锁,防止多线程中qdebug太频繁导致崩溃 + static QMutex mutex; + QMutexLocker locker(&mutex); + QString content; + + //这里可以根据不同的类型加上不同的头部用于区分 + int msgType = SaveLog::Instance()->getMsgType(); + switch (type) { + case QtDebugMsg: + if ((msgType & MsgType_Debug) == MsgType_Debug) { + content = QString("Debug %1").arg(msg); + } + break; +#if (QT_VERSION >= QT_VERSION_CHECK(5,5,0)) + case QtInfoMsg: + if ((msgType & MsgType_Info) == MsgType_Info) { + content = QString("Infox %1").arg(msg); + } + break; +#endif + case QtWarningMsg: + if ((msgType & MsgType_Warning) == MsgType_Warning) { + content = QString("Warnx %1").arg(msg); + } + break; + case QtCriticalMsg: + if ((msgType & MsgType_Critical) == MsgType_Critical) { + content = QString("Error %1").arg(msg); + } + break; + case QtFatalMsg: + if ((msgType & MsgType_Fatal) == MsgType_Fatal) { + content = QString("Fatal %1").arg(msg); + } + break; + } + + //没有内容则返回 + if (content.isEmpty()) { + return; + } + + //加上打印代码所在代码文件、行号、函数名 +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + if (SaveLog::Instance()->getUseContext()) { + int line = context.line; + QString file = context.file; + QString function = context.function; + if (line > 0) { + content = QString("行号: %1 文件: %2 函数: %3\n%4").arg(line).arg(file).arg(function).arg(content); + } + } +#endif + + //还可以将数据转成html内容分颜色区分 + //将内容传给函数进行处理 + SaveLog::Instance()->save(content); +} + +QScopedPointer SaveLog::self; +SaveLog *SaveLog::Instance() +{ + if (self.isNull()) { + static QMutex mutex; + QMutexLocker locker(&mutex); + if (self.isNull()) { + self.reset(new SaveLog); + } + } + + return self.data(); +} + +SaveLog::SaveLog(QObject *parent) : QObject(parent) +{ + //必须用信号槽形式,不然提示 QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread + //估计日志钩子可能单独开了线程 + connect(this, SIGNAL(send(QString)), SendLog::Instance(), SLOT(send(QString))); + + isRun = false; + maxRow = currentRow = 0; + maxSize = 128; + toNet = false; + useContext = true; + + //全局的文件对象,在需要的时候打开而不是每次添加日志都打开 + file = new QFile(this); + //默认取应用程序根目录 + path = qApp->applicationDirPath(); + //默认取应用程序可执行文件名称 + QString str = qApp->applicationFilePath(); + QStringList list = str.split("/"); + name = list.at(list.count() - 1).split(".").at(0); + fileName = ""; + + //默认所有类型都输出 + msgType = MsgType(MsgType_Debug | MsgType_Info | MsgType_Warning | MsgType_Critical | MsgType_Fatal); +} + +SaveLog::~SaveLog() +{ + this->stop(); +} + +void SaveLog::openFile(const QString &fileName) +{ + //当文件名改变时才新建和打开文件而不是每次都打开文件(效率极低)或者一开始打开文件 + if (this->fileName != fileName) { + this->fileName = fileName; + //先关闭之前的 + if (file->isOpen()) { + file->close(); + } + //重新设置新的日志文件 + file->setFileName(fileName); + //以 Append 追加的形式打开 + file->open(QIODevice::WriteOnly | QIODevice::Append | QFile::Text); + } +} + +bool SaveLog::getUseContext() +{ + return this->useContext; +} + +MsgType SaveLog::getMsgType() +{ + return this->msgType; +} + +//安装日志钩子,输出调试信息到文件,便于调试 +void SaveLog::start() +{ + if (isRun) { + return; + } + + isRun = true; +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + qInstallMessageHandler(Log); +#else + qInstallMsgHandler(Log); +#endif +} + +//卸载日志钩子 +void SaveLog::stop() +{ + if (!isRun) { + return; + } + + isRun = false; + this->clear(); +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + qInstallMessageHandler(0); +#else + qInstallMsgHandler(0); +#endif +} + +void SaveLog::clear() +{ + currentRow = 0; + fileName.clear(); + if (file->isOpen()) { + file->close(); + } +} + +void SaveLog::save(const QString &content) +{ + //如果重定向输出到网络则通过网络发出去,否则输出到日志文件 + if (toNet) { + Q_EMIT send(content); + } else { + //目录不存在则先新建目录 + QDir dir(path); + if (!dir.exists()) { + dir.mkdir(path); + } + + //日志存储规则有多种策略 优先级 行数>大小>日期 + //1: 设置了最大行数限制则按照行数限制来 + //2: 设置了大小则按照大小来控制日志文件 + //3: 都没有设置都存储到日期命名的文件,只有当日期变化了才会切换到新的日志文件 + bool needOpen = false; + if (maxRow > 0) { + currentRow++; + if (fileName.isEmpty()) { + needOpen = true; + } else if (currentRow >= maxRow) { + needOpen = true; + } + } else if (maxSize > 0) { + //1MB=1024*1024 经过大量测试 QFile().size() 方法速度非常快 + //首次需要重新打开文件以及超过大小需要重新打开文件 + if (fileName.isEmpty()) { + needOpen = true; + } else if (file->size() > (maxSize * 1024)) { + needOpen = true; + } + } else { + //日期改变了才会触发 + QString fileName = QString("%1/%2_log_%3.txt").arg(path).arg(name).arg(QDATE); + openFile(fileName); + } + + if ((maxRow > 0 || maxSize > 0) && needOpen) { + currentRow = 0; + QString fileName = QString("%1/%2_log_%3.txt").arg(path).arg(name).arg(QDATETIMS); + openFile(fileName); + } + + //用文本流的输出速度更快 + QTextStream stream(file); + stream << content << "\n"; + } +} + +void SaveLog::setMaxRow(int maxRow) +{ + //这里可以限定最大最小值 + if (maxRow >= 0) { + this->maxRow = maxRow; + this->clear(); + } +} + +void SaveLog::setMaxSize(int maxSize) +{ + //这里可以限定最大最小值 + if (maxSize >= 0) { + this->maxSize = maxSize; + this->clear(); + } +} + +void SaveLog::setListenPort(int listenPort) +{ + SendLog::Instance()->setListenPort(listenPort); +} + +void SaveLog::setToNet(bool toNet) +{ + this->toNet = toNet; + if (toNet) { + SendLog::Instance()->start(); + } else { + SendLog::Instance()->stop(); + } +} + +void SaveLog::setUseContext(bool useContext) +{ + this->useContext = useContext; +} + +void SaveLog::setPath(const QString &path) +{ + this->path = path; +} + +void SaveLog::setName(const QString &name) +{ + this->name = name; +} + +void SaveLog::setMsgType(const MsgType &msgType) +{ + this->msgType = msgType; +} + + +//网络发送日志数据类 +QScopedPointer SendLog::self; +SendLog *SendLog::Instance() +{ + if (self.isNull()) { + static QMutex mutex; + QMutexLocker locker(&mutex); + if (self.isNull()) { + self.reset(new SendLog); + } + } + + return self.data(); +} + +SendLog::SendLog(QObject *parent) : QObject(parent) +{ + listenPort = 6000; + socket = NULL; + + //实例化网络通信服务器对象 + server = new QTcpServer(this); + connect(server, SIGNAL(newConnection()), this, SLOT(newConnection())); +} + +SendLog::~SendLog() +{ + if (socket != NULL) { + socket->disconnectFromHost(); + } + + server->close(); +} + +void SendLog::newConnection() +{ + //限定就一个连接 + while (server->hasPendingConnections()) { + socket = server->nextPendingConnection(); + } +} + +void SendLog::setListenPort(int listenPort) +{ + this->listenPort = listenPort; +} + +void SendLog::start() +{ + //启动端口监听 +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + server->listen(QHostAddress::AnyIPv4, listenPort); +#else + server->listen(QHostAddress::Any, listenPort); +#endif +} + +void SendLog::stop() +{ + if (socket != NULL) { + socket->disconnectFromHost(); + socket = NULL; + } + + server->close(); +} + +void SendLog::send(const QString &content) +{ + if (socket != NULL && socket->isOpen()) { + socket->write(content.toUtf8()); + //socket->flush(); + } +} diff --git a/control/savelog/savelog.h b/control/savelog/savelog.h new file mode 100644 index 0000000..d2e8098 --- /dev/null +++ b/control/savelog/savelog.h @@ -0,0 +1,154 @@ +#ifndef SAVELOG_H +#define SAVELOG_H + +/** + * 日志重定向输出 作者:feiyangqingyun(QQ:517216493) 2016-12-16 + * 1. 支持动态启动和停止。 + * 2. 支持日志存储的目录。 + * 3. 支持网络发出打印日志。 + * 4. 支持输出日志上下文信息比如所在代码文件、行号、函数名等。 + * 5. 支持设置日志文件大小限制,超过则自动分文件,默认128kb。 + * 6. 支持按照日志行数自动分文件,和日志大小条件互斥。 + * 7. 可选按照日期时间区分文件名存储日志。 + * 8. 日志文件命名规则优先级:行数》大小》日期。 + * 9. 自动加锁支持多线程。 + * 10. 可以分别控制哪些类型的日志需要重定向输出。 + * 11. 支持Qt4+Qt5+Qt6,开箱即用。 + * 12. 使用方式最简单,调用函数start()启动服务,stop()停止服务。 + */ + +#include + +class QFile; +class QTcpSocket; +class QTcpServer; + +//消息类型 +enum MsgType { + MsgType_Debug = 0x0001, + MsgType_Info = 0x0002, + MsgType_Warning = 0x0004, + MsgType_Critical = 0x0008, + MsgType_Fatal = 0x0010, +}; + +#ifdef quc +class Q_DECL_EXPORT SaveLog : public QObject +#else +class SaveLog : public QObject +#endif + +{ + Q_OBJECT +public: + static SaveLog *Instance(); + explicit SaveLog(QObject *parent = 0); + ~SaveLog(); + +private: + static QScopedPointer self; + + //是否在运行 + bool isRun; + //文件最大行数 0表示不启用 + int maxRow, currentRow; + //文件最大大小 0表示不启用 单位kb + int maxSize; + //是否重定向到网络 + bool toNet; + //是否输出日志上下文 + bool useContext; + + //文件对象 + QFile *file; + //日志文件路径 + QString path; + //日志文件名称 + QString name; + //日志文件完整名称 + QString fileName; + //消息类型 + MsgType msgType; + +private: + void openFile(const QString &fileName); + +public: + bool getUseContext(); + MsgType getMsgType(); + +Q_SIGNALS: + //发送内容信号 + void send(const QString &content); + +public Q_SLOTS: + //启动日志服务 + void start(); + //暂停日志服务 + void stop(); + + //清空状态 + void clear(); + //保存日志 + void save(const QString &content); + + //设置日志文件最大行数 + void setMaxRow(int maxRow); + //设置日志文件最大大小 单位kb + void setMaxSize(int maxSize); + + //设置监听端口 + void setListenPort(int listenPort); + //设置是否重定向到网络 + void setToNet(bool toNet); + //设置是否输出日志上下文 + void setUseContext(bool useContext); + + //设置日志文件存放路径 + void setPath(const QString &path); + //设置日志文件名称 + void setName(const QString &name); + //设置消息类型 + void setMsgType(const MsgType &msgType); +}; + +#ifdef quc +class Q_DECL_EXPORT SendLog : public QObject +#else +class SendLog : public QObject +#endif + +{ + Q_OBJECT +public: + static SendLog *Instance(); + explicit SendLog(QObject *parent = 0); + ~SendLog(); + +private: + static QScopedPointer self; + + //监听端口 + int listenPort; + //网络通信对象 + QTcpSocket *socket; + //网络监听服务器 + QTcpServer *server; + +private slots: + //新连接到来 + void newConnection(); + +public Q_SLOTS: + //设置监听端口 + void setListenPort(int listenPort); + + //启动和停止服务 + void start(); + void stop(); + + //发送日志 + void send(const QString &content); +}; + +#endif // SAVELOG_H diff --git a/control/savelog/savelog.pro b/control/savelog/savelog.pro new file mode 100644 index 0000000..6cee141 --- /dev/null +++ b/control/savelog/savelog.pro @@ -0,0 +1,17 @@ +QT += core gui network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = savelog +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmsavelog.cpp +SOURCES += savelog.cpp + +HEADERS += frmsavelog.h +HEADERS += savelog.h + +FORMS += frmsavelog.ui diff --git a/control/saveruntime/frmsaveruntime.cpp b/control/saveruntime/frmsaveruntime.cpp new file mode 100644 index 0000000..ce5994c --- /dev/null +++ b/control/saveruntime/frmsaveruntime.cpp @@ -0,0 +1,56 @@ +#pragma execution_character_set("utf-8") + +#include "frmsaveruntime.h" +#include "ui_frmsaveruntime.h" +#include "qfile.h" +#include "saveruntime.h" +#include "qdebug.h" + +frmSaveRunTime::frmSaveRunTime(QWidget *parent) : QWidget(parent), ui(new Ui::frmSaveRunTime) +{ + ui->setupUi(this); + //设置文件存储目录 + SaveRunTime::Instance()->setPath(qApp->applicationDirPath() + "/log"); +} + +frmSaveRunTime::~frmSaveRunTime() +{ + delete ui; +} + +void frmSaveRunTime::on_checkBox_stateChanged(int arg1) +{ + if (arg1 == 0) { + SaveRunTime::Instance()->stop(); + } else { + SaveRunTime::Instance()->start(); + } + on_btnOpen_clicked(); +} + +void frmSaveRunTime::on_btnAppend_clicked() +{ + SaveRunTime::Instance()->initLog(); + SaveRunTime::Instance()->appendLog(); + on_btnOpen_clicked(); +} + +void frmSaveRunTime::on_btnUpdate_clicked() +{ + SaveRunTime::Instance()->saveLog(); + on_btnOpen_clicked(); +} + +void frmSaveRunTime::on_btnOpen_clicked() +{ + QString path = qApp->applicationDirPath(); + QString name = qApp->applicationFilePath(); + QStringList list = name.split("/"); + name = list.at(list.count() - 1).split(".").at(0); + + QString fileName = QString("%1/log/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year()); + QFile file(fileName); + if (file.open(QFile::ReadOnly | QFile::Text)) { + ui->txtMain->setText(file.readAll()); + } +} diff --git a/control/saveruntime/frmsaveruntime.h b/control/saveruntime/frmsaveruntime.h new file mode 100644 index 0000000..20df424 --- /dev/null +++ b/control/saveruntime/frmsaveruntime.h @@ -0,0 +1,28 @@ +#ifndef FRMSAVERUNTIME_H +#define FRMSAVERUNTIME_H + +#include + +namespace Ui { +class frmSaveRunTime; +} + +class frmSaveRunTime : public QWidget +{ + Q_OBJECT + +public: + explicit frmSaveRunTime(QWidget *parent = 0); + ~frmSaveRunTime(); + +private: + Ui::frmSaveRunTime *ui; + +private slots: + void on_checkBox_stateChanged(int arg1); + void on_btnAppend_clicked(); + void on_btnUpdate_clicked(); + void on_btnOpen_clicked(); +}; + +#endif // FRMSAVERUNTIME_H diff --git a/control/saveruntime/frmsaveruntime.ui b/control/saveruntime/frmsaveruntime.ui new file mode 100644 index 0000000..72d3903 --- /dev/null +++ b/control/saveruntime/frmsaveruntime.ui @@ -0,0 +1,107 @@ + + + frmSaveRunTime + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + QFrame::Box + + + QFrame::Sunken + + + + + + 启动运行时间记录 + + + + + + + + 130 + 0 + + + + 插入一条记录 + + + + + + + + 130 + 0 + + + + 更新一条记录 + + + + + + + + 130 + 0 + + + + 打开记录文件 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + diff --git a/control/saveruntime/main.cpp b/control/saveruntime/main.cpp new file mode 100644 index 0000000..2cc5f2c --- /dev/null +++ b/control/saveruntime/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmsaveruntime.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmSaveRunTime w; + w.setWindowTitle("运行时间记录示例 V2022 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/saveruntime/saveruntime.cpp b/control/saveruntime/saveruntime.cpp new file mode 100644 index 0000000..0e4bf3d --- /dev/null +++ b/control/saveruntime/saveruntime.cpp @@ -0,0 +1,238 @@ +#pragma execution_character_set("utf-8") + +#include "saveruntime.h" +#include "qmutex.h" +#include "qdir.h" +#include "qfile.h" +#include "qapplication.h" +#include "qtimer.h" +#include "qtextstream.h" +#include "qstringlist.h" + +QScopedPointer SaveRunTime::self; +SaveRunTime *SaveRunTime::Instance() +{ + if (self.isNull()) { + static QMutex mutex; + QMutexLocker locker(&mutex); + if (self.isNull()) { + self.reset(new SaveRunTime); + } + } + + return self.data(); +} + +SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent) +{ + path = qApp->applicationDirPath(); + QString str = qApp->applicationFilePath(); + QStringList list = str.split("/"); + name = list.at(list.count() - 1).split(".").at(0); + + saveInterval = 1 * 60 * 1000; + startTime = QDateTime::currentDateTime(); + + //存储运行时间定时器 + timerSave = new QTimer(this); + timerSave->setInterval(saveInterval); + connect(timerSave, SIGNAL(timeout()), this, SLOT(saveLog())); +} + +SaveRunTime::~SaveRunTime() +{ + this->stop(); +} + +void SaveRunTime::getDiffValue(const QDateTime &startTime, const QDateTime &endTime, int &day, int &hour, int &minute) +{ + qint64 sec = startTime.secsTo(endTime); + day = hour = minute = 0; + int seconds = 0; + + while (sec > 0) { + seconds++; + if (seconds == 60) { + minute++; + seconds = 0; + } + + if (minute == 60) { + hour++; + minute = 0; + } + + if (hour == 24) { + day++; + hour = 0; + } + + sec--; + } +} + +void SaveRunTime::start() +{ + if (timerSave->isActive()) { + return; + } + + //开始时间变量必须在这,在部分嵌入式系统上开机后的时间不准确比如是1970,而后会变成1999或者其他时间 + //会在getDiffValue函数执行很久很久 + startTime = QDateTime::currentDateTime(); + timerSave->start(); + + initLog(); + appendLog(); + saveLog(); +} + +void SaveRunTime::stop() +{ + if (!timerSave->isActive()) { + return; + } + + timerSave->stop(); +} + +void SaveRunTime::newPath() +{ + //检查目录是否存在,不存在则先新建 + QDir dir(path); + if (!dir.exists()) { + dir.mkdir(path); + } +} + +void SaveRunTime::initLog() +{ + //判断当前年份的记事本文件是否存在,不存在则新建并且写入标题 + //存在则自动读取最后一行的id号 记事本文件格式内容 + //幢号 开始时间 结束时间 已运行时间 + //1 2016-01-01 12:33:33 2016-02-05 12:12:12 day: 0 hour: 0 minute: 0 + + newPath(); + logFile = QString("%1/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year()); + QFile file(logFile); + + if (file.size() == 0) { + if (file.open(QFile::WriteOnly | QFile::Text)) { + QString strID = QString("%1\t").arg("编号"); + QString strStartTime = QString("%1\t\t").arg("开始时间"); + QString strEndTime = QString("%1\t\t").arg("结束时间"); + QString strRunTime = QString("%1").arg("已运行时间"); + QString line = strID + strStartTime + strEndTime + strRunTime; + + QTextStream stream(&file); + stream << line << "\n"; + file.close(); + lastID = 0; + } + } else { + if (file.open(QFile::ReadOnly)) { + QString lastLine; + while (!file.atEnd()) { + lastLine = file.readLine(); + } + + file.close(); + QStringList list = lastLine.split("\t"); + lastID = list.at(0).toInt(); + } + } + + lastID++; +} + +void SaveRunTime::appendLog() +{ + newPath(); + logFile = QString("%1/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year()); + QFile file(logFile); + + //写入当前首次运行时间 + if (file.open(QFile::WriteOnly | QFile::Append | QFile::Text)) { + QString strID = QString("%1\t").arg(lastID); + QString strStartTime = QString("%1\t").arg(startTime.toString("yyyy-MM-dd HH:mm:ss")); + QString strEndTime = QString("%1\t").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")); + + int day, hour, minute; + getDiffValue(startTime, QDateTime::currentDateTime(), day, hour, minute); + QString strRunTime = QString("%1 天 %2 时 %3 分").arg(day).arg(hour).arg(minute); + QString line = strID + strStartTime + strEndTime + strRunTime; + + QTextStream stream(&file); + stream << line << "\n"; + file.close(); + } +} + +void SaveRunTime::saveLog() +{ + //每次保存都是将之前的所有文本读取出来,然后替换最后一行即可 + newPath(); + logFile = QString("%1/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year()); + QFile file(logFile); + + //如果日志文件不存在,则初始化一个日志文件 + if (file.size() == 0) { + initLog(); + appendLog(); + return; + } + + if (file.open(QFile::ReadWrite)) { + //一行行读取到链表 + QStringList content; + while (!file.atEnd()) { + content.append(file.readLine()); + } + + //重新清空文件 + file.resize(0); + //如果行数小于2则返回 + if (content.count() < 2) { + file.close(); + return; + } + + QString lastLine = content.last(); + QStringList list = lastLine.split("\t"); + + //计算已运行时间 + int day, hour, minute; + getDiffValue(startTime, QDateTime::currentDateTime(), day, hour, minute); + QString strRunTime = QString("%1 天 %2 时 %3 分").arg(day).arg(hour).arg(minute); + + //重新拼接最后一行 + list[2] = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss"); + list[3] = strRunTime; + lastLine = list.join("\t"); + + //重新替换最后一行并写入新的数据 + content[content.count() - 1] = lastLine; + + QTextStream stream(&file); + stream << content.join("") << "\n"; + file.close(); + } +} + +void SaveRunTime::setPath(const QString &path) +{ + this->path = path; +} + +void SaveRunTime::setName(const QString &name) +{ + this->name = name; +} + +void SaveRunTime::setSaveInterval(int saveInterval) +{ + if (this->saveInterval != saveInterval) { + this->saveInterval = saveInterval; + timerSave->setInterval(saveInterval); + } +} diff --git a/control/saveruntime/saveruntime.h b/control/saveruntime/saveruntime.h new file mode 100644 index 0000000..5c7ec98 --- /dev/null +++ b/control/saveruntime/saveruntime.h @@ -0,0 +1,77 @@ +#ifndef SAVERUNTIME_H +#define SAVERUNTIME_H + +/** + * 运行时间记录 作者:feiyangqingyun(QQ:517216493) 2016-12-16 + * 1. 可以启动和停止服务,在需要的时候启动。 + * 2. 可以指定日志文件存放目录。 + * 3. 可以指定时间日志输出间隔。 + * 4. 可以单独追加一条记录到日志文件。 + * 5. 日志为文本格式,清晰明了。 + */ + +#include +#include + +class QTimer; + +#ifdef quc +class Q_DECL_EXPORT SaveRunTime : public QObject +#else +class SaveRunTime : public QObject +#endif + +{ + Q_OBJECT +public: + static SaveRunTime *Instance(); + explicit SaveRunTime(QObject *parent = 0); + ~SaveRunTime(); + +private: + static QScopedPointer self; + + //日志文件路径 + QString path; + //日志文件名称 + QString name; + + //最后的编号 + int lastID; + //保存间隔 + int saveInterval; + //开始时间 + QDateTime startTime; + //日志文件 + QString logFile; + //保存文件定时器 + QTimer *timerSave; + +private: + //比较两个时间差值 + void getDiffValue(const QDateTime &startTime, const QDateTime &endTime, int &day, int &hour, int &minute); + +public Q_SLOTS: + //启动服务 + void start(); + //停止服务 + void stop(); + + //新建目录 + void newPath(); + //初始化日志文件 + void initLog(); + //追加一条记录到日志文件 + void appendLog(); + //保存运行时间到日志文件 + void saveLog(); + + //设置文件保存目录 + void setPath(const QString &path); + //设置文件名称 + void setName(const QString &name); + //设置保存间隔 + void setSaveInterval(int saveInterval); +}; + +#endif // SAVERUNTIME_H diff --git a/control/saveruntime/saveruntime.pro b/control/saveruntime/saveruntime.pro new file mode 100644 index 0000000..ca217d2 --- /dev/null +++ b/control/saveruntime/saveruntime.pro @@ -0,0 +1,17 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = saveruntime +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmsaveruntime.cpp +SOURCES += saveruntime.cpp + +HEADERS += frmsaveruntime.h +HEADERS += saveruntime.h + +FORMS += frmsaveruntime.ui diff --git a/control/smoothcurve/frmsmoothcurve.cpp b/control/smoothcurve/frmsmoothcurve.cpp new file mode 100644 index 0000000..bf36bdf --- /dev/null +++ b/control/smoothcurve/frmsmoothcurve.cpp @@ -0,0 +1,82 @@ +#include "frmsmoothcurve.h" +#include "ui_frmsmoothcurve.h" +#include "smoothcurve.h" +#include "qpainter.h" +#include "qdatetime.h" +#include "qdebug.h" + +#define TIMEMS QTime::currentTime().toString("hh:mm:ss zzz") + +frmSmoothCurve::frmSmoothCurve(QWidget *parent) : QWidget(parent), ui(new Ui::frmSmoothCurve) +{ + ui->setupUi(this); + + //初始化随机数种子 + srand(QDateTime::currentDateTime().toMSecsSinceEpoch()); + + //随机生成曲线上的点 + int x = -300; + while (x < 300) { + datas << QPointF(x, rand() % 300 - 100); + x += qMin(rand() % 30 + 5, 300); + } + + //正常曲线 + pathNormal.moveTo(datas.at(0)); + for (int i = 1; i < datas.size(); ++i) { + pathNormal.lineTo(datas.at(i)); + } + + //平滑曲线1 + //qDebug() << TIMEMS << "createSmoothCurve start"; + pathSmooth1 = SmoothCurve::createSmoothCurve(datas); + //qDebug() << TIMEMS << "createSmoothCurve stop"; + + //平滑曲线2 + //qDebug() << TIMEMS << "createSmoothCurve2 start"; + pathSmooth2 = SmoothCurve::createSmoothCurve2(datas); + //qDebug() << TIMEMS << "createSmoothCurve2 stop"; + + ui->ckShowPoint->setChecked(true); + connect(ui->ckShowPoint, SIGNAL(clicked(bool)), this, SLOT(update())); + connect(ui->rbtnPathNormal, SIGNAL(clicked(bool)), this, SLOT(update())); + connect(ui->rbtnPathSmooth1, SIGNAL(clicked(bool)), this, SLOT(update())); + connect(ui->rbtnPathSmooth2, SIGNAL(clicked(bool)), this, SLOT(update())); +} + +frmSmoothCurve::~frmSmoothCurve() +{ + delete ui; +} + +void frmSmoothCurve::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.translate(width() / 2, height() / 2); + painter.scale(1, -1); + + //画坐标轴 + painter.setPen(QColor(180, 180, 180)); + painter.drawLine(-250, 0, 250, 0); + painter.drawLine(0, 150, 0, -150); + + //根据选择绘制不同的曲线路径 + painter.setPen(QPen(QColor(80, 80, 80), 2)); + if (ui->rbtnPathSmooth1->isChecked()) { + painter.drawPath(pathSmooth1); + } else if (ui->rbtnPathSmooth2->isChecked()) { + painter.drawPath(pathSmooth2); + } else { + painter.drawPath(pathNormal); + } + + //如果曲线上的点可见则显示出来 + if (ui->ckShowPoint->isChecked()) { + painter.setPen(Qt::black); + painter.setBrush(Qt::gray); + foreach (QPointF point, datas) { + painter.drawEllipse(point, 3, 3); + } + } +} diff --git a/control/smoothcurve/frmsmoothcurve.h b/control/smoothcurve/frmsmoothcurve.h new file mode 100644 index 0000000..d72e583 --- /dev/null +++ b/control/smoothcurve/frmsmoothcurve.h @@ -0,0 +1,32 @@ +#ifndef FRMSMOOTHCURVE_H +#define FRMSMOOTHCURVE_H + +#include +#include +#include +#include + +namespace Ui { +class frmSmoothCurve; +} + +class frmSmoothCurve : public QWidget +{ + Q_OBJECT + +public: + explicit frmSmoothCurve(QWidget *parent = 0); + ~frmSmoothCurve(); + +protected: + void paintEvent(QPaintEvent *event); + +private: + Ui::frmSmoothCurve *ui; + QVector datas; //曲线上的点 + QPainterPath pathNormal; //正常曲线 + QPainterPath pathSmooth1; //平滑曲线1 + QPainterPath pathSmooth2; //平滑曲线2 +}; + +#endif // FRMSMOOTHCURVE_H diff --git a/control/smoothcurve/frmsmoothcurve.ui b/control/smoothcurve/frmsmoothcurve.ui new file mode 100644 index 0000000..39c3d09 --- /dev/null +++ b/control/smoothcurve/frmsmoothcurve.ui @@ -0,0 +1,79 @@ + + + frmSmoothCurve + + + + 0 + 0 + 800 + 600 + + + + Widget + + + + + + Qt::Vertical + + + + 20 + 473 + + + + + + + + 平滑曲线1 + + + + + + + 平滑曲线2 + + + + + + + 显示坐标点 + + + + + + + Qt::Horizontal + + + + 549 + 20 + + + + + + + + 正常曲线 + + + true + + + + + + + + + diff --git a/control/smoothcurve/main.cpp b/control/smoothcurve/main.cpp new file mode 100644 index 0000000..34b9eee --- /dev/null +++ b/control/smoothcurve/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmsmoothcurve.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmSmoothCurve w; + w.setWindowTitle("平滑曲线 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/smoothcurve/smoothcurve.cpp b/control/smoothcurve/smoothcurve.cpp new file mode 100644 index 0000000..13fa094 --- /dev/null +++ b/control/smoothcurve/smoothcurve.cpp @@ -0,0 +1,120 @@ +#include "smoothcurve.h" +#include "qdebug.h" + +QPainterPath SmoothCurve::createSmoothCurve(const QVector &points) +{ + QPainterPath path; + int len = points.count(); + if (len < 2) { + return path; + } + + QVector firstControlPoints; + QVector secondControlPoints; + calculateControlPoints(points, &firstControlPoints, &secondControlPoints); + path.moveTo(points[0].x(), points[0].y()); + + for (int i = 0; i < len - 1; ++i) { + path.cubicTo(firstControlPoints[i], secondControlPoints[i], points[i + 1]); + } + + return path; +} + +QPainterPath SmoothCurve::createSmoothCurve2(const QVector &points) +{ + //采用Qt原生方法不做任何处理 + int count = points.count(); + if (count == 0) { + return QPainterPath(); + } + + QPainterPath path(points.at(0)); + for (int i = 0; i < count - 1; ++i) { + //控制点的 x 坐标为 sp 与 ep 的 x 坐标和的一半 + //第一个控制点 c1 的 y 坐标为起始点 sp 的 y 坐标 + //第二个控制点 c2 的 y 坐标为结束点 ep 的 y 坐标 + QPointF sp = points.at(i); + QPointF ep = points.at(i + 1); + QPointF c1 = QPointF((sp.x() + ep.x()) / 2, sp.y()); + QPointF c2 = QPointF((sp.x() + ep.x()) / 2, ep.y()); + path.cubicTo(c1, c2, ep); + } + + return path; +} + +void SmoothCurve::calculateFirstControlPoints(double *&result, const double *rhs, int n) +{ + result = new double[n]; + double *tmp = new double[n]; + double b = 2.0; + result[0] = rhs[0] / b; + + for (int i = 1; i < n; ++i) { + tmp[i] = 1 / b; + b = (i < n - 1 ? 4.0 : 3.5) - tmp[i]; + result[i] = (rhs[i] - result[i - 1]) / b; + } + + for (int i = 1; i < n; ++i) { + result[n - i - 1] -= tmp[n - i] * result[n - i]; + } + + delete tmp; +} + +void SmoothCurve::calculateControlPoints(const QVector &datas, + QVector *firstControlPoints, + QVector *secondControlPoints) +{ + int n = datas.count() - 1; + for (int i = 0; i < n; ++i) { + firstControlPoints->append(QPointF()); + secondControlPoints->append(QPointF()); + } + + if (n == 1) { + (*firstControlPoints)[0].rx() = (2 * datas[0].x() + datas[1].x()) / 3; + (*firstControlPoints)[0].ry() = (2 * datas[0].y() + datas[1].y()) / 3; + (*secondControlPoints)[0].rx() = 2 * (*firstControlPoints)[0].x() - datas[0].x(); + (*secondControlPoints)[0].ry() = 2 * (*firstControlPoints)[0].y() - datas[0].y(); + return; + } + + double *xs = 0; + double *ys = 0; + double *rhsx = new double[n]; + double *rhsy = new double[n]; + + for (int i = 1; i < n - 1; ++i) { + rhsx[i] = 4 * datas[i].x() + 2 * datas[i + 1].x(); + rhsy[i] = 4 * datas[i].y() + 2 * datas[i + 1].y(); + } + + rhsx[0] = datas[0].x() + 2 * datas[1].x(); + rhsx[n - 1] = (8 * datas[n - 1].x() + datas[n].x()) / 2.0; + rhsy[0] = datas[0].y() + 2 * datas[1].y(); + rhsy[n - 1] = (8 * datas[n - 1].y() + datas[n].y()) / 2.0; + + calculateFirstControlPoints(xs, rhsx, n); + calculateFirstControlPoints(ys, rhsy, n); + + for (int i = 0; i < n; ++i) { + (*firstControlPoints)[i].rx() = xs[i]; + (*firstControlPoints)[i].ry() = ys[i]; + + if (i < n - 1) { + (*secondControlPoints)[i].rx() = 2 * datas[i + 1].x() - xs[i + 1]; + (*secondControlPoints)[i].ry() = 2 * datas[i + 1].y() - ys[i + 1]; + } else { + (*secondControlPoints)[i].rx() = (datas[n].x() + xs[n - 1]) / 2; + (*secondControlPoints)[i].ry() = (datas[n].y() + ys[n - 1]) / 2; + } + } + + delete xs; + delete ys; + delete rhsx; + delete rhsy; +} diff --git a/control/smoothcurve/smoothcurve.h b/control/smoothcurve/smoothcurve.h new file mode 100644 index 0000000..53bb103 --- /dev/null +++ b/control/smoothcurve/smoothcurve.h @@ -0,0 +1,28 @@ +#ifndef SMOOTHCURVE_H +#define SMOOTHCURVE_H + +#include +#include +#include +#include + +#ifdef quc +class Q_DECL_EXPORT SmoothCurve +#else +class SmoothCurve +#endif + +{ +public: + //创建平滑曲线路径 + static QPainterPath createSmoothCurve(const QVector &points); + static QPainterPath createSmoothCurve2(const QVector &points); + +private: + static void calculateFirstControlPoints(double *&result, const double *rhs, int n); + static void calculateControlPoints(const QVector &datas, + QVector *firstControlPoints, + QVector *secondControlPoints); +}; + +#endif // SMOOTHCURVE_H diff --git a/control/smoothcurve/smoothcurve.pro b/control/smoothcurve/smoothcurve.pro new file mode 100644 index 0000000..c8fe1be --- /dev/null +++ b/control/smoothcurve/smoothcurve.pro @@ -0,0 +1,17 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = smoothcurve +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmsmoothcurve.cpp +SOURCES += smoothcurve.cpp + +HEADERS += frmsmoothcurve.h +HEADERS += smoothcurve.h + +FORMS += frmsmoothcurve.ui diff --git a/control/zhtopy/data/zhtopy.txt b/control/zhtopy/data/zhtopy.txt new file mode 100644 index 0000000..8e1e53b --- /dev/null +++ b/control/zhtopy/data/zhtopy.txt @@ -0,0 +1 @@ +yi ding yu qi shang xia myeon wan zhang san shang xia qi bu yu mian gai chou chou zhuan qie pi shi shi qiu bing ye cong dong si cheng diu qiu liang diu you liang yan bing sang shu jiu ge ya pan zhong ji jie feng guan chuan chan lin zhuo zhu ha wan dan wei zhu jing li ju pie fu yi yi nai wu jiu jiu tuo mo yi ho zhi wu zha hu fa le yin ping pang qiao hu guai cheng cheng yi yin ya mie jiu qi ye xi xiang gai jiu hal hol shu dou shi ji keg kal keol tol mol ol mai luan cal ru xue yan phoi sal na gan sol eol cui ceor gan luan gui gan luan lin yi jue le ma yu zheng shi shi er chu yu kui xu yun hu qi wu jing si sui gen geng ya xie ya zhai ya ji wen wang kang da jiao hai yi chan heng mu ye xiang jing ting liang xiang jing ye qin bo you xie zhan lian duo wei ren ren ji ra wu yi shen ren li ding ze jin pu chou ba zhang jin ge bing reng cong fo jin lun bing cang zai shi ta zhang fu xian xian tuo hong tong ren qian han yi bo dai ling yi chao zhang sa shang yi mu men ren fan chao yang jing zhong bi wo wu jian jia yao feng cang ren wang fen di fang zhong qi pei yu diao dun wu yi xin kang yi ji ai wu qi fu fa xiu jin pi shen fu tang zhong you huo hui yu cui yun san wei chuan ju ya xian shang chang lun cang xun xin wei zhu chi xuan nu bo gu ni ni xie ban xu ling zhou shen qu ci peng si jia pi zhi shi yi zheng dian gan mai dan zhu bu qu bi zhao ci wei di zhu zuo you yang ti zhan he bi tuo she yu die fo zuo gou ning tong ni xian qu yong wa qian shi ka bao pei hui ge lao xiang ge yang bai fa ming jia er bing ji hen huo gui quan tiao jiao ci yi shi xing shen tuo kan zhi hai lai yi chi kua guang li yin shi mi zhu xu you an lu mou er lun dong cha chi xun gong zhou yi ru cun xia si dai lv ta jiao zhen ce qiao kuai chai ning nong jin wu hou jiong cheng chen zuo chou qin lv ju dou ting shen tui bo nan xiao bian tui yu xi cu e qiu xu guang ku wu jun yi fu liang zu qiao li yong hun jing xian san pei su fu xi li mian ping bao yu si xia xin xiu yu di ju chou zhi yan liang li lai si jian xiu fu huo ju xiao pai jian biao shu fei feng ya an bei yu xin bei hu chang zhi bing jiu yao cui liang wan lai cang zong ge guan bei tian shu shu men dao dan jue chui xing peng tang hou yi qi ti gan jing jie sui chang jie fang zhi kong juan zong ju qian ni lun zhuo wo luo song ling hun dong zi ben wu ju nai cai jian zhai ye zhi sha qing qie ying cheng qian yan ru zhong chun jia jie wei yu bing ruo ti wei pian yan feng dang wo e xie che sheng kan di zuo cha ting bei ye huang yao zhan chou an you jian xu zha ci fu fu zhi cong mian ji yi xie xun si duan ce zhen ou tou tou bei zan lou jie wei fen chang kui sou si su xia fu yuan rong li nu yun gou ma pang dian tang hao jie xi shan qian que cang chu san bei xiao rong yao ta suo yang fa bing jia dai zai tang gu bin chu nuo can lei cui yong cao zong beng song ao chuan yu zhai qi shang chuang jing chi sha han zhang qing yan di xie lou bei piao jin lian lu man qian xian tan ying dong zhuan xiang shan qiao jiong tui zun pu xi lao chang guang liao qi deng chan wei ji bo hui chun tie dan jiao jiu ceng fen xian ju e jiao jian tong lin bo gu xian su xian jiang min ye jin jia qiao pi feng zhou ai sai yi jun nong tan yi dang jing xuan kuai jian chu dan jiao sha zai can bin an ru tai chou chai lan yi jin qian meng wu ning qiong ni chang lie lei lv kuang bao yu biao zan zhi si you hao qing qin li teng wei long chu chan rang shu xie li luo zan nuo tang yan lei nang er wu yun zan yuan xiong chong zhao xiong xian guang yue ke dui mian tu chang er dui er jin tu si yan yan shi shike dang qianke dou gongfen haoke shen dou baike jing gongli huang ru wang nei quan liang yu ba gong liu xi jie lan gong tian guan xing bing qi ju dian ci ppun yang jian shou ji yi ji chan tong mao ran nei yan mao gang ran ce jiong ce zai gua jiong mao zhou mao gou xu mian tu rong yin xie kan jun nong yi mi shi guan meng zhong ju yuan ming kou min fu xie mi liang dong tai gang feng bing hu chong jue ya kuang ye leng pan fa min dong xian lie qia jian jing sou mei tu qi gu zhun song jing liang qing diao ling dong gan jian yin cou ai li cang ming zhun cui si duo jin lin lin ning xi du ji fan fan fan feng ju chu zheng feng mu zhi fu feng ping feng kai huang kai gan deng ping qian xiong kuai tu ao chu ji dang han han zao dao diao li ren ren chuang fen qie yi ji kan qian cun chu wen ji dan xing hua wan jue li yue lie liu ze gang chuang fu chu qu diao shan min ling zhong pan bie jie jie pao li shan bie chan jing gua geng dao chuang kui kuo duo er zhi shua quan sha ci ke jie gui ci gui kai duo ji ti jing dou luo ze yuan cuo xiao ke la qian sha chuang gua jian cuo li ti fei pou chan qi chuang zi gang wan bo ji duo qing yan zhuo jian ji bo yan ju huo sheng jian duo duan wu gua fu sheng jian ge da kai chuang chuan chan zhuan lu li peng shan piao kou jiao gua qiao jue hua zha zhuo lian ju pi liu gui chao gui jian jian tang huo ji jian yi jian zhi chan zuan mi li zhu li ya quan ban gong jia wu mai lie jin keng xie zhi dong zhu nu jie qu shao yi zhu miao li jin lao lao juan kou gu wa xiao mou kuang jie lie he shi ke jin gao bo min chi lang yong yong mian ke xun juan qing lu bu meng chi lei kai mian dong xu xu kan wu yi xun weng sheng lao mu lu piao shi ji qin qiang jiao quan xiang yi qiao fan juan tong ju dan xie mai xun xun lv li che xiang quan bao di yun jiu bao gou wu yun mangmi bi gai gai bao cong yi xiong peng ju tao ge pu e pao fu gong da jiu gong bi hua bei nao chi fang jiu yi za jiang kang jiang kuang hu xia qu fan gui qie cang kuang fei hu yu gui gui hui dan gui lian lian suan du jiu qu xi pi qu yi ke yan bian ni qu shi xun qian nian sa zu sheng wu hui ban shi xi wan hua xie wan bei zu zhuo xie dan mai nan dan ji bo shuai bu guan bian bu zhan ka lu you lu xi gua wo xie jie ran wei ang qiong zhi mao yin wei shao ji que luan chi juan xie xu jin que kui ji e qing xi san chang yan e ting li zhai an li ya ya ya she di zhai pang ting qie ya shi ce mang ti li she hou ting zui cuo fei yuan ce yuan xiang yan li jue xia dian chu jiu jin ao gui yan si li chang qian li yan yan yuan si hong miao qiu qu qu keum lei du xian zhuan san can can can can ai dai you cha ji you shuang fan shou guai ba fa ruo shi shu zhuo qu shou bian xu xia pan sou ji wei sou die rui cong kou gu ju ling gua dao kou zhi jiao zhao ba ding ke tai chi shi you qiu po ye hao si tan chi le diao ji dug hong mie xu mang chi ge song yao ji he ji diao cun tong ming hou li tu xiang zha xia ye lv ya ma ou huo yi jun chou lin tun yin fei bi qin qin jie bu fou ba dun fen hua han ting hang shun qi hong zhi yin wu wu chao na jue xi chui dou wen hou ou wu gao ya jun lv e ge wen dai qi cheng wu gao fu jiao yun chi sheng na tun mu yi tai ou li bei yuan wo wen qiang wu e shi juan pen min ne mu ling ran you di zhou shi zhou tie xi yi zhi ping ci gua ci wei hou he nu xia pei chi hao shen hu ming dan qu zui gan za tuo duo pou pao bi fu yang he zha he tai jiu yong fu da zhou wa ka gu ka zuo bu long dong ning tuo si xian huo qi er e guang zha die yi lie zi mie mie zhi yao ji zhu lo xun za xiao ke hui kua shi tiao xian an xuan xiu guo yan lao yi ai pin shen tong hong xiong duo wa ha zai you di pai xiang ai hen kuang ya da xiao bi hui nian hua xing kuai duo ppun ji nong mou yo hao yuan long tou mang ge o chi shao li na zu he ku xiao xian lao bo zhe zha lang ba mie lie sui fu bu han heng geng shuo jia you yan gu gu bei han suo chun yi ai jia tu yan wan li xi tang zuo qiu che wu zao ya dou qi di qin mai mas gong teo keos lao liang suo zao huan lang sha ji zo wei feng jin hu qi shou wei shua chang er li qiang an zuo yo nian yu tian lai qie xi tuo hu ai zhou nou ken zhuo zhao shang di heng lin a cai qiang tun wu wen cui jie gu qi qi tao dan dan ye ci bi cui chuo he ya qi zhe fei liang xian pi sha la ze qing gua pa ze se zhuan nie guo luo ngam di quan chan bo ding lang xiao geu tang di ti an jiu dan ke yong wei nan shan yu zhe la jie hou han die zhou chai wai nuo yu yin za yao wo mian hu yun chuan hui huan yuan xi he ji kui zhong wei che xu huang duo yan xuan liang yu sang chi qiao yan dan ben qi li yo zha wei miao ying pen phos kui bei yu gib lou ku qiao hu ti yao he sha xiu qiang se yong su gong xie yi shuo ma cha hai ke da sang tian ru sou gu ji pang wu qian shi ge zi jie lao weng wa si chi hao suo jia hai suo qin nie he cis sai en go na dia ai qiang tong bi ao ao lian zui zhe mo shu sou tan di qi jiao chong dao kai tan shan cao jia ai xiao piao lou ga jia xiao hu hui guo ou xian ze chang xu po de ma ma hu le du ga tang ye beng ying sai jiao mi xiao hua mai ran zuo peng lao xiao ji zhu chao kui zui xiao si hao mu liao qiao xi xu tan tan hei xun e zun bo chi hui can chuang cu dan yu tun ceng jiao ye xi qi hao lian xu deng hui yin pu jue qin xun nie lu si yan ying da zhan ao zhuo jin nong hui xie qi e zao ai shi jiao yuan ai yong xue kuai yu pen dao ge xin dun dang xin sai pi pi yin zui ning di lan ta huo ru hao xia yan duo pi chou ji jin hao ti chang xun me ca ti lu hui bao you nie yin hu mo hong zhe li liu xie nang xiao mo yan li lu long po dan chen pin pi xiang huo me xi duo ku yan chan ying rang di la ta xiao jiao chuo huan huo zhuan nie xiao za li chan chai li yi luo nang zan su heui zeng jian yan zhu lan nie nang ram luo wei hui yin qiu si nin nan hui xin yin nan tuan tuan tun kang yuan jiong pian yun cong hu hui yuan e guo kun cong wei tu wei lun guo qun shi ling gu guo tai guo tu you guo yin hun pu yu han yuan lun quan yu qing guo chuan wei yuan quan ku pu yuan yuan ya tuan tu tu tuan lue hui yi huan luan luan tu ya tu ting ku pu lu kuai ya zai xu ge zhun wu gui pi yi di qian qian zhen zhuo dang qia xia shan kuang chang qi nie mo ji jia zhi zhi ban xun yi qin fen jun rong tun fang fen ben tan kan huai zuo kang bi jing di jing ji kuai di jing jian tan li ba wu fen zhui po ban tang kun ju tan zhi tuo gan ping dian gua ni tai pi jiong yang fo ao lu qiu mu ke gou xue ba di che ling zhu fu hu zhi chui la long long lu ao dai pao min xing tong ji he lv ci chi lei gai yin hou dui zhao fu guang yao duo duo gui cha yang yin fa gou yuan die xie ken jiong shou e bing dian hong ya kua da ka dang kai hang nao an xing xian yuan bang fu bei yi yin han xu zhui cen geng ai feng fang jue yong jun xia di mai lang juan cheng yan qin zhe lie lie bu cheng hua bu shi xun guo jiong ye dian di yu bu ya juan sui pi qing wan ju lun zheng kong shang dong dai tan yan cai chu beng xian zhi duo yi zhi yi pei ji zhun qi sao ju ni ku ke tang kun ni jian dui jin gang yu e peng gu tu leng fang ya qian kun an shen duo nao tu cheng yin hun bi lian guo die zhuan hou bao bao yu di mao jie ruan ye geng kan zong yu huang e yao yan bao ji mei chang du tuo yin feng zhong jie jin feng gang chuan jian ping lei jiang huang leng duan wan xuan ji ji kuai ying ta cheng yong kai su su shi mi ta weng cheng tu tang qiao zhong li peng bang sai zang dui tian wu zheng xun ge zhen ai gong yan kan tian yuan wen xie liu hai lang chang peng beng chen lu lu ou qian mei mo zhuan shuang shu lou chi man biao jing ce shu zhi zhang kan yong dian chen zhi ji guo qiang jin di shang mu cui yan ta zeng qian qiang liang wei zhui qiao zeng xu shan shan fa pu kuai dong fan qiao mo dun dun zun di sheng duo duo tan deng wu fen huang tan da ye zhu jian ao qiang ji qiao ken yi pi bi dian jiang ye yong xue tan lan ju huai dang rang qian xun lan xi he ai ya dao hao ruan jin lei kuang lu yan tan wei huai long long rui li lin rang chan xun yan lei ba wan shi ren san zhuang zhuang sheng yi mai ke zhu zhuang hu hu kun yi hu xu kun shou mang dun shou yi zhi ying chu jiang feng bei zhai bian sui qun ling fu cuo xia xiong xie nao xia kui xi wai yuan mao su duo duo ye qing oes gou gou qi meng meng yin huo chen da ce tian tai fu jue yao yang hang gao shi ben tai tou tao bi yi kua jia duo hwa kuang yun jia ba en lian huan di yan pao juan qi nai feng xie fen dian juan kui zou huan qi kai zha ben yi jiang tao zhuang ben xi huang fei diao xun beng dian ao she weng tai ao wu ao jiang lian duo yun jiang shi fen huo bi luan che nv nu ding nai qian jian ta jiu nuan cha hao xian fan ji shuo ru fei wang hong zhuang fu ma dan ren fu jing yan jie wen zhong pa du ji hang zhong yao jin yun miao pei chi jue zhuang niu yan na xin fen bi yu tuo feng yuan fang wu yu gui du ba ni zhou zhuo zhao da ni yuan tou xuan yi e mei mo qi bi shen qie e he xu fa zheng min ban mu fu ling zi zi shi ran han yang gan jie gu si xing wei ci ju shan pin ren yao dong jiang shu ji gai xiang huo juan jiao gou lao jian jian yi nian zhi zhen ji xian heng guang xun kua yan ming lie pei ya you yan cha xian yin ti gui quan zi song wei hong wa lou ya rao jiao luan pin xian shao li cheng xie mang fu suo mu wei ke cu cu ting niang xing nan yu na pou sui juan shen zhi han di zhuang e ping tui xian mian wu yan wu ai yan yu si yu wa li xian ju qu zhui qi xian zhuo dong chang lu ai e e lou mian cong pei ju po cai ling wan biao xiao shu qi hui fan wo rui tan fei fei jie tian ni juan jing hun jing jin dian xing hu guan lai bi yin chou chuo fu jing lun an lan kun yin ya ju li dian xian hua hua ying chan shen ting yang yao mu nan ruo jia yu xu yu wei ti rou mei dan ruan qin hui wo qian chun miao fu jie duan pei zhong mei huang mian an ying xuan jie wei mei yuan zheng qiu ti xie tuo lian mao ran si pian wei wa cu hu yun jie bao xu yu gui zou yao bi xi yuan ying rong ru chi liu mei pan yun ma gou kui qin jia sao zhen yuan jie rong ming ying ji su niao xian tao pang lang nao bao ai pi pin yi piao yu lei xuan yuan yi zhang kang yong ni li di gui yan jin zhuan chang ce han nen lao mo zhe hu hu ao nen qiang ma pie gu wu qiao tuo zhan miao xian xian mo liao lian hua gui deng zhi xu yi hua xi kui yao xi yan chan jiao mei fan fan yan yi hei jiao fan shi bi chan sui qiang lian huan xin niao dong yi can ai niang ning ma tiao chou jin ci yu pin rong ru nai yan tai ying qian niao yue ying mian bi ma shen xing ni du liu yuan lan yan shuang ling jiao niang lan xian ying shuang xie huan mi li luan yan shu lan zi jie jue jue kong yun zi zi cun sun fu bo zi xiao shen meng si tai bao ji gu nu xue you zhuan hai luan sun nao mie cong qian shu chan ya zi yi fu zi li xue bo ru nai nie nie ying luan mian ning rong ta gui zhai qiong yu shou an tu song wan rou yao hong yi jing zhun mi zhu dang hong zong guan zhou ding wan yi bao shi shi chong shen ke xuan shi you huan yi tiao shi xian gong cheng jiong gong xiao zai zha bao hai yan xiao jia pan chen rong huang mi kou kuan bin su cai zan ji yuan ji yin mi kou qing he zhen jian fu ning bing huan mei qin han yu shi ning qin ning zhi yu bao kuan ning qin mo cha lou gua qin hu wu liao shi ning zhai shen wei xie kuan hui liao jun huan yi yi bao qin chong bao feng cun dui si xun dao luo dui shou po feng zhuan fu she ke jiang jiang zhuan wei zun xun shu dui dao xiao jie shao er er er ga jian shu chen shang shang ma ga chang liao xian xian kun you you you liao liao yao long wang wang wang ga yao duo kui zhong jiu gan gu gan tui gan gan shi yin chi kao ni jin wei niao ju pi ceng xie bi ju jie tian jue ti jie wu diao shi shi ping ji xie zhen xie ni zhan xi u man e lou ping ti fei shu xie tu lv lv xi ceng lv ju xie ju jue liao jue shu xie che tun ni shan wa xian li yan dao hui hong yi qi ren wu an shen yu chu sui qi yen yue ban yao ang ya wu jie ji ji qian fen wan qi cen qian qi cha jie qu gang xian ao lan dao ba zuo zuo yang ju gang ke gou xue po li tiao zu yan fu xiu jia ling tuo pi ao dai kuang yue qu hu po min an tiao ling chi ping dong ceom kui bang mao tong xue yi bian he ba luo e fu xun die lu en er gai quan tong yi mu shi an wei huan zhi mi li ji tong wei you gu xia lie yao qiao zheng luan jiao e e yu ye bu qiao qun feng feng nao li you xian rong dao shen cheng tu geng jun gao xia yin wu lang kan lao lai xian que kong chong chong ta lin hua ju lai qi min kun kun cui gu cui ya ya gang lun lun ling jue duo zheng guo yin dong han zheng wei xiao bi yan song jie beng cui jue dong chan gu yin zi ze huang yu wei yang feng qiu yang ti yi zhi shi zai yao e zhu kan lv yan mei han ji ji huan ting sheng mei qian mao yu zong lan jie yan yan wei zong cha sui rong ke qin yu qi lou tu cui xi weng cang tang ying jie ai liu wu song qiao zi wei beng dian cuo qian yong nie cuo ji shi ruo song zong jiang liao kang chan di cen ding tu lou zhang zhan zhan ao cao qu qiang wei zui dao dao xi yu pei long xiang ceng bo qin jiao yan lao zhan lin liao liao jin deng duo zun qiao jue yao jiao yao jue zhan yi xue nao ye ye yi nie xian ji jie ke xi di ao zui wei yi rong dao ling jie yu yue yin ru jie li xi long long dian ying xi ju chan ying wei yan wei nao quan chao cuan luan dian dian nie yan yan yan kui yan chuan kuai chuan zhou huang jing xun chao chao lie gong zuo qiao ju gong keo wu pu pu cha qiu qiu ji yi si ba zhi zhao xiang yi jin sun quan phas xun jin fu za bi shi bu ding shuai fan nie shi fen pa zhi xi hu dan wei zhang nu dai mo pi pa tie fu lian zhi zhou bo zhi di mo yi yi ping qia juan ru shuai dai zhen shui qiao zhen shi qun xi bang dai gui chou ping zhang jian wan dai wei chang qie qi ce guo mao zhu hou zhen zheng mi wei wo fu kai bang ping die gong pan huang tao mi jia teng hui zhong shen man mu biao guo ce mu bang zhang jing chan fu zhi wu fan chuang bi bi zhang mi qiao chan fen meng bang chou mie chu jie xian lan gan ping nian jian bing bing xing gan yao huan you you ji guang bi ting ze guang zhuang mo qing pi qin tun chuang gui ya ting jie xu lu wu zhuang ku ying di pao dian ya miao geng ci fu tong pang fei xiang yi zhi tiao zhi xiu du zuo xiao tu gui ku pang ting you bu bing cheng lai bei cuo an shu kang yong tuo song shu qing yu yu miao sou ce xiang fei jiu e gui liu xia lian lang sou zhi bu qing jiu jiu jin ao kuo lou yin liao dai lu yi chu chan tu si xin miao chang wu fei guang kos kuai bi qiang xie lin lin liao lu ji ying xian ting yong li ting yin xun yan ting di po jian hui nai hui gong nian kai bian yi qi nong fen qu nan yi zang bi yi yi er san shi er shi shi gong diao yin hu fu hong wu di chi jiang ba shen di zhang jue tao fu di mi xian hu chao nu jing zhen yi mi juan wan shao ruo yuan jing diao zhang jiang qiang peng dan qiang bi bi she dan jian gou ge fa bi kou jian bie xiao dan guo jiang hong mi kuo wan jue ji ji gui dang lu lu tuan hui zhi hui hui yi yi yi yi huo huo xian xing wen tong yan yan yu chi cai biao diao bin peng yong piao zhang ying chi chi zhuo tuo ji fang zhong yi wang che bi di ling fu wang zheng cu wang jing dai xi xun hen yang hui lv hou jia cheng zhi xu jing tu cong cong lai cong de pai xi uu ji chang zhi cong zhou lai yu xie jie jian shi jia pian huang fu xun wei pang yao wei xi zheng biao chi de zheng zheng bie de chong che jiao hui jiao hui mei long xiang bao qu xin xin bi yi le ren dao ting gai ji ren ren qian tan te te han qi tai cun zhi wang mang xi fan ying tian min min zhong chong wu ji wu xi jie you wan cong song kuai yu bian qi shi cui chen tai zhun qin nian hun xiong niu wang xian xin hang hu kai fen huai tai song wu ou chang chuang ju yi bao chao min pei zha zen yang ju ban nu nao zheng pa bu zhan hu hu ju dan lian si you di dai yi die you fu ji peng xing yuan ni guai fei xi bi yao qie xuan cong bing huang xu chu bi shu xi tan yong zong dui mo ki yi shi nen xun zhi xi lao heng kuang mou zhi xie lian tiao huang die hao kong wei heng qi jiao shu si kua qiu yang hui hui chi qi yi xiong guai lin hui zi xu chi shang nv hen en ke dong tian gong zhuan xi qia yue peng ken de hui e xiao tong yan kai ce nao yun mang yong yong juan bi kun qiao yue yu yu jie xi zhe lin ti han hao qie ti bu yi qian hui xi bei men yi heng song xun cheng li wu wu you li liang huan cong nian yue li nin nao e que xuan qian wu min cong fei bei de cui chang men li ji guan guan xing dao qi kong tian lun xi kan gun ni qing chou dun guo zhan jing wan yuan jin ji lin yu huo he juan tan ti ti nian wang chuo hu hun xi chang xin wei hui e rui zong jian yong dian ju can cheng de bei qie can dan guan duo nao yun xiang chuan die huang chun qiong re xing ce bian min zong shi qiao chou bei xuan wei ge qian wei yu yu bi xuan huan min bi yi mian yong he yang yin e chen mao ke ke yu ai qie yan ruan gan yun cong si leng fen ying kui kui que gong yun su su qi yao song huang ji gu ju chuang ni xie kai zheng yong cao xun shen bo kai yuan xi hun yong yang li sao tao yin ci chu qian tai huang yun shen ming gong she cao piao mu mu guo chi can can can cui min ni zhang tong ao shuang man guan que zao jiu hui kai lian ou song jin yin lv shang wei tuan man qian she yong qing kang di zhi lou juan qi qi yu ping liao cong you chong zhi tong cheng qi qu peng bei bie qiong jiao zeng chi lian ping kui hui qiao cheng yin yin xi xi dan tan duo dui dun su jue ce xiao fan fen lao lao chong han qi xian min jing liao wu can jue cu xian tan sheng pi yi chu xian nang dan tan jing song han ji wei huan dong qin qin ju cao ken xie ying ao mao yi lin se jun huai men lan ai lin yan guo xia chi yu yin dai meng yi meng dui qi mo xian men chou zhi nuo nuo yan yang bo zhi kuang kuang you fu liu mie cheng hui chan meng lan huai xuan rang chan ji ju huan she yi lian nan mi tang jue gang gang gang ge yue wu jian xu shu rong hu cheng wo jie ge can qiang huo qiang zhan dong qi jia die cai jia ji zhi kan ji kui gai deng zhan chuang ge jian jie yu jian yan lu xi zhan xi xi chuo dai qu hu hu hu e yi ti mao hu li fang suo bian dian jiong shang yi yi shan hu fei yan shou ti cai zha qiu le pu pa da reng fu ru zai tuo zhang diao kang yu wu han shen cha tuo ge kou wu den qian zhi ren kuo men sao yang niu ban che rao xi qin ban jia yu fu ao zhe pi zhi kan e den zhao cheng ji yan wang bian chao gou wen gu yue jue ba qin shen zheng yun wan ne yi shu zhua pou dou dou kang zhe fu fu pao ba ao ze zhuan kou lun qiang yun hu bao bing zhai peng nan bu pi tai yao zhen zha yang bao he ni ye di chi pi jia ma mei shen ya chou qu min chu jia fu zha zhu dan chai mu dian la fu pao ban pai ling na guai qian ju tuo ba tuo tuo ao ju zhuo pin zhao bai bai zhi ni ju kuo long jian qia yong lan ning bo ze qian hen kuo shi jie zheng nin gong gong quan quan cun zan kao yi xie ce hui pin zhuai shi na bai chi gua zhi guang duo duo zhi qia an nong zhen ge jiao kua dong na tiao lie zha lu she wa jue lie ju zhi luan ya wo ta jia nao dang jiao zheng ji hui xian yu ai tuo nuo cuo bo geng ti zhen cheng suo suo keng mei nong ju bang jian yi ting yan nuo wan jia cha feng ku wu jun ju tong kun chi tu zhuo fu luo ba han shao nie juan ze shu ye jue bu wan bu zun zhuai zhai lu sou shui lao sun bang jian huan dao wei wan qin peng she lie min men fu ba ju dao luo ai juan yue song tian chui jie tu ben na niane wei cu wo qi xian cheng dian sao lun qing gang zhuo shou diao pou di zhang hun ji tao qia qi pai shu qian ling ye ya jue zheng liang gua nie huo yan ding lue cai tan che bing jie ti kong tui yan cuo zhou ju tian qian ken bai pa jie lu guo ming geng zhi dan meng can sao guan peng chuan nuo jian zheng you qian yu yan kui nan xuan rou che wei sai zou xuan miao ti nie cha shi song zhen yi xun huang bian yang huan yan zan an xu ya wo ke chuai ji di la la cheng kai jiu jiu tu jie hui gen chong xiao ye xie yuan jian ye cha zha bei yao wei dem lan wen qin chan ge lou zong gen jiao gou qin rong que zou chi zhan sun sun bo chu rong bang cuo sao ke yao dao zhi nuo xie jian sou qiu gao xian shuo sang jin mie yi chui nuo shan ta jie tang pan ban da li tao hu zhi wa xia qian wen qiang shen zhen e xie na quan cha zha ge wu en she gang she lu bai yao bin rong tan sha chan suo liao chong chuang guo bing feng shuai di ji sou zhai lian cheng chi guan lu luo lou zong gai hu zha cheng tang hua cui zhi mo qiang gui ying zhi ao zhi che man chan kou chu she tuan chao mo mo zhe chan qian piao jiang yao gou qian liao ji ying jue pie pie lao dun xian ruan gui zen yi xun cheng cheng sa nao hong si han guang da zun nian lin cheng wei zhuang jiao ji cao tan dan che bo che jue xiao liao ben fu qiao bo cuo zhuo zhuan zhui pu qin dun nian hua xie lu jiao cuan ta han ji wo jian gan yong lei nang lu shan zhuo ze bu chuo ji dang se cao qing qing huan jie qin kuai dan xie ye pi bo ao ju ye e meng sou mi ji tai zhuo dao xing lan ca ju ye ru ye ye ni huo jie bin ning ge zhi jie kuo mo jian xie lie tan bai sou lu li rao zhi pan yang lei ca lu cuan nian xian jun huo li lai huan ying lu long qian qian zan qian lan xian ying mei rang chan ying cuan xie she luo mei mi chi zan luan tan zuan li dian wa dang jiao jue lan li nang zhi gui gui qi xun pu pu shou kao you gai yi gong gan ban fang zheng po dian kou min wu gu he ce xiao mi shou ge di xu jiao min chen jiu zhen dui yu chi ao bai xu jiao dui lian nie bi chang dian duo yi gan san ke yan dun qi tou xue duo qiao jing yang xia min shu ai qiao ai zheng di chen fu shu liao ou xiong yi jiao shan jiao zhuo yi lian bi li xiao xiao wen xue qi qi zhai bin jue zhai uu fei ban ban lan yu lan men dou sheng liao jia hu xie jia yu zhen jiao wo tou dou jin chi yin fu qiang zhan qu zhuo zhan duan zhuo si xin zhuo zhuo qin lin zhuo chu duan zhu fang jie hang yu shi pei you myeo pang qi zhan mao lv pei pi liu fu fang xuan jing jing ni zu zhao yi liu shao jian eos yi qi zhi fan piao fan zhan kuai sui yu wu ji ji ji huo ri dan jiu zhi zao xie tiao xun xu ga la han han ying di xu chan shi kuang yang shi wang min min tun chun wu yun bei ang ze ban jie kun sheng hu fang hao jiong chang xuan ming hun fen qin hu yi xi cuan yan ze fang tan shen ju yang zan bing xing ying xuan po zhen ling chun hao mei zuo mo bian xiong hun zhao zong shi shi yu fei yi mao ni chang wen dong ai bing ang zhou long xian kuang tiao chao shi huang huang xuan kui kua jiao jin zhi jin shang tong hong yan gai xiang shai xiao ye yun hui han han jun wan xian kun zhou xi sheng sheng bu zhe zhe wu wan hui hao chen wan tian zhuo zui zhou pu jing xi shan ni xi qing qi jing gui zheng yi zhi yan wan lin liang chang wang xiao zan fei xuan geng yi xia yun hui xu min kui ye ying du wei shu qing mao nan jian nuan an yang chun yao suo pu ming jiao kai gao weng chang qi hao yan li ai ji ji men zan xie hao mu mo cong ni zhang hui bao han xuan chuan liao xian tan jing pie lin tun xi yi ji huang dai ye ye li tan tong xiao fei shen zhao hao yi xiang xing shan jiao bao jing yan ai ye ru shu meng xun yao pu li chen kuang die uu yan huo lu xi rong long nang luo luan shai tang yan zhu yue yue qu ye geng yi hu he shu cao cao sheng man zeng zeng ti zui jian xu hui yin qie fen pi yue you ruan peng ban fu ling ku xu uu nv tiao shuo zhen lang lang juan ming huang wang tun chao qi qi ying zong wang tong lang lao meng long mu pin wei mo ben zha zhu shu teul zhu ren ba pu duo duo dao li qiu ji jiu bi xiu cheng ci sha ru za quan qian yu gan wu cha shan xun fan wu zi li xing cai cun ren shao tuo duo zhang mang chi yi ge gong du yi qi shu gang tiao jiang shan wan lai jiu mang yang ma miao zhi yuan hang bei bei jie dong gao yao qian chu chun pa shu hua xin niu zhu chou song ban song ji yue jin gou ji mao pi bi wang ang fang fen yi fu nan xi hu ya dou xin chen yao lin nen e mei zhao guo zhi cong yun zui sheng shu zao duo li lu jian cheng song qiang feng zhan xiao zhen ku ping tai xi zhi guai xiao jia jia gou bao mo xie ye ye shi nie bi tuo yi ling bing ni la he ban fan zhong dai ci yang fu bo mou gan qi ran rou mao shao song zhe xia you shen ju tuo zuo ran ning yong chi zhi zu cha dan gu bu jiu ao fu jian ba duo ke nai zhu bi liu chai zha si zhu pei shi guai cha yao cheng jiu shi zhi liu mei li rong zha zao biao zhan zhi long dong lu saeng li lan yong shu xun shuan qi chen xi li yi xiang zhen li ci kuo kan bing ren xiao bai ren bing zi chou yi ci xu zhu zun zui er er you fa gong kao lao zhan lie yin yang he gen zhi shi ge zai luan fu jie heng gui tao guang wei kuang ru an an juan yi zhuo ku zhi qiong tong sang sang huan ju jiu xue duo chui mou zan uu ying jie liu zhan ya rao zhen dang qi qiao hua hui jiang zhuang xun suo sa chen bei ying kuo jing bo ben fu rui tong jue xi lang liu feng qi wen jun gan su liang qiu ting you mei bang long peng zhuang di juan tu zao ao gu bi di han zi zhi ren bei geng jian huan wan nuo jia tiao ji xiao lv kuan shao cen fen song meng wu li li dou qin ying suo ju ti xie kun zhuo shu chan fan wei jing li bing xia fo chou zhi lai lian jian tuo ling li qi bing lun song qian mian qi qi cai gun chan de fei pai bang bei hun zong chang zao ji li peng yu yu gu gun dong tang gang wang di cuo fan cheng zhan qi yuan yan yu juan yi sen shen chui ling qi zhuo fu ke lai zou zou zhuo guan fen fen chen qing ni wan guo lu hao jie yi chou ju ju cheng cui liang kong zhi zhui ya ju bei jiao zhuo zi bin peng ding chu chang men hua jian gui xi du qian dao gui dian luo zhi juan myeong fu geng peng shan yi tuo san chuan ye fu wei wei duan jia zong jian yi shen po yan yan chuan jian chun yu he zha wo pian bi yao guo xu ruo yang la yan ben hui kui jie kui si feng xie tuo ji jian mu mao chu ku hu lian leng ting nan yu you mei cong xuan xuan yang zhen pian die ji jie ye chu dun yu zou wei mei di ji jie kai qiu ying rou huang lou le quan xiang pin shi gai tan lan wen yu chen lv ju shen chu pi xie jia yi zhan bo nuo mi lang rong gu jin ju ta yao zhen bang sha yuan zi ming su jia yao jie huang gan fei zha qian ma sun yuan xie rong shi zhi cui wen ting liu rong tang que zhai si sheng ta ke xi gu qi gao gao sun pan tao ge chun zhen nou ji shuo gou chui qiang cha qian huai mei chu gang gao zhuo tuo qiao yang zhen jia kan zhi dao long bin zhu sang xi ji lian hui yong qian guo gai gai tuan hua qi shen cui peng you hu jiang hu huan gui nie yi gao kang gui gui cao man jin di zhuang le lang chen cong li xiu qing shuang fan tong guan ze su lei lu liang mi lou chao su ke chu tang biao lu liao zhe zha shu zhang man mo niao yang tiao peng zhu sha xi quan heng jian cong ji yan qiang xue ying er xun zhi qiao zui cong pu shu hua gui zhen zun yue shan xi chun dian fa gan mo wu qiao rao lin liu qiao jian run fan zhan du liao yun shun dun cheng tang meng ju cheng su jue jue tan hui ji nuo xiang tuo ning rui zhu tong zeng fen qiong ran heng qian gu liu lao gao chu xi sheng zi san ji dou jing lu jian chu yuan da qiao jiang tan lin nao yin xi hui shan zui xuan cheng gan ju zui yi qin pu dan lei feng hui dang ji sui bo bo cheng chu zhua hui ji jie jia jing zhai jian qiang dao yi biao song she lin li cha meng yin chou tai mian qi tuan bin huo ji lian mi ning yi gao kan yin ru qing yan qi mi di gui chun ji kui po deng chu ge mian you zhi guang qian lei lei sa lu li cuan lv mie hui ou lv zhi gao du yuan li fei zhu sou lian jiang chu qing zhu lu yan li zhu chen ji e su huai nie yu long lai qiao xian gui ju xiao ling ying jian yin you ying rang nong bo chan lan ju shuang she zui cong quan qu cang jou yu luo li zuan luan dang jue yan lan lan zhu lei li ba nang yu ling guang qian ci huan xin yu yu qian ou xu chao chu qi ai yin jue xi xu he yu kui lang kuan shuo xi ai qi qi xu chuai qin kuan qian kuan kan chuan sha gua yin xin xie yu qian xiao ye ge wu tan jin ou hu ti huan xu pen xi chi xu xi uu lian chu yi e yu chuo huan zhi zheng ci bu wu qi bu bu wai ju qian chi se chi se zhong sui sui li ji yu li gui dai e si jian zhe wen mo yao mo cu yang tian sheng dai shang xu xun shu can jing piao qia qiu su jing yun lian yi bo zhi yan can hun dan ji die zhen yun wen chou bin ti jin shang yin diao jiu kui cuan yi dan du jiang lian bin du jian jian shu ou duan zhu yin sheng yi sa ke ke yao xun dian hui hui gu qiao ji yi kou hui duan yi xiao wu guan mu mei mei ai jie du yu bi bi bi pi pi bi chan mao uu uu bi mao jia zhan sai mu tuo xun er rong xian ju mu hao qiu dou uu tan pei ju duo cui bi san san mao sai shu shu tuo he jian ta san shu mu mao tong rong chang pu lu zhan sao zhan meng lu qu die zhi di min jue mang qi pie nai qi dao xian chuan fen ri nei bin fu shen dong qing qi yin xi hai yang an ya ke qing ya dong dan lv qing yang yun yun shui shui cheng bing yong dang shui le ni qiu fan qiu ding zhi qiu pa ze mian cuan hui diao han cha zhuo chuan wan fan tai xi tuo mang you qi shan chi han qian wu wu xun si ru gong jiang chi wu tu jiu tang zhi zhi qian mi yu wang jing jing rui jun hong tai fu ji bian bian han wen zhong fang xiong jue hu niu qi pen xu xu qin yi wo yun yuan hang yan shen chen dan you dun hu huo qi mu niu mei ta mian wu chong pang bi sha zhi pei pan zhui za gou liu mei ze feng ou li lun cang feng wei hu mo mei shu ju za tuo tuo tuo he zhen ni chi fa fei you tian zhi zhao gu zhan yan si kuang jiong gou xie qiu die jia zhong quan bo hui mi ben ze zhu le ao gu hong gan fa liu si hu ping ci fan di su ning cheng ling pao bo qi si ni ju yue zhu sheng lei xuan xue fu pan min tai yang ji yong guan beng xue long lu dan luo xie po ze jing yin zhou jie shi hui hui zai cheng yan wei hou cun yang lie si ji er xing fu sa zi zhi yin wu xi kao zhu jiang luo uu an dong yi mou lei yi mi quan jin po wei xiao xie hong xu su kuang yao jie ju er zhou ru ping xun xiong zhi huang huan ming huo gui qia pai hu qu liu yi xia jing qian jiang jiao zhen shi zhuo ce peol hui ji liu chan hun hu nong xun jin lie qiu wei zhe jun han bin mang zhuo you xi bo dou huan hong yi pu cheng lan hao lang han li geng fu wu li chun feng yi yu tong lao hai jin xia chong jiong mei sui cheng pei jian shen tu kun ping nie han jing xiao she ren tu yong xiao xian ting e shu yun juan cen ti li shui si lei shui tao du lao lai lian wei wo yun huan di heng run jian zhang se pou guan xing shou shuan ya chuo zhang ye kong wan han tuo dong he wo ju she liang hun ta zhuo dian ji de juan zi xi xiao qi gu guo yan lin chang diao peng hao chang shu qi fang chi lu nao ju tao cong lei zhe peng fei song tian pi dan yu ni yu lu gan mi jing ling lun yin cui qu huai yu nian shen hu chun hu yuan lai hun qing yan qian tian miao zhi yin bo ben yuan wen ruo fei qing yuan ke ji she yuan se lu zi du qi jian mian pi xi yu yuan shen shen rou huan zhu jian nuan yu qiu ting qu du feng zha bo wo wo di wei wen nuo die ce wei he gang yan hong xuan mi ke mao ying yan you hong miao sheng mei zai hun nai gui chi e pai mei lian qi qi mei tian cou wei can tuan mian xu po xu ji pen qian jian hu feng xiang yi yin zhan shi jie zhen huang tan yu bi min shi tu sheng yong ju tong tuan qiu qiu qiu yan tang long huo yuan nan pan you quan zhuang liang chan xian chun nie zi wan shi man ying la kui feng jian xu lou wei gai xia ying po jin gui tang yuan suo yuan lian yao meng zhun cheng ke tai da wa liu gou sao ming zha shi yi lun ma pu wei li zai wu xi wen qiang ze shi shuo ai zhen sou yun xiu yin rong hun su suo ni ta shi ru ai pan xu chu pang weng cang mie ge dian hao huang qi zi di zhi xing fu jie hua ge zi tao teng sui bi jiao hui gun yao gao long zhi yan she man ying chun lv lan luan xiao bin tan yu xiu hu bi biao zhi jiang kou shen shang di mi ao lu hu hu you chan fan yong gun man qing yu piao ji ya chao qi xi ji lu lu long jin guo cong lou zhi gai qiang li yan cao jiao cong chun zhuan ou teng ye xi mi tang mo shang han lian lan wa tai gan feng xuan yi man zi mang kang luo peng shu zhang zhang chong xu huan kuo jian yan shuang liao cui ti yang jiang zong ying hong xin shu guan ying xiao zong kun xu lian zhi wei pie yu jiao po xiang hui jie wu pa ji pan wei su qian qian xi lu xi xun dun huang min run su liao zhen zong yi zhi wan tan tan chao xun kui ye shao tu zhu sa hei bi shan chan chan shu tong pu lin wei se se cheng jiong cheng hua jiao lao che gan cun jing si shu peng han yun liu gong fu hao he xian jian shan xi ao lu lan ning yu lin mian zao dang han ze xie yu li shi xue ling wan zi yong hui can lian dian ye ao huan zhen dan man gan dan yi sui pi ju ta qin ji zhuo lian nong guo jin pen se ji sui hui chu ta song ding se zhu lai bin lian mi shi shu mi ning ying ying meng jin qi bi ji hao ruan cui wo tao yin yin dui ci huo jing lan jun kai pu zhuo wei bin gu qian ying bin kuo fei cang me jian dui luo zan lu li you yang lu si zhi ying du wang hui xie pan shen biao chan mie liu jian pu se cheng gu bin huo xian lu qin han ying rong li jing xiao ying sui wei xie huai xue zhu long lai dui fan hu lai shu ling ying mi ji lian jian ying fen lin yi jian yao chan dai rang jian lan fan shuang yuan jiao feng she lei lan cong qu yong qian fa guan jue yan hao ying sa zan luan yan li mi shan tan dang jiao chan ying hao ba zhu lan lan nang wan luan quan xian yan gan yan yu huo huo mie guang deng hui xiao xiao hui hong ling zao zhuan jiu zha xie chi zhuo zai zai can yang qi zhong fen niu jiong wen pu yi lu chui pi kai pan yan yan feng mu chao liao que kang dun guang xin zhi guang guang wei qiang bian da xia zheng zhu ke zhao fu ba xie xie ling zhuo xuan ju tan pao jiong pao tai tai bing yang tong shan zhu zha dian wei shi lian chi huang zhou hu shuo lan jing jiao xu heng quan lie huan yang xiu xiu xian yin wu zhou yao shi wei tong xue zai kai hong lao xia chong xuan zheng po yan hui guang che hui kao chen fan shao ye hui uu tang jin re lie xi fu jiong che pu jing zhuo ting wan hai peng lang yan xu feng chi rong hu xi shu huo xun kao juan xiao xi yan han zhuang jun di che ji wu uu lv han yan huan men ju tao bei fen lin kun hun tun xi cui wu hong chao fu wo jiao cong feng ping qiong ruo xi qiong xin zhuo yan yan yi jiao yu gang ran pi xiong wang sheng chang shao xiong nian geng qu chen he kui zhong duan xia hui feng lian xuan xing huang jiao jian bi ying zhu wei tuan shan xi xuan nuan chan yan jiong jiong yu mei sha wei ye jin qiong rou mei huan xu zhao wei fan qiu sui yang lie zhu jie sao gua bao hu wen nan shi liang bian gou tui tang chao shan en bo huang xie xi wu xi yun he he xi yun xiong xiong shan qiong yao xun mi qian ying wu rong gong yan qiang liu xi bi biao cong lu jian shou yi lou feng cui yi tong jue zong yun hu yi zhi ao wei liu han ou re jiong man kun shang cuan zeng jian xi xi xi yi xiao chi huang dan ye tan ran yan xun qiao jun deng dun shen jiao fen si liao yu lin tong shao fen fan yan xun lan mei tang yi jiong men jing uu ying yu yi xue lan lie zao can sui xi que cong lian hui zhu xie ling yu yi xie zhao hui da nung bing ru bing xiao xun jin chou tao yao he lan biao rong li mo bao ruo lv lie ao xun kuang shuo liao li lu jue liao yan xi xie long ye can rang yue lan cong jue chong guan ju che mi tang lan zhu lan ling cuan yu zhua zhua pa zheng pao cheng yuan ai wei han jue jue fu ye ba die ye yao zu shuang er pan chuang ke zang die qiang yong qiang pian ban pan chao jian pai du chuang yu zha bian die bang bo chuang you yong du ya cheng niu niu pin le mou ta mu lao ren mang fang mao mu gang wu yan ge bei si jian gu you ke sheng mu di qian quan quan zi te xi mang keng qian wu gu xi li li pou ji gang zhi ben quan chun du ju jia jian feng pian ke ju kao chu xi bei luo jie ma san wei mao dun tong qiao jiang xi li du lie bai piao bao xi chou wei kui chou quan quan ba fan qiu ji chai bao han he zhuang guang ma you kang fei hou ya yin huan zhuang yun kuang niu di kuang zhong mu bei pi ju chi sheng pao xia yi hu ling fei pi ni yao you gou xue ju dan bo ku xian ning huan hen jiao he zhao jie xun shan shi rong shou tong lao du xia shi kuai zheng yu sun yu bi mang xi juan li xia yin jun lang bei zhi yan sha li han xian jing pai fei xiao pi qi ni biao yin lai lie jian qiang kun yan guo zong mi chang ji zhi zheng wei meng cai cu she lie ceon luo hu zong fui wei feng wo yuan xing zhu mao wei chuan xian tuan jia nao xie jia hou bian you you mei cha yao sun bo ming hua yuan sou ma yuan dai yu shi hao qiang yi zhen cang hao man jing jiang mu zhang chan ao ao hao cui fen jue bi bi huang pu lin yu tong xiao liao xi xiao shou dun jiao ge xuan du hui kuai xian xie ta xian xun ning bian huo ru meng lie you guang shou lu ta xian mi rang huan nao luo xian qi jue xuan miao zi shuai lu yu su wang qiu ga ding le ba ji hong di chuan gan jiu yu qi yu yang ma hong wu fu wen jie ya fen men bang yue jue yun jue wan yin mei dan pin wei huan xian qiang ling dai yi gan ping dian fu xuan xi bo ci gou jia shao po ci ke ran sheng shen yi ju jia min shan liu bi zhen zhen jue fa long jin jiao jian li guang xian zhou gong yan xiu yang xu luo su zhu qin yin xun bao er xiang yao xia heng gui chong xu ban pei lao dang ying hun wen e cheng di wu wu cheng jun mei bei ting xian chu han xuan yan qiu xuan lang li xiu fu liu ya xi ling li jin lian suo suo feng wan dian pin zhan cui min yu ju chen lai min sheng wei tian chu zhuo pei cheng hu qi e kun chang qi beng wan lu cong guan yan diao fei lin qin pi pa qiang zhuo qin fa jin qiong du jie hun yu mao mei chun xuan ti xing dai rou min jian wei ruan huan jie chuan jian zhuan yang lian quan xia duan huan ye nao hu ying yu huang rui se liu shi rong suo yao wen wu zhen jin ying ma tao liu tang li lang gui tian cang cuo jue zhao yao ai bin tu chang kun zhuan cong jin yi cui cong ji li jing zao qiu xuan ao lian men zhang yin hua ying wei lu wu deng xiu zeng xun qu dang lin liao jue su huang gui pu jing fan jin liu ji hui jing ai bi can qu zao dang jiao gun tan kuai huan se sui tian chu yu jin fu bin shu wen zui lan xi ji xuan ruan wo gai lei du li zhi rou li zan qiong ti gui sui la long lu li zan lan ying xi xiang qiong guan dao zan huan gua bo die pao gu hu piao ban rang li wa shiwa hong qianwa ban pen fang dan weng ou fenwa milik wa hu ling yi ping ci baiwa juan chang chi liwa dang wa bu zhui ping bian zhou zhen liwa ci ying qi xian lou di ou meng zhuan beng lin zeng wu pi dan weng ying yan gan dai shen tian tian han chang sheng qing shen chan chan rui sheng su shen yong shuai lu pu yong beng feng ning tian you jia shen you dian fu nan dian ping ding hua ding quan zi mang bi bi jiu sun liu chang mu yun fan fu geng tian jie jie quan wei fu tian mu tap pan jiang wa fu nan liu ben zhen chu mu mu ji tian gai bi da zhi lue qi lue fan yi fan hua she she mu jun yi liu she die chou hua dang zhui qi wan jiang cheng chang tuan lei ji cha liu die tuan lin jiang jiang chou pi die die pi jie dan shu shu zhi yi ne nai ding bi jie liao gang ge jiu zhou xia shan xu nue li yang chen you ba jie jue qi ya cui bi yi li zong chuang feng zhu pao pi gan ke ci xue zhi dan zhen bian zhi teng ju ji fei ju shan jia xuan zha bing ni zheng yong jing quan chong tong yi jie you hui shi yang chi zhi hen ya mei dou jing xiao tong tu mang pi xiao suan pu li zhi cuo duo wu sha lao shou huan xian yi peng zhang guan tan fei ma ma chi ji dian an chi bi bi min gu dui ke wei yu cui ya zhu cu dan shen zhong chi yu hou feng la yang chen tu yu guo wen huan ku xia yin yi lou sao jue chi xi guan yi wen ji chuang ban hui liu cuo shou nue dian da bie tan zhang biao shen cu luo yi zong lu zhang ji sou se que diao lou lou mo qin yin ying huang fu liao long jiao liu lao xian fei dan yin he ai ban xian guan gui nong yu wei yi yong pi lei li shu dan lin dian lin lai bie ji chi yang xuan jie zheng me li huo lai ji dian xuan ying yin qu yong tan dian luo luan luan bo uu gui ba fa deng fa bai bai qie bi zao zao mao de ba jie huang gui ci ling gao mo ji jiao peng gao ai e hao han bi wan chou qian xi ai po hao huang hao ze cui hao xiao ye pan hao jiao ai xing huang li piao he jiao pi gan pao zhou jun qiu cun que zha gu jun jun zhou zha uu zhan du min qi ying yu bei zhao zhong pen he ying he yi bo wan he ang zhan yan jian he yu kui fan gai dao pan fu qiu sheng dao lu zhan meng li jin xu jian pan guan an lu xu chou dang an gu li mu ding gan xu mang mang zhi qi yuan xian xiang dun xin xi pan feng dun min ming sheng shi yun mian pan fang miao dan mei mao kan xian kou shi ying zheng ao shen huo da zhen kuang ju shen yi sheng mei mie zhu zhen zhen mian shi yuan die ni zi zi chao zha xuan bing pan long sui tong mi zhi di ne ming xun chi kuang juan mou zhen tiao yang yan mo zhong mo zhuo zheng mei juan shao han huan ti cheng cuo juan e man xian xi kun lai jian shan tian huan wan leng shi qiong li ya jing zheng li lai sui juan shui hui du pi bi mu hun ni lu gao jie cai zhou yu hun ma xia xing hui gun zai chun jian mei du hou xuan tian kui gao rui mao xu fa wo miao chou kui mi weng kou dang chen ke sou xia huan mo ming man fen ze zhang yi diao kou mo shun cong lou chi man piao cheng gui meng huan shun pie xi qiao pu zhu deng shen shun liao che jian kan ye xu tong wu lin kui jian ye ai hui zhan jian gu zhao qu wei chou sao ning xun yao huo meng mian pin mian lei kuang jue xuan mian huo lu meng long guan man li chu tang kan zhu mao jin jin yu shuo zhuo jue shi yi shen zhi hou shen ying ju zhou jiao cuo duan ai jiao zeng yue ba shi ding qi ji zi gan wu da ku gang xi fan kuang dang ma sha dan jue li fu min e hua kang zhi qi kan jie fen e ya pi zhe yan sui zhuan che dun wa yan jin feng fa mo zuo zu yu ke tuo tuo di zhai zhen e fei mu zhu li bian nu ping peng ling pao le po bo po shen za ai li long tong yong li kuang chu keng quan zhu guang gui e nao qia lu wei ai ge ken xing yan dong peng xi lao hong shuo xia qiao qing ai qiao ji qing xiao ku chan lang hong yu xiao xia bang long yong che che wo liu ying mang que yan sha kun gu ceok hua lu cen jian nue song zhuo keng peng yan chui kong cheng qi cong qing lin jun pan ding min diao zhan he lu ai sui xi leng bei yin dui wu qi lun wan dian gang bei qi chen ruan yan die ding zhou tuo jie ying bian ke bi wei shuo zhen duan xia dang ti nao peng jian di tan cha tian qi dun feng xuan que que ma gong nian xie e ci liu ti tang bang hua pi kui sang lei cuo tian xia qi lian pan ai yun chui zhe ke la pak yao gun zhuan chan qi ao peng liu lu kan chuang ca yin lei piao qi mo qi cui zong qing chuo lun ji shan lao qu zeng deng jian xi lin ding dian huang pan ji ao di li jian jiao xi zhang qiao dun jian yu zhui he huo ze lei jie chu ye que dang yi jiang pi pi yu pin qi ai ke jian yu ruan meng pao ci bo yang ma ca xian kuang lei lei zhi li li fan que pao ying li long long mo bo shuang guan lan ca yan shi shi li reng she yue si qi ta ma xie yao xian zhi qi zhi fang dui zhong uu yi shi you zhi tiao fu fu mi jie zhi suan mei zuo qu hu zhu shen sui ci chai mi lv yu xiang wu tiao piao zhu gui xia zhi ji gao zhen gao shui jin shen gai kun di dao huo tao qi gu guan zui ling lu bing jin dao zhi lu chan bi chu hui you xi yin zi huo zhen fu yuan xu xian yang zhi yi mei si di bei zhuo zhen yong ji gao tang si ma ta fu xuan qi yu xi ji si chan dan gui sui li nong mi dao li rang yue ti zan lei rou yu yu li xie qin he tu xiu si ren tu zi cha gan zhi xian bing nian qiu qiu zhong fen hao yun ke miao zhi jing bi zhi yu mi ku ban pi ni li you zu pi bo ling mo cheng nian qin yang zuo zhi zhi shu ju zi kuo ji cheng tong zhi kuo he yin zi zhi jie ren du chi zhu hui nong bu xi gao lang fu xun shui lv kun gan jing ti cheng tu shao shui ya lun lu gu zuo ren zhun bang bai qi zhi zhi kun ling peng ke bing chou zui yu su lue uu yi qie bian ji fu bi nuo jie zhong zong xu cheng dao wen xian zi yu ji xu zhen zhi dao jia ji gao gao gu rong sui rong ji kang mu cen mi zhi ji lu su ji ying wen qiu se kweok yi huang qie ji sui rao pu jiao bo tong zui lu sui nong se hui rang nuo yu pin ji tui wen cheng huo kuang lv biao se rang jue li zan xue wa jiu qiong xi kong kong yu shen jing yao chuan tun tu lao qie zhai yao bian bao yao bing wa zhu liao qiao diao wu wa yao zhi chuang yao tiao jiao chuang jiong xiao cheng kou cuan wo dan ku ke zhuo huo su guan kui dou zhuo yin wo wa ya yu lou qiong yao yao tiao chao yu tian diao lou liao xi wu kui chuang ke kuan kuan long cheng cui liao zao cuan qiao qiong dou zao long qie li chu shi fu qian chu hong qi hao sheng fen shu miao qu zhan zhu ling long bing jing jing zhang bai si jun hong tong song zhen diao yi shu jing qu jie ping duan li zhuan ceng deng cun wai jing kan jing zhu zhu le peng yu chi gan mang zhu wan du ji jiao ba suan ji qin zhao sun ya rui yuan wen hang xiao cen bi bi jian yi dong shan sheng xia di zhu na chi gu li qie min bao tiao si fu ce ben ba da zi di ling zuo nu fu gou fan jia gan fan shi mao po shi jian qiong long min bian luo gui qu chi yin yao xian bi qiong kuo deng jiao jin quan sun ru fa kuang zhu tong ji da hang ce zhong kou lai bi shai dang zheng ce fu yun tu pa li lang ju guan jian han tong xia zhi cheng suan shi zhu zuo xiao shao ting jia yan gao kuai gan chou kuang gang yun o qian xiao jian pou lai bei pai bi bi ge tai guai yu jian dao gu hu zheng jing sha zhou lu bo ji lin suan jun fu zha gu kong qian quan jun chui guan wan ce zu bo zhai qie tuo luo dan xiao ruo jian xuan bian sun xiang xian ping zhen sheng hu shi zhu yue chun lv wu dong xiao ji jie huang xing mei fan chuan zhuan pian feng zhu hong qie hou qiu miao qian gu kui shi lou yun he tang yue chou gao fei ruo zheng gou nie qian xiao cuan gong pang du li bi zhuo chu shi chi zhu cang long lan jian bu li hui bi zhu cong yan peng zan zuan pi piao dou yu mie zhuan zhai shai guo yi hu chan kou cu ping zao ji gui su lou ce lu nian suo cuan diao suo le duan liang xiao bo mie si dang liao dan dian fu jian min kui dai jiao deng huang zhuan lao zan xiao lu shi zan qi pai qi pi gan ju lu lu yan bo dang sai ke gou qian lian bu zhou lai shi lan kui yu yue hao zhen tai ti mi chou jie yi qi teng zhuan zhou fan sou zhou qian zhuo teng lu lu jian tuo ying yu lai long qie lian lan qian yue zhong ju lian bian duan zuan li shi luo ying yue zhuo yu mi di fan shen zhe shen nv he lei xian zi ni cun zhang qian zhai pi ban wu sha kang rou fen bi cui yin zhe mi tai hu ba li gan ju po mo cu nian zhou chi su diao li xi su hong tong ci ce yue zhou lin zhuang bai lao fen er qu he liang xian fu liang can jing li yue lu ju qi cui bai zhang lin zong jing guo hua shen shen tang bian rou mian hou xu zong hu jian zan ci li xie fu nuo bei gu xiu gao tang qiu jia cao zhuang tang mi shen fen zao kang jiang mo san san nuo xi liang jiang kuai bo huan shu ji xian nuo tuan nie li zuo di nie tiao lan si si jiu xi gong zheng jiu you ji cha zhou xun yue hong yu he wan ren wen wen qiu na zi tou niu fou jie shu chun pi zhen sha hong zhi ji fen yun ren dan jin su fang suo cui jiu zha ba jin fu zhi qi zi chou hong zha lei xi fu xie shen bo zhu qu ling zhu shao gan yang fu tuo zhen dai chu shi zhong xuan zu jiong ban qu mo shu zui kuang jing ren hang yi jie zhu chou gua bai jue kuang hu ci geng geng tao jie ku jiao quan ai luo xuan bing xian fu gei tong rong tiao yin lei xie juan xu hai die tong si jiang xiang hui jue zhi jian juan chi wan zhen lv cheng qiu shu bang tong xiao wan qin geng xiu ti xiu xie hong xi fu ting sui dui kun fu jing hu zhi xian jiong feng ji xu ren zong lin duo li lv liang chou quan shao qi qi zhun qi wan qing xian shou wei qi tao wan gang wang beng zhui cai guo cui guan liu qi zhan bi chuo ling mian qi qie tan zong hun zou xi zi xing liang jin fei rui hun yu zong fan lv xu ying shang qi xu xiang jian ke xian ruan mian qi duan zhong di min miao yuan xie bao si qiu bian huan geng cong mian wei fu wei xu gou miao xie lian zong bian yun yin ti gua zhi yun cheng chan dai xia yuan zong xu sheng wei geng seon ying jin yi zhui ni bang hu pan zhou jian cuo quan shuang yun xia shuai xi rong tao fu yun zhen gao ru hu zai teng xian su zhen zong tao huang cai bi feng cu li su yan xi zong lei zhuan qian man zhi lv mo piao lian mi xuan zong ji shan cui fan lv beng yi sao miu yao qiang sheng xian xi sha xiu ran xuan sui qiao zeng zuo zhi shan san lin yu fan liao chuo zun jian rao chan rui xiu hui hua zuan xi qiang yun da sheng hui xi se jian jiang huan sao cong xie jiao bi tan yi nong sui yi sha ru ji bin qian lan pu xun zuan qi peng li mo lei xie zuan kuang you xu lei xian chan jiao lu chan ying cai xiang xian zui zuan luo li du lan lei lian si jiu yu hong zhou qian he yue ji wan kuang ji ren wei yun hong chun pi sha gang na ren zong guan fen zhi wen fang zhu zhen niu shu xian gan yi fu lian zu shen xi zhi zhong zhou ban fu chu shao yi jing dai bang rong jie ku rao die hang hui gei xuan jiang luo jue jiao tong geng shao juan xiu xi sui tao ji ti ji xu ling ying xu qi fei chuo shang gun sheng wei mian shou beng chou tao liu quan zong zhan wan lv zhui zi ke xiang jian mian lan ti miao qi yun hui si duo duan bian xian gou zhui huan di lv bian min yuan jin fu ru zhen feng shuai gao chan li yi jian bin piao man lei ying su miu sao xie liao shan ceng jiang qian sao huan jiao zuan fou xie gang fou que fou qi bo ping xiang zhao gang ying ying qing xia guan zun tan cang qi weng ying lei tan lu guan wang wang wang wang han ra luo fu shen fa gu zhu ju mao gu min gang ba gua ti juan fu shen yan zhao zui gua zhuo yu zhi an fa lan shu si pi ma liu ba fa li chao wei bi ji zeng chong liu ji juan mi zhao luo pi ji ji luan yang mi qiang da mei yang you you fen ba gao yang gu qiang yang gao ling yi zhu di xiu qiang yi xian rong qun qun qiang huan suo xian yi yang kong xian yu geng jie tang yuan xi fan shan fen shan lian lei geng nou qiang chan yu hong yi chong weng fen hong chi chi cui fu xia ben yi la yi pi ling lu zhi qu xi xie xiang xi xi ke qiao hui hui shu sha hong jiang zhai cui fei zhou sha chi zhu jian xuan chi pian zong wan hui hou he hao han ao piao yi lian qu ao lin pen qiao ao fan yi hui xuan dao yao lao uu kao mao zhe qi gou gou gou die die er shua ruan er nai zhuan lei ting zi geng chao hao yun pa pi yi si chu jia ju huo chu lao lun jie tang ou lou nou jiang pang ze lou ji lao huo you mo huai er yi ding ye da song qin yun chi dan dan hong geng zhi uu nie dan zhen che ling zheng you tui liao long zhi ning tiao er ya tie guo sei lian hao sheng lie pin jing ju bi zhi guo wen xu ping cong ding uu ting ju cong kui lian kui cong lian weng kui lian lian cong ao sheng song ting kui nie zhi dan ning qie jian ting ting long yu nie zhao si su si su si zhao zhao rou yi le ji qiu ken cao ge di huan huang chi ren xiao ru zhou yuan du gang rong gan cha wo chang gu zhi qin fu fei fen pei feng jian fang zhun you na ang ken ran gong yu wen yao qi pi qian xi xi fei ken jing tai shen zhong zhang xie shen wei zhou die dan fei ba bo qu tian bei gua tai zi ku shi ni ping ci fu pang zhen xian zuo pei jia sheng zhi bao mu qu hu ke chi yin xu yang long dong ka lu jing nu yan pang kua yi guang hai ge dong zhi jiao xiong xiong er an heng pian neng zi gui cheng tiao zhi cui mei xie cui xie mai mai ji xie nin kuai sa zang qi nao mi nong luan wan bo wen huan xiu jiao jing rou heng cuo luan shan ting mei chun shen jia te zui cu xiu xin tuo pao cheng nei pu dou tuo niao nao pi gu luo li lian zhang cui jie liang shui pi biao lun pian guo juan chui dan tian nei jing nai la ye yan ren shen zhui fu fu ju fei qiang wan dong bi guo zong ding wo mei ruan zhuan chi cou luo ou di an xing nao yu shuan nan yun zhong rou e sai dun yao jian wei jiao yu jia duan bi chang fu xian ni mian wa teng tui bang qian lv wa shou tang su zhui ge yi bo liao ji pi xie gao lv bin ou chang lu guo pang chuai piao jiang fu tang mo xi zhuan lu jiao ying lou zhi xue cen lin tong peng ni chuai liao cui kui xiao teng pan zhi jiao shan wu cui run xiang sui fen ying shan zhua dan kuai nong tun lian bei yong ju chu yi juan ge lian sao tun gu qi cui bin xun ru wo zang xian biao xing kun la yan lu huo za luo qu zang luan luan zan chen xian wo jiong zang lin jiong zi jiao nie chou ji hao chou bian nie zhi zhi ge jian zhi zhi xiu tai zhen jiu xian yu cha yao yu chuang xi xi jiu yu yu xing ju jiu xin she she she jiu shi ran shu shi tian tan pu pu guan hua tian chuan shun xia wu zhou dao xiang shan yi fan pa tai fan ban chuan hang fang ban bi lu zhong jian cang ling zhou ze duo bo xian ge chuan xia lu hong pang xi kua fu zao feng li shao yu lang ting uu wei bo meng nian ju huang shou zong bian mo die dou bang cha yi sou cang cao lou dai xue tiao tong deng dang qiang lu yi ji jian huo meng qi lu lu chan shuang gen liang jian jian se yan fu ping yan yan cao cao yi le ding qiu ai nai tiao jiao jie peng wan yi cha mian mi gan qian yu xu shao xiong du xia qi mang zi hui sui zhi xiang pi fu chun wei wu zhi qi shan wen qian ren fu kou jie lu xu ji qin chi yuan fen ba rui xin ji hua hua fang wu jue ji zhi yun qin ao chu mao ya fei reng hang cong yin you bian yi qie wei li pi e xian chang cang zhu su ti yuan ran ling tai tiao di miao qing li yong he mu bei bao gou min yi yi ju pie ruo ku ning ni pa bing shan xiu yao xian ben hong ying zha dong ju die nie gan hu ping mei fu sheng gua bi wei fu zhu mao fan qie mao mao ba ci mo zi zhi chi ji jing long cong niao uu xue ying qiong ge ming li rong yin gen qian chai chen yu xiu zi lie wu duo gui ci chong ci hou guang mang cha jiao niao fu yu zhu zi jiang hui yin cha fa rong ru chong mang tong zhong qian zhu xun huan fu quan gai da jing xing chuan cao jing er an qiao chi ren jian yi huang ping li qian lao shu zhuang da jia rao bi ce qiao hui ji dang yu rong hun xing luo ying xun jin sun yin mai hong zhou yao du wei li dou fu ren yin he bi bu yun di tu sui sui cheng chen wu bie xi geng li fu zhu mo li zhuang zuo tuo qiu sha suo chen peng ju mei qing xing jing che xin jun yan ting you cuo guan han you cuo jia wang you niu xiao xian liang fu e mo mian jie nan mu kan lai lian shi wo tu xian huo you ying ying neus chun mang mang ci wan jing di qu dong guan chu gu la lu ju wei jun ren kun he pu zi gao guo fu lun chang chou song chui zhan men cai ba li tu bo han bao qin juan xi qin di jie pu dang jin zhao zhi geng hua gu ling fei jin yan wang beng zhou yan ju jian lin tan shu tian dao hu ji he cui tao chun pi chang huan fei lai qi meng ping wei dan sha zhui yan yi shao qi guan ce nai zhen ze jiu tie luo bi yi meng be pao ding ying ying ying xiao sa qiu ke xiang wan yu yu fu lian xuan xuan nan ce wo chun xiao yu pian mao an e luo ying huo kuo jiang mian zuo zuo zu bao rou xi ye yan qu jian fu lv jing pen feng hong hong hou yan tu zhe zi xiang shen ge qia jing mi huang shen pu gai dong zhou jian wei bo wei pa ji hu zang xia duan yao jun cong quan wei zhen kui ting hun xi shi qi lan zong yao yuan mei yun shu di zhuan guan ran xue chan kai kui uu jiang lou wei pai yong sou yin shi chun shi yun zhen lang na meng li que suan yuan li ju xi bang chu shu tu liu huo dian qian zu po cuo yuan chu yu kuai pan pu pu na shuo xi fen yun zheng jian ji ruo cang en mi hao sun zhen ming sou xu liu xi gu lang rong weng gai cuo shi tang luo ru suo xuan bei yao gui bi zong gun zuo tiao ce pei lan uu ji li shen lang yu ling ying mo tiao xiu mao tong zhu peng an lian cong xi ping qiu jin chun jie wei tui cao yu yi zi liao bi lu xu bu zhang lei qiang man yan ling ji piao gun han di su lu she shang di mie hun man bo dai cuo zhe shen xuan wei hu ao mi lou cu zhong cai po jiang mi cong niao hui juan yin jian yan shu yin guo chen hu sha kou qian ma cang ze qiang dou lian lin kou ai bi li wei ji xun sheng fan meng ou chan dian xun jiao rui rui lei yu qiao zhu hua jian mai yun bao you qu lu yao hui e ti fei jue zui fa ru fen kui shun rui ya xu fu jue dang wu dong si xiao xi long yun shao ji jian yun sun ling yu xia yong ji hong si nong lei xuan yun yu xi hao bo hao ai wei hui hui ji zi xiang luan mie yi leng jiang can shen qiang lian ke yuan da zhi tang xue bi zhan sun lian fan ding xie gu xie shu jian kao hong sa xin xun yao bai sou shu xun dui pin yuan ning chou mai ru piao tai ji zao chen zhen er ni ying gao cong hao qi fa jian yu kui jie bian di mi lan jin cang mo qiong qie xian uu ou xian su lv yi xu xie li yi la lei jiao di zhi bei teng yao mo huan biao fan sou tan tui qiong qiao wei liu hui ou kao yun bao li zhu zhu ai lin zao xuan qin lai huo ze e rui rui ji heng lu su tui mang yun ping yu xun ji jiong xuan mo qiu su jiong feng nie bo xiang yi xian yu ju lian lian yin qiang ying long tou hua yue ling ju yao fan mei lan kui lan ji dang man lei lei hui feng zhi wei kui zhan huai li ji mi lei huai luo ji kui lu jian sal teng lei quan xiao yi luan men bie hu hu lu nve lv ti xiao qian chu hu xu cuo fu xu xu lu hu yu hao jiao ju guo bao yan zhan zhan kui bin xi shu hui qiu diao ji qiu ding shi uu jue zhe ye yu han zi hong hui meng ge sui xia chai shi yi ma xiang fang e ba chi qian wen wen rui bang pi yue yue jun qi tong yin zhi can yuan jue you qin qi zhong ya ci mu wang fen fen hang gong zao fu ran jie fu chi dou bao xian ni dai qiu you zha ping chi you ke han ju li fu ran zha gou pi pi xian zhu diao bie bing gu zhan qu she tie ling gu dan gu ying li cheng qu mou ge ci hui hui mang fu yang wa lie zhu yi xian kuo jiao li xu ping jie ge she yi wang mo gong qie gui qiong zhi man lao zhe jia nao si qi xing jie qiu xiao yong jia tui che bei e han shu xuan feng shen shen pu xian zhe wu fu li liang bi yu xuan you jie dan dan ting dian tui hui wo zhi song fei ju mi qi qi yu jun la meng qiang xi xi lun li die tiao tao kun han han yu bang fei pi wei tun yi yuan suo quan qian rui ni qing wei liang guo wan dong e ban zhuo wang can mi ying guo chan uu la ke ji xie ting mao xu mian yu jie shi xuan huang yan bian rou wei fu yuan mei wei fu ruan xie you qiu mao xia ying shi zhong tang zhu zong ti fu yuan kui meng la du hu qiu die li wo yun yu nan lou chun rong ying jiang tui lang pang si ci ci xi yuan weng lian sou pan rong rong ji wu xiu han qin yi pi hua tang yi du neng xia hu gui ma ming yi wen ying teng zhong cang so qi man tiao shang zhe cao chi dai ao lu wei zhi tang chen piao ju pi yu jian luo lou qin zhong yin jiang shuai wen xiao man zhe zhe mo ma yu liu mao xi cong li man xiao chang zhang mang xiang mo zui si qiu te zhi peng peng qiao qu bie liao fan gui xi ji zhuan huang ben lao jue jue hui xun chan jiao shan rao xiao wu chong xun si chu cheng dang li xie shan yi jing da chan ji ji xiang she guo qin ying chai li zei xuan lian shu ze xie mang xie qi rong jian meng hao ru huo zhuo jie bin he mie fan lei jie la mian li chun li qiu nie lu du xiao chu long li long pang ye pi rang gu juan ying shu xi can qu quan du can man jue jie shu zhuo xie huang nv fou nv xin zhong mai er ka mie xi xing yan kan yuan qu ling xuan shu xian tong long jie xian ya hu wei dao chong wei dao zhun heng qu yi yi bu gan yu biao cha yi shan chen fu gun fen shuai jie na zhong dan yi zhong zhong jie zhi xie ran zhi ren qin jin jun yuan mei chai ao niao yi ran jia tuo ling dai pao pao yao zuo bi shao tan ju ke xue xiu zhen tuo pa bo di wa fu gun zhi zhi ran pan yi mao tuo jue gou xuan chan qu bei yu xi mi bo uu fu chi chi ku ren jiang qia zun bo jie er ge ru zhu gui yin cai lie ka xing zhuang dang sed kun ken niao shu xie kun cheng li juan shen bao jie yi yu zhen liu qiu qun ji yi bu zhuang shui sha qun li lian lian ku jian bao tan bi kun tao yuan ling chi chang chou duo biao liang shang pei pei fei yuan luo guo yan du xi zhi ju qi qi guo gua ken qi ti ti fu zhong xie bian die kun tuan xiu xiu he yuan bao bao fu yu tuan yan yi bei chu lv pao dan yun ta gou da huai rong yuan ru nai jiong suo pan tun chi sang niao ying jie qian huai ku lian lan li zhe shi lv nie die xie xian wei biao cao ji qiang sen bao xiang bi pu jian zhuan jian cuo ji chan za bo bo xiang xun bie rao man lan ao ze hui cao sui nong chan lian bi jin dang shu tan bi lan pu ru zhi tae shu wa shi bai xie bo chen lai long xi xian lan zhe dai ju zan shi jian pan yi lan ya xi xi yao ban qin fu fiao fu ba he ji ji jian guan bian yan gui jiao pian mao mi mi pie shi si chan zhen jue mi tiao lian yao zhi jun xi shan wei xi tian yu lan e du qin pang ji ming ying gou qu zhan jin guan deng jian luan qu jian wei jue qu luo lan shen ji guan jian guan yan gui mi shi chan lan jue ji xi ji tian yu gou jin qu jiao qiu jin chu jue zhi chao ji gu dan zui di shang xie quan ge shi jie gui gong chu xie hun qiu xing su ni ji lu zhi da bi xing hu shang gong zhi xue chu xi yi li jue xi yan xi yan yan ding fu qiu qiu jiao heng ji fan xun diao hong cha tao xu ji yi ren xun yin shan qi tuo ji xun yin e fen ya yao song shen jin xin jue xiao ne chen you zhi xiong fang xin chao she yan sa zhun xu yi yi su chi he shen he xu zhen zhu zheng gou zi zi zhan gu fu jian die ling di yang li nu pan zhou gan yi ju yao zha tuo yi qu zhao ping bi xiong chu ba da zu tao zhu ci zhe yong xu xun yi huang he shi cha xiao shi hen cha gou gui quan hui jie hua gai xiang wei shen chou tong mi zhan ming luo hui yan xiong gua er bing tiao yi lei zhu kuang kua wu yu teng ji zhi ren cu lang e kuang yi shi ting dan bei chan you keng qiao qin shua an yu xiao cheng jie xian wu wu gao song bu hui jing shuo zhen shuo du hua chang shui jie ke qu cong xiao sui wang xian fei lai ta yi ni yin diao bei zhuo chan chen zhun ji qi tan zhui wei ju qing dong zheng cuo zhou qian zhuo liang jian chu hao lun nie biao hua bian yu die xu pian shi xuan shi hun gua e zhong di xie fu pu ting jian qi yu zi zhuan xi hui yin an xian nan chen feng zhu yang yan huang xuan ge nuo qi mou ye wei xing teng zhou shan jian pao kui huang huo ge ying mi sou mi xi qiang zhen xue ti su bang chi qian shi jiang yuan xie xiao tao yao yao zhi xu biao cong qing li mo mo shang zhe miu jian ze zu lian lou can ou gun xi shu ao ao jin zhe yi hu jiang man chao han hua chan xu zeng se xi zha dui zheng xiao lan e ying jue ji zun qiao bo hui zhuan mo jian zha shi qiao tan zen pu sheng xuan zao tan dang sui xian ji jiao jing lian nang yi ai zhan pi hui hui yi yi shan rang nou qian dui ta hu chou hao yi ying jian yu jian hui du zhe xuan zan lei shen wei chan li yi bian zhe yan e chou wei chou yao chan rang yin lan chan xie nie huan zan yi dang zhan yan du yan ji ding fu ren ji jie hong tao rang shan qi tuo xun yi xun ji ren jiang hui ou ju ya ne xu e lun xiong song feng she fang jue zheng gu he ping zu shi xiong zha su zhen di chou ci chu zhao bi yi yi kuang lei shi gua shi jie hui cheng zhu shen hua dan gou quan gui xun yi zheng gai xiang cha hun xu chou jie wu yu qiao wu gao you hui kuang shuo song ei qing zhu zhou nuo du zhuo fei ke wei yu shui mie diao chan liang zhun sui tan shen yi mou chen die huang jian xie nue ye wei e yu xuan chan zi an yan di mi pian xu mo dang su xie yao bang shi qian mi jin man zhe jian miu tan jian qiao lan pu jue yan qian zhan chan gu qian hong xia ji hong han hong xi xi huo liao han du long dou jiang qi chi feng deng wan bi shu xian feng zhi zhi yan yan shi chu hui tun yi tun yi yan ba hou e chu xiang huan jian ken gai ju fu xi bin hao yu zhu jia fen xi hu wen huan bin di zong fen yi zhi bao chai an pi na pi gou duo you diao mo si xiu huan ken he he mo an mao li ni bi yu jia tuan mao pi xi yi lou mo chu tan huan jue bei zhen yuan fu cai gong dai yi hang wan pin huo fan tan guan ze zhi er zhu shi bi zi er gui pian bian mai dai sheng kuang fei tie yi chi mao he ben lu lin hui gai pian zi jia xu zei jiao gai zang jian ying xun zhen she bin bin qiu she chuan zang zhou lai zan ci chen shang tian pei geng xian mai jian sui fu tan cong cong zhi ji zhang du jin xiong chun yun bao zai lai feng cang ji sheng yi zhuan fu gou sai ze liao yi bai chen wan zhi zhui biao bin zeng dan zan yan pu shan wan ying jin gan xian zang bi du shu yan uu xuan long gan zang bei zhen fu yuan gong cai ze xian bai zhang huo zhi fan tan pin bian gou zhu guan er jian ben shi tie gui kuang dai mao fei he yi zei zhi jia hui zi lin lu zang zi gai jin qiu zhen lai she fu du ji shu shang ci bi zhou geng pei dan lai feng zhui fu zhuan sai ze yan zan bin zeng shan ying gan chi xi she nan xiong xi cheng he cheng zhe xia tang zou zou li jiu fu zhao gan qi shan qiong qin xian ci jue qin di ci chen chen die ju chao di xi zhan jue yue qu jie chi chu gua chi ci tiao duo lie gan suo cu xi zhao su yin ju jian que tang chuo cui lu qu dang qiu zi ti qu chi huang qiao qiao jiao zao yao er zan zan zu pa bao wu ke dun jue fu chen yan fang zhi qi yue ba ji yue qiang chi tai yi chen ling mei ba die ku tuo jia ci pao qia zhu ju zhan zhi fu pan ju shan po ni ju li gen yi ji duo xian jiao duo zhu quan kua zhuai gui qiong kui xiang chi lu pian zhi jia tiao cai jian da qiao bi xian duo ji qu ji shu duo cu jing nie xiao bu xue cun mu shu liang yong jiao chou qiao meo ta jian ji wo cu chuo jie ji nie ju nie lun lu leng huai ju chi wan juan ti pou cu qie qi cu zong cai zong peng zhi zheng dian zhi yu duo dun chun yong zhong chi zha chen chuai jian tuo tang ju fu cu die pian rou nuo ti cha tui jian dao cuo xi ta qiang nian dian di ji nie man liu zan bi chong lu liao cu tang dai su xi kui ji zhi qiang di man zong lian beng zao ran bie tui ju deng ceng xian fan chu zhong dun bo jiu cu jue jue lin ta qiao qiao pu liao dun cuan guan zao da bi bi zhuo ju chuo qiao dun chou ji wu yue nian lin lie zhi li zhi chan chu duan wei long lin xian wei zuan lan xie rang xie nie ta qu ji cuan zuan xi kui jue lin shen gong dan fen qu ti duo duo gong lang ren luo ai ji ju tang kong uu yan mei kang qu lou lao duo zhi yan ti dao ying yu che ga gui jun wei yue xin dai xuan fan ren shan kuang shu tun qi tai e na qi mao ruan kuang qian zhuan hong hu gou kuang di ling dai ao zhen fan kuang yang peng bei gu gu pao zhu fu e ba zhou zhi yao ke yi qing shi ping er gong ju jiao guang he kai quan zhou zai zhi she liang yu shao you wan qun zhe wan fu qing zhou ni ling zhe zhan liang zi hui wang chuo guo kan yi peng qian gun nian ping guan bei lun pai liang ruan rou ji yang xian chuan cou chun ge you hong shu fu zi fu wen fan nian yu yun tao gu zhen xia yuan lu jiao chao zhuan wei xuan xue zhe jiao zhan bu liao fen fan lin ge se kan huan yi ji zhui er yu jian hong lei pei li li lu lin che ga gui xuan dai ren zhuan e lun ruan hong gu ke lu zhou zhi yi hu zhen li yao qing shi zai zhi jiao zhou quan he jiao zhe fu liang nian bei hui gun wang liang chuo zi cou fu ji wen shu pei yuan xia nian lu zhe lin xin gu ci ci pi zui bian la la ci xue ban ban bian bian uu bian ban ci bian bian chen ru nong nong zhen chuo zou yi reng bian bian shi ru liao da chan gan qian yu yu qi xun yi guo mai qi bi kuang tu zhun ying da yun jin hang ya fan wu da e huan zhe zhong jin yuan wei lian chi che ni tiao chi yi jiong jia chen dai er di po zhu die ze tao shu tuo qu jing hui dong you mi beng ji nai yi jie zhui lie xun tui song shi tao feng hou ni dun jiong xuan xun bu you xiao qiu tou zhu qiu di di tu jing ti dou yi zhe tong guang wu shi cheng su zao qun feng lian suo hui li gu lai ben cuo zhu beng huan dai lu you zhou jin yu chuo kui wei ti yi da yuan luo bi nuo yu dang sui dun sui yan chuan chi ti yu shi zhen you yun e bian guo e xia huang qiu dao da wei nan yi gou yao chou liu xun ta di chi yuan su ta qian ma yao guan zhang ao shi ca chi su zao zhe dun shi lou chi cuo lin zun rao qian xuan yu yi e liao ju shi bi yao mai xie sui huan zhan teng er miao bian bian la li yuan yao luo li yi ting deng qi yong shan han yu mang ru qiong wan kuang fu hang bin fang xing na xin shen bang yuan cun huo xie bang wu ju you han tai qiu bi pi bing shao bei wa di zou ye lin kuang gui zhu shi ku yu gai he xi zhi ji xun hou xing jiao xi gui nuo lang jia kuai zheng lang yun yan cheng dou xi lv fu wu fu gao hao lang jia geng jun ying bo xi ju li yun bu xiao qi pi qing guo zhou tan zou ping lai ni chen you bu xiang dan ju yong qiao yi dou yan mei ruo bei e shu juan yu yun hou kui xiang xiang sou tang ming xi ru chu jin zou ye wu xiang yun hao yong bi mao chao lu liao yin zhuan hu qiao yan zhang man qiao xu deng bi xun bi zeng wei zheng mao shan lin po dan meng ye sao kuai feng meng ju kuang lian zan chan you ji yan chan zan ling huan xi feng zan li you ding qiu zhuo pei zhou yi gan yu jiu yin zui mao dan xu dou zhen fen yuan fu yun tai tian qia dou cu han gu su fa chou zai ming lao chuo chou you tong zhi xian jiang cheng yin tu jiao mei ku suan lei pu fu hai yan shi niang wei lu lan yan tao pei zhan chun tan zui zhui cu kun ti xian du hu xu xing tan qiu chun yun fa ke sou mi quan chou cuo yun yong ang zha hai tang jiang piao chan ou li zao lao yi jiang bu jiao xi tan fa nong yi li ju yan yi niang ru xun shou yan ling mi mi niang xin jiao shi mi yan bian cai shi you shi shi li zhong ye liang li jin jin ga yi liao dao zhao ding po qiu he fu zhen zhi ba luan fu nai diao shan qiao kou chuan zi fan yu wu gan gang qi mang ren di si xi yi chai shi tu xi nv qian qiu jian zhao ya jin ba fang chen xing dou yue zhong fu pi na qin e jue dun gou yin qian ban sa ren chao niu fen yun yi qin pi guo hong yin jun diao yi zhong xi gai ri huo tai kang yuan lu ngag wen duo zi ni tu shi min gu ke ling bing si gu bo pi yu si zuo bu you dian jia zhen shi shi tie ju chan yi tuo xuan zhao bao he bi sheng zu shi bo zhu chi za po tong qian fu zhai mao qian fu li yue pi yang ban bo jie gou shu zheng mu ni nie di jia mu tan shen yi si kuang ka bei jian tong xing hong jiao chi er ge ping shi mou ha yin jun zhou chong xiang tong mo lei ji si xu ren zun zhi qiong shan li xian jian quan pi yi zhu hou ming kua tiao gua xian xiu jun cha lao ji pi ru mi yi yin guang an diu you se kao qian luan si ngai diao han rui zhi keng qiu xiao zhe xiu zang ti cuo gua gong yong dou lv mei lang wan xin jun bei wu su yu chan ting bo han jia hong juan feng chan wan zhi tuo juan wu yu tiao kuang zhuo lue jing qin shen han lue ye chu zeng ju xian e mang pu li pan rui cheng gao li te bing zhu zhen tu liu zui ju chang wan jian gang diao tao chang lun guo ling pi lu li qing pou juan min zui peng an pi xian ya zhui lei a kong ta kun du wei chui zi zheng ben nie zong chun tian ding qi qian zhui ji yu jin guan mao chang tian xi lian diao gu cuo shu zhen lu meng lu hua biao ga lai ken fang wu nai wan zan hu de xian uu huo liang fa men jie ying chi lian guo xian du tu wei zong fu rou ji e jun zhen ti zha hu yang duan xia yu keng sheng huang wei fu zhao cha qie shi hong kui nuo mou qiao qiao hou tou zong huan ye min jian duan jian si kui hu xuan zhe jie zhen bian zhong zi xiu ye mei pai ai gai qian mei suo ta bang xia lian suo kai liu yao ta nou weng rong tang suo qiang ge shuo chui bo pan da bi sang gang zi wu ying huang tiao liu kai sun sha sou jian gao zhen zhen lang yi yuan tang nie xi jia ge ma juan song zu suo uu feng wen na lu suo kou zu tuan xiu guan xuan lian sou ao man mo luo bi wei liao di can zong yi ao ao keng qiang cui qi chang tang man yong chan feng jing biao shu lou xiu cong long zan zan cao li xia xi kang shuang beng zhang qian cheng lu hua ji pu sui qiang po lin se xiu sa cheng kui si liu nao huang pie sui fan qiao quan yang tang xiang yu jiao zun liao qie lao dun tan zan ji jian zhong deng ya ying dun jue nou ti pu tie uu zhang ding shan kai jian fei sui lu juan hui yu lian zhuo sao jian zhuo lei bi tie huan ye duo guo dang ju ben da bi yi ai zong xun diao zhu heng zhui ji ni he huo qing bin ying kui ning ru jian jian qian cha zhi mie li lei ji zuan kuang shang peng la du shuo chuo lv biao bao lu xian kuan long e lu xin jian lan bo qian yao chan xiang jian xi guan cang nie lei cuan qu pan luo zuan luan zao yi jue tang zhu lan jin ga yi zhen ding zhao po liao tu qian chuan shan sa fan diao men nv yang chai xing gai bu tai ju dun chao zhong na bei gang ban qian yue qin jun wu gou kang fang huo dou niu ba yu qian zheng qian gu bo ke po bu bo yue zuan mu tan jia dian you tie bo ling shuo qian mao bao shi xuan tuo bi ni pi duo xing kao lao er mang ya you cheng jia ye nao zhi dang tong lv diao yin kai zha zhu xian ting diu gua hua quan sha ha diao ge ming zheng se jiao yi chan chong tang an yin ru zhu lao pu wu lai te lian keng xiao suo li zeng chu guo gao e xiu cuo lue feng xin liu kai jian rui ti lang qin ju a qiang zhe nuo cuo mao ben qi de ke kun chang xi gu luo chui zhui jin zhi xian juan huo pou xian ding jian ju meng zi qie ying kai qiang si e cha qiao zhong duan sou huang huan ai du mei lou zi fei mei mo zhen bo ge nie tang juan nie na liu gao bang yi jia bin rong biao tang man luo beng yong jing di zu xuan liao tan jue liao pu lu dun lan pu chuan qiang deng huo lei huan zhuo lian yi cha biao la chan xiang chang chang jiu ao die jue liao mi chang men ma shuan shan shan men yan bi bi bi shan kai kang beng hong run san xian xian jian min xia shui dou zha nao zhan peng xia ling bian bi run he guan ge he fa chu hong gui min seo kun liang lv ting sha ju yue yue chan qu lin chang sha kun yan wen yan yan hun yu wen xiang bao juan qu yao wen ban an wei yin kuo que lan she quan phdeng tian nie ta kai he que chuang guan dou qi kui tang guan piao kan xi hui chan pi dang huan ta wen uu men shuan shan yan han bi wen chuang run wei xian hong jian min kang men zha nao gui wen ta min lv kai fa ge he kun jiu yue liang she yu yan chang xi wen hun yan yan chan lan qu hui kuo que he tian ta que kan huan fu fu le dui xin qian wei gai yi yin yang dou e sheng ban pei keng yun ruan zhi pi jing fang yang yin zhen jie cheng ai qu di zu zuo dian ling a tuo tuo po bing fu ji lu long chen jing duo lou mo jiang shu duo xian er gui yu gai shan jun qiao jing chun fu bi xia shan sheng zhi pu dou yuan zhen chu xian dao nie yun xian pei pei zou qi dui lun yin ju chui chen pi ling tao xian lu sheng xian yin du yang reng xia chong yan yin yu di yu long wei wei nie dui sui an huang jie sui yin ai yan duo ge yun wu kui ai xi tang ji zhang dao ao xi yin sa rao lin tui deng pi sui sui yu xian fen ni er ji dao xi yin zhi duo long xi dai li li cui que zhi sun jun nan yi que yan qin qian xiong ya ji gu huan zhi gou juan ci yong ju chu hu za luo yu chou diao sui han huo shuang huan chu za yong ji xi chou liu li nan xue za ji ji yu xu xue na fou xi mu wen fen fang yun li chi yang ling lei an bao meng dian dang hu wu diao xu ji mu chen xiao sha ting zhen pei mei ling qi zhou huo sha fei hong zhan yin ni zhu tun lin ling dong ying wu ling shuang ling xia hong yin mai mai yun liu meng bin wu wei kuo yin xi yi ai dan teng san yu lu long dai ji pang yang ba pi wei uu xi ji mai mao meng lei li sui ai fei dai long ling ai feng li bao he he he bing qing qing liang tian zhen jing cheng jing jing liang dian jing tian fei fei kao mi mian mian bao yan mian hui yan ge ding cha qian ren di du wu ren qin jin xue niu ba yin sa na mo zu da ban xie yao tao bi jie hong pao yang bing yin ge tao ji xie an an hen gong qia da qiao ting man bian sui tiao qiao juan kong beng ta shang bi kuo ju la die rou bang eng qiu qiu he shao mu ju jian bian di jian on tao gou ta bei xie pan ge bi kuo tang lou gui qiao xue ji jian jiang chan da hu xian qian du wa jian lan wei ren fu mei juan ge wei qiao han chang kuo rou yun she wei ge bai tao gou yun gao bi xue hui du wa du wei ren fu han wei yun tao jiu jiu xian xie xian ji yin za yun shao le peng huang ying yun peng an yin xiang hu ye ding qing qiu xiang shun han xu yi xu gu song kui qi hang yu wan ban dun di dian pan po ling che jing lei han qiao an e wei jie kuo shen yi yi hai dui yu ping lei fu jia tou pou kui jia luo ting cheng ying yun hu han jing tui tui pin lai tui zi zi chui ding lai tan han qian ke cui jiong qin yi sai ti e e yan hun yan yong zhuan yan xian xin yi yuan sang dian dian jiang kua lei lao piao zhuai man cu qiao hao qiao gu xun yan hui chan ru meng bin xian pin lu lan nie quan ye ding qing han xiang shun xu xu wan gu dun qi ban song hang yu lu ling po jing jie jia ting he ying jiong hai yi pin pou tui han ying ying ke ti yong e zhuan yan e nie man dian sang hao lei chan ru pin quan feng diao gua fu xia zhan pao sa ba tai lie gua xuan xiao ju biao si wei yang yao sou kai sao fan liu xi liao piao piao liu biao biao biao liao biao se feng xiu feng yang zhan pao sa ju si sou yao liu piao biao biao fei fan fei fei shi shi can ji ding si tuo gan sun xiang tun ren yu yang chi yin fan fan can yin zhu yi zha bi jie tao bao ci tie si bao shi duo hai ren tian jiao he bing yao tong ci xiang yang juan er yan le xi can bo nei e bu jun dou su yu xi yao hun guo chi jian zhui bing xian bu ye dan fei zhang wei guan e nuan hun hu huang tie hui zhan hou he tang fen wei gu zha song tang bo gao xi kui liu sou xian ye wen mo tang man bi yu xiu jin san kui zhuan shan xi dan yi ji rao cheng yong tao wei xiang zhan fen hai meng yan mo chan xiang luo zan nang shi ding ji tuo tang tun xi ren yu shi fan yin jian shi bao si duo yi er rao xiang he ge jiao xi bing bo dou e yu nei jun guo hun xian guan zha kui gu sou chan ye mo bo liu xiu jin man san zhuan nang shou kui xu xiang fen bo ni bi bo tu han fei jian an ai fu xian yun xin fen pin xin ma yu feng han di tuo tuo chi xun zhu zhi pei xin ri sa yun wen zhi dan lv you bo bao jue tuo yi qu pu qu jiong po zhao yuan peng zhou ju zhu nu ju pi zu jia ling zhen tai fu yang shi bi tuo tuo si liu ma pian tao zhi rong teng dong xun quan shen jiong er hai bo zhu yin luo zhou dan hai liu ju song qin mang liang han tu xuan tui jun e cheng xing si lu zhui zhou she pian kun tao lai zong ke qi qi yan fei sao yan ge yao wu pian cong pian qian fei huang qian huo yu ti quan xia zong kui rou si gua tuo gui sou qian cheng zhi liu peng teng xi cao du yan yuan zou sao shan qi zhi shuang lu xi luo zhang mo ao can piao cong qu bi zhi yu xu hua bo su xiao lin zhan dun liu tuo ceng dian jiao tie yan luo zhan jing yi ye tuo pin zhou yan long lv teng xiang ji shuang ju xi huan li biao ma yu tuo xun chi qu ri bo lv zu shi si fu ju zhou zhu tuo nu jia yi tai xiao ma yin jiao hua luo hai pian biao li cheng yan xing qin jun qi qi ke zhui zong su can pian zhi kui sao wu ao liu qian shan piao luo cong chan zhou ji shuang xiang gu wan wan wan yu gan yi ang gu jie bao bei ci ti di ku hai jiao hou kua ge tui geng pian bi ke ge yu sui lou bo xiao pang jue cuo kuan bin mo liao lou xiao du zang sui ti bin kuan lu gao gao qiao kao qiao lao sao biao kun kun ti fang xiu ran mao dan kun bin fa tiao pi zi fa ran ti bao bi mao fu er rong qu gong xiu kuo ji peng zhua shao sha ti li bin zong ti peng song zheng quan zong shun jian duo hu la jiu qi lian zhen bin peng ma san man man seng xu lie qian qian nang huan kuai ning bin lie rang dou dou nao hong xi dou han dou dou jiu chang yu yu ge yan fu xin gui zeng liu gui shang yu gui mei qi qi ga kuai hun ba po mei xu yan xiao liang yu zhui qi wang liang wei gan chi piao bi mo qi xu chou yan zhan yu dao ren ji ba hong tuo diao ji xu hua ji sha hang tun mo jie shen ban yuan bi lu wen hu lu shi fang fen na you pian mo he xia qu han pi ling tuo ba qiu ping fu bi ci wei ju diao bo you gun pi nian zheng tai bao fu zha ju gu shi dong chou ta jie shu hou xiang er an wei zhao zhu yin lie luo tong yi yi bing wei jiao ku gui xian ge hui lao fu kao xiu duo jun ti mian shao zha suo qin yu nei zhe gun geng su wu qiu shan pu huan tiao li sha sha kao meng cheng li zou xi yong shen zi qi qing xiang nei chun ji diao qie gu zhou dong lai fei ni yi kun lu jiu chang jing lun ling zou li meng zong zhi nian hu yu di shi shen huan ti hou xing zhu la zong ji bian bian huan quan zei wei wei yu chun rou die huang lian yan qiu qiu jian bi e yang fu sai jian xia tuo hu shi ruo xuan wen jian hao wu pang sao liu ma shi shi guan zi teng ta yao ge yong qian qi wen ruo shen lian ao le hui min ji tiao qu jian can man xi qiu biao ji ji zhu jiang xiu zhuan yong zhang kang xue bie yu qu xiang bo jiao xun su huang zun shan shan fan jue lin xun miao xi zeng xiang fen guan hou kuai zei sao shan gan gui sheng li chang lei shu ai ru ji yu hu shu li la li mie zhen xiang e lu guan li xian yu dao ji you tun lu fang ba he ba ping nian lu you zha fu bo bao hou pi tai gui jie kao wei er tong zei hou kuai ji jiao xian zha xiang xun geng li lian jian li shi tiao gun sha huan jun ji yong qing ling qi zou fei kun chang gu ni nian diao jing can shi zi fen die bi chang ti wen wei sai e qiu fu huang quan jiang bian sao ao qi ta guan yao pang jian le biao xue bie man min yong wei xi jue shan lin zun hu gan li shan guan niao yi fu li jiu bu yan fu diao ji feng ru han shi feng ming bao yuan zhi hu qin fu fen wen qian shi yu fou yao jue jue pi huan zhen bao yan ya zheng fang feng wen ou dai jia ru ling bi fu tuo min li bian zhi ge yuan ci gou xiao chi dan ju yao gu zhong yu yang yu ya die yu tian ying dui wu er gua ai zhi yan heng xiao jia lie zhu xiang yi hong lu ru mou ge ren jiao xiu zhou chi luo heng nian e luan jia ji tu juan tuo pu wu juan yu bo jun jun bi xi jun ju tu jing ti e e kuang hu wu shen chi jiao pan lu pi shu fu an zhuo peng qiu qian bei diao lu que jian ju tu ya yuan qi li ye zhui kong duo kun sheng qi jing yi yi qing zi lai dong qi chun geng ju qu yi zun ji shu uu chi miao rou ya qiu ti hu ti e jie mao fu chun tu yan he yuan bian kun mei hu ying chuan wu ju dong cang fang hu ying yuan xian weng shi he chu tang xia ruo liu ji hu jian sun han ci ci yi yao yan ji li tian kou ti ti yi tu ma xiao gao tian chen ji tuan zhe ao yao yi ou chi zhi liu yong lv bi shuang zhuo yu wu jue yin tan si jiao yi hua bi ying su huang fan jiao liao yan gao jiu xian xian tu mai zun yu ying lu tuan xian xue yi pi shu luo xi yi ji ze yu zhan ye yang bi ning hu mi ying meng di yue yu lei bu lu he long shuang yue ying huan qu li luan niao jiu ji yuan ming shi ou ya cang bao zhen gu dong lu ya xiao yang ling chi gou yuan xue tuo si zhi er gua xiu heng zhou ge luan hong wu bo li juan hu e yu xian ti wu que miao an kun bei peng qian chun geng yuan su hu he e hu qiu ci mei wu yi yao weng liu ji yi jian he yi ying zhe liu liao jiao jiu yu lu huan zhan ying hu meng huan shuang lu jin ling jian xian cuo jian jian yan cuo lu you cu ji biao cu pao cu jun zhu jian mi mi yu liu chen qun lin ni qi lu jiu jun jing li xiang xian jia mi li she zhang lin jing qi ling yan cu mai mai he chao fu mian mian fu pao qu qu mou fu xian lai qu mian chi feng fu qu mian ma me me hui mo zou nun fen huang huang jin guang tian tou hong hua kuang hong shu li nian chi hei hei yi qian dan xi tun mo mo qian dai chu you dian yi xia yan qu mei yan qing yue li dang du can yan jian yan zhen an zhen zhun can yi mei zhan yan du lu xian fen fu fu meng meng yuan cu qu chao wa zhu zhi meng ao bie tuo bi yuan chao tuo ding jiong nai ding zi gu gu dong fen tao yuan pi chang gao cao yuan tang teng shu shu fen fei wen ba diao tuo zhong qu sheng shi you shi ting wu ju jing hun xi yan tu si xi xian yan lei bi yao qiu han wu wu hou xie he zha xiu weng zha nong nang qi zhai ji ji ji ji qi ji chi chen chen he ya yin xie bao ze shi zi chi yan ju tiao ling ling chu quan xie yin nie jiu yao chuo yun wu chu qi ni ce chuo qu yun yan yu e wo yi cuo zou dian chu jin ya chi chen he yin ju ling bao tiao zi yin wu chuo qu wo long pang gong pang yan long long gong kan da ling da long gong kan gui qiu bie gui yue chui he jiao xie yu \ No newline at end of file diff --git a/control/zhtopy/frmzhtopy.cpp b/control/zhtopy/frmzhtopy.cpp new file mode 100644 index 0000000..3228e59 --- /dev/null +++ b/control/zhtopy/frmzhtopy.cpp @@ -0,0 +1,24 @@ +#include "frmzhtopy.h" +#include "ui_frmzhtopy.h" +#include "zhtopy.h" + +frmZhToPY::frmZhToPY(QWidget *parent) : QWidget(parent), ui(new Ui::frmZhToPY) +{ + ui->setupUi(this); + ZhToPY::Instance()->loadPY(":/data/zhtopy.txt"); +} + +frmZhToPY::~frmZhToPY() +{ + delete ui; +} + +void frmZhToPY::on_btnPY_clicked() +{ + ui->txtResult->setText(ZhToPY::Instance()->zhToPY(ui->txtChinese->text())); +} + +void frmZhToPY::on_btnJP_clicked() +{ + ui->txtResult->setText(ZhToPY::Instance()->zhToJP(ui->txtChinese->text())); +} diff --git a/control/zhtopy/frmzhtopy.h b/control/zhtopy/frmzhtopy.h new file mode 100644 index 0000000..1a2e44f --- /dev/null +++ b/control/zhtopy/frmzhtopy.h @@ -0,0 +1,26 @@ +#ifndef FRMZHTOPY_H +#define FRMZHTOPY_H + +#include + +namespace Ui { +class frmZhToPY; +} + +class frmZhToPY : public QWidget +{ + Q_OBJECT + +public: + explicit frmZhToPY(QWidget *parent = 0); + ~frmZhToPY(); + +private: + Ui::frmZhToPY *ui; + +private slots: + void on_btnPY_clicked(); + void on_btnJP_clicked(); +}; + +#endif // FRMZHTOPY_H diff --git a/control/zhtopy/frmzhtopy.ui b/control/zhtopy/frmzhtopy.ui new file mode 100644 index 0000000..aa72b9b --- /dev/null +++ b/control/zhtopy/frmzhtopy.ui @@ -0,0 +1,81 @@ + + + frmZhToPY + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + 11 + 11 + 481 + 63 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 转全拼 + + + + + + + 飞扬青云 QQ:517216493 + + + + + + + 汉字 + + + + + + + + + + 结果 + + + + + + + 转简拼 + + + + + + + + + diff --git a/control/zhtopy/main.cpp b/control/zhtopy/main.cpp new file mode 100644 index 0000000..04cd69a --- /dev/null +++ b/control/zhtopy/main.cpp @@ -0,0 +1,34 @@ +#pragma execution_character_set("utf-8") + +#include "frmzhtopy.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QFont font; + font.setFamily("Microsoft Yahei"); + font.setPixelSize(13); + a.setFont(font); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmZhToPY w; + w.setWindowTitle("汉字转拼音 (QQ: 517216493 WX: feiyangqingyun)"); + w.show(); + + return a.exec(); +} diff --git a/control/zhtopy/main.qrc b/control/zhtopy/main.qrc new file mode 100644 index 0000000..880a2d4 --- /dev/null +++ b/control/zhtopy/main.qrc @@ -0,0 +1,5 @@ + + + data/zhtopy.txt + + diff --git a/control/zhtopy/zhtopy.cpp b/control/zhtopy/zhtopy.cpp new file mode 100644 index 0000000..d09a52f --- /dev/null +++ b/control/zhtopy/zhtopy.cpp @@ -0,0 +1,303 @@ +#pragma execution_character_set("utf-8") + +#include "zhtopy.h" +#include "qmutex.h" +#include "qfile.h" +#include "qapplication.h" +#include "qdebug.h" + +QScopedPointer ZhToPY::self; +ZhToPY *ZhToPY::Instance() +{ + if (self.isNull()) { + static QMutex mutex; + QMutexLocker locker(&mutex); + if (self.isNull()) { + self.reset(new ZhToPY); + } + } + + return self.data(); +} + +ZhToPY::ZhToPY(QObject *parent) : QObject(parent) +{ + //加载拼音文件 + loadPY(qApp->applicationDirPath() + "/config/zhtopy.txt"); + + //加载简拼数组 + listJP << "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJ"; + listJP << "HHSDSJNKKTMOMLCRXYPSN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XMXZXFGHKZSZGGYLCLSARJYHSLLLMZXELGLXYDJYTLFB"; + listJP << "HBPNLYZFBBHPTGJKWETZHKJJXZXXGLLJLSTGSHJJYQLQZFKCGNNDJSSZFDBCTWWSEQFHQJBSAQTGYPQLBXBMMYWXGSLZHGLZGQYF"; + listJP << "LZBYFZJFRYSFMBYZHQGFWZSYFYJJPHZBYYZFFWODGRLMFTWLBZGYCQXCDJYGZYYYYTYTYDWEGAZYHXJLZYYHLRMGRXXZCLHNELJJ"; + listJP << "TJTPWJYBJJBXJJTJTEEKHWSLJPLPSFYZPQQBDLQJJTYYQLYZKDKSQJYYQZLDQTGJQYZJSUCMRYQTHTEJMFCTYHYPKMHYZWJDQFHY"; + listJP << "YXWSHCTXRLJHQXHCCYYYJLTKTTYTMXGTCJTZAYYOCZLYLBSZYWJYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLXYJZYZYYPNHMYMDYYL"; + listJP << "BLHLSYYQQLLNJJYMSOYQBZGDLYXYLCQYXTSZEGXHZGLHWBLJHEYXTWQMAKBPQCGYSHHEGQCMWYYWLJYJHYYZLLJJYLHZYHMGSLJL"; + listJP << "JXCJJYCLYCJPCPZJZJMMYLCQLNQLJQJSXYJMLSZLJQLYCMMHCFMMFPQQMFYLQMCFFQMMMMHMZNFHHJGTTHHKHSLNCHHYQDXTMMQD"; + listJP << "CYZYXYQMYQYLTDCYYYZAZZCYMZYDLZFFFMMYCQZWZZMABTBYZTDMNZZGGDFTYPCGQYTTSSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHW"; + listJP << "WKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWPYMLGKDLDLGKQQBGYCHJ"; + listJP << "XY"; +} + +void ZhToPY::loadPY(const QString &fileName) +{ + //从配置文件读取拼音数组 + QFile file(fileName); + if (file.open(QFile::ReadOnly | QFile::Text)) { + QString str = file.readAll(); + listPY = str.split(" "); + } +} + +QString ZhToPY::zhToPY(const QString &chinese) +{ + if (listPY.count() == 0) { + return ""; + } + + QStringList list; + for (int i = 0; i < chinese.length(); ++i) { + int unicode = QString::number(chinese.at(i).unicode(), 10).toInt(); + if (unicode >= 0x4E00 && unicode <= 0x9FA5) { + //这里的listPY就是按照UNICODE每个中文对应的拼音数组 + list.append(listPY.at(unicode - 0x4E00)); + } else { + list.append(chinese.at(i)); + } + } + + return list.join(" "); +} + +QString ZhToPY::zhToJP(const QString &chinese) +{ + QString strChineseFirstPY = listJP.join(""); + if (chinese.length() == 0) { + return chinese; + } + + QString str; + int index = 0; + for (int i = 0; i < chinese.length(); ++i) { + //若是字母或数字则直接输出 + ushort vChar = chinese.at(i).unicode() ; + if ((vChar >= 'a' && vChar <= 'z') || (vChar >= 'A' && vChar <= 'Z')) { + str.append(chinese.at(i).toUpper()); + } + + if ((vChar >= '0' && vChar <= '9')) { + str.append(chinese.at(i)); + } else { + index = (int)vChar - 19968; + if (index >= 0 && index < strChineseFirstPY.length()) { + str.append(strChineseFirstPY.at(index)); + } + } + } + + return str; +} + +QString ZhToPY::zhToZM(const QString &chinese) +{ + return zhToJP(chinese).at(0); +} diff --git a/control/zhtopy/zhtopy.h b/control/zhtopy/zhtopy.h new file mode 100644 index 0000000..0256d74 --- /dev/null +++ b/control/zhtopy/zhtopy.h @@ -0,0 +1,42 @@ +#ifndef ZHTOPY_H +#define ZHTOPY_H + +/** + * 汉字转拼音类 作者:feiyangqingyun(QQ:517216493) 2019-02-16 + * 1. 汉字转拼音。 + * 2. 汉字转拼音简拼。 + * 3. 汉字转拼音首字母。 + */ + +#include +#include + +#ifdef quc +class Q_DECL_EXPORT ZhToPY : public QObject +#else +class ZhToPY : public QObject +#endif + +{ + Q_OBJECT +public: + static ZhToPY *Instance(); + explicit ZhToPY(QObject *parent = 0); + +private: + static QScopedPointer self; + QStringList listPY; + QStringList listJP; + +public: + //载入拼音文件 + void loadPY(const QString &fileName = "zhtopy.txt"); + //汉字转拼音 + QString zhToPY(const QString &chinese); + //汉字转字母简拼 + QString zhToJP(const QString &chinese); + //汉字转首字母 + QString zhToZM(const QString &chinese); +}; + +#endif // ZHTOPY_H diff --git a/control/zhtopy/zhtopy.pro b/control/zhtopy/zhtopy.pro new file mode 100644 index 0000000..8d3a471 --- /dev/null +++ b/control/zhtopy/zhtopy.pro @@ -0,0 +1,19 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = zhtopy +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmzhtopy.cpp +SOURCES += zhtopy.cpp + +HEADERS += frmzhtopy.h +HEADERS += zhtopy.h + +FORMS += frmzhtopy.ui + +RESOURCES += main.qrc