You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
3.1 KiB
151 lines
3.1 KiB
/******************************************************************
|
|
Copyright © Deng Zhimao Co., Ltd. 1990-2021. All rights reserved.
|
|
* @projectName 17_sqlite_example
|
|
* @brief mainwindow.h
|
|
* @author Deng Zhimao
|
|
* @email 1252699831@qq.com
|
|
* @net www.openedv.com
|
|
* @date 2021-05-15
|
|
*******************************************************************/
|
|
#ifndef ALARM_H
|
|
#define ALARM_H
|
|
|
|
#include <QSqlDatabase>
|
|
#include <QSqlQuery>
|
|
#include <QMainWindow>
|
|
#include <QDialog>
|
|
#include <QHBoxLayout>
|
|
#include <QVBoxLayout>
|
|
#include <QPushButton>
|
|
#include <QListWidget>
|
|
#include <QLabel>
|
|
#include <QTime>
|
|
#include <QSqlTableModel>
|
|
#include "numberpicker.h"
|
|
#include "switchbutton.h"
|
|
#include <QApplication>
|
|
#include <QFile>
|
|
#include <QtMultimedia>
|
|
#include <QtMultimediaWidgets>
|
|
#include <QFrame>
|
|
#include <QTimer>
|
|
#include "tt.h"
|
|
#include "ui_tt.h"
|
|
#include "flyme/flyme.h"
|
|
|
|
class NumberPicker;
|
|
class SwitchButton;
|
|
|
|
class tt;
|
|
class FloatingButton;
|
|
|
|
/* ListWiget项结构体 */
|
|
struct ItemObjectInfo {
|
|
/* 闹钟开关 */
|
|
SwitchButton *switchButton;
|
|
/* Widget容器 */
|
|
QWidget *widget;
|
|
/* 水平布局 */
|
|
QHBoxLayout *hBoxLayout;
|
|
};
|
|
|
|
|
|
class Alarm : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Alarm(QWidget *parent = nullptr);
|
|
~Alarm();
|
|
|
|
private:
|
|
/* 媒体播放器,用于播放音乐 */
|
|
QMediaPlayer *musicPlayer;
|
|
|
|
/* 数据库连接类 */
|
|
QSqlDatabase sqlDatabase;
|
|
|
|
/* 数据库操作模型 */
|
|
QSqlTableModel *model;
|
|
|
|
/* 时针选择器 */
|
|
NumberPicker *hourPicker;
|
|
|
|
/* 分钟选择器 */
|
|
NumberPicker *minutePicker;
|
|
|
|
/* 弹出选择时间对话框 */
|
|
QDialog *alarmDialog;
|
|
QFrame *biasc_display;
|
|
|
|
/* 水平布局 */
|
|
QHBoxLayout *hBoxLayout[3];
|
|
|
|
/* 垂直布局 */
|
|
QVBoxLayout *vBoxLayout[2];
|
|
|
|
/* 显示闹钟列表 */
|
|
QListWidget *listWidget;
|
|
|
|
/* 主Widget */
|
|
QWidget *mainWidget;
|
|
|
|
/* 底部Wiget */
|
|
QWidget *bottomWidget;
|
|
|
|
/* 弹出对话框布局窗口选择时间容器 */
|
|
QWidget *timeWidget;
|
|
|
|
/* 弹出对话框布局窗口按钮容器 */
|
|
QWidget *btWidget;
|
|
|
|
/* 添加闹钟按钮 */
|
|
QPushButton *addAlarm;
|
|
|
|
/* 确认按钮 */
|
|
QPushButton *yesButton;
|
|
|
|
/* 取消按钮 */
|
|
QPushButton *cancelButton;
|
|
|
|
/* listWiget项信息存储 */
|
|
QVector<ItemObjectInfo> itemObjectInfo;
|
|
/* 加载qss */
|
|
void loadStyle();
|
|
/* 控制闹钟 */
|
|
void control_alarm();
|
|
/*定时器*/
|
|
QTimer* timer;
|
|
/* 铃声 */
|
|
void alarm_play();
|
|
|
|
/* 显示时间 */
|
|
QLabel *time_notice;
|
|
|
|
tt *tui;
|
|
FloatingButton *floatingbutton;
|
|
|
|
private slots:
|
|
/* 添加闹钟按钮被点击 */
|
|
void addAlarmClicked();
|
|
|
|
/* 列表被点击 */
|
|
void listWidgetItemClicked(QListWidgetItem *);
|
|
|
|
/* 确认按钮被点击 */
|
|
void yesButtonClicked();
|
|
|
|
/* 取消按钮被点击 */
|
|
void cancelButtonClicked();
|
|
|
|
/* 开关按钮点击 */
|
|
void switchButtonClicked(bool);
|
|
/* 关闭点击 */
|
|
void alarm_display();
|
|
/*悬浮球 */
|
|
void onButtonPressed();
|
|
signals:
|
|
void alarm_close(bool t);
|
|
};
|
|
#endif // MAINWINDOW_H
|