diff --git a/clock.cpp b/clock.cpp index 6b8adb7..14987ec 100644 --- a/clock.cpp +++ b/clock.cpp @@ -26,8 +26,10 @@ #include "kwidget.h" #include "kwindowbuttonbar.h" #include +#include "configutil.h" #include "kwindowsystem.h" #include +#include #include "windowmanager/windowmanager.h" #include "dbusnoticeshowagainadaptor.h" using std::string; @@ -79,6 +81,67 @@ Clock::Clock(QWidget *parent) : //ui 构造代码 ui->setupUi(this); + //重新构建组件 + switchWidget = new QWidget(ui->titileWidget); + switchClock = new KPushButton(switchWidget); + switchCountdown = new KPushButton(switchWidget); + switchStopwatch = new KPushButton(switchWidget); + mainWidget = new QStackedWidget(ui->titileWidget); + countdownPage = new QWidget(this->mainWidget); + alarmPage = new QWidget(this->mainWidget); + stopwatchPage = new QWidget(this->mainWidget); + addAlarmPage = new QWidget(this->mainWidget); + //绑定页面 + mainWidget->addWidget(countdownPage); + mainWidget->addWidget(alarmPage); + mainWidget->addWidget(stopwatchPage); + mainWidget->addWidget(addAlarmPage); + mainWidget->setCurrentIndex(1); + + countdownStackedW = new QStackedWidget(countdownPage); + countdownSetPage = new QWidget(countdownStackedW); + countdownRunPage = new Countdown_Animation(countdownStackedW); + countdownStackedW->addWidget(countdownSetPage); + countdownStackedW->addWidget(countdownRunPage); + countdownStackedW->setCurrentIndex(0); + + startCountSingle = new QPushButton(countdownSetPage); + alarmWidget = new QWidget(countdownRunPage); + btnWidget = new QWidget(countdownRunPage); + timeWidget = new QWidget(countdownRunPage); + tinyWidget = new QWidget(countdownRunPage); + countdownAlarmIcon = new QLabel(alarmWidget); + countdownAlarmTime = new QLabel(alarmWidget); + startCountdownBtn = new QPushButton(btnWidget); + suspendCountdownBtn = new QPushButton(btnWidget); + remainTime = new QLabel(timeWidget); + tinyWindowBtn = new QPushButton(tinyWidget); + addAlarmBtn = new QPushButton(this->alarmPage); + alarmListWidget = new QListWidget(alarmPage); + noAlarm = new QLabel(alarmPage); + noAlarmIcon = new QLabel(alarmPage); + //秒表页面 + ringBtn = new QPushButton(stopwatchPage); + startStopwatch = new QPushButton(stopwatchPage); + timeListWidget = new QListWidget(stopwatchPage); + timeShowBig = new QLabel(stopwatchPage); + timeShowSmall = new QLabel(stopwatchPage); + timeShowBig->setText("00:00:00"); + timeShowSmall->setText("00:00:00"); + + //闹钟编辑页面 + editAlarmPage = new QWidget(addAlarmPage); + cancelbtnOnEditAlarm = new QPushButton(editAlarmPage); + saveBtnOnEditAlarm = new QPushButton(editAlarmPage); + timeFormatOnTimeWheel = new QLabel(editAlarmPage); + + //主屏信息 + primaryManager = new PrimaryManager(); + + inidata(); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + bool rotations = GsettingSubject::getInstance()->getRotations(); + iniframe(onTablet,rotations); currentTheme = new theme(); //创建或打开数据库 clock_sql::createConnection(); @@ -105,55 +168,49 @@ Clock::Clock(QWidget *parent) : //闹钟页初始化 clockInit(); setupInit(); - this->setFixedSize(390,580); /*实现鼠标左键滑动效果 *Realize the sliding effect of left mouse button*/ - ui->alarmListWidget -> setFrameShape(QListWidget::NoFrame); - ui->timeListWidget -> setFrameShape(QListWidget::NoFrame); - QScroller::grabGesture(ui->alarmListWidget,QScroller::LeftMouseButtonGesture); /*设置鼠标左键拖动 Set left mouse drag*/ - QScroller::grabGesture(ui->timeListWidget,QScroller::LeftMouseButtonGesture); /*设置鼠标左键拖动 Set left mouse drag*/ - ui->alarmListWidget -> setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); /*设置像素级滑动 Set pixel level slide*/ - ui->timeListWidget -> setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); /*设置像素级滑动 Set pixel level slide*/ - ui->alarmListWidget->setProperty("contextMenuPolicy", Qt::CustomContextMenu); /*重要:设置QListWidget的contextMenuPolicy属性,不然不能显示右键菜单*/ - ui->alarmListWidget ->setGridSize(QSize(340, 108+15)); - ui->timeListWidget ->setGridSize(QSize(340, 58+10)); - ui->alarmListWidget->setProperty("drawScrollBarGroove", false); - ui->timeListWidget->setProperty("drawScrollBarGroove", false); - //主屏信息 - primaryManager = new PrimaryManager(); + alarmListWidget -> setFrameShape(QListWidget::NoFrame); + timeListWidget -> setFrameShape(QListWidget::NoFrame); + QScroller::grabGesture(alarmListWidget,QScroller::LeftMouseButtonGesture); /*设置鼠标左键拖动 Set left mouse drag*/ + QScroller::grabGesture(timeListWidget,QScroller::LeftMouseButtonGesture); /*设置鼠标左键拖动 Set left mouse drag*/ + alarmListWidget -> setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); /*设置像素级滑动 Set pixel level slide*/ + timeListWidget -> setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); /*设置像素级滑动 Set pixel level slide*/ + alarmListWidget->setProperty("contextMenuPolicy", Qt::CustomContextMenu); /*重要:设置QListWidget的contextMenuPolicy属性,不然不能显示右键菜单*/ +// alarmListWidget ->setGridSize(QSize(340+8, 108+15)); +// timeListWidget ->setGridSize(QSize(340, 58+10)); + alarmListWidget->setProperty("drawScrollBarGroove", false); + timeListWidget->setProperty("drawScrollBarGroove", false); //闹钟居中 //move((m_pSreenInfo->m_screenWidth - this->width() + m_pSreenInfo->m_nScreen_x )/2, (m_pSreenInfo->m_screenHeight - this->height())/2); utils = new Utils(); utils->centerToScreen(this); - ui->switchClock->setFixedSize(40,40); - navigationBtnStyle(ui->switchClock); - ui->switchClock->setToolTip(tr(CLOCK_TITLE_NAME)); - ui->switchCountdown->setFixedSize(40,40); - navigationBtnStyle(ui->switchCountdown); - ui->switchCountdown->setToolTip(tr("Count down")); + //导航栏初始设置 + navigationBtnStyle(switchClock); + switchClock->setToolTip(tr(CLOCK_TITLE_NAME)); + navigationBtnStyle(switchCountdown); + switchCountdown->setToolTip(tr("Count down")); + navigationBtnStyle(switchStopwatch); + switchStopwatch->setToolTip(tr("Watch")); - ui->switchStopwatch->setFixedSize(40,40); - navigationBtnStyle(ui->switchStopwatch); - ui->switchStopwatch->setToolTip(tr("Watch")); - - connect(ui->switchCountdown, SIGNAL(clicked()), this, SLOT( CountdownPageSwitch ())); - connect(ui->switchClock, SIGNAL(clicked()), this, SLOT( AlarmPageSwitch ())); - connect(ui->switchStopwatch, SIGNAL(clicked()), this, SLOT( StopwatchPageSwitch ())); + connect(switchCountdown, SIGNAL(clicked()), this, SLOT( CountdownPageSwitch ())); + connect(switchClock, SIGNAL(clicked()), this, SLOT( AlarmPageSwitch ())); + connect(switchStopwatch, SIGNAL(clicked()), this, SLOT( StopwatchPageSwitch ())); AlarmPageSwitch ();/*初始显示闹钟界面 Initial display alarm interface*/ close_or_hide_page = new close_or_hide(this); - close_or_hide_page->setFixedSize(350,174); shadow->installEventFilter(this); - ui->alarmListWidget->installEventFilter(this); - ui->switchClock->installEventFilter(this); - ui->switchCountdown->installEventFilter(this); - ui->switchStopwatch->installEventFilter(this); + editAlarmPage->installEventFilter(this); + alarmListWidget->installEventFilter(this); + switchClock->installEventFilter(this); + switchCountdown->installEventFilter(this); + switchStopwatch->installEventFilter(this); //蓝色 - QPalette palette = ui->suspendCountdownBtn->palette(); + QPalette palette = suspendCountdownBtn->palette(); QColor ColorPlaceholderText(248,163,76,255); QBrush brush3; brush3.setColor(ColorPlaceholderText); @@ -165,7 +222,7 @@ Clock::Clock(QWidget *parent) : // ui->suspendCountdownBtn->setPalette(palette); // setSwitchHighlightColor(ui->suspendCountdownBtn); startCountSingle->setEnabled(false); - ui->countdownStackedW->setCurrentIndex(0); + countdownStackedW->setCurrentIndex(0); drawNoAlarmPrompt();//绘制无闹钟提示图标 onMin_5btnClicked();//倒计时初始时间默认五分钟 //字体设置 @@ -175,37 +232,38 @@ Clock::Clock(QWidget *parent) : f.setFamily("NotoSansCJKsc-Regular"); f.setWeight(400); f.setPixelSize(38); - ui->timeShowBig->setFont(f); + timeShowBig->setFont(f); //监听主题 settingsStyle(); //主题框架1.0.6-5kylin2 //配置重要按钮 //添加 - ui->addAlarmBtn->setProperty("isImportant", true); + addAlarmBtn->setProperty("isImportant", true); //新建闹钟保存 - ui->saveBtnOnEditAlarm->setProperty("isImportant", true); + saveBtnOnEditAlarm->setProperty("isImportant", true); //倒计时 滚轮页设置页,开始 startCountSingle->setProperty("isImportant", true); //倒计时,运行页,开始结束 // ui->count_stat->setProperty("isImportant", true); //秒表 开始结束 - ui->startStopwatch->setProperty("isImportant", true); + startStopwatch->setProperty("isImportant", true); // 倒计时 暂停继续 - ui->suspendCountdownBtn->setProperty("isImportant", true); + suspendCountdownBtn->setProperty("isImportant", true); //倒计时 开始结束 - ui->startCountdownBtn->setProperty("useButtonPalette", true); + startCountdownBtn->setProperty("useButtonPalette", true); //闹钟编辑 取消 - ui->cancelbtnOnEditAlarm->setProperty("useButtonPalette", true); + cancelbtnOnEditAlarm->setProperty("useButtonPalette", true); //秒表 计次 - ui->ringBtn->setProperty("useButtonPalette", true); + ringBtn->setProperty("useButtonPalette", true); //迷你窗口 updateTinyBtn(); //倒计时上的小闹钟 // ui->countdownAlarmIcon->setProperty("useButtonPalette", true); iniWaylandWinId(); - + //绘制闹钟列表 + updateAlarmClock(); } Clock::~Clock() @@ -219,7 +277,8 @@ Clock::~Clock() delete dialog_music; delete count_music_sellect; delete dialog_remind_late; - delete ui->countdownRunPage; + delete countdownRunPage; + delete countdownSetPage; delete ui; delete utils; delete primaryManager; @@ -228,6 +287,235 @@ Clock::~Clock() delete tinycountdownDia; delete currentTheme; } + +void Clock::iniframe(bool tablet,bool rotations) +{ + double dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch()/96; + //主屏信息 + QRect deskRect = QApplication::desktop()->screenGeometry(); + int desktopX = deskRect.width(); + int desktopY = deskRect.height(); + if(tablet){ + int aa=desktopX; + int bb=desktopY; + if(!rotations){ + aa=qMax(desktopX,desktopY); + bb=qMin(desktopX,desktopY); + }else{ + aa=qMin(desktopX,desktopY); + bb=qMax(desktopX,desktopY); + } + this->setFixedSize(aa,bb); + //导航栏 + switchWidget->setGeometry(0,76,this->width(),80); + switchClock->setFixedSize(QSize(72,72)); + switchCountdown->setFixedSize(QSize(72,72)); + switchStopwatch->setFixedSize(QSize(72,72)); + int iconwh = 36; + switchClock->move(aa/2-iconwh*3-56,4); + switchCountdown->move(aa/2-iconwh,4); + switchStopwatch->move(aa/2+iconwh+56,4); + + + //主页 + int HHHeight = 168; + mainWidget->setGeometry(0,HHHeight,aa-32,bb-HHHeight); + countdownPage->setGeometry(0,0,aa-156,bb-HHHeight); + alarmPage->setGeometry(0,0,aa-32,bb-HHHeight); + stopwatchPage->setGeometry(0,0,aa-156,bb-HHHeight); + addAlarmPage->setGeometry(0,0,aa-78,bb-HHHeight); + + + //倒计时页面 + countdownStackedW->setGeometry(0,0,aa-156,bb-HHHeight); + countdownSetPage->setGeometry(0,0,aa-156,bb-HHHeight); + countdownRunPage->setGeometry(0,0,aa-156,bb-HHHeight); + //倒计时设置页面 + startCountSingle->resize(120,48); + startCountSingle->move(aa/2-60,bb-168-64-48); + //倒计时运行页面 + alarmWidget->setGeometry(aa/2-260,bb/2-HHHeight-60-8-40,530,80); + btnWidget->setGeometry(0,bb-168-64-48,aa-156,bb-168); + timeWidget->setGeometry(aa/2-260,bb/2-HHHeight-60,530,120); + tinyWidget->setGeometry(aa/2-260,bb/2-HHHeight+60+48,530,60); + + countdownAlarmIcon->setGeometry(150+80,22,24,26); + countdownAlarmTime->setGeometry(168+81,9,60,52); + QFont f; + f.setFamily("NotoSansCJKsc-Regular"); + f.setPixelSize(24); + countdownAlarmTime->setFont(f); + + + startCountdownBtn->setGeometry(aa/2-28-120,0,120,48); + suspendCountdownBtn->setGeometry(aa/2+28,0,120,48); + + remainTime->setGeometry(102,9,316,112); + QFont ff; + ff.setFamily("NotoSansCJKsc-Regular"); + ff.setWeight(400); + ff.setPixelSize(76); + remainTime->setFont(ff); + + tinyWindowBtn->setGeometry(238,9,48,48); + //倒计时光圈 + countdownRunPage->countdownRunRoundBar->setGeometry(aa/2-250-94,bb/2-460,800,800); + + //闹钟主页 + addAlarmBtn->setGeometry(aa/2-60,bb-280,120,48); + int numX = (aa-32)/368*dpi; + int numY = (bb-280)/168*dpi; + int posX = (aa-numX*368*dpi)/2; + int HeightY = numY*168*dpi; + alarmListWidget->setGeometry(posX,8,aa-posX-8,HeightY); + alarmListWidget->setGridSize(QSize(360+8,160+8)); + noAlarm->setGeometry(aa/2-70,320,140,31); + noAlarmIcon->setGeometry(aa/2-70,110,256,256); + + //秒表页面 + ringBtn->setGeometry(aa/2-28-120,bb-280,120,48); + startStopwatch->setGeometry(aa/2+28,bb-280,120,48); + timeListWidget->setGeometry(aa/2-320,109,656,646/dpi); + timeListWidget ->setGridSize(QSize(640, 58+10)); + if(!runorsuspend){ + timeShowBig->setGeometry(aa/2-100,(bb-280)/2-70,210,70); + timeShowSmall->setGeometry(aa/2-100,(bb-280)/2,210,70); + }else{ + timeShowBig->setGeometry(aa/2-100,4,210,70); + timeShowSmall->setGeometry(aa/2-100,60,210,70); + } + + + //闹钟编辑页面 + editAlarmPage->setGeometry(aa/2-190,bb/2-401,372,522); + + + cancelbtnOnEditAlarm->setGeometry(65,464,120,48); + saveBtnOnEditAlarm->setGeometry(210,464,120,48); + timeFormatOnTimeWheel->setGeometry(60,80,41,22); + }else{ + this->setFixedSize(390,580); + //导航栏 + switchWidget->setGeometry(0,49,400,60); + switchClock->setFixedSize(QSize(40,40)); + switchCountdown->setFixedSize(QSize(40,40)); + switchStopwatch->setFixedSize(QSize(40,40)); + switchClock->move(109,9); + switchCountdown->move(175,9); + switchStopwatch->move(241,9); + + + //主页 + mainWidget->setGeometry(0,106,398,465); + countdownPage->setGeometry(0,0,398,465); + alarmPage->setGeometry(0,0,398,465); + stopwatchPage->setGeometry(0,0,398,465); + addAlarmPage->setGeometry(0,0,398,465); + + + //倒计时页面 + countdownStackedW->setGeometry(0,0,390,477); + countdownSetPage->setGeometry(0,0,390,477); + countdownRunPage->setGeometry(0,0,390,477); + //倒计时设置页面 + startCountSingle->resize(120,34); + startCountSingle->move(135,401); + //倒计时运行页面 + alarmWidget->setGeometry(16,60,361,70); + btnWidget->setGeometry(9,386,361,48); + timeWidget->setGeometry(14,100,361,77); + tinyWidget->setGeometry(9,174,361,40); + + countdownAlarmIcon->setGeometry(150,22,24,26); + countdownAlarmTime->setGeometry(168,9,60,52); + QFont f; + f.setFamily("NotoSansCJKsc-Regular"); + f.setPixelSize(20); + countdownAlarmTime->setFont(f); + + startCountdownBtn->setGeometry(41,9,120,34); + suspendCountdownBtn->setGeometry(199,9,120,34); + + remainTime->setGeometry(102,9,156,59); + QFont ff; + ff.setFamily("NotoSansCJKsc-Regular"); + ff.setWeight(400); + ff.setPixelSize(40); + remainTime->setFont(ff); + + tinyWindowBtn->setGeometry(173,9,24,24); + //倒计时光圈 + countdownRunPage->countdownRunRoundBar->setGeometry(-4, -4, 454, 461); + + //闹钟主页 + addAlarmBtn->setGeometry(135,401,120,34); + alarmListWidget->setGeometry(25,0,364,354); + alarmListWidget->setGridSize(QSize(340+8, 108+15)); + noAlarm->setGeometry(122+3,232,140,31); + noAlarmIcon->setGeometry(116+10,94,149,130); + + + //秒表页面 + ringBtn->setGeometry(65,401,120,34); + startStopwatch->setGeometry(210,401,120,34); + timeListWidget->setGeometry(25,109,356,277); + timeListWidget ->setGridSize(QSize(340, 58+10)); + if(!runorsuspend){ + timeShowBig->setGeometry(90,125,210,70); + timeShowSmall->setGeometry(90,190,210,70); + }else{ + timeShowBig->setGeometry(90,4,210,70); + timeShowSmall->setGeometry(90,55,210,70); + } + + //闹钟编辑页面 + editAlarmPage->setGeometry(0,0,398,465); + cancelbtnOnEditAlarm->setGeometry(65,401,120,34); + saveBtnOnEditAlarm->setGeometry(210,401,120,34); + timeFormatOnTimeWheel->setGeometry(60,80,41,22); + } +} + +void Clock::inidata() +{ + //倒计时页面 + //倒计时设置页面 + startCountSingle->setText(tr("start")); + //倒计时运行页面 + countdownAlarmTime->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); + QPalette ptext; + ptext.setColor(QPalette::WindowText,Qt::gray); + countdownAlarmTime->setPalette(ptext); + + startCountdownBtn->setText(tr("start")); + suspendCountdownBtn->setText(tr("suspend")); + + remainTime->setText("00:00:00"); + +// tinyWindowBtn->setText("tinybtn"); + + //闹钟主页 + addAlarmBtn->setText(tr("add")); + alarmListWidget->setViewMode(QListView::IconMode); + //根据listwidget 容器大小, 动态调整布局位置 + alarmListWidget->setResizeMode(QListView::Adjust); + //禁止拖拽 + alarmListWidget->setMovement(QListView::Static); + noAlarm->setText(tr("no Alarm")); + connect(addAlarmBtn,&QPushButton::clicked,this,[=]{ + mainWidget->setCurrentIndex(3); + }); + + + //秒表页面 + ringBtn->setText(tr("count")); + startStopwatch->setText(tr("start")); + + //闹钟编辑页面 + cancelbtnOnEditAlarm->setText(tr("cancel")); + saveBtnOnEditAlarm->setText(tr("save")); + timeFormatOnTimeWheel->setText(tr("AM")); +} //重写关闭事件 void Clock::closeEvent(QCloseEvent *event) { @@ -254,7 +542,7 @@ void Clock::closeHandel() QPointF position = this->pos(); kdk::UkuiStyleHelper::self()->removeHeader(close_or_hide_page); // XAtomHelper::setStandardWindowHint(close_or_hide_page->winId()); - close_or_hide_page->move(position.x()+20,position.y()+200); + close_or_hide_page->move(position.x()+this->width()/2-close_or_hide_page->width()/2,position.y()+this->height()/2-close_or_hide_page->height()/2); close_or_hide_page->exec(); } @@ -265,7 +553,7 @@ void Clock::enableTrayIcon() } QAction *quitAction = new QAction(tr("Quit"), this); connect(quitAction, &QAction::triggered, qApp, - &QCoreApplication::quit); + [&](){exit(0);}); QMenu *trayIconMenu = new QMenu(); trayIconMenu->addAction(quitAction); m_trayIcon = new QSystemTrayIcon(); @@ -275,8 +563,6 @@ void Clock::enableTrayIcon() m_trayIcon->setIcon(trayicon); connect(m_trayIcon, &QSystemTrayIcon::activated, this, [=](QSystemTrayIcon::ActivationReason r){ if (r == QSystemTrayIcon::Trigger) { - //不知道什么原因,加了最小化后,点击托盘后,不再处于最小化状态 - showMinimized(); if (isHidden()) { // show(); this->showThisWindow(); @@ -332,21 +618,6 @@ void Clock::settingsStyle() connect(subject,&GsettingSubject::iconChnaged, this,[=](){ ui->titileWidget->setIcon("kylin-alarm-clock"); }); - //由于功能按钮适配了sdk,这个信号 槽函数可以不用了 -// connect(subject,&GsettingSubject::themeColorChanged, this,[=](){ -// int index = ui->mainWidget->currentIndex(); -// if(index==0){ -// setSwitchHighlightColor(ui->switchCountdown); -// }else if(index==1){ -// setSwitchHighlightColor(ui->switchClock); -// }else if(index==2){ -// setSwitchHighlightColor(ui->switchStopwatch); -// }else{ -// //闹钟编辑页 -// setSwitchHighlightColor(ui->switchClock); -// } -// }); - connect(subject,&GsettingSubject::timeZoneChanged, this,[=](QString timeZone){ this->m_timeZone =timeZone; @@ -358,22 +629,144 @@ void Clock::settingsStyle() }); //平板改变 connect(subject,&GsettingSubject::tabletModeChange, this,[=](bool currentTablet){ + bool rotations = GsettingSubject::getInstance()->getRotations(); + iniframe(currentTablet,rotations); + int px = 0; + int py = 0; if(currentTablet){ - muteBtn->setFixedSize(36,36); - muteBtn->move(180,15); + ui->titileWidget->windowButtonBar()->setFollowMode(false); + ui->titileWidget->windowButtonBar()->maximumButton()->hide(); + muteBtn->setFixedSize(40,40); + muteBtn->move(this->width()-210,13); + //倒计时运行页面和设置页面的铃声选择项选择隐藏还是显示 + if(countdown_isStarted){ + countdownBellLabelOnRun->hide(); + countdownBellLabelOnSet->hide(); + count_music_sellect->hide(); + }else{ + countdownBellLabelOnRun->show(); + countdownBellLabelOnSet->show(); + count_music_sellect->show(); + } + countdownBellLabelOnSet->move(this->width()/2-175,this->height()/2-70); + countdownBellLabelOnRun->move(this->width()/2-175,this->height()/2-70); + //铃声下拉框 + count_music_sellect->resize(256,48); + count_music_sellect->move(this->width()/2-95,this->height()/2-80); + //数字盘 + px = this->width()/2-195; + py = this->height()/2-406; + updateClockTimeRing(px,py); + + int selectHeight = 221; + int selectWidth = 94; + int selectGap = 56; + updateClockEditPageLabel(selectHeight,selectGap,9); + updateClockEditPageBtn(selectWidth,selectHeight,selectGap,48); }else{ + ui->titileWidget->windowButtonBar()->setFollowMode(false); + ui->titileWidget->windowButtonBar()->maximumButton()->hide(); muteBtn->setFixedSize(30,30); muteBtn->move(238,5); + //铃声 + countdownBellLabelOnRun->show(); + countdownBellLabelOnSet->show(); + count_music_sellect->show(); + countdownBellLabelOnSet->move(20,330); + countdownBellLabelOnRun->move(20,330); + //铃声下拉框 + count_music_sellect->resize(256,36); + count_music_sellect->move(100,326); + //数字盘 + px = 0; + py = 0; + updateClockTimeRing(px,py); + + int selectHeight = 218; + int selectWidth = 100; + int selectGap = 44; + updateClockEditPageLabel(selectHeight,selectGap,7); + updateClockEditPageBtn(selectWidth,selectHeight,selectGap,36); } + model->submitAll(); + int m = model->rowCount(); + for (int i = 0; i < m; i++) { + if(currentTablet){ + aItem[i]->setSizeHint(QSize(360,160)); + }else{ + aItem[i]->setSizeHint(QSize(340,108)); + } + } + //切换模式后,不居中 + this->showThisWindow(); + }); + subject->iniAutoRotations(); + + //要设置需要的屏幕方向,才能收到QScreen的orientationChanged信号 + QApplication::primaryScreen()->setOrientationUpdateMask( + Qt::PortraitOrientation + | Qt::LandscapeOrientation + | Qt::InvertedLandscapeOrientation + | Qt::PrimaryOrientation + | Qt::InvertedPortraitOrientation); + connect(subject,&GsettingSubject::tabletRotationChange, this,[=](bool currentRotation){ + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(!iniRotationFlag){ + if(QApplication::primaryScreen()->orientation()==Qt::LandscapeOrientation||QApplication::primaryScreen()->orientation()==Qt::InvertedLandscapeOrientation){ + currentRotation = false; + }else{ + currentRotation = true; + } + iniRotationFlag = true; + } + iniframe(onTablet,currentRotation); + if(onTablet){ + muteBtn->setFixedSize(40,40); + muteBtn->move(this->width()-210,13); + //铃声 + countdownBellLabelOnSet->move(this->width()/2-195+20,this->height()/2-70); + countdownBellLabelOnRun->move(this->width()/2-195+20,this->height()/2-70); + //铃声下拉框 + count_music_sellect->resize(256,48); + count_music_sellect->move(this->width()/2-95,this->height()/2-80); + //数字盘 + int px = this->width()/2-195; + int py = this->height()/2-406; + updateClockTimeRing(px,py); + + int selectHeight = 221; + int selectWidth = 94; + int selectGap = 56; + updateClockEditPageLabel(selectHeight,selectGap,9); + updateClockEditPageBtn(selectWidth,selectHeight,selectGap,48); + } + this->showThisWindow(); }); subject->iniWidgetStyle(); subject->iniFontSize(); subject->iniTimeZone(); subject->iniTabletMode(); + subject->iniRotations(); + + //当改变屏幕分辨率时 重新计算 主屏坐标 屏幕宽高 + //这段代码目的:本意是想仅针对分辨率修改的,但貌似旋转方向也影响了。 + connect(QApplication::primaryScreen(), &QScreen::geometryChanged, this, [=](){ + QRect desktop = QApplication::desktop()->screenGeometry(); + int desktopX = desktop.width(); + int desktopY = desktop.height(); + if(desktopX>desktopY){ + subject->setRotations(false); + emit subject->tabletRotationChange(false); + }else{ + subject->setRotations(true); + emit subject->tabletRotationChange(true); + } + }); connect(this,&Clock::timeJump,this,[=](qint64 timeValue){ qWarning()<<"dbq检测到时间跳跃"<titileWidget->setIcon("kylin-alarm-clock"); //倒计时上的小闹钟图标 - ui->countdownAlarmIcon->setPixmap(pixmap4); - ui->countdownAlarmIcon->setVisible(true); - ui->countdownAlarmIcon->setFocusPolicy(Qt::NoFocus); + countdownAlarmIcon->setPixmap(pixmap4); + countdownAlarmIcon->setVisible(true); + countdownAlarmIcon->setFocusPolicy(Qt::NoFocus); // ui->countdownAlarmIcon->move(152,100); muteBtnStyle(); @@ -461,32 +854,47 @@ void Clock::buttonImageInit() //提醒铃声 倒计时设置页 - countdownBellLabelOnSet = new QLabel(ui->countdownSetPage); + countdownBellLabelOnSet = new QLabel(countdownSetPage); //提醒铃声 倒计时页面运行页 - countdownBellLabelOnRun = new QLabel(ui->countdownRunPage); + countdownBellLabelOnRun = new QLabel(countdownRunPage); int moveHeight = 330; - updateClockSelectBtnLabel(countdownBellLabelOnSet,moveHeight,tr(" bell")); - updateClockSelectBtnLabel(countdownBellLabelOnRun,moveHeight,tr(" bell")); //闹钟名称 新建闹钟 - int selectHeight = 225; - int selectGap = 44; - clockNamelabel = new QLabel(ui->editAlarmPage); - updateClockSelectBtnLabel(clockNamelabel,selectHeight,tr(" name")); - selectHeight+=selectGap; + clockNamelabel = new QLabel(editAlarmPage); //重复 新建闹钟 - clockRepeatLabel = new QLabel(ui->editAlarmPage); - updateClockSelectBtnLabel(clockRepeatLabel,selectHeight,tr(" repeat")); - selectHeight+=selectGap; + clockRepeatLabel = new QLabel(editAlarmPage); //提醒铃声 新建闹钟 - clockBellLabel = new QLabel(ui->addAlarmPage); - updateClockSelectBtnLabel(clockBellLabel,selectHeight,tr(" bell")); - selectHeight+=selectGap; + clockBellLabel = new QLabel(editAlarmPage); //稍后提醒 新建闹钟 - clockRemindLabel = new QLabel(ui->editAlarmPage); - updateClockSelectBtnLabel(clockRemindLabel,selectHeight,tr(" remind")); + clockRemindLabel = new QLabel(editAlarmPage); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + countdownBellLabelOnRun->setFixedWidth(100);//设置固定大小,系统放大字体遮挡 + countdownBellLabelOnRun->setText(tr(" bell")); + countdownBellLabelOnRun->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); + countdownBellLabelOnSet->setFixedWidth(100);//设置固定大小,系统放大字体遮挡 + countdownBellLabelOnSet->setText(tr(" bell")); + countdownBellLabelOnSet->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); + QFont font; + font.setPixelSize(14); + countdownBellLabelOnRun->setFont(font); + countdownBellLabelOnSet->setFont(font); + countdownBellLabelOnSet->move(this->width()/2-195+20,this->height()/2-168-238+330); + countdownBellLabelOnRun->move(this->width()/2-195+20,this->height()/2-168-238+330); + countdownBellLabelOnRun->hide(); + int selectHeight = 221; + int selectGap = 56; + updateClockEditPageLabel(selectHeight,selectGap,9); + } else{ + updateClockSelectBtnLabel(countdownBellLabelOnSet,moveHeight,tr(" bell")); + updateClockSelectBtnLabel(countdownBellLabelOnRun,moveHeight,tr(" bell")); + + int selectHeight = 218; + int selectGap = 44; + updateClockEditPageLabel(selectHeight,selectGap,7); + } } /* *倒计时页初始化 @@ -500,7 +908,7 @@ void Clock::CountdownInit() /*信号和槽 Signals and slots*/ //倒计时开始-结束 - connect(ui->startCountdownBtn, SIGNAL(clicked()), this, SLOT(startbtnCountdown()) ); + connect(startCountdownBtn, SIGNAL(clicked()), this, SLOT(startbtnCountdown()) ); // connect(tinycountdownDia, SIGNAL(finishClick()), this, SLOT(tinyCountdownFinish()) ); //倒计时执行 connect(countdown_timer, SIGNAL(timeout()), this, SLOT(statCountdownMsec())); @@ -514,12 +922,12 @@ void Clock::CountdownInit() countdown_isStarted = 0; countdown_isStarted_2 = 0; - ui->countdownRunPage->countdownRunRoundBar->setRange(0,COUNTDOWN_TIME); + countdownRunPage->countdownRunRoundBar->setRange(0,COUNTDOWN_TIME); /*初始化倒计时进度圈 Initialize countdown progress circle*/ - ui->countdownRunPage->countdownRunRoundBar->setValue(COUNTDOWN_TIME); + countdownRunPage->countdownRunRoundBar->setValue(COUNTDOWN_TIME); //父的顶部 - ui->startCountdownBtn->raise(); + startCountdownBtn->raise(); //初始化倒计时弹窗 countdownNoticeDialog = new Natice_alarm(60,-1); countdownNoticeDialog->timer->stop(); @@ -571,13 +979,14 @@ void Clock::stopwatchInit() Set the timer to send a timeout () signal every milliseconds*/ timer->setInterval(10); //显示时间大 - ui->timeShowBig->setText("00:00.00"); + timeShowBig->setText("00:00.00"); //显示时间小 - ui->timeShowSmall->setText("00:00.00"); + timeShowSmall->setText("00:00.00"); QPalette ptext; ptext.setColor(QPalette::WindowText,Qt::gray); - ui->timeShowSmall->setPalette(ptext); + timeShowSmall->setPalette(ptext); isStarted = 0; + runorsuspend = 0; hour=0; minute=0; second=0; @@ -593,11 +1002,8 @@ void Clock::stopwatchInit() stopwatch_second = 0; stopwatch_isStarted = 0; - ui->timeShowBig->move(90,125); - ui->timeShowSmall->move(90,190); - ui->timeListWidget->move(25,230); - ui->startStopwatch->raise(); - ui->ringBtn->raise(); + startStopwatch->raise(); + ringBtn->raise(); //计次间隔时间最长,最短 timeSepOrderIndex = new QMap(); hisLongShortIndex = new QList(); @@ -615,11 +1021,11 @@ void Clock::clockInit() connect(timer_clock, SIGNAL(timeout()), this, SLOT(timerUpdate()) );/*动态获取时间 Dynamic acquisition time*/ timer_clock->start(1000); - connect( ui->addAlarmBtn, SIGNAL(clicked()), this, SLOT(setAlarmClock()) );/*添加闹钟 + connect( addAlarmBtn, SIGNAL(clicked()), this, SLOT(setAlarmClock()) );/*添加闹钟 Add alarm*/ - ui->timeShowBig->setAlignment(Qt::AlignHCenter); - ui->timeShowSmall->setAlignment(Qt::AlignHCenter); - ui->remainTime->setAlignment(Qt::AlignHCenter); + timeShowBig->setAlignment(Qt::AlignHCenter); + timeShowSmall->setAlignment(Qt::AlignHCenter); + remainTime->setAlignment(Qt::AlignHCenter); //单个表读取和写入数据库记录的高级接口 model = new QSqlTableModel(this); model->setTable("clock"); @@ -637,26 +1043,26 @@ void Clock::clockInit() connect(this->action_Delete_In_ListWidget_, SIGNAL(triggered()), this, SLOT(deleteAlarm())); //编辑 connect(this->action_edit_In_ListWidget_, SIGNAL(triggered()), this, SLOT(listdoubleClickslot())); - connect(ui->alarmListWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(listdoubleClickslot())); - connect(ui->saveBtnOnEditAlarm, SIGNAL(clicked()), this, SLOT(setAlarmSave()) ); - connect(ui->startStopwatch, SIGNAL(clicked()), this, SLOT(onPushbuttonStartClicked())); - connect(ui->ringBtn, SIGNAL(clicked()), this, SLOT(onPushbuttonRingClicked())); - connect(ui->cancelbtnOnEditAlarm, SIGNAL(clicked()), this, SLOT(alarmCancelSave()) ); + connect(alarmListWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(listdoubleClickslot())); + connect(saveBtnOnEditAlarm, SIGNAL(clicked()), this, SLOT(setAlarmSave()) ); + connect(startStopwatch, SIGNAL(clicked()), this, SLOT(onPushbuttonStartClicked())); + connect(ringBtn, SIGNAL(clicked()), this, SLOT(onPushbuttonRingClicked())); + connect(cancelbtnOnEditAlarm, SIGNAL(clicked()), this, SLOT(alarmCancelSave()) ); //暂停继续按钮 - connect(ui->suspendCountdownBtn, SIGNAL(clicked()), this, SLOT(onCountPushClicked())); + connect(suspendCountdownBtn, SIGNAL(clicked()), this, SLOT(onCountPushClicked())); - connect(ui->tinyWindowBtn, SIGNAL(clicked()), this, SLOT(onTinyClicked())); + connect(tinyWindowBtn, SIGNAL(clicked()), this, SLOT(onTinyClicked())); /*绑定右键显示菜单:在单击右键之后会执行槽函数, 槽函数中负责弹出右键菜单*/ - connect(ui->alarmListWidget, SIGNAL(customContextMenuRequested(const QPoint &)), + connect(alarmListWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onCustomContextMenuRequested(const QPoint &))); //初始化SystemTimeFlag,不然初始值可能不为0或者1 iniSystemTimeFlag(); - //绘制闹钟列表 - updateAlarmClock(); +// //绘制闹钟列表 +// updateAlarmClock(); } @@ -683,7 +1089,7 @@ void Clock::callUserGuide() void Clock::onCustomContextMenuRequested(const QPoint &pos) { /*弹出右键菜单*/ - if(ui->alarmListWidget->itemAt(pos)!=NULL){ + if(alarmListWidget->itemAt(pos)!=NULL){ //右键弹窗与闹钟绑定 popMenu_In_ListWidget_->exec(QCursor::pos()); } @@ -705,14 +1111,8 @@ void Clock::setupInit() textTimerupdate(); comboxclickedflag = false; //闹钟名称 - int selectHeight = 218; - int selectWidth = 100; - int selectGap = 44; - clockEditOnClockNew = new QLineEdit(ui->editAlarmPage); - clockEditOnClockNew->resize(256,36); - clockEditOnClockNew->move(selectWidth,selectHeight); + clockEditOnClockNew = new QLineEdit(editAlarmPage); clockEditOnClockNew->setMaxLength(16); - selectHeight+=selectGap; /*设置输入框无视空格,过滤特殊字符*/ QRegExp rx = QRegExp("^[\u4E00-\u9FA5A-Za-z0-9_]+$"); @@ -724,32 +1124,40 @@ void Clock::setupInit() QString bellName = m_selectBtnUtil->getBellNameById(bellId); //重复下拉框 - dialog_repeat = new CustomComBox(9,ui->editAlarmPage); - dialog_repeat->resize(256,36); - dialog_repeat->move(selectWidth,selectHeight); + dialog_repeat = new CustomComBox(9,editAlarmPage); alarmRepeat(); - selectHeight+=selectGap; //铃声下拉框 - dialog_music = new QComboBox(ui->editAlarmPage); - dialog_music->resize(256,36); - dialog_music->move(selectWidth,selectHeight); + dialog_music = new QComboBox(editAlarmPage); dialog_music->setFocusPolicy(Qt::NoFocus); setMusicSelectDialogListById(bellId,dialog_music); selectAlarmMusic(); - selectHeight+=selectGap; //稍后提醒下拉框 - dialog_remind_late = new QComboBox(ui->editAlarmPage); - dialog_remind_late->resize(256,36); - dialog_remind_late->move(selectWidth,selectHeight); + dialog_remind_late = new QComboBox(editAlarmPage); dialog_remind_late->setFocusPolicy(Qt::NoFocus); selectRemindLate(); //倒计时铃声选择 - count_music_sellect = new QComboBox(ui->countdownPage); - count_music_sellect->resize(256,36); - count_music_sellect->move(100,326); + count_music_sellect = new QComboBox(countdownPage); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + int selectHeight = 221; + int selectWidth = 100-6; + int selectGap = 56; + updateClockEditPageBtn(selectWidth,selectHeight,selectGap,48); + + count_music_sellect->resize(256,48); + count_music_sellect->move(this->width()/2-95,this->height()/2-168-238+326); + }else{ + int selectHeight = 218; + int selectWidth = 100; + int selectGap = 44; + updateClockEditPageBtn(selectWidth,selectHeight,selectGap,36); + + count_music_sellect->resize(256,36); + count_music_sellect->move(100,326); + } count_music_sellect->setFocusPolicy(Qt::NoFocus); setMusicSelectDialogListById(bellId,count_music_sellect); countdownMusicSellect(); @@ -856,7 +1264,7 @@ void Clock::stopwatchJg() stopwatch_jg_s = QString::number(stopwatch_second); } - ui->timeShowSmall->setText(stopwatch_jg_h+TIME_SEPARATOR+stopwatch_jg_m+"."+stopwatch_jg_s); + timeShowSmall->setText(stopwatch_jg_h+TIME_SEPARATOR+stopwatch_jg_m+"."+stopwatch_jg_s); stopwatch_second++; if (stopwatch_second==100) { @@ -891,14 +1299,14 @@ void Clock::CountDown() } else { stopwatch_s = QString::number(second); } - ui->timeShowBig->setText(stopwatch_h+TIME_SEPARATOR+stopwatch_m+"."+stopwatch_s); + timeShowBig->setText(stopwatch_h+TIME_SEPARATOR+stopwatch_m+"."+stopwatch_s); // QString selfFont = Utils::loadFontFamilyFromTTF(); // QFont f(selfFont); QFont f; f.setFamily("NotoSansCJKsc-Regular"); f.setWeight(400); f.setPixelSize(38); - ui->timeShowBig->setFont(f); + timeShowBig->setFont(f); //命名很不友好 //second单位是10ms second++; @@ -919,8 +1327,9 @@ void Clock::CountDown() void Clock::onPushbuttonStartClicked() { if (!isStarted) { - ui->startStopwatch->setText(tr("suspend")); - QPalette palette = ui->startStopwatch->palette(); + runorsuspend = 1; + startStopwatch->setText(tr("suspend")); + QPalette palette = startStopwatch->palette(); QColor ColorPlaceholderText(248,163,76,255); QBrush brush2; brush2.setColor(ColorPlaceholderText); @@ -941,8 +1350,9 @@ void Clock::onPushbuttonStartClicked() stopwatchStartAnimation(); stopwatch_Animation = 1; } - ui->ringBtn->setText(tr("count")); + ringBtn->setText(tr("count")); } else { + runorsuspend = 1; timer->stop(); /*查询间隔计时器是否启动 Query whether the interval timer starts*/ @@ -951,9 +1361,9 @@ void Clock::onPushbuttonStartClicked() stopwatch_isStarted = 0; } isStarted=0; - ui->startStopwatch->setText(tr("continue")); + startStopwatch->setText(tr("continue")); - QPalette palette = ui->startStopwatch->palette(); + QPalette palette = startStopwatch->palette(); QColor ColorPlaceholderText(248,163,76,255); QBrush brush2; brush2.setColor(ColorPlaceholderText); @@ -963,7 +1373,7 @@ void Clock::onPushbuttonStartClicked() palette.setBrush(QPalette::ButtonText, QBrush(Qt::white)); //注释原因:统一多色按钮 // ui->startStopwatch->setPalette(palette); - ui->ringBtn->setText(tr("reset")); + ringBtn->setText(tr("reset")); } return; } @@ -974,22 +1384,41 @@ void Clock::onPushbuttonStartClicked() */ void Clock::stopwatchStartAnimation() { - animation1 = new QPropertyAnimation(ui->timeShowBig, "geometry"); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + animation1 = new QPropertyAnimation(timeShowBig, "geometry"); animation1->setDuration(1000); - animation1->setKeyValueAt(0, QRect(90, 125, 210, 70)); - animation1->setEndValue(QRect(90, 4, 210, 70)); + if(onTablet){ + //平板模式 + animation1->setKeyValueAt(0, QRect(this->width()/2-100, 300, 210, 70)); + animation1->setEndValue(QRect(this->width()/2-100, 4, 210, 70)); + }else{ + animation1->setKeyValueAt(0, QRect(90, 125, 210, 70)); + animation1->setEndValue(QRect(90, 4, 210, 70)); + } animation1->start(); - animation2 = new QPropertyAnimation(ui->timeShowSmall, "geometry"); + animation2 = new QPropertyAnimation(timeShowSmall, "geometry"); animation2->setDuration(1000); - animation2->setKeyValueAt(0, QRect(90, 173, 210, 41)); - animation2->setEndValue(QRect(90, 60, 210, 41)); + if(onTablet){ + //平板模式 + animation2->setKeyValueAt(0, QRect(this->width()/2-100, 370, 210, 41)); + animation2->setEndValue(QRect(this->width()/2-100, 60, 210, 41)); + }else{ + animation2->setKeyValueAt(0, QRect(90, 173, 210, 41)); + animation2->setEndValue(QRect(90, 60, 210, 41)); + } animation2->start(); - animation3 = new QPropertyAnimation(ui->timeListWidget, "geometry"); + animation3 = new QPropertyAnimation(timeListWidget, "geometry"); animation3->setDuration(1000); - animation3->setKeyValueAt(0, QRect(25 ,230, 356, 270)); - animation3->setEndValue(QRect(25, 109, 356, 270)); + if(onTablet){ + //平板模式 + animation3->setKeyValueAt(0, QRect(this->width()/2-328 ,230, 656, 476)); + animation3->setEndValue(QRect(this->width()/2-328, 109, 656, 476)); + }else{ + animation3->setKeyValueAt(0, QRect(25 ,109, 356, 270)); + animation3->setEndValue(QRect(25, 109, 356, 270)); + } animation3->start(); } /* @@ -998,22 +1427,41 @@ void Clock::stopwatchStartAnimation() */ void Clock::stopwatchStopAnimation() { - animation1 = new QPropertyAnimation(ui->timeShowBig, "geometry"); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + animation1 = new QPropertyAnimation(timeShowBig, "geometry"); animation1->setDuration(1000); - animation1->setKeyValueAt(0, QRect(90, 4, 210, 70)); - animation1->setEndValue(QRect(90, 125, 210, 70)); + if(onTablet){ + //平板模式 + animation1->setKeyValueAt(0, QRect(this->width()/2-100, 4, 210, 70)); + animation1->setEndValue(QRect(this->width()/2-100, 300, 210, 70)); + }else{ + animation1->setKeyValueAt(0, QRect(90, 4, 210, 70)); + animation1->setEndValue(QRect(90, 125, 210, 70)); + } animation1->start(); - animation2 = new QPropertyAnimation(ui->timeShowSmall, "geometry"); + animation2 = new QPropertyAnimation(timeShowSmall, "geometry"); animation2->setDuration(1000); - animation2->setKeyValueAt(0, QRect(90, 55, 210, 41)); - animation2->setEndValue(QRect(90, 183, 210, 41)); + if(onTablet){ + //平板模式 + animation2->setKeyValueAt(0, QRect(this->width()/2-100, 60, 210, 41)); + animation2->setEndValue(QRect(this->width()/2-100, 370, 210, 41)); + }else{ + animation2->setKeyValueAt(0, QRect(90, 55, 210, 41)); + animation2->setEndValue(QRect(90, 183, 210, 41)); + } animation2->start(); - animation3 = new QPropertyAnimation(ui->timeListWidget, "geometry"); + animation3 = new QPropertyAnimation(timeListWidget, "geometry"); animation3->setDuration(1000); - animation3->setKeyValueAt(0, QRect(25 ,109, 356, 270)); - animation3->setEndValue(QRect(25, 230, 356, 270)); + if(onTablet){ + //平板模式 + animation3->setKeyValueAt(0, QRect(this->width()/2-328 ,109, 356, 270)); + animation3->setEndValue(QRect(this->width()/2-328, 230, 356, 270)); + }else{ + animation3->setKeyValueAt(0, QRect(25 ,109, 656, 476)); + animation3->setEndValue(QRect(25, 230, 656, 476)); + } animation3->start(); } @@ -1026,22 +1474,23 @@ void Clock::onPushbuttonRingClicked() if (!isStarted) { //复位 //清空数据 + runorsuspend = 0; timeSepOrderIndex->clear(); hisLongShortIndex->clear(); - ui->timeListWidget->verticalScrollBar()->setHidden(true); + timeListWidget->verticalScrollBar()->setHidden(true); if (nullptr != timer) { timer->stop(); timer_2->stop(); - ui->timeShowBig->setText("00:00.00"); - ui->timeShowSmall->setText("00:00.00"); + timeShowBig->setText("00:00.00"); + timeShowSmall->setText("00:00.00"); isStarted = 0; stopwatch_isStarted = 0; hour = 0; minute = 0;second = 0; stopwatch_hour = 0; stopwatch_minute = 0; stopwatch_second = 0; - ui->startStopwatch->setText(tr("start")); - ui->startStopwatch->setPalette(ui->addAlarmBtn->palette()); + startStopwatch->setText(tr("start")); + startStopwatch->setPalette(addAlarmBtn->palette()); for (int i=0; i < stopwatch_item_flag; i++) { delete stopwatch_w[i]; delete stopwatch_aItem[i]; @@ -1060,17 +1509,18 @@ void Clock::onPushbuttonRingClicked() } if (stopwatch_item_flag < 100) { stopwatch_aItem[stopwatch_item_flag] =new QListWidgetItem; - stopwatch_aItem[stopwatch_item_flag]->setSizeHint(QSize(340,58)); +// stopwatch_aItem[stopwatch_item_flag]->setSizeHint(QSize(340,58)); + stopwatch_aItem[stopwatch_item_flag]->setSizeHint(QSize(600,58)); stopwatch_aItem[stopwatch_item_flag]->setTextColor(QColor(255, 0, 0, 255)); - ui->timeListWidget->insertItem(0,stopwatch_aItem[stopwatch_item_flag]); + timeListWidget->insertItem(0,stopwatch_aItem[stopwatch_item_flag]); - ui->timeListWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - ui->timeListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->timeListWidget->verticalScrollBar()->setHidden(true); + timeListWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + timeListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + timeListWidget->verticalScrollBar()->setHidden(true); if(stopwatch_item_flag>2){ - ui->timeListWidget->verticalScrollBar()->setHidden(false); + timeListWidget->verticalScrollBar()->setHidden(false); } - stopwatch_w[stopwatch_item_flag] = new stopwatch_item(ui->timeListWidget); + stopwatch_w[stopwatch_item_flag] = new stopwatch_item(timeListWidget); stopwatch_w[stopwatch_item_flag]->stopwatch1->setText(tr("count")+QString::number(stopwatch_item_flag+1)); stopwatch_w[stopwatch_item_flag]->stopwatch2->setText(tr("interval ")+stopwatch_jg_h+TIME_SEPARATOR+stopwatch_jg_m+"."+stopwatch_jg_s); @@ -1089,7 +1539,7 @@ void Clock::onPushbuttonRingClicked() f.setPixelSize(24); stopwatch_w[stopwatch_item_flag]->stopwatch3->setFont(f); - ui->timeListWidget->setItemWidget(stopwatch_aItem[stopwatch_item_flag],stopwatch_w[stopwatch_item_flag]); + timeListWidget->setItemWidget(stopwatch_aItem[stopwatch_item_flag],stopwatch_w[stopwatch_item_flag]); stopwatch_hour = 0; stopwatch_minute = 0; @@ -1098,7 +1548,7 @@ void Clock::onPushbuttonRingClicked() stopwatch_item_flag++; } else if(stopwatch_item_flag >= 100) { - QToolTip::showText(mapToGlobal(ui->timeListWidget->pos()+QPoint(90,340)),tr("up to 100 times"),this); + QToolTip::showText(mapToGlobal(timeListWidget->pos()+QPoint(90,340)),tr("up to 100 times"),this); } } @@ -1137,16 +1587,16 @@ void Clock::onPushbuttonTimeselectClicked() return; timer->stop(); timer_2->stop(); - ui->timeShowBig->setText("00:00.00"); - ui->timeShowSmall->setText("00:00.00"); + timeShowBig->setText("00:00.00"); + timeShowSmall->setText("00:00.00"); isStarted = 0; stopwatch_isStarted = 0; hour = 0; minute = 0;second = 0; stopwatch_hour = 0; stopwatch_minute = 0; stopwatch_second = 0; - ui->startStopwatch->setText(tr("start")); - ui->startStopwatch->setPalette(ui->addAlarmBtn->palette()); + startStopwatch->setText(tr("start")); + startStopwatch->setPalette(addAlarmBtn->palette()); for (int i=0; i < stopwatch_item_flag; i++) { delete stopwatch_w[i]; @@ -1209,14 +1659,25 @@ void Clock::muteAllBell() m_commonToolTipCloseTimer->start(); //存储静音到数据库 model_setup->setData(model_setup->index(0, 0), 1);//静音 Mute - if(countdownNoticeDialog->isVisible() == 1){ +// if(countdownNoticeDialog->isVisible() == 1){ +// if(countdownNoticeDialog->m_musicPlayer->state()!= MMediaPlayer::State::PausedState){ +// countdownNoticeDialog->m_musicPlayer->pause(); +// } +// } +// if(alarmNoticeDialog){ +// if(alarmNoticeDialog->m_musicPlayer->state()!= MMediaPlayer::State::PausedState) +// alarmNoticeDialog->m_musicPlayer->pause(); +// } + if(countdownNoticeDialog->m_noticeId!=0){ if(countdownNoticeDialog->m_musicPlayer->state()!= MMediaPlayer::State::PausedState){ countdownNoticeDialog->m_musicPlayer->pause(); } } if(alarmNoticeDialog){ - if(alarmNoticeDialog->m_musicPlayer->state()!= MMediaPlayer::State::PausedState) - alarmNoticeDialog->m_musicPlayer->pause(); + if(alarmNoticeDialog->m_noticeId!=0){ + if(alarmNoticeDialog->m_musicPlayer->state()!= MMediaPlayer::State::PausedState) + alarmNoticeDialog->m_musicPlayer->pause(); + } } //试听音乐开启静音 if(playController::getInstance().getState() == playController::PlayState::PLAY_STATE){ @@ -1224,11 +1685,22 @@ void Clock::muteAllBell() } }else{ model_setup->setData(model_setup->index(0, 0), 0);//静音 Mute - if(countdownNoticeDialog->isVisible() == 1){ +// if(countdownNoticeDialog->isVisible() == 1){ +// ringContinueWhenMute(countdownNoticeDialog); +// } +// if(alarmNoticeDialog){ +// ringContinueWhenMute(alarmNoticeDialog); +// } + if(countdownNoticeDialog->m_noticeId!=0){ +// if(countdownNoticeDialog->m_musicPlayer->state()!=MMediaPlayer::State::PausedState){ +// countdownNoticeDialog->m_musicPlayer->pause(); +// } ringContinueWhenMute(countdownNoticeDialog); } if(alarmNoticeDialog){ - ringContinueWhenMute(alarmNoticeDialog); + if(alarmNoticeDialog->m_noticeId!=0){ + ringContinueWhenMute(alarmNoticeDialog); + } } //试听音乐取消静音 auto sumtime = playController::getInstance().getPlayer()->duration(); @@ -1281,10 +1753,11 @@ void Clock::ringContinueWhenMute(Natice_alarm *tempdialog) */ void Clock:: CountdownPageSwitch () { - setSwitchHighlightColor(ui->switchCountdown); - setSwitchDefaultColor(ui->switchClock); - setSwitchDefaultColor(ui->switchStopwatch); - ui->mainWidget->setCurrentIndex(0); + setSwitchHighlightColor(switchCountdown); + setSwitchDefaultColor(switchClock); + setSwitchDefaultColor(switchStopwatch); + mainWidget->setCurrentIndex(0); + alarmPage->hide(); } void Clock::setBtnIcon(KPushButton *btn, QString imgUrl, QString localUrl) { @@ -1303,12 +1776,12 @@ void Clock::setBtnIcon(KPushButton *btn, QString imgUrl, QString localUrl) } void Clock::setDefaultIcon(KPushButton *btn) { - if(btn==ui->switchClock){ - setBtnIcon(ui->switchClock,"ukui-alarm-symbolic",":/image/alarm.png"); - }else if(btn==ui->switchCountdown){ - setBtnIcon(ui->switchCountdown,"ukui-countselect-symbolic",":/image/count.png"); - }else if(btn==ui->switchStopwatch){ - setBtnIcon(ui->switchStopwatch,"stopwatch-symbolic",":/image/stopwatch.png"); + if(btn==switchClock){ + setBtnIcon(switchClock,"ukui-alarm-symbolic",":/image/alarm.png"); + }else if(btn==switchCountdown){ + setBtnIcon(switchCountdown,"ukui-countselect-symbolic",":/image/count.png"); + }else if(btn==switchStopwatch){ + setBtnIcon(switchStopwatch,"stopwatch-symbolic",":/image/stopwatch.png"); } if(theme::themetype==1){ changeIconHeight(btn); @@ -1351,10 +1824,10 @@ void Clock::setSwitchHighlightColor(KPushButton * btn) */ void Clock:: AlarmPageSwitch () { - setSwitchDefaultColor(ui->switchCountdown); - setSwitchHighlightColor(ui->switchClock); - setSwitchDefaultColor(ui->switchStopwatch); - ui->mainWidget->setCurrentIndex(1); + setSwitchDefaultColor(switchCountdown); + setSwitchHighlightColor(switchClock); + setSwitchDefaultColor(switchStopwatch); + mainWidget->setCurrentIndex(1); } void Clock::changeIconHeight(KPushButton *btn) { @@ -1368,10 +1841,11 @@ void Clock::changeIconHeight(KPushButton *btn) */ void Clock:: StopwatchPageSwitch () { - setSwitchDefaultColor(ui->switchCountdown); - setSwitchDefaultColor(ui->switchClock); - setSwitchHighlightColor(ui->switchStopwatch); - ui->mainWidget->setCurrentIndex(2); + setSwitchDefaultColor(switchCountdown); + setSwitchDefaultColor(switchClock); + setSwitchHighlightColor(switchStopwatch); + mainWidget->setCurrentIndex(2); + alarmPage->hide(); } @@ -1464,8 +1938,14 @@ bool Clock::checkSystem24() void Clock::muteBtnStyle() { muteBtn = new QPushButton(ui->titileWidget); - muteBtn->setFixedSize(30,30); - muteBtn->move(238,5); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + muteBtn->setFixedSize(40,40); + muteBtn->move(this->width()-210,13); + }else{ + muteBtn->setFixedSize(30,30); + muteBtn->move(238,5); + } int mute = model_setup->index(0, 0).data().toInt(); m_muteOn = mute==1?true:false; QPixmap pixmap = QPixmap(":/image/miniIcon/mute-off.png"); @@ -1477,6 +1957,9 @@ void Clock::muteBtnStyle() QPainter p(muteBtn); //表示引擎应尽可能对图元的边缘进行抗锯齿。 p.setRenderHint(QPainter::Antialiasing); + //同三联样式 + muteBtn->setProperty("isWindowButton", 0x1); + muteBtn->setProperty("useIconHighlightEffect", 0x2); muteBtn->setFlat(true); muteBtn->setVisible(true); muteBtn->setFocusPolicy(Qt::NoFocus); @@ -1516,7 +1999,7 @@ void Clock::closeBtnStyle() { //适配sdk QPushButton* btn = ui->titileWidget->windowButtonBar()->closeButton(); - btn->setToolTip(tr("Quit")); + btn->setToolTip(tr("Close")); disconnect(ui->titileWidget->windowButtonBar()->closeButton(), &QPushButton::clicked, this, &KWidget::close); connect(btn, SIGNAL(clicked()), this, SLOT(windowClosingClicked())); } @@ -1528,7 +2011,7 @@ void Clock::menuBtnStyle() //适配sdk //删除原sdk中的多余选项 KMenuButton* btn = ui->titileWidget->windowButtonBar()->menuButton(); - btn->setToolTip(tr("Menu")); + btn->setToolTip(tr("Option")); QMenu* menu = ui->titileWidget->windowButtonBar()->menuButton()->menu(); QAction* settingAction = ui->titileWidget->windowButtonBar()->menuButton()->settingAction(); QAction* themeAction = ui->titileWidget->windowButtonBar()->menuButton()->themeAction(); @@ -1542,19 +2025,25 @@ void Clock::menuBtnStyle() QAction* m_closeAction = ui->titileWidget->windowButtonBar()->menuButton()->quitAction(); m_helpAction->setText(tr("Help")); m_aboutAction->setText(tr("About")); - m_closeAction->setText(tr("Close")); + m_closeAction->setText(tr("Quit")); connect(m_helpAction, &QAction::triggered, this, [=](){ qDebug() << "help clicked"; callUserGuide(); }); connect(m_aboutAction, &QAction::triggered, this, [=](){ - About *dialog = new About(); - QPointF position = this->pos(); - kdk::UkuiStyleHelper::self()->removeHeader(dialog); - dialog->showThisWindow(); - QRect aboutRect = QRect(position.x()-15,position.y()+130,dialog->width(),dialog->height()); - kdk::WindowManager::setGeometry(dialog->windowHandle(),aboutRect); - dialog->exec(); +// About *dialog = new About(); +// QPointF position = this->pos(); +// kdk::UkuiStyleHelper::self()->removeHeader(dialog); +// dialog->showThisWindow(); +// QRect aboutRect = QRect(position.x()-15,position.y()+130,dialog->width(),dialog->height()); +// kdk::WindowManager::setGeometry(dialog->windowHandle(),aboutRect); +// dialog->exec(); + QApplication::setApplicationName(tr(CLOCK_TITLE_NAME)); + QString version = ConfigUtil().Get("common","version").toString(); + KAboutDialog *aboutDialog = new KAboutDialog(this,QIcon::fromTheme("kylin-alarm-clock"),tr(CLOCK_TITLE_NAME),tr("Version:")+version); + kdk::UkuiStyleHelper::self()->removeHeader(aboutDialog); + aboutDialog->setBodyTextVisiable(true); + aboutDialog->exec(); }); connect(m_closeAction, SIGNAL(triggered()), this, SLOT(windowClosingClicked())); } @@ -1608,6 +2097,59 @@ void Clock::updateClockSelectBtnLabel(QLabel *temp, int moveHeight, QString text temp->move(labelLeftSpace, moveHeight); } +void Clock::updateClockTimeRing(int ringWidthOffset, int ringHeightOffset) +{ + int ringMoveWidth = 67+ringWidthOffset; + int ringMoveHeight = 30+ringHeightOffset; + int timeSep = 100; + int labelSep = 74; + int timeLabelMoveHeight = 125+ringHeightOffset; + hourTimerRing->move(ringMoveWidth, ringMoveHeight); + h_in_m->move(ringMoveWidth+labelSep,timeLabelMoveHeight); + ringMoveWidth+=timeSep; + minuteTimeRing->move(ringMoveWidth, ringMoveHeight); + m_in_s->move(ringMoveWidth+labelSep,timeLabelMoveHeight); + ringMoveWidth+=timeSep; + secondTimeRing->move(ringMoveWidth, ringMoveHeight); + after_s->move(ringMoveWidth+labelSep,timeLabelMoveHeight); +} + +void Clock::updateClockEditPageLabel(int selectHeight, int selectGap, int labelHeightOffset) +{ + //闹钟名称 + updateClockSelectBtnLabel(clockNamelabel,selectHeight+labelHeightOffset,tr(" name")); + selectHeight+=selectGap; + //重复下拉框 + updateClockSelectBtnLabel(clockRepeatLabel,selectHeight+labelHeightOffset,tr(" name")); + selectHeight+=selectGap; + //铃声下拉框 + updateClockSelectBtnLabel(clockBellLabel,selectHeight+labelHeightOffset,tr(" bell")); + selectHeight+=selectGap; + //稍后提醒下拉框 + updateClockSelectBtnLabel(clockRemindLabel,selectHeight+labelHeightOffset,tr(" remind")); +} + +void Clock::updateClockEditPageBtn(int selectMoveWidth, int selectMoveHeight, int selectGap, int btnHeight) +{ + int btnWidth = 256; + //闹钟名称 + clockEditOnClockNew->resize(btnWidth,btnHeight); + clockEditOnClockNew->move(selectMoveWidth,selectMoveHeight); + selectMoveHeight+=selectGap; + //重复下拉框 + dialog_repeat->resize(btnWidth,btnHeight); + dialog_repeat->move(selectMoveWidth,selectMoveHeight); + selectMoveHeight+=selectGap; + //铃声下拉框 + dialog_music->resize(btnWidth,btnHeight); + dialog_music->move(selectMoveWidth,selectMoveHeight); + selectMoveHeight+=selectGap; + //稍后提醒下拉框 + dialog_remind_late->resize(btnWidth,btnHeight); + dialog_remind_late->move(selectMoveWidth,selectMoveHeight); + +} + void Clock::widgetListWhiteStyle(QListWidget *listWidget) { QString listBackColor = getDefaultGreyColor(); @@ -1771,20 +2313,11 @@ void Clock::timerUpdate() void Clock::noticeDialogShow(int close_time, int alarm_num, QString id) { model_setup->select(); - QScreen *screen=QGuiApplication::primaryScreen (); //闹钟弹窗 alarmNoticeDialog = new Natice_alarm(close_time,alarm_num,nullptr,id); - alarmNoticeDialog->showThisWindow(); - if(countdownNoticeDialog != nullptr) { - if (countdownNoticeDialog->isVisible() == 0) - primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,alarmNoticeDialog,1); - else - primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,alarmNoticeDialog,0); - } - else - primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,alarmNoticeDialog,1); - alarmNoticeDialog->screenSaveStyle(); alarmNoticeDialog->playMusic(); + NoticeAlarmPoolUtil::getInstance()-> + inseartNoticesMap(alarmNoticeDialog->getNoticeId(),alarmNoticeDialog); } @@ -1797,11 +2330,11 @@ void Clock::updateAlarmClock() int hour_now; int min_now; if(rowNum){ - ui->noAlarm->hide(); - ui->noAlarmIcon->hide(); + noAlarm->hide(); + noAlarmIcon->hide(); }else{ - ui->noAlarm->show(); - ui->noAlarmIcon->show(); + noAlarm->show(); + noAlarmIcon->show(); } auto sqlQuery = clock_sql::getQSqlQuery(); sqlQuery.exec("select * from clock order by Hour ASC,Minute ASC"); @@ -1812,24 +2345,29 @@ void Clock::updateAlarmClock() while (sqlQuery.next()) { //窗体 aItem[alarmNum] =new QListWidgetItem; - aItem[alarmNum]->setSizeHint(QSize(340,108)); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + aItem[alarmNum]->setSizeHint(QSize(360,160)); + }else{ + aItem[alarmNum]->setSizeHint(QSize(340,108)); + } aItem[alarmNum]->setTextColor(QColor(255, 0, 0, 255)); - ui->alarmListWidget->addItem(aItem[alarmNum]); + alarmListWidget->addItem(aItem[alarmNum]); //避免滚动条因占据item空间而使item发生变化 - ui->alarmListWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - ui->alarmListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->alarmListWidget->verticalScrollBar()->setHidden(true); - connect(ui->alarmListWidget->verticalScrollBar(),&QScrollBar::rangeChanged,this, [=](){ - if (ui->alarmListWidget->verticalScrollBar()->maximum() == 0) { - ui->alarmListWidget->verticalScrollBar()->setHidden(true); - } else { - ui->alarmListWidget->verticalScrollBar()->setHidden(false); - } - }); +// alarmListWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + alarmListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +// alarmListWidget->verticalScrollBar()->setHidden(true); +// connect(alarmListWidget->verticalScrollBar(),&QScrollBar::rangeChanged,this, [=](){ +// if (alarmListWidget->verticalScrollBar()->maximum() == 0) { +// alarmListWidget->verticalScrollBar()->setHidden(true); +// } else { +// alarmListWidget->verticalScrollBar()->setHidden(false); +// } +// }); //闹钟信息 - w1[alarmNum] = new item_new(ui->alarmListWidget); + w1[alarmNum] = new item_new(alarmListWidget); //信息与展示窗体绑定 - ui->alarmListWidget->setItemWidget(aItem[alarmNum],w1[alarmNum]); + alarmListWidget->setItemWidget(aItem[alarmNum],w1[alarmNum]); //绑定Id到闹钟子项 auto hisId = sqlQuery.value(14).toString(); w1[alarmNum]->setId(hisId); @@ -1951,8 +2489,8 @@ void Clock::timerAlarmStartUpdate() */ void Clock::drawNoAlarmPrompt() { - ui->noAlarmIcon->setPixmap(QPixmap(":/image/noClockWhite.png"));//.pixmap(164,194) - ui->noAlarm->setAlignment(Qt::AlignHCenter); + noAlarmIcon->setPixmap(QPixmap(":/image/noClockWhite.png"));//.pixmap(164,194) + noAlarm->setAlignment(Qt::AlignHCenter); } /* @@ -1986,17 +2524,33 @@ void Clock::setAlarmClock() { onEditPage = false; //新建闹钟页 - ui->mainWidget->setCurrentIndex(3); + mainWidget->setCurrentIndex(3); + alarmPage->show(); //取消 - ui->cancelbtnOnEditAlarm->show(); + cancelbtnOnEditAlarm->show(); repeat_new_or_edit_flag = 0; model_setup->select();/*调用默认设置 Call default settings*/ repeat_str_model = tr("Workingday"); + //数字盘时间设置为当前时间 + QTime time = QTime::currentTime(); + int timeH = time.hour(); + int timeM = time.minute(); + timer_alarm_start24->m_currentValue = timeH; + timer_alarm_start60->m_currentValue = timeM; + if(timer_alarm_start24->m_currentValue>=12){ + timer_alarm_startAPM->m_currentValue=2; + }else{ + timer_alarm_startAPM->m_currentValue=1; + } //工作日默认 dialog_repeat->line_edit_->setText(repeat_str_model+tr("(default)")); //工作日设置的逻辑 + //存储重复选择的星期,默认清零 + for (int i = 0; i < 9; i++) { + repeat_day[i] = 0; + } for (int i=0; i<5; i++) { repeat_day[i] = 1; } @@ -2101,8 +2655,8 @@ void Clock::setAlarmSave() } updateAlarmClock(); updateAlarmItemFront(CURRENT_FONT_SIZE); - ui->mainWidget->setCurrentIndex(1); - ui->mainWidget->raise();/*将页面放置最前方 + mainWidget->setCurrentIndex(1); + mainWidget->raise();/*将页面放置最前方 Put the page at the front*/ }else{ @@ -2126,8 +2680,8 @@ void Clock::setAlarmSave() QMessageBox::warning(this, tr("warning"), tr("the number of alarms reaches limit!!"), tr("yes")); } - ui->mainWidget->setCurrentIndex(1); - ui->mainWidget->raise();//将页面放置最前方 + mainWidget->setCurrentIndex(1); + mainWidget->raise();//将页面放置最前方 // Put the page at the front } @@ -2338,8 +2892,8 @@ QString Clock::formatReturnMsg(STATUS_CODE status, string msg) */ void Clock::alarmCancelSave() { - ui->mainWidget->setCurrentIndex(1); - ui->mainWidget->raise(); + mainWidget->setCurrentIndex(1); + mainWidget->raise(); playController::getInstance().stop(); } @@ -2350,7 +2904,8 @@ void Clock::alarmCancelSave() void Clock::listdoubleClickslot() { onEditPage = true; - ui->mainWidget->setCurrentIndex(3); + mainWidget->setCurrentIndex(3); + alarmPage->show(); //以链表序号找寻数据 auto curentId = getClockPkByCurrentNum(); //根据id查询数据 @@ -2427,8 +2982,8 @@ void Clock::listdoubleClickslot() QString Clock::getClockPkByCurrentNum() { - int num = ui->alarmListWidget->currentRow(); - auto widgetItem = static_cast(ui->alarmListWidget->itemWidget(aItem[num])); + int num = alarmListWidget->currentRow(); + auto widgetItem = static_cast(alarmListWidget->itemWidget(aItem[num])); auto curentId = widgetItem->id(); return curentId; } @@ -2609,7 +3164,7 @@ void Clock::alarmRepeat() int num; //repeat_new_or_edit_flag 编辑是1 if(repeat_new_or_edit_flag) - num = ui->alarmListWidget->currentRow(); + num = alarmListWidget->currentRow(); else { num= model->rowCount(); } @@ -2633,13 +3188,11 @@ void Clock::alarmRepeat() } }); connect(dialog_repeat->list_widget_,&CustomListWidget::getPosition,this,[=](QPointF position){ - int yy = position.y(); - int xx=position.x(); int honum=0; if(comboxclickedflag){ honum = dialog_repeat->list_widget_->currentRow(); }else{ - honum=dialog_repeat->list_widget_->row(dialog_repeat->list_widget_->itemAt(xx,yy)); + honum=dialog_repeat->list_widget_->row(dialog_repeat->list_widget_->itemAt(position.x(),position.y())); dialog_repeat->setCurrentHoverNum(honum); } dialog_repeat->setTextHoverStyle(honum); @@ -2761,14 +3314,19 @@ void Clock::statCountdown(){ }else { s = QString::number(countdown_second); } - ui->remainTime->setText(h+TIME_SEPARATOR+m+TIME_SEPARATOR+s); + remainTime->setText(h+TIME_SEPARATOR+m+TIME_SEPARATOR+s); // QString selfFont = Utils::loadFontFamilyFromTTF(); // QFont f(selfFont); QFont f; f.setFamily("NotoSansCJKsc-Regular"); f.setWeight(400); - f.setPixelSize(40); - ui->remainTime->setFont(f); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + f.setPixelSize(76); + }else{ + f.setPixelSize(40); + } + remainTime->setFont(f); //设置倒计时托盘tooltip QString tooltip = tr("Count down"); @@ -2817,7 +3375,7 @@ void Clock::updateCountdownTime() { //设置当前时间 int ringmax = countdown_hour*3600 + countdown_minute*60 + countdown_second; - ui->countdownRunPage->countdownRunRoundBar->setValue(ringmax); + countdownRunPage->countdownRunRoundBar->setValue(ringmax); QString h; QString m; QString s; if (countdown_hour < 10){ @@ -2839,14 +3397,19 @@ void Clock::updateCountdownTime() }else { s = QString::number(countdown_second); } - ui->remainTime->setText(h+TIME_SEPARATOR+m+TIME_SEPARATOR+s); + remainTime->setText(h+TIME_SEPARATOR+m+TIME_SEPARATOR+s); // QString selfFont = Utils::loadFontFamilyFromTTF(); // QFont f(selfFont); QFont f; f.setFamily("NotoSansCJKsc-Regular"); f.setWeight(400); - f.setPixelSize(40); - ui->remainTime->setFont(f); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + f.setPixelSize(76); + }else{ + f.setPixelSize(40); + } + remainTime->setFont(f); //设置倒计时托盘tooltip QString tooltip = tr("Count down"); tooltip +=TIME_SEPARATOR_CN+h+TIME_SEPARATOR+m+TIME_SEPARATOR+s; @@ -2880,29 +3443,10 @@ void Clock::countdownNoticeDialogShow() if(checkTinyCountdownDia()){ tinycountdownDia->set_dialog_close(); } - model_setup->select(); - QScreen *screen=QGuiApplication::primaryScreen (); - QRect mm=screen->availableGeometry() ; - int screen_width = mm.width(); - int screen_height = mm.height(); - model_setup->select(); -// countdownNoticeDialog->timer_value = 59; - //多少秒后自动关闭 - countdownNoticeDialog->ui->autoCloseTime->setText(tr("60 Seconds to close")); - //左上图标 -// countdownNoticeDialog->ui->titleLabel->setText(tr("Alarm")); - countdownNoticeDialog->showThisWindow(); - //时间到 - if (alarmNoticeDialog != nullptr) { - if (alarmNoticeDialog->isVisible() == 0) - primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,countdownNoticeDialog,1); - else - primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,countdownNoticeDialog,0); - } else - primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,countdownNoticeDialog,1); - countdownNoticeDialog->screenSaveStyle(); countdownNoticeDialog->playMusic(); + NoticeAlarmPoolUtil::getInstance()-> + inseartNoticesMap(countdownNoticeDialog->getNoticeId(),countdownNoticeDialog); } @@ -2922,26 +3466,36 @@ void Clock::startbtnCountdown(){ //当前剩余时间,单位秒 int ringmax = hourTimerRing->m_currentValue*3600 + minuteTimeRing->m_currentValue*60 + secondTimeRing->m_currentValue; //进度圈 - ui->countdownRunPage->countdownRunRoundBar->setRange(0,ringmax); + countdownRunPage->countdownRunRoundBar->setRange(0,ringmax); //切换进度条颜色 - ui->countdownRunPage->countdownRunRoundBar->switchRunRingColor(); - ui->startCountdownBtn->setStyleSheet(""); + countdownRunPage->countdownRunRoundBar->switchRunRingColor(); + startCountdownBtn->setStyleSheet(""); countdown_isStarted=1; //结束 - ui->startCountdownBtn->setText(tr("End")); + startCountdownBtn->setText(tr("End")); //点击开始,刷新数值 refreshCountdownLabel11Flag = true; //设置倒计时初始时间label9 中间数字 setcoutdownNumber(hourTimerRing->m_currentValue, minuteTimeRing->m_currentValue, secondTimeRing->m_currentValue);//获取转轮当前值 //倒计时页面 - ui->countdownStackedW->setCurrentIndex(1); + countdownStackedW->setCurrentIndex(1); countdown_timer->start(); //光圈的进度值修改定时启动 + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + countdownBellLabelOnRun->hide(); + countdownBellLabelOnSet->hide(); + count_music_sellect->hide(); + }else{ + countdownBellLabelOnRun->show(); + countdownBellLabelOnSet->show(); + count_music_sellect->show(); + } } else { //点击了结束,或者时间耗尽 - ui->countdownRunPage->countdownRunRoundBar->setRange(0,COUNTDOWN_TIME); - ui->countdownRunPage->countdownRunRoundBar->setValue(COUNTDOWN_TIME);/*初始化倒计时进度圈 + countdownRunPage->countdownRunRoundBar->setRange(0,COUNTDOWN_TIME); + countdownRunPage->countdownRunRoundBar->setValue(COUNTDOWN_TIME);/*初始化倒计时进度圈 Initialize countdown progress circle*/ countdown_timer->stop(); countdown_isStarted=0; @@ -2949,14 +3503,14 @@ void Clock::startbtnCountdown(){ hourTimerRing->m_currentValue = 0; minuteTimeRing->m_currentValue = 0; secondTimeRing->m_currentValue = 0; - ui->startCountdownBtn->setText(tr("start")); - ui->remainTime->setText("00:00:00"); + startCountdownBtn->setText(tr("start")); + remainTime->setText("00:00:00"); //切换到倒计时滚轮页 - ui->countdownStackedW->setCurrentIndex(0); + countdownStackedW->setCurrentIndex(0); //暂停 - ui->suspendCountdownBtn->setText(tr("suspend")); + suspendCountdownBtn->setText(tr("suspend")); - QPalette palette = ui->suspendCountdownBtn->palette(); + QPalette palette = suspendCountdownBtn->palette(); QColor ColorPlaceholderText(248,163,76,255); QBrush brush2; brush2.setColor(ColorPlaceholderText); @@ -2971,6 +3525,10 @@ void Clock::startbtnCountdown(){ } //恢复默认托盘 setDefaultTrayIconTooltip(); + + count_music_sellect->show(); + countdownBellLabelOnRun->show(); + countdownBellLabelOnSet->show(); } return; } @@ -3012,14 +3570,19 @@ void Clock::setcoutdownNumber(int h1, int m1, int s1){ s = QString::number(countdown_second); } - ui->remainTime->setText(h+TIME_SEPARATOR+m+TIME_SEPARATOR+s); + remainTime->setText(h+TIME_SEPARATOR+m+TIME_SEPARATOR+s); // QString selfFont = Utils::loadFontFamilyFromTTF(); // QFont f(selfFont); QFont f; f.setFamily("NotoSansCJKsc-Regular"); f.setWeight(400); - f.setPixelSize(40); - ui->remainTime->setFont(f); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + f.setPixelSize(76); + }else{ + f.setPixelSize(40); + } + remainTime->setFont(f); //获取倒计时结束时间 getCountdownOverTime(); } @@ -3061,12 +3624,12 @@ void Clock::getCountdownOverTime() } if (x_h >= 48) { x_h = x_h - 48; - ui->countdownAlarmTime->setText(tr("after tomorrow")+formatX_h(x_h)+TIME_SEPARATOR+changeNumToStr(x_m)); + countdownAlarmTime->setText(tr("after tomorrow")+formatX_h(x_h)+TIME_SEPARATOR+changeNumToStr(x_m)); } else if (x_h >= 24) { x_h = x_h - 24; - ui->countdownAlarmTime->setText(tr("Tomorrow")+formatX_h(x_h)+TIME_SEPARATOR+changeNumToStr(x_m)); + countdownAlarmTime->setText(tr("Tomorrow")+formatX_h(x_h)+TIME_SEPARATOR+changeNumToStr(x_m)); } else{ - ui->countdownAlarmTime->setText(formatX_h(x_h)+TIME_SEPARATOR+changeNumToStr(x_m)); + countdownAlarmTime->setText(formatX_h(x_h)+TIME_SEPARATOR+changeNumToStr(x_m)); } } //上下午格式 @@ -3203,11 +3766,11 @@ void Clock::onCountPushClicked() tinycountdownDia->updateOnRunState(countdown_isStarted_2); if (countdown_isStarted_2){ //点击了继续 - ui->suspendCountdownBtn->setText(tr("suspend")); + suspendCountdownBtn->setText(tr("suspend")); //切换进度条颜色 - ui->countdownRunPage->countdownRunRoundBar->switchRunRingColor(); + countdownRunPage->countdownRunRoundBar->switchRunRingColor(); - QPalette palette = ui->suspendCountdownBtn->palette(); + QPalette palette = suspendCountdownBtn->palette(); QColor ColorPlaceholderText(248,163,76,255); QBrush brush2; brush2.setColor(ColorPlaceholderText); @@ -3223,11 +3786,11 @@ void Clock::onCountPushClicked() getCountdownOverTime(); } else { //点击了暂停 - ui->suspendCountdownBtn->setText(tr("continue")); + suspendCountdownBtn->setText(tr("continue")); //切换进度条颜色 - ui->countdownRunPage->countdownRunRoundBar->switchStopRingColor(); + countdownRunPage->countdownRunRoundBar->switchStopRingColor(); - QPalette palette = ui->suspendCountdownBtn->palette(); + QPalette palette = suspendCountdownBtn->palette(); QColor ColorPlaceholderText(SWITCH_BTN_HIGHLIGHT_BACK_COLOR); QBrush brush2; brush2.setColor(ColorPlaceholderText); @@ -3252,14 +3815,14 @@ void Clock::countdownSetStartTime() { //倒计时小时滚轮 - hourTimerRing = new VerticalScroll_99(ui->countdownSetPage); - QLabel * h_in_m = new QLabel (ui->countdownSetPage); + hourTimerRing = new VerticalScroll_99(countdownSetPage); + h_in_m = new QLabel (countdownSetPage); //倒计时分钟 - minuteTimeRing = new VerticalScroll_60(ui->countdownSetPage); - QLabel * m_in_s = new QLabel (ui->countdownSetPage); + minuteTimeRing = new VerticalScroll_60(countdownSetPage); + m_in_s = new QLabel (countdownSetPage); //倒计时秒 - secondTimeRing = new VerticalScroll_60(ui->countdownSetPage); - QLabel * after_s = new QLabel (ui->countdownSetPage); + secondTimeRing = new VerticalScroll_60(countdownSetPage); + after_s = new QLabel (countdownSetPage); hourTimerRing->resize(60,228); minuteTimeRing->resize(60,228); @@ -3282,11 +3845,21 @@ void Clock::countdownSetStartTime() after_s->resize(50,30); after_s->setText(tr("sec")); // after_s->setStyleSheet("font: 30pt 'Sans Serif';"); - int ringMoveWidth = 67; - int ringMoveHeight = 30; + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + int px = 0; + int py = 0; + if(!onTablet){ + px = 0; + py = 0; + }else{ + px = this->width()/2-195; + py = this->height()/2-168-238; + } + int ringMoveWidth = 67+px; + int ringMoveHeight = 30+py; int timeSep = 100; int labelSep = 74; - int timeLabelMoveHeight = 125; + int timeLabelMoveHeight = 125+py; hourTimerRing->move(ringMoveWidth, ringMoveHeight); h_in_m->move(ringMoveWidth+labelSep,timeLabelMoveHeight); //hour 要比min长 @@ -3301,10 +3874,6 @@ void Clock::countdownSetStartTime() secondTimeRing->move(ringMoveWidth, ringMoveHeight); after_s->move(ringMoveWidth+labelSep,timeLabelMoveHeight); //配置倒计时页的开始按钮 - startCountSingle = new QPushButton(ui->countdownSetPage); - startCountSingle->resize(120,34); - startCountSingle->move(135,401); - startCountSingle->setText(tr("start")); connect(startCountSingle, SIGNAL(clicked()), this, SLOT(startbtnCountdown()) ); QPalette palette2 = startCountSingle->palette(); @@ -3412,7 +3981,7 @@ void Clock::updateQLineEditFront(QLineEdit *lineEdit, int size) */ void Clock::updateAlarmItemFront(int size) { - QListWidget * alarmList = ui->alarmListWidget; + QListWidget * alarmList = alarmListWidget; for (int i=0;icount() ;i++ ) { QListWidgetItem * varItem = alarmList->item(i); item_new * varWidget = static_cast(alarmList->itemWidget(varItem)) ; @@ -3422,7 +3991,7 @@ void Clock::updateAlarmItemFront(int size) void Clock::updateStopwatchItemFront(int size) { - QListWidget * stopwatchList = ui->timeListWidget; + QListWidget * stopwatchList = timeListWidget; for (int i=0;icount() ;i++ ) { QListWidgetItem * varItem = stopwatchList->item(i); stopwatch_item * varWidget = static_cast(stopwatchList->itemWidget(varItem)) ; @@ -3437,8 +4006,8 @@ void Clock::updateFront(const int size) //闹钟页面子项 updateAlarmItemFront(size); //秒表页面 两个时间 - updateLabelFront(ui->timeShowBig,round(3.2*size)); - updateLabelFront(ui->timeShowSmall,round(1.73*size)); + updateLabelFront(timeShowBig,round(3.2*size)); + updateLabelFront(timeShowSmall,round(1.73*size)); //秒表页面子项 updateStopwatchItemFront(size); double font = 1.15; @@ -3525,23 +4094,23 @@ void Clock::updateLineEditTextByLength(QLineEdit *temp, int limitSize) */ void Clock::alarmSetStartTime() { - shadow = new QWidget(ui->editAlarmPage); + shadow = new QWidget(editAlarmPage); shadow->move(115,58); shadow->resize(160,58); //闹钟小时滚轮 - timer_alarm_start24 = new VerticalScroll_24(ui->editAlarmPage, this); - QLabel * h_in_m = new QLabel (ui->editAlarmPage); + timer_alarm_start24 = new VerticalScroll_24(editAlarmPage, this); + QLabel * h_in_m = new QLabel (editAlarmPage); //闹钟分钟滚轮 - timer_alarm_start60 = new VerticalScroll_60(ui->editAlarmPage); + timer_alarm_start60 = new VerticalScroll_60(editAlarmPage); //闹中上下午滚轮 - timer_alarm_startAPM = new VerticalScroll_APM(ui->editAlarmPage); + timer_alarm_startAPM = new VerticalScroll_APM(editAlarmPage); timer_alarm_start24->resize(63,228); timer_alarm_start60->resize(63,228); timer_alarm_startAPM->resize(50,228); - QLabel * hour_ring = new QLabel (ui->editAlarmPage); - QLabel * min_ring = new QLabel (ui->editAlarmPage); + QLabel * hour_ring = new QLabel (editAlarmPage); + QLabel * min_ring = new QLabel (editAlarmPage); hour_ring->hide(); min_ring->hide(); @@ -3884,7 +4453,7 @@ void Clock::paintEvent(QPaintEvent *event) bool Clock::eventFilter(QObject *watched, QEvent *event) { - if(watched == ui->editAlarmPage && event->type() == QEvent::Paint) + if(watched == editAlarmPage && event->type() == QEvent::Paint) { showPaint(); //响应函数 } @@ -3893,23 +4462,23 @@ bool Clock::eventFilter(QObject *watched, QEvent *event) { // showPaint7(); } - int index = ui->mainWidget->currentIndex(); - if(watched == ui->switchClock && event->type() == QEvent::HoverEnter){ + int index = mainWidget->currentIndex(); + if(watched == switchClock && event->type() == QEvent::HoverEnter){ if(index==0||index==2){ QColor backgroundColor = palette().color(QPalette::Button); - ui->switchClock->setBackgroundColor(backgroundColor); + switchClock->setBackgroundColor(backgroundColor); } } - if(watched == ui->switchCountdown && event->type() == QEvent::HoverEnter){ + if(watched == switchCountdown && event->type() == QEvent::HoverEnter){ if(index!=0){ QColor backgroundColor = palette().color(QPalette::Button); - ui->switchCountdown->setBackgroundColor(backgroundColor); + switchCountdown->setBackgroundColor(backgroundColor); } } - if(watched == ui->switchStopwatch && event->type() == QEvent::HoverEnter){ + if(watched == switchStopwatch && event->type() == QEvent::HoverEnter){ if(index!=2){ QColor backgroundColor = palette().color(QPalette::Button); - ui->switchStopwatch->setBackgroundColor(backgroundColor); + switchStopwatch->setBackgroundColor(backgroundColor); } } return QWidget::eventFilter(watched,event); @@ -3920,21 +4489,57 @@ bool Clock::eventFilter(QObject *watched, QEvent *event) */ void Clock::showPaint() { - QPainter painter(ui->editAlarmPage); - painter.setPen(Qt::gray); - painter.setBrush(Qt::green); - QStyleOption opt; - opt.init(this); - painter.setBrush(opt.palette.color(QPalette::Base)); - painter.setPen(Qt::transparent); - QRect rect = ui->editAlarmPage->rect(); - rect.setWidth(rect.width() - 0); - rect.setHeight(rect.height() - 0); - painter.drawRoundedRect(rect, 7, 7); - { - QPainterPath painterPath; - painterPath.addRoundedRect(rect, 0, 0); - painter.drawPath(painterPath); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + QPainter p(editAlarmPage); + p.setRenderHint(QPainter::Antialiasing); + QPainterPath rectPath; + rectPath.addRoundedRect(editAlarmPage->rect().adjusted(6, 6, -6, -6), WINDOWN_RADIUS, WINDOWN_RADIUS); + // 画一个黑底 + QPixmap pixmap(editAlarmPage->rect().size()); + pixmap.fill(Qt::transparent); + QPainter pixmapPainter(&pixmap); + pixmapPainter.setRenderHint(QPainter::Antialiasing); + auto shadowColor = palette().text().color(); + shadowColor.setAlphaF(SHADOWCOLOR_ALPHAF); + pixmapPainter.setBrush(shadowColor); + pixmapPainter.setPen(Qt::transparent); + pixmapPainter.drawPath(rectPath); + pixmapPainter.end(); + // 模糊这个黑底 + QImage img = pixmap.toImage(); + qt_blurImage(img, VAGUE_RADIUS, false, false); + // 挖掉中心 + pixmap = QPixmap::fromImage(img); + QPainter pixmapPainter2(&pixmap); + pixmapPainter2.setRenderHint(QPainter::Antialiasing); + pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); + pixmapPainter2.setPen(Qt::transparent); + pixmapPainter2.setBrush(Qt::transparent); + pixmapPainter2.drawPath(rectPath); + // 绘制阴影 + p.drawPixmap(editAlarmPage->rect(), pixmap, pixmap.rect()); + QStyleOption opt; + opt.init(editAlarmPage); + // 绘制一个背景 + p.save(); + //描边 + QColor borderColor = palette().text().color(); + borderColor.setAlphaF(BORDERCOLOR_ALPHAF); + p.setPen(borderColor); + p.translate(BORDER_RANGE, BORDER_RANGE); + p.setBrush(palette().color(QPalette::Base)); + p.drawPath(rectPath); + p.restore(); + }else{ + QPainter p(editAlarmPage); + p.setRenderHint(QPainter::Antialiasing); // 反锯齿; + QPainterPath rectPath; + rectPath.addRect(editAlarmPage->rect()); + p.fillPath(rectPath,palette().color(QPalette::Base)); + p.setBrush(palette().color(QPalette::Base)); + p.setPen(Qt::transparent); + p.drawPath(rectPath); } } @@ -3972,15 +4577,15 @@ void Clock::showPaint7() void Clock::updateTinyBtn() { QPixmap pixmap = QPixmap(":image/switchIconB.png"); - ui->tinyWindowBtn->setProperty("useButtonPalette", true); - ui->tinyWindowBtn->setIcon(pixmap); - ui->tinyWindowBtn->setIconSize(QSize(24,24)); - ui->tinyWindowBtn->setToolTip(tr("mini window")); + tinyWindowBtn->setProperty("useButtonPalette", true); + tinyWindowBtn->setIcon(pixmap); + tinyWindowBtn->setIconSize(QSize(24,24)); + tinyWindowBtn->setToolTip(tr("mini window")); // ui->tinyWindowBtn->setFlat(true); } void Clock::updateSwitchBtnStyle() { - int index=ui->mainWidget->currentIndex(); + int index=mainWidget->currentIndex(); if(index==1){ AlarmPageSwitch(); }else if(index==0){ @@ -3992,45 +4597,45 @@ void Clock::updateSwitchBtnStyle() //黑色主题 void Clock::blackStyle() { - ui->timeShowBig->setStyleSheet("color: rgba(255, 255, 255, 0.9);font-size:38px;"); + timeShowBig->setStyleSheet("color: rgba(255, 255, 255, 0.9);font-size:38px;"); // QString selfFont = Utils::loadFontFamilyFromTTF(); // QFont f(selfFont); QFont f; f.setFamily("NotoSansCJKsc-Regular"); f.setWeight(400); f.setPixelSize(38); - ui->timeShowBig->setFont(f); - ui->remainTime->setStyleSheet("color: rgba(255, 255, 255, 0.9)"); - ui->noAlarmIcon->setPixmap(QPixmap(":/image/noClockBlack.png")); - ui->noAlarm->setStyleSheet("color: rgba(255, 255, 255, 0.6);font-size:16px;"); + timeShowBig->setFont(f); + remainTime->setStyleSheet("color: rgba(255, 255, 255, 0.9)"); + noAlarmIcon->setPixmap(QPixmap(":/image/noClockBlack.png")); + noAlarm->setStyleSheet("color: rgba(255, 255, 255, 0.6);font-size:16px;"); - widgetListBlackStyle(ui->alarmListWidget); - widgetListBlackStyle(ui->timeListWidget); + widgetListBlackStyle(alarmListWidget); + widgetListBlackStyle(timeListWidget); QString itemRadius = QString::number(ITEM_RADIUS); // clockEditOnClockNew->clockNameLineEdit->setStyleSheet("QLineEdit{background-color:rgb(55, 55, 59);border-radius:"+itemRadius+"px;color: rgb(148, 148, 148);}"); - ui->tinyWindowBtn->setIcon(QIcon(":image/switchIconW.png")); + tinyWindowBtn->setIcon(QIcon(":image/switchIconW.png")); updateSwitchBtnStyle(); repeat_on_Pixmap=theme::changeIconColor(repeat_on_Pixmap,palette().highlightedText().color()); } //白色主题 void Clock::whiteStyle() { - ui->timeShowBig->setStyleSheet("color: rgba(49, 66, 89, 1);font-size:38px;"); + timeShowBig->setStyleSheet("color: rgba(49, 66, 89, 1);font-size:38px;"); // QString selfFont = Utils::loadFontFamilyFromTTF(); // QFont f(selfFont); QFont f; f.setFamily("NotoSansCJKsc-Regular"); f.setWeight(400); f.setPixelSize(38); - ui->timeShowBig->setFont(f); - ui->remainTime->setStyleSheet("color: rgba(49, 66, 89, 1)"); - ui->noAlarmIcon->setPixmap(QPixmap(":/image/noClockWhite.png")); - ui->noAlarm->setStyleSheet("color: rgba(49, 66, 89, 0.6);font-size:16px;"); - widgetListWhiteStyle(ui->alarmListWidget); - widgetListWhiteStyle(ui->timeListWidget); + timeShowBig->setFont(f); + remainTime->setStyleSheet("color: rgba(49, 66, 89, 1)"); + noAlarmIcon->setPixmap(QPixmap(":/image/noClockWhite.png")); + noAlarm->setStyleSheet("color: rgba(49, 66, 89, 0.6);font-size:16px;"); + widgetListWhiteStyle(alarmListWidget); + widgetListWhiteStyle(timeListWidget); QString itemRadius = QString::number(ITEM_RADIUS); // clockEditOnClockNew->clockNameLineEdit->setStyleSheet("QLineEdit{background-color:rgb(240, 240, 240);border-radius:"+itemRadius+"px;color: rgb(148, 148, 148);}"); - ui->tinyWindowBtn->setIcon(QIcon(":image/switchIconB.png")); + tinyWindowBtn->setIcon(QIcon(":image/switchIconB.png")); updateSwitchBtnStyle(); repeat_on_Pixmap = QPixmap(":/image/object-select-symbolic.png"); } diff --git a/clock.h b/clock.h index bedb3be..c9fdb0f 100644 --- a/clock.h +++ b/clock.h @@ -106,10 +106,12 @@ #include "gui_g.h" #include "verticalscrollapm.h" #include +#include #include #include #include "noticealarmpoolutil.h" #include "customcombox.h" +#include "countdownAnimation.h" class QDialog; class QSpinBox; @@ -136,6 +138,8 @@ public: explicit Clock(QWidget *parent = nullptr); ~Clock(); + void iniframe(bool tablet,bool rotations); + void inidata(); void paintEvent(QPaintEvent *event) override; void keyPressEvent(QKeyEvent * event) override; @@ -176,6 +180,8 @@ public: void selectRemindLate(); void countdownMusicSellect(); void alarmRepeat(); + QLabel *timeFormatOnTimeWheel; + protected: void paintEvent1(QPaintEvent *); void closeEvent(QCloseEvent *event) override; @@ -333,6 +339,42 @@ private slots: signals: void timeJump(qint64 timeValue); private: +private: + QWidget *switchWidget; + KPushButton *switchClock; + KPushButton *switchCountdown; + KPushButton *switchStopwatch; + QStackedWidget *mainWidget; + QWidget *countdownPage; + QStackedWidget *countdownStackedW; + QWidget *countdownSetPage; + Countdown_Animation *countdownRunPage; + QWidget *tinyWidget; + QPushButton *tinyWindowBtn; + QWidget *timeWidget; + QLabel *remainTime; + QWidget *alarmWidget; + QLabel *countdownAlarmIcon; + QLabel *countdownAlarmTime; + QWidget *btnWidget; + QPushButton *startCountdownBtn; + QPushButton *suspendCountdownBtn; + QWidget *alarmPage; + QPushButton *addAlarmBtn; + QListWidget *alarmListWidget; + QLabel *noAlarmIcon; + QLabel *noAlarm; + QWidget *stopwatchPage; + QPushButton *startStopwatch; + QLabel *timeShowSmall; + QLabel *timeShowBig; + QPushButton *ringBtn; + QListWidget *timeListWidget; + QWidget *addAlarmPage; + QWidget *editAlarmPage; + QPushButton *cancelbtnOnEditAlarm; + QPushButton *saveBtnOnEditAlarm; + bool comboxclickedflag; //多选下拉框是否点击过 QPoint m_startPoint; QTimer *timer = nullptr; @@ -346,6 +388,7 @@ private: int alarmMinute; int cPauseTime; bool isStarted; + bool runorsuspend;//记录倒计时页面,0初始状态或复位,1运行页面 QPushButton* muteBtn; QPushButton* closeTitleBtn; QPushButton* minmizeBtn; @@ -431,6 +474,10 @@ private: VerticalScroll_24 *timer_alarm_start24; VerticalScroll_60 *timer_alarm_start60; VerticalScroll_APM *timer_alarm_startAPM; + QLabel * h_in_m; + QLabel * m_in_s; + QLabel * after_s; + CustomComBox *dialog_repeat = nullptr; QComboBox *dialog_remind_late = nullptr; @@ -517,6 +564,9 @@ private: void updateCountdownSelectBtnStyle(Btn_new * temp,int moveWidth,int moveHeight); void updateClockSelectBtnLabel(QLabel * temp,int moveHeight,QString text); + void updateClockTimeRing(int ringWidthOffset,int ringHeightOffset); + void updateClockEditPageLabel(int selectHeight,int selectGap,int labelHeightOffset); + void updateClockEditPageBtn(int selectMoveWidth,int selectMoveHeight,int selectGap,int btnHeight); void widgetListWhiteStyle(QListWidget * listWidget); void widgetListBlackStyle(QListWidget * listWidget); QMediaPlayer * hisPlayer = nullptr; @@ -550,6 +600,8 @@ private: QTime musicStartTime; QObject *m_obj; void publishDbusNoticeShowAgain(); + bool closeflag = false; + bool iniRotationFlag = false; }; #endif // CLOCK_H diff --git a/clock.ui b/clock.ui index 8d79dab..39f3f90 100644 --- a/clock.ui +++ b/clock.ui @@ -37,623 +37,6 @@ 0 - - - - 0 - 106 - 398 - 465 - - - - - - - 3 - - - - - - 0 - 0 - 390 - 477 - - - - - - - 1 - - - - - - - 9 - 174 - 371 - 40 - - - - - - - - 24 - 24 - - - - - 24 - 24 - - - - - - - - - - - 24 - 24 - - - - - - - - - - 14 - 100 - 361 - 77 - - - - - - - font-size:40px; - - - 00:00:00 - - - - - - - - - 16 - 60 - 361 - 70 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 13 - 16 - - - - - 26 - 26 - - - - icon - - - - - - - - -1 - - - - color: rgb(176, 176, 176); -font-size:18px; - - - - - - PM - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 9 - 386 - 361 - 48 - - - - - - - - 120 - 34 - - - - - 120 - 16777215 - - - - - - - start - - - - - - - - 120 - 34 - - - - - 120 - 16777215 - - - - - - - suspend - - - - - - - - - - - - - 135 - 401 - 120 - 34 - - - - - 120 - 0 - - - - - - - add - - - - - - 25 - 0 - 356 - 354 - - - - - - - - - - 116 - 76 - 149 - 170 - - - - - - - Qt::AlignCenter - - - - - - 122 - 262 - 140 - 31 - - - - color: rgba(49, 66, 89, 0.6); -font-size:16px; - - - no alarm - - - Qt::AlignCenter - - - - - - - - 210 - 401 - 120 - 34 - - - - - 120 - 0 - - - - - - - start - - - - - - 90 - 55 - 210 - 41 - - - - color: rgb(176, 176, 176); -font: 19pt - - - - 00:00:00 - - - - - - 90 - 0 - 210 - 70 - - - - font: 30pt - - - 00:00:00 - - - - - - 65 - 401 - 120 - 34 - - - - - 120 - 0 - - - - - - - count - - - - - - 25 - 109 - 356 - 277 - - - - - - - - - - - - 0 - 0 - 390 - 477 - - - - - 16777215 - 16777215 - - - - - - - - - 65 - 412 - 120 - 34 - - - - - 120 - 0 - - - - - - - cancel - - - - - - 210 - 412 - 120 - 34 - - - - - 120 - 0 - - - - - - - save - - - - - - 60 - 80 - 41 - 22 - - - - - 0 - 0 - - - - - - - - - - - - - 0 - 48 - 398 - 58 - - - - - 0 - - - 0 - - - 9 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 40 - 40 - - - - - 40 - 40 - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 26 - 20 - - - - - - - - - 40 - 40 - - - - - 40 - 40 - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 26 - 20 - - - - - - - - - 40 - 40 - - - - - 40 - 40 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -672,23 +55,12 @@ font: 19pt - - Countdown_Animation - QWidget -
countdownAnimation.h
- 1 -
KWidget QWidget
kwidget.h
1
- - KPushButton - QPushButton -
kpushbutton.h
-
diff --git a/clock_conf.ini b/clock_conf.ini index 7a9ae05..e6f7dd4 100644 --- a/clock_conf.ini +++ b/clock_conf.ini @@ -1,2 +1,2 @@ [common] -version=3.1.4.0.0k0-0k1.1 +version=4.0.0.0-ok1 diff --git a/closeOrHide.cpp b/closeOrHide.cpp index 37e0292..2970bbf 100644 --- a/closeOrHide.cpp +++ b/closeOrHide.cpp @@ -16,7 +16,7 @@ * */ #include "closeOrHide.h" -#include "ui_closeOrHide.h" +//#include "ui_closeOrHide.h" #include "QDebug" #include #include "xatom-helper.h" @@ -27,79 +27,242 @@ extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); close_or_hide::close_or_hide(QWidget *parent) : - QDialog(parent), - ui(new Ui::close_or_hide) + QDialog(parent) { - ui->setupUi(this); - ui->surebtn->setText(""); - ui->cancelbtn->setText(""); +// ui->setupUi(this); + setupUi(this); + iniframe(); +// ui->surebtn->setText(""); +// ui->cancelbtn->setText(""); // this->setProperty("blurRegion", QRegion(QRect(1, 1, 1, 1))); // setAttribute(Qt::WA_TranslucentBackground); // this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog); - ui->backrunRadio->setChecked(1); + backrunRadio->setChecked(1); // 添加窗管协议 // XAtomHelper::setStandardWindowHint(this->winId()); // XAtomHelper::setStandardWindowRadius(this->winId(),WINDOWN_RADIUS); kdk::UkuiStyleHelper::self()->removeHeader(this); - ui->closeInfoLabel->setText(tr("Please select the state after closing:")); - ui->closeInfoLabel->setWordWrap(true); - ui->closeInfoLabel->setAlignment(Qt::AlignTop); + closeInfoLabel->setText(tr("Please select the state after closing:")); + closeInfoLabel->setWordWrap(true); + closeInfoLabel->setAlignment(Qt::AlignTop); //调色板 - QPalette palette = ui->surebtn->palette(); + QPalette palette = surebtn->palette(); palette.setColor(QPalette::Button,QColor(61,107,229,255)); palette.setBrush(QPalette::ButtonText, QBrush(Qt::white)); //保留按钮 - ui->surebtn->setPalette(palette); + surebtn->setPalette(palette); //退出按钮 - QPalette palette1 = ui->closebtn->palette(); + QPalette palette1 = closebtn->palette(); QColor ColorPlaceholderText1(255,255,255,0); QBrush brush; brush.setColor(ColorPlaceholderText1); palette.setBrush(QPalette::Button, brush); - ui->closebtn->setPalette(palette1); + closebtn->setPalette(palette1); + closebtn->setIcon(QIcon::fromTheme("window-close-symbolic")); + closebtn->setProperty("isWindowButton", 0x2); + closebtn->setProperty("useIconHighlightEffect", 0x8); + closebtn->setFlat(true); - ui->closebtn->setIcon(QIcon::fromTheme("window-close-symbolic")); - ui->closebtn->setProperty("isWindowButton", 0x2); - ui->closebtn->setProperty("useIconHighlightEffect", 0x8); - ui->closebtn->setFlat(true); // 主题框架1.0.6-5kylin2 //配置重要按钮 - ui->surebtn->setProperty("isImportant", true); - ui->cancelbtn->setProperty("useButtonPalette", true); + surebtn->setProperty("isImportant", true); + cancelbtn->setProperty("useButtonPalette", true); //关闭按钮去掉聚焦状态 - ui->closebtn->setFocusPolicy(Qt::NoFocus); - + closebtn->setFocusPolicy(Qt::NoFocus); //按钮文本居中显示,避免使用stylesheet,添加label于pushbutton上 QLabel *sureLabel = new QLabel(); sureLabel->setText(tr("sure")); sureLabel->adjustSize(); - QHBoxLayout *myLayout = new QHBoxLayout(ui->surebtn); + QHBoxLayout *myLayout = new QHBoxLayout(surebtn); myLayout->addWidget(sureLabel); myLayout->setContentsMargins(0,2,0,4); myLayout->setAlignment(Qt::AlignHCenter); - ui->surebtn->setLayout(myLayout); + surebtn->setLayout(myLayout); QLabel *cancelLabel = new QLabel(); cancelLabel->setText(tr("cancel")); cancelLabel->adjustSize(); - QHBoxLayout *myLayout1 = new QHBoxLayout(ui->cancelbtn); + QHBoxLayout *myLayout1 = new QHBoxLayout(cancelbtn); myLayout1->addWidget(cancelLabel); myLayout1->setContentsMargins(0,2,0,4); myLayout1->setAlignment(Qt::AlignHCenter); - ui->cancelbtn->setLayout(myLayout1); + cancelbtn->setLayout(myLayout1); - ui->questionIconLabel->setPixmap(QIcon::fromTheme("dialog-question").pixmap(24,24)); + questionIconLabel->setPixmap(QIcon::fromTheme("dialog-question").pixmap(24,24)); + connect(closebtn,SIGNAL(clicked()),this,SLOT(on_closebtn_clicked())); + connect(surebtn,SIGNAL(clicked()),this,SLOT(on_surebtn_clicked())); + connect(cancelbtn,SIGNAL(clicked()),this,SLOT(on_cancelbtn_clicked())); settingsStyle(); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + updatePosition(onTablet); } close_or_hide::~close_or_hide() { - delete ui; +// delete ui; +} + +void close_or_hide::setupUi(QDialog *close_or_hide) +{ + if (close_or_hide->objectName().isEmpty()) + close_or_hide->setObjectName(QString::fromUtf8("close_or_hide")); + close_or_hide->resize(350, 174); + retranslateUi(close_or_hide); + + QMetaObject::connectSlotsByName(close_or_hide); +} // setupUi + +void close_or_hide::retranslateUi(QDialog *close_or_hide) +{ + close_or_hide->setWindowTitle(QApplication::translate("close_or_hide", "Dialog", nullptr)); +} // retranslateUi + +void close_or_hide::iniframe() +{ + + widget = new QWidget(this); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(widget->sizePolicy().hasHeightForWidth()); + widget->setSizePolicy(sizePolicy); + + verticalLayoutWidget = new QWidget(widget); + + horizontalLayout = new QHBoxLayout(verticalLayoutWidget); + + closebtn = new QPushButton(verticalLayoutWidget); + + horizontalLayout->addWidget(closebtn); + + verticalLayoutWidget_2 = new QWidget(widget); + + horizontalLayout_2 = new QHBoxLayout(verticalLayoutWidget_2); + horizontalLayout_2->setSpacing(0); + horizontalLayout_2->setContentsMargins(0, 0, 0, 0); + horizontalSpacer = new QSpacerItem(57, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_2->addItem(horizontalSpacer); + + backrunRadio = new QRadioButton(verticalLayoutWidget_2); + QSizePolicy sizePolicy1(QSizePolicy::Maximum, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(backrunRadio->sizePolicy().hasHeightForWidth()); + backrunRadio->setSizePolicy(sizePolicy1); + QFont font; + font.setPointSize(11); + backrunRadio->setFont(font); + backrunRadio->setText(tr(" backstage")); + + horizontalLayout_2->addWidget(backrunRadio); + + horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_2->addItem(horizontalSpacer_3); + + exitRadio = new QRadioButton(verticalLayoutWidget_2); + sizePolicy1.setHeightForWidth(exitRadio->sizePolicy().hasHeightForWidth()); + exitRadio->setSizePolicy(sizePolicy1); + exitRadio->setMinimumSize(QSize(120, 0)); + exitRadio->setMaximumSize(QSize(120, 16777215)); + exitRadio->setFont(font); + exitRadio->setText(tr(" Exit program")); + + horizontalLayout_2->addWidget(exitRadio); + + horizontalSpacer_2 = new QSpacerItem(80, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_2->addItem(horizontalSpacer_2); + + widget_2 = new QWidget(widget); + QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(widget_2->sizePolicy().hasHeightForWidth()); + widget_2->setSizePolicy(sizePolicy2); + horizontalLayout_3 = new QHBoxLayout(widget_2); + horizontalLayout_3->setSpacing(0); + horizontalLayout_3->setContentsMargins(0, 0, 0, 0); + horizontalSpacer_4 = new QSpacerItem(156, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_4); + + cancelbtn = new QPushButton(widget_2); + cancelbtn->setFont(font); + + horizontalLayout_3->addWidget(cancelbtn); + + horizontalSpacer_5 = new QSpacerItem(10, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_5); + + surebtn = new QPushButton(widget_2); + surebtn->setFont(font); + + horizontalLayout_3->addWidget(surebtn); + + horizontalSpacer_6 = new QSpacerItem(24, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_6); + + widget_3 = new QWidget(widget); + + horizontalLayout_4 = new QHBoxLayout(widget_3); + horizontalLayout_4->setSpacing(0); + horizontalLayout_4->setContentsMargins(0, 0, 0, 0); + horizontalSpacer_7 = new QSpacerItem(24, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_4->addItem(horizontalSpacer_7); + + questionIconLabel = new QLabel(widget_3); + questionIconLabel->setFixedSize(24,24); + + horizontalLayout_4->addWidget(questionIconLabel, 0, Qt::AlignVCenter); + + closeInfoLabel = new QLabel(widget_3); + closeInfoLabel->setFont(font); + closeInfoLabel->setMargin(0); + + horizontalLayout_4->addWidget(closeInfoLabel, 0, Qt::AlignVCenter); +} + +void close_or_hide::updatePosition(bool onTablet) +{ + if(onTablet){ + this->setFixedSize(350,214); + widget->setGeometry(QRect(0, 0, 350, 214)); + verticalLayoutWidget->setGeometry(QRect(290, 0, 61, 57)); + horizontalLayout->setContentsMargins(5, 8, 8, 0); + closebtn->setFixedSize(48,48); + verticalLayoutWidget_2->setGeometry(QRect(0, 90, 351, 40)); + backrunRadio->setIconSize(QSize(16, 16)); + exitRadio->setIconSize(QSize(16, 16)); + widget_2->setGeometry(QRect(0, 138, 351, 60)); + horizontalSpacer_4->changeSize(150,20); + cancelbtn->setFixedSize(80,48); + surebtn->setFixedSize(80,48); + widget_3->setGeometry(QRect(0, 50, 351, 41)); + }else{ + this->setFixedSize(350,174); + widget->setGeometry(QRect(0, 0, 350, 174)); + verticalLayoutWidget->setGeometry(QRect(310, 0, 40, 36)); + horizontalLayout->setContentsMargins(5, 5, 5, 0); + closebtn->setFixedSize(30,30); + verticalLayoutWidget_2->setGeometry(QRect(0, 60, 351, 40)); + backrunRadio->setIconSize(QSize(14, 14)); + exitRadio->setIconSize(QSize(14, 14)); + widget_2->setGeometry(QRect(0, 120, 351, 31)); + horizontalSpacer_4->changeSize(156,20); + cancelbtn->setFixedSize(80,30); + surebtn->setFixedSize(80,30); + widget_3->setGeometry(QRect(0, 20, 351, 41)); + } } void close_or_hide::on_closebtn_clicked() @@ -110,7 +273,7 @@ void close_or_hide::on_closebtn_clicked() void close_or_hide::on_surebtn_clicked() { - if(ui->backrunRadio->isChecked()==true){ + if(backrunRadio->isChecked()==true){ this->hide(); close_flag = 1; }else{ @@ -128,8 +291,12 @@ void close_or_hide::settingsStyle() { GsettingSubject * subject = GsettingSubject::getInstance(); connect(subject,&GsettingSubject::iconChnaged, this,[=](){ - ui->questionIconLabel->setPixmap(QIcon::fromTheme("dialog-question").pixmap(24,24)); + questionIconLabel->setPixmap(QIcon::fromTheme("dialog-question").pixmap(24,24)); }); + connect(subject,&GsettingSubject::tabletModeChange, this,[=](bool currentTablet){ + updatePosition(currentTablet); + }); + subject->iniTabletMode(); } void close_or_hide::paintEvent(QPaintEvent *event) diff --git a/closeOrHide.h b/closeOrHide.h index 3d61ff8..cd18687 100644 --- a/closeOrHide.h +++ b/closeOrHide.h @@ -24,7 +24,9 @@ #include #include #include +#include #include +#include namespace Ui { class close_or_hide; @@ -37,6 +39,34 @@ class close_or_hide : public QDialog public: explicit close_or_hide(QWidget *parent = nullptr); ~close_or_hide(); + void setupUi(QDialog *close_or_hide); + void retranslateUi(QDialog *close_or_hide); + void iniframe(); + QWidget *widget; + QWidget *verticalLayoutWidget; + QHBoxLayout *horizontalLayout; + QPushButton *closebtn; + QWidget *verticalLayoutWidget_2; + QHBoxLayout *horizontalLayout_2; + QSpacerItem *horizontalSpacer; + QRadioButton *backrunRadio; + QSpacerItem *horizontalSpacer_3; + QRadioButton *exitRadio; + QSpacerItem *horizontalSpacer_2; + QWidget *widget_2; + QHBoxLayout *horizontalLayout_3; + QSpacerItem *horizontalSpacer_4; + QPushButton *cancelbtn; + QSpacerItem *horizontalSpacer_5; + QPushButton *surebtn; + QSpacerItem *horizontalSpacer_6; + QWidget *widget_3; + QHBoxLayout *horizontalLayout_4; + QSpacerItem *horizontalSpacer_7; + QLabel *questionIconLabel; + QLabel *closeInfoLabel; + + void updatePosition(bool onTablet); //绘制底部阴影 // Draw bottom shadow diff --git a/closeOrHide.ui b/closeOrHide.ui index cda792a..50f66e6 100644 --- a/closeOrHide.ui +++ b/closeOrHide.ui @@ -10,6 +10,18 @@ 174 + + + 350 + 174 + + + + + 350 + 174 + + Dialog diff --git a/commontooltip.cpp b/commontooltip.cpp index 41f0b16..9622d1c 100644 --- a/commontooltip.cpp +++ b/commontooltip.cpp @@ -24,7 +24,7 @@ CommonToolTip::CommonToolTip(QWidget *parent) : QDialog(parent) { - this->setFixedSize(155,50); +// this->setFixedSize(155,50); this->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明 this->setWindowFlags(Qt::FramelessWindowHint|Qt::ToolTip); //设置无边框窗口 setRoundStyle(); diff --git a/coreplayer/mmediaplayer.cpp b/coreplayer/mmediaplayer.cpp index 0dcc245..f68794f 100644 --- a/coreplayer/mmediaplayer.cpp +++ b/coreplayer/mmediaplayer.cpp @@ -114,6 +114,20 @@ void MMediaPlayer::pause() } } +void MMediaPlayer::pauseOnly() +{ + // 获得mpv播放器的"暂停"状态 + QString pasued = getProperty("pause"); + KyInfo() << "pauseStated = " << pasued; + + // 根据"暂停"状态来选择暂停还是播放 + if(pasued == "no") { + KyInfo() << "begin pause."; + setProperty("pause", "yes"); + changeState(PausedState); + } +} + void MMediaPlayer::stop() { setProperty("pause", "no"); diff --git a/coreplayer/mmediaplayer.h b/coreplayer/mmediaplayer.h index 6d404e4..ac4beef 100644 --- a/coreplayer/mmediaplayer.h +++ b/coreplayer/mmediaplayer.h @@ -35,6 +35,7 @@ public: void setPlaylist(MMediaPlaylist *playlist); //设置播放列表 void pause(); //暂停或继续 + void pauseOnly(); // 暂停 State state() const; //获取状态 qint64 position() const; //获取当前播放点 diff --git a/gsettingsubject.cpp b/gsettingsubject.cpp index ed18230..0d03d54 100644 --- a/gsettingsubject.cpp +++ b/gsettingsubject.cpp @@ -77,8 +77,11 @@ void GsettingSubject::iniConnection() if (m_statusManagerInterface->isValid()){ QObject::connect(m_statusManagerInterface, SIGNAL(mode_change_signal(bool)), this, SLOT(emitTabletModeChange(bool))); + QObject::connect(m_statusManagerInterface, SIGNAL(rotations_change_signal(QString)), + this, SLOT(emitTabletRotationChange(QString))); + QObject::connect(m_statusManagerInterface, SIGNAL(modemonitor_change_signal(bool)), + this, SLOT(emitTabletAutoRotationChange(bool))); } - } void GsettingSubject::iniData() @@ -118,6 +121,27 @@ bool GsettingSubject::getScreenSaveOn() const return m_screenSaveOn; } +bool GsettingSubject::getOnTablet() const +{ + return onTablet; +} + +bool GsettingSubject::getRotations() const +{ + return m_rotations; +} + +bool GsettingSubject::getAutoRotations() const +{ + return m_autoRotation; +} + +void GsettingSubject::setRotations(bool rotations) +{ + m_rotations = rotations; +} + + /** * @brief 初始化主题 */ @@ -160,7 +184,7 @@ void GsettingSubject::iniFontSize() void GsettingSubject::iniTabletMode() { if(m_statusManagerInterface==nullptr){ - qDebug()<<"dbq-空指针"; + qDebug()<<"zds-空指针"; }else{ if(m_statusManagerInterface->isValid()){ QDBusReply reply = m_statusManagerInterface->call("get_current_tabletmode"); @@ -174,6 +198,40 @@ void GsettingSubject::iniTabletMode() } } +void GsettingSubject::iniRotations() +{ + if(m_statusManagerInterface==nullptr){ + qDebug()<<"zds-空指针"; + }else{ + if(m_statusManagerInterface->isValid()){ + QDBusReply rotationReply = m_statusManagerInterface->call("get_current_rotation"); + if (rotationReply.isValid()){ + QString value = rotationReply.value(); + emitTabletRotationChange(value); + }else{ + qCritical() << "get_current_rotation called failed! 获取模式失败"; + } + } + } +} + +void GsettingSubject::iniAutoRotations() +{ + if(m_statusManagerInterface==nullptr){ + qDebug()<<"zds-空指针"; + }else{ + if(m_statusManagerInterface->isValid()){ + QDBusReply autoRotationReply = m_statusManagerInterface->call("get_auto_rotation"); + if (autoRotationReply.isValid()){ + bool value = autoRotationReply.value(); + emitTabletAutoRotationChange(value); + }else{ + qCritical() << "get_auto_rotation called failed! 获取模式失败"; + } + } + } +} + void GsettingSubject::iniMouseWheel() { if(m_mouseSettings!=nullptr){ @@ -221,9 +279,25 @@ void GsettingSubject::emitScreenSaveUnlock() void GsettingSubject::emitTabletModeChange(bool currentTablet) { - qDebug()<<"zds-emitTabletModeChange"; - onTablet = currentTablet; - emit tabletModeChange(currentTablet); + if(onTablet!=currentTablet){ + onTablet = currentTablet; + emit tabletModeChange(currentTablet); + } +} + +void GsettingSubject::emitTabletRotationChange(QString currentRotation) +{ + if(currentRotation == "left" ||currentRotation == "right"){ + m_rotations = true; + }else{ + m_rotations = false; + } + emit tabletRotationChange(m_rotations); +} + +void GsettingSubject::emitTabletAutoRotationChange(bool autoRotaiton) +{ + m_autoRotation = autoRotaiton; } GsettingSubject::~GsettingSubject() diff --git a/gsettingsubject.h b/gsettingsubject.h index 1435145..711e823 100644 --- a/gsettingsubject.h +++ b/gsettingsubject.h @@ -34,6 +34,8 @@ public: void iniTimeZone(); void iniFontSize(); void iniTabletMode(); + void iniRotations(); + void iniAutoRotations(); ~GsettingSubject(); GsettingSubject(const GsettingSubject&)=delete; GsettingSubject& operator=(const GsettingSubject&)=delete; @@ -44,7 +46,10 @@ public: void iniMouseWheel(); void iniScreenSaveState(); bool getScreenSaveOn() const; - bool onTablet = false; + bool getOnTablet() const; + bool getRotations() const; + bool getAutoRotations() const; + void setRotations(bool rotations); signals: void blackStyle(); void whiteStyle(); @@ -61,6 +66,8 @@ private slots: void emitScreenSaveLock(); void emitScreenSaveUnlock(); void emitTabletModeChange(bool currentTablet); + void emitTabletRotationChange(QString currentRotation); + void emitTabletAutoRotationChange(bool autoRotaiton); private: static void iniConnect(); void iniConnection(); @@ -72,6 +79,9 @@ private: QDBusInterface *m_screenSaveInterface = nullptr; QDBusInterface *m_screenSaveIface = nullptr; QDBusInterface *m_statusManagerInterface = nullptr; + bool onTablet = false; + bool m_rotations = false; + bool m_autoRotation = false; bool m_screenSaveOn = false; explicit GsettingSubject(QObject *parent = nullptr); void getWheelSpeed(); diff --git a/guide/en_US/image/2.png b/guide/en_US/image/2.png index 14f44c4..c16be5c 100644 Binary files a/guide/en_US/image/2.png and b/guide/en_US/image/2.png differ diff --git a/guide/en_US/image/countdown_set.png b/guide/en_US/image/countdown_set.png new file mode 100644 index 0000000..1afc293 Binary files /dev/null and b/guide/en_US/image/countdown_set.png differ diff --git a/guide/en_US/image/longest.png b/guide/en_US/image/longest.png new file mode 100644 index 0000000..18ecfd5 Binary files /dev/null and b/guide/en_US/image/longest.png differ diff --git a/guide/en_US/image/main.png b/guide/en_US/image/main.png new file mode 100644 index 0000000..7942e9a Binary files /dev/null and b/guide/en_US/image/main.png differ diff --git a/guide/en_US/image/menu.jpg b/guide/en_US/image/menu.jpg new file mode 100644 index 0000000..db4cbb1 Binary files /dev/null and b/guide/en_US/image/menu.jpg differ diff --git a/guide/en_US/image/mini.png b/guide/en_US/image/mini.png new file mode 100644 index 0000000..d0c6374 Binary files /dev/null and b/guide/en_US/image/mini.png differ diff --git a/guide/en_US/image/shortest.png b/guide/en_US/image/shortest.png new file mode 100644 index 0000000..9c0be79 Binary files /dev/null and b/guide/en_US/image/shortest.png differ diff --git a/guide/en_US/image/stopwatch.png b/guide/en_US/image/stopwatch.png new file mode 100644 index 0000000..aafbc80 Binary files /dev/null and b/guide/en_US/image/stopwatch.png differ diff --git a/guide/en_US/index.md b/guide/en_US/index.md index 3da3eb3..d08b73c 100644 --- a/guide/en_US/index.md +++ b/guide/en_US/index.md @@ -10,11 +10,44 @@ ![](image/1.png) -​ In the alarm clock interface, click **"add"** to add an alarm clock and set the time, alarm name, repeating day, ring tone and later reminder time. - -![](image/2.png) - ​ Click ![](image/mute.png) You can set alarm mute. ​ Click ![](image/menu.png) You can open the alarm menu bar. After selecting "setting" in the menu bar, a setting window will pop up. In the alarm menu bar, select **"help"** to automatically jump to the user's manual and view the operating instructions of the tool. Select **"about"** to view the current version information, and **"exit"** to close the application. +## Alarm + +​ In the alarm clock interface, click **"add"** to add an alarm clock and set the time, alarm name, repeating day, ring tone and later reminder time. + +![](image/2.png) + +​ Double-click the alarm clock to enter the editing alarm interface. Or right-click the alarm and select **"edit"** or **"delete"** the alarm. + +## Count Down + +​ In the countdown setting screen, you can set the time and bell. Time settings can scroll through the dial settings or double-click to enter the number settings. + +![](image/countdown_set.png) + +​ Click **"start"** to enter the countdown running interface, and the large scroll dial shows the estimated ringing time and remaining time. + +​ Click the mini window button ![](image/mini.png)to hide the alarm clock and show the mini window. + + In the mini window, click the Main Window button ![](image/main.png) to return to the alarm clock countdown running interface. + +​ Click **"suspend"** to pause the timer. + +​ Click **"End"** to end the timer and return to the countdown setting interface. + +## Watch + +​ The stopwatch can be timed and counted. + +​ ![](image/stopwatch.png) + +​ Click **"start"** to start the timer. + +​ Click **"count"** to record the counting and counting interval time, and the timing will not be interrupted. Labels ![](image/longest.png)![](image/shortest.png)indicate the longest and shortest interval records, respectively. + +​ Click **"suspend"** to record the final time. + +​ Click **"reset"** to clear the stopwatch. diff --git a/guide/zh_CN/image/2.png b/guide/zh_CN/image/2.png index ac33c47..f433cb5 100644 Binary files a/guide/zh_CN/image/2.png and b/guide/zh_CN/image/2.png differ diff --git a/guide/zh_CN/image/countdown_set.png b/guide/zh_CN/image/countdown_set.png new file mode 100644 index 0000000..d79cd1a Binary files /dev/null and b/guide/zh_CN/image/countdown_set.png differ diff --git a/guide/zh_CN/image/longest.png b/guide/zh_CN/image/longest.png new file mode 100644 index 0000000..f232555 Binary files /dev/null and b/guide/zh_CN/image/longest.png differ diff --git a/guide/zh_CN/image/main.png b/guide/zh_CN/image/main.png new file mode 100644 index 0000000..7942e9a Binary files /dev/null and b/guide/zh_CN/image/main.png differ diff --git a/guide/zh_CN/image/menu.jpg b/guide/zh_CN/image/menu.jpg new file mode 100644 index 0000000..db4cbb1 Binary files /dev/null and b/guide/zh_CN/image/menu.jpg differ diff --git a/guide/zh_CN/image/mini.png b/guide/zh_CN/image/mini.png new file mode 100644 index 0000000..d0c6374 Binary files /dev/null and b/guide/zh_CN/image/mini.png differ diff --git a/guide/zh_CN/image/shortest.png b/guide/zh_CN/image/shortest.png new file mode 100644 index 0000000..f0b6e31 Binary files /dev/null and b/guide/zh_CN/image/shortest.png differ diff --git a/guide/zh_CN/image/stopwatch.png b/guide/zh_CN/image/stopwatch.png new file mode 100644 index 0000000..5ef2675 Binary files /dev/null and b/guide/zh_CN/image/stopwatch.png differ diff --git a/guide/zh_CN/index.md b/guide/zh_CN/index.md index 7e14979..4f90b70 100644 --- a/guide/zh_CN/index.md +++ b/guide/zh_CN/index.md @@ -10,12 +10,46 @@ ![](image/1.png) -​ 在闹钟界面中,点击**“添加”**可添加闹钟,并设定时间、闹钟名、重复日、铃声及稍后提醒时间。 - -![](image/2.png) - ​ 点击导航栏中的![](image/mute.png)(静音按钮),可以设置静音。 ​ 点击导航栏中的![](image/menu.png)可打开闹钟菜单栏,选择**“帮助”**将自动跳转至用户手册中,可查看该工具的操作说明。选择**“关于”**可查看当前版本信息,选择**“退出”**可关闭应用。 + +## 闹钟 + +​ 在闹钟界面中,点击**“添加”**可添加闹钟,并设定时间、闹钟名、重复日、铃声及稍后提醒时间。 + +![](image/2.png) + +​ 双击闹钟,可进入编辑闹钟界面。或者右键点击闹钟,可选择**“编辑”**或者**“删除”**该闹钟。 + +## 倒计时 + +​ 在倒计时设置界面中,可设定时间和铃声。时间设定可滚动数字盘设置,也可以双击输入数字设定。 + +![](image/countdown_set.png) + +​ 点击**“开始”**进入倒计时运行界面,大滚动盘中显示预计响铃时间和剩余时间。 + +​ 点击迷你窗口按钮![](image/mini.png),隐藏闹钟应用,显示迷你窗口。 + +​ 在迷你窗口中,点击主窗口按钮![](image/main.png),可回到闹钟倒计时运行界面。 + +​ 点击**“暂停”**,计时暂停。 + +​ 点击**“结束”**,计时结束并回到倒计时设置界面。 + +## 秒表 + +​ 秒表可以计时和计次。 + + ![](image/stopwatch.png) + +​ 点击**“开始”**即开始计时。 + +​ 点击**“计次”**可记录计次、计次间隔时间,计时不中断。标签![](image/longest.png) ![](image/shortest.png)分别表示最长和最短的间隔时间记录。 + +​ 点击**“暂停”**可记录最终时间。 + +​ 点击**“复位”**,清除秒表。 \ No newline at end of file diff --git a/itemNew.cpp b/itemNew.cpp index 77b746e..6f623e5 100644 --- a/itemNew.cpp +++ b/itemNew.cpp @@ -26,22 +26,19 @@ item_new::item_new(QWidget *parent) : QWidget(parent) { setupUi(this); - this->setFixedSize(340, 108); +// this->setFixedSize(340, 108); m_selectBtnUtil = new SelectBtnUtil(); alarmLabel_w0 = new QLabel(this);//闹钟用途//Alarm function - alarmLabel_w0->move(27 ,6); alarmLabel_w0->setFixedSize(200, 25); alarmLabel_w0->setText("闹钟"); alarmLabel_s0 = new QLabel( this);//闹钟重复//Repetition of alarm clock - alarmLabel_s0->move(27, 74); alarmLabel_s0->setFixedSize(270, 23); alarmLabel_s0->setText("工作日"); alarmLabel_s0->setVisible(true); alarmLabel0 = new QLabel(this);//闹钟//Alarm clock -// alarmLabel0->move(25,24); alarmLabel0->setFixedSize(125, 56); alarmLabel0->setText("00:00"); alarmLabel0->setVisible(true); @@ -49,11 +46,10 @@ item_new::item_new(QWidget *parent) : alarmLabel1 = new QLabel(this);//上下午//Last afternoon // alarmLabel1->move(155,22); - alarmLabel1->setFixedSize(36, 56); +// alarmLabel1->setFixedSize(36, 56); QFont f; f.setPixelSize(18); alarmLabel1->setFont(f); -// alarmLabel1->setStyleSheet("font: 10pt;background-color: rgb();"); alarmLabel1->setText("上午"); alarmLabel1->setVisible(true); @@ -61,11 +57,13 @@ item_new::item_new(QWidget *parent) : updateLabelStyle(); alarm_on_off0 = new KSwitchButton(this);//闹钟开关// Alarm switch - alarm_on_off0->move(263,43); alarm_on_off0->setFixedSize(50,24); alarm_on_off0->setFlat(true); alarm_on_off0->setVisible(true); + settingsStyle(); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + updatePosition(onTablet); } item_new::~item_new() @@ -101,7 +99,11 @@ void item_new::settingsStyle() connect(subject,&GsettingSubject::whiteStyle, this,[=](){ this->whiteStyle(); }); + connect(subject,&GsettingSubject::tabletModeChange, this,[=](bool currentTablet){ + updatePosition(currentTablet); + }); subject->iniWidgetStyle(); + subject->iniTabletMode(); } @@ -169,15 +171,35 @@ void item_new::updateLabelStyle() QByteArray output = process.readAllStandardOutput(); QString str_output = output; if (str_output.compare("'24'\n") == 0) { - alarmLabel0->move(28,24); + alarmLabel0->move(25,50); alarmLabel1->move(134,30); } else { if(localeNum==1||localeNum==2){ - alarmLabel0->move(70,24); - alarmLabel1->move(28,30); + alarmLabel0->move(70,50); + alarmLabel1->move(28,56); }else{ - alarmLabel0->move(28,24); - alarmLabel1->move(134,30); + alarmLabel0->move(25,50); + alarmLabel1->move(134,56); } } } + +void item_new::updatePosition(bool onTbalet) +{ + if(onTbalet){ + this->setFixedSize(340, 160); + alarmLabel_w0->move(27 ,16); + alarmLabel_s0->move(27, 118); + alarmLabel_s0->move(27, 118); + alarmLabel0->move(25,52); + alarmLabel1->setFixedSize(36, 56); + alarm_on_off0->move(277,43); + }else{ + this->setFixedSize(340, 108); + alarmLabel_w0->move(27 ,6); + alarmLabel_s0->move(27, 74); + alarmLabel0->move(25,24); + alarmLabel1->move(155,22); + alarm_on_off0->move(263,43); + } +} diff --git a/itemNew.h b/itemNew.h index 760e385..5a8d829 100644 --- a/itemNew.h +++ b/itemNew.h @@ -84,6 +84,7 @@ private: bool m_itemClose = false; SelectBtnUtil * m_selectBtnUtil = nullptr; void updateLabelStyle(); + void updatePosition(bool onTbalet); }; #endif // ITEM_NEW_H diff --git a/noticeAlarm.cpp b/noticeAlarm.cpp index 4a4cf5d..feb48f4 100644 --- a/noticeAlarm.cpp +++ b/noticeAlarm.cpp @@ -32,6 +32,7 @@ #include #include #include "theme.h" +#include extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); /** @@ -43,32 +44,16 @@ extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int tran */ Natice_alarm::Natice_alarm(int close_time, int num, QWidget *parent , QString clockId) : QWidget(parent), - ui(new Ui::Natice_alarm), timer_value(close_time), num_flag(num), m_clockId(clockId) { - ui->setupUi(this); m_musicPlayer = new MMediaPlayer(this); m_playList = new MMediaPlaylist(m_musicPlayer); m_playList->setPlaybackMode(MMediaPlaylist::CurrentItemInLoop); m_selectBtnUtil = new SelectBtnUtil(); - //响铃提示 - this->setWindowTitle(tr("Ring prompt")); - this->setWindowIcon(QIcon::fromTheme("kylin-alarm-clock")); - //多少秒后自动关闭 - ui->autoCloseTime->setAlignment(Qt::AlignRight); - QPalette pa; - pa.setColor(QPalette::WindowText,Qt::gray); - ui->autoCloseTime->setPalette(pa); - - //this->setProperty("blurRegion", QRegion(QRect(1, 1, 1, 1))); //保存一个多少秒后关闭,用于稍后提醒的显式 timer_value2 = timer_value; - //右上角关闭 - connect(ui->closeTitleBtn, SIGNAL(clicked()), this, SLOT(set_dialog_close()) ); - //稍后提醒 - connect(ui->remindLateBtn, SIGNAL(clicked()), this, SLOT(show_again()) ); //进行 剩余秒数显示 的定时 timer = new QTimer(); //剩余秒 减1 @@ -81,107 +66,26 @@ Natice_alarm::Natice_alarm(int close_time, int num, QWidget *parent , QString cl timer_xumhuan->setInterval(1000); model_clock = clock_sql::getClockTable(this); natice_init(); - QPalette palette1 = ui->closeTitleBtn->palette(); - QColor ColorPlaceholderText1(255,255,255,0); - QBrush brush; - brush.setColor(ColorPlaceholderText1); - ui->closeTitleBtn->setPalette(palette1); - - ui->closeTitleBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); - ui->closeTitleBtn->setProperty("isWindowButton", 0x2); - ui->closeTitleBtn->setProperty("useIconHighlightEffect", 0x8); - ui->closeTitleBtn->setFlat(true); - //启用主题框架不需要代码 - ui->titleIcon->setPixmap(QIcon::fromTheme("kylin-alarm-clock").pixmap(24,24)); - // 主题框架1.0.6-5kylin2 - - //配置重要按钮 关闭 - ui->remindLateBtn->setProperty("isImportant", true); - ui->closeTitleBtn->setFocusPolicy(Qt::NoFocus); //数据库 model_setup = clock_sql::getSetupTable(this); //倒计时初始化无稍后提醒 if(num_flag < 0){ hideRemindBtn(); } - settingsStyle(); - //初始化锁屏dbus客户端 - m_screenSaveIface = new QDBusInterface(SSWND_DBUS_SERVICE, - SSWND_DBUS_PATH, - SSWND_DBUS_INTERFACE); - //初始化使用不锁屏 - this->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明 - installEventFilter(this); -// this->setWindowFlags(Qt::FramelessWindowHint|Qt::ToolTip); //设置无边框窗口 -// this->setAttribute(Qt::WA_AlwaysShowToolTips); - Qt::WindowFlags m_flags = windowFlags(); - this->setWindowFlags(m_flags | Qt::WindowStaysOnTopHint); -// 添加窗管协议 -// XAtomHelper::setStandardWindowHint(this->winId()); - kdk::UkuiStyleHelper::self()->removeHeader(this); - m_primaryManager = new PrimaryManager(); + //随机一个id + m_utilptr = new Utils(); + m_noticeId = m_utilptr->getRandomId().toUInt(); +// m_noticeId = 1; } -void Natice_alarm::settingsStyle() -{ - GsettingSubject * subject = GsettingSubject::getInstance(); - connect(subject,&GsettingSubject::fontChanged, this,[=](int size){ - this->CURRENT_FONT_SIZE=size; - this->updateFront(size); - }); - connect(subject,&GsettingSubject::iconChnaged, this,[=](){ - ui->titleIcon->setPixmap(QIcon::fromTheme("kylin-alarm-clock").pixmap(24,24)); - }); - subject->iniFontSize(); - //锁屏绑定screenSaveStyle - connect(subject,&GsettingSubject::screenSaveLock, this,[=](){ - this->m_screenSaveOn = true; - screenSaveStyle(); - }); - connect(subject,&GsettingSubject::screenSaveUnlock, this,[=](){ - this->m_screenSaveOn = false; - screenSaveStyle(); - }); - subject->iniScreenSaveState(); -} - -void Natice_alarm::updateFront(int size) -{ - double font = 1.15; - int pointSize = round(font*size); - updateLabelFront(ui->titleLabel,pointSize); - updateLabelFront(ui->timeEndInfo,pointSize); - updateLabelFront(ui->autoCloseTime,pointSize); - QFont tempFont; - tempFont.setPixelSize(pointSize); - ui->remindLateBtn->setFont(tempFont); - //稍后提醒按钮最大号字体省略 - QString remindbtninfo = tr("Remind later"); - if(size >= 14){ - ui->remindLateBtn->setToolTip(remindbtninfo); - int limitsize = 8; - if(remindbtninfo.length() > limitsize){ - remindbtninfo = remindbtninfo.left(limitsize); - remindbtninfo = remindbtninfo+"..."; - } - } - ui->remindLateBtn->setText(remindbtninfo); -} -void Natice_alarm::updateLabelFront(QLabel *label, int size) -{ - QString styleSheet = "font-size:"; - styleSheet.append(QString::number(size)).append("px;"); - label->setStyleSheet(styleSheet); -} Natice_alarm::~Natice_alarm() { delete timer; delete timer_xumhuan; - delete ui; } /** * @brief 初始化铃声 @@ -202,15 +106,8 @@ void Natice_alarm::natice_init() info = info.append(Utils::changeNumToStr(model_clock->index(num_flag, 1).data().toInt())); info = info.append(" "); QString clockName = model_clock->index(num_flag, 13).data().toString(); - int sizeLimit = 3; - if(clockName.length()>sizeLimit){ - //名字超长 - ui->timeEndInfo->setToolTip(info+clockName); - clockName = clockName.left(sizeLimit); - clockName = clockName+"..."; - } info = info.append(clockName); - ui->timeEndInfo->setText(info); + m_timeEndInfo=info; //稍后提醒逻辑 QString remindLate = model_clock->index(num_flag, 15).data().toString(); if(remindLate=="none"||remindLate==tr("none")){ @@ -220,14 +117,100 @@ void Natice_alarm::natice_init() } } else { //倒计时 - ui->timeEndInfo->setText(tr("Time out")+"!"); + m_timeEndInfo=tr("Time out")+"!"; + } + m_autoCloseTime=(QString::number(timer_value)+tr(" Seconds to close")); +} + + + +void Natice_alarm::callNotice() +{ + QDBusInterface iface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", + QDBusConnection::sessionBus()); + QList args; + QStringList actions; + if(!m_hideRemindLate){ + actions.append("noticeShowAgain"); //按钮动作 + actions.append(QString(tr("Remind later"))); //按钮名称 + } + m_noticeInfo = m_timeEndInfo+" "+m_autoCloseTime; + qDebug()<<"dbq-m_noticeInfo"< hints; + args<select(); + int muteOn = model_setup->index(0, 0).data().toInt(); + if(m_noticeId == 0){ + if(m_musicPlayer->state() != MMediaPlayer::State::StoppedState){ + m_musicPlayer->stop(); + } + }else{ + if(muteOn){ + if(m_musicPlayer->state() == MMediaPlayer::State::PlayingState){ + m_musicPlayer->pause(); + } + }else{ + if(m_musicPlayer->state() != MMediaPlayer::State::PlayingState){ + m_musicPlayer->play(); + } + } + } +} +void Natice_alarm::StopSendnotify(uint id, uint closeReson) +{ + qDebug()<<"dbq-id"< args; + args<stop(); +} + //重新加载最新音乐 void Natice_alarm::refreshMusic() { @@ -255,151 +238,44 @@ void Natice_alarm::refreshMusic() m_musicPlayer->play(); m_musicPlayer->pause(); }else{ - m_musicPlayer->setVolume( 100 ); - m_musicPlayer->play(); + if(m_noticeId == 0){ + m_musicPlayer->stop(); + }else{ + m_musicPlayer->setVolume( 100 ); + m_musicPlayer->play(); + } } } } void Natice_alarm::hideRemindBtn() { - ui->widget_3->hide(); - this->setFixedSize(288,90); - + m_hideRemindLate = true; } void Natice_alarm::showRemindBtn() { - ui->widget_3->show(); - this->setFixedSize(288,120); + m_hideRemindLate = false; } void Natice_alarm::playMusic() { timer_value = timer_value2; m_musicPlayer->setVolume(100); + alarmAction(); +} + +void Natice_alarm::alarmAction() +{ timer->start(); + callNotice(); refreshMusic(); } -void Natice_alarm::showThisWindow() -{ - kdk::UkuiStyleHelper::self()->removeHeader(this); - this->show(); - m_primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,this,1); -} -void Natice_alarm::screenSaveStyle() -{ - if(this->isVisible()){ - this->hide(); - qDebug()<<"dbq-m_screenSaveOn"<setWindowFlags(Qt::FramelessWindowHint|Qt::ToolTip); //设置无边框窗口 - this->setAttribute(Qt::WA_AlwaysShowToolTips); - //圆角 - QBitmap bmp(this->size()); - bmp.fill(); - QPainter p(&bmp); - p.setRenderHint(QPainter::Antialiasing); // 反锯齿; - p.setPen(Qt::NoPen); - p.setBrush(palette().color(QPalette::Base)); - p.drawRoundedRect(bmp.rect(),WINDOWN_RADIUS,WINDOWN_RADIUS); - setMask(bmp); - - QThread::sleep(1); - m_screenSaveIface = new QDBusInterface(SSWND_DBUS_SERVICE, - SSWND_DBUS_PATH, - SSWND_DBUS_INTERFACE); - if ( m_screenSaveIface&& m_screenSaveIface->isValid()) { - QDBusReply reply = m_screenSaveIface->call("RegisteSubWnd", this->winId()); - if(reply.isValid()) { - qDebug() << "Result :"<setWindowFlags(m_flags | Qt::WindowStaysOnTopHint); -// 添加窗管协议 -// XAtomHelper::setStandardWindowHint(this->winId()); - kdk::UkuiStyleHelper::self()->removeHeader(this); - } - update(); - this->showThisWindow(); - } - -} - -bool Natice_alarm::eventFilter(QObject *obj, QEvent *e) -{ - switch (e->type()) { - case QEvent::MouseButtonPress: { - QMouseEvent *event = static_cast(e); - - if (event->button() == Qt::LeftButton) { - QWidget *w = qobject_cast(obj); - if (w->cursor().shape() != Qt::ArrowCursor) - return false; - mousePressEvent(event); - return false; - } - return false; - } - case QEvent::MouseMove: { - QMouseEvent *event = static_cast(e); - if (qAbs(event->pos().x() - dragPosition.x()) < 2 || - qAbs(event->pos().y() - dragPosition.y()) < 2) { - return true; - } - //move request - mouseMoveEvent( event); - return false; - } - case QEvent::MouseButtonRelease: { - QMouseEvent *event = static_cast(e); - mouseReleaseEvent( event); - return false; - } - case QEvent::Move: { - return false; - } - default: - return false; - } -} -void Natice_alarm::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) { - this->dragPosition = event->globalPos() - frameGeometry().topLeft(); - this->mousePressed = true; - } - QWidget::mousePressEvent(event); -} - -void Natice_alarm::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) { - this->mousePressed = false; - } - this->setCursor(Qt::ArrowCursor); - QWidget::mouseReleaseEvent(event); -} - -void Natice_alarm::mouseMoveEvent(QMouseEvent *event) -{ - - if (this->mousePressed) { - move(event->globalPos() - this->dragPosition); - this->setCursor(Qt::ClosedHandCursor); - } - QWidget::mouseMoveEvent(event); -} + + //窗口关闭 /** @@ -413,12 +289,6 @@ void Natice_alarm::set_dialog_close() { timer->stop(); m_musicPlayer->stop(); - if(num_flag >= 0) - { - this->close(); - }else{ //倒计时的隐藏不关闭 - this->hide(); - } } //关闭音乐 /** @@ -431,77 +301,20 @@ void Natice_alarm::set_dialog_close() void Natice_alarm::close_music() { if (timer_value == 0) { + closeNotice(); set_dialog_close(); - } - timer_value--; - ui->autoCloseTime->setText(QString::number(timer_value)+tr(" Seconds to close")); -} -//绘制背景 -// Draw background -void Natice_alarm::paintEvent(QPaintEvent *event) -{ - if(m_screenSaveOn){ - Q_UNUSED(event); - QPainter p(this); - p.setRenderHint(QPainter::Antialiasing); - QPainterPath rectPath; - int SHADOW_RANGE = 1; - rectPath.addRoundedRect(this->rect().adjusted(SHADOW_RANGE, SHADOW_RANGE, -SHADOW_RANGE, -SHADOW_RANGE), WINDOWN_RADIUS, WINDOWN_RADIUS); - // 画一个黑底 - - QPixmap pixmap(this->rect().size()); - pixmap.fill(Qt::transparent); - QPainter pixmapPainter(&pixmap); - pixmapPainter.setRenderHint(QPainter::Antialiasing); - auto shadowColor = palette().text().color(); - shadowColor.setAlphaF(SHADOWCOLOR_ALPHAF); - pixmapPainter.setBrush(shadowColor); - pixmapPainter.setPen(Qt::transparent); - pixmapPainter.drawPath(rectPath); - pixmapPainter.end(); - // 模糊这个黑底 - QImage img = pixmap.toImage(); - qt_blurImage(img, VAGUE_RADIUS, false, false); - // 挖掉中心 - pixmap = QPixmap::fromImage(img); - QPainter pixmapPainter2(&pixmap); - pixmapPainter2.setRenderHint(QPainter::Antialiasing); - pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear); - pixmapPainter2.setPen(Qt::transparent); - pixmapPainter2.setBrush(Qt::transparent); - pixmapPainter2.drawPath(rectPath); - // 绘制阴影 - p.drawPixmap(this->rect(), pixmap, pixmap.rect()); - QStyleOption opt; - opt.init(this); - // 绘制一个背景 - p.save(); - - //描边 - QColor borderColor = palette().text().color(); - borderColor.setAlphaF(BORDERCOLOR_ALPHAF); - p.setPen(borderColor); - p.translate(BORDER_RANGE, BORDER_RANGE); - p.setBrush(palette().color(QPalette::Base)); - p.drawPath(rectPath); - p.restore(); }else{ - QPainter p(this); - p.setRenderHint(QPainter::Antialiasing); // 反锯齿; - QPainterPath rectPath; - rectPath.addRect(this->rect()); - p.fillPath(rectPath,palette().color(QPalette::Base)); - p.setBrush(palette().color(QPalette::Base)); - p.setPen(Qt::transparent); - p.drawPath(rectPath); + timer_value--; + m_autoCloseTime=(QString::number(timer_value)+tr(" Seconds to close")); + callNotice(); } } + //再次弹出 //Eject again void Natice_alarm::show_again() { - this->hide(); //刷新数据 model_setup->select(); QString info = model_clock->index(num_flag, 15).data().toString(); @@ -521,6 +334,7 @@ void Natice_alarm::show_again() timer_xumhuan->start(); timer->stop(); m_musicPlayer->stop(); + closeNotice(); } int Natice_alarm::getRemindStatusByName(QString name) @@ -541,6 +355,16 @@ int Natice_alarm::getRemindStatusByName(QString name) } return status; } + +uint Natice_alarm::getNoticeId() const +{ + return m_noticeId; +} + +void Natice_alarm::setNoticeId(const uint ¬iceId) +{ + m_noticeId = noticeId; +} //响铃 //Ring a bell 每一秒减一 void Natice_alarm::ring() @@ -552,19 +376,13 @@ void Natice_alarm::ring() bool result = ClockEntityDao::checkClockExist(m_clockId); if(result){ natice_init(); - this->showThisWindow(); - screenSaveStyle(); - timer->start(); - refreshMusic(); + alarmAction(); }else{ qDebug()<<"dbq-闹钟被删-啥也不做"; } }else{ natice_init(); - this->showThisWindow(); - screenSaveStyle(); - timer->start(); - refreshMusic(); + alarmAction(); } } @@ -574,16 +392,8 @@ void Natice_alarm::ring() -void Natice_alarm::closeEvent(QCloseEvent *event) -{ - timer->stop(); - m_musicPlayer->stop(); - if(num_flag >= 0) - { - event->accept();//接受 - this->close(); - }else{ - event->ignore();//忽视 - this->hide(); - } -} + + + + + diff --git a/noticeAlarm.h b/noticeAlarm.h index 251b3da..56cf7c1 100644 --- a/noticeAlarm.h +++ b/noticeAlarm.h @@ -34,6 +34,7 @@ #include "coreplayer/playcontroller.h" #include #include "primarymanager.h" +#include "utils.h" namespace Ui { class Natice_alarm; } @@ -47,68 +48,61 @@ class Natice_alarm : public QWidget public: explicit Natice_alarm( int close_time, int num,QWidget *parent = nullptr,QString clockId = nullptr); ~Natice_alarm(); - Ui::Natice_alarm *ui; - - //bool eventFilter(QObject *watched, QEvent *event); - void showPaint(); - void closeEvent(QCloseEvent *event) override; - QTimer *timer = nullptr; QTimer *timer_xumhuan = nullptr; -// QMediaPlayer *music; MMediaPlayer* m_musicPlayer = nullptr; MMediaPlaylist* m_playList = nullptr; int timer_value; - void refreshMusic(); void hideRemindBtn(); void showRemindBtn(); void playMusic(); - void screenSaveStyle(); - bool eventFilter(QObject *obj, QEvent *e) override; - void mousePressEvent(QMouseEvent *event) override; - void mouseReleaseEvent(QMouseEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; + void alarmAction(); + //再次弹出 Eject again + void show_again(); - void showThisWindow(); + uint getNoticeId() const; + void setNoticeId(const uint ¬iceId); + enum ClosedReason { + TimeOut = 1, + ClosedByUser = 2, + ClosedByApp = 3, + Undefined = 4, + HandledByUser = 20 + }; + + void closeNotice(); + uint m_noticeId = 0; protected: - //绘制背景 - // Draw background - void paintEvent(QPaintEvent *) override; -public slots: - //再次弹出 Eject again - void show_again(); + private slots: - //窗口关闭 window closing - void set_dialog_close(); + //窗口关闭 window closing + void set_dialog_close(); //关闭音乐 Turn off music void close_music(); //响铃 Ring a bell void ring(); + void StopSendnotify(uint id, uint closeReson); + void showAgainnotify(uint id, QString actionKey); private: void natice_init(); - void closeMusic(); - + void callNotice(); int num_flag; -// QMediaPlaylist *playlist; int ring_num; int timer_value2; int full_flag=1; - PrimaryManager * m_primaryManager = nullptr; QSqlTableModel *model_setup; - QPoint dragPosition; //拖动坐标 - bool mousePressed; //鼠标是否按下 QString m_clockId; QSqlTableModel *model_clock; SelectBtnUtil * m_selectBtnUtil = nullptr; - int CURRENT_FONT_SIZE; - bool m_screenSaveOn = false; - QDBusInterface *m_screenSaveIface = nullptr; int getRemindStatusByName(QString name); - void settingsStyle(); - void updateFront(int size); - void updateLabelFront(QLabel *label, int size); +// uint m_noticeId = 0; + QString m_timeEndInfo; + QString m_autoCloseTime; + QString m_noticeInfo; + bool m_hideRemindLate = true; + Utils * m_utilptr = nullptr; }; #endif // NATICE_ALARM_H diff --git a/qroundProgressBar.cpp b/qroundProgressBar.cpp index 3a7f848..b4ae66a 100644 --- a/qroundProgressBar.cpp +++ b/qroundProgressBar.cpp @@ -164,14 +164,27 @@ void QRoundProgressBar::paintEvent(QPaintEvent* /*event*/) painter.setBrush(mainColor); //在指定的boundingRectangle中创建一个椭圆,并将其作为封闭的子路径添加到painter路径。 QPainterPath bigCircle; - bigCircle.addEllipse(65, 13, 266, 266); + int px = 0; + int py = 0; + int ra = 266; + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + if(onTablet){ + px = 147; + py = 147; + ra = 560; + }else{ + px = 0; + py = 0; + ra = 266; + } + bigCircle.addEllipse(65, 13, ra, ra); QPainterPath path = bigCircle ; painter.drawPath(path); //保存当前的画家状态(将状态推送到堆栈上)。 在save()之后必须有一个相应的restore(); end()函数展开堆栈。 painter.restore(); - double outerRadius = 133; - QRectF baseRect(198 - outerRadius, 146 - outerRadius, outerRadius * 2, outerRadius * 2); + double outerRadius = ra/2; + QRectF baseRect(198+px - outerRadius, 146+py - outerRadius, outerRadius * 2, outerRadius * 2); QPainter p(this); //表示引擎应尽可能对图元的边缘进行抗锯齿。 p.setRenderHint(QPainter::Antialiasing); @@ -179,9 +192,8 @@ void QRoundProgressBar::paintEvent(QPaintEvent* /*event*/) rebuildDataBrushIfNeeded(); // background drawBackground(p, rect()); - double innerRadius = 133; - QRectF innerRect = QRectF((198 - outerRadius) + 5, (146 - outerRadius) + 5, (outerRadius - 5) * 2 , (outerRadius - 5) * 2 ); - + double innerRadius = ra/2; + QRectF innerRect = QRectF((198+px - outerRadius) + 5, (146+py - outerRadius) + 5, (outerRadius - 5) * 2 , (outerRadius - 5) * 2 ); //calculateInnerRect(baseRect, outerRadius, innerRect, innerRadius); double arcStep = 360.0 / (m_max - m_min) * m_value; // base circle diff --git a/stopwatchItem.cpp b/stopwatchItem.cpp index 215fd4b..22f7c0a 100644 --- a/stopwatchItem.cpp +++ b/stopwatchItem.cpp @@ -23,21 +23,18 @@ stopwatch_item::stopwatch_item(QWidget *parent) : QWidget(parent) { setupUi(this); - this->setFixedSize(356, 58); +// this->setFixedSize(356, 58); stopwatch1 = new QLabel(this);//计次 - stopwatch1->move(13, 11); stopwatch1->setFixedSize(100, 17); stopwatch1->setText("计次"); stopwatch2 = new QLabel( this);//间隔 - stopwatch2->move(13, 32); stopwatch2->setFixedSize(138, 19); stopwatch2->setText("工作日"); stopwatch2->setVisible(true); stopwatch3 = new QLabel(this);//记次时间 - stopwatch3->move(183,13); stopwatch3->setFixedSize(145, 54); stopwatch3->setStyleSheet("font-size:24px;"); stopwatch3->setAlignment(Qt::AlignRight); @@ -45,13 +42,14 @@ stopwatch_item::stopwatch_item(QWidget *parent) : stopwatch3->setVisible(true); tipLabel = new QLabel(this);//最长最短标记 - tipLabel->move(150,30); tipLabel->setFixedSize(32, 20); tipLabel->setAlignment(Qt::AlignCenter); tipLabel->setText(tr("max")); tipLabel->hide(); settingsStyle(); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + updatePosition(onTablet); } stopwatch_item::~stopwatch_item() @@ -86,7 +84,11 @@ void stopwatch_item::settingsStyle() connect(subject,&GsettingSubject::whiteStyle, this,[=](){ this->whiteStyle(); }); + connect(subject,&GsettingSubject::tabletModeChange, this,[=](bool currentTablet){ + updatePosition(currentTablet); + }); subject->iniWidgetStyle(); + subject->iniTabletMode(); } //黑色主题 @@ -125,4 +127,21 @@ void stopwatch_item::updateTipShortestStyle() tipLabel->show(); } +void stopwatch_item::updatePosition(bool onTbalet) +{ + if(onTbalet){ + this->setFixedSize(640, 58); + stopwatch1->move(13, 17); + stopwatch2->move(100, 17); + stopwatch3->move(463,13); + tipLabel->move(214,30); + }else{ + this->setFixedSize(356, 58); + stopwatch1->move(13, 11); + stopwatch2->move(13, 32); + stopwatch3->move(183,13); + tipLabel->move(150,30); + } +} + diff --git a/stopwatchItem.h b/stopwatchItem.h index 1c41a35..28f31f1 100644 --- a/stopwatchItem.h +++ b/stopwatchItem.h @@ -54,6 +54,7 @@ public: private: Ui::stopwatch_item *ui; + void updatePosition(bool onTbalet); }; #endif // STOPWATCH_ITEM_H diff --git a/tinycountdown.cpp b/tinycountdown.cpp index 91fb8c9..7a026bc 100644 --- a/tinycountdown.cpp +++ b/tinycountdown.cpp @@ -16,34 +16,51 @@ * */ #include "tinycountdown.h" -#include "ui_tinycountdown.h" +//#include "ui_tinycountdown.h" #include "theme.h" #include #include "utils.h" extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); tinyCountdown::tinyCountdown(QWidget *parent) : - QWidget(parent), - ui(new Ui::tinyCountdown) + QWidget(parent) { - ui->setupUi(this); + setupUi(this); + + clockIcon = new QLabel(this); + clockIcon->setFixedSize(24,24); + + timeLabel = new QLabel(this); + timeLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); + + suspendRunBtn = new RoundBtn(this); + suspendRunBtn->setEnabled(true); + + finishBtn = new RoundBtn(this); + finishBtn->setEnabled(true); + + mainBtn = new QPushButton(this); + mainBtn->setEnabled(true); + + closeBtn = new QPushButton(this); //右上角关闭 closeStyle(); switchStyle(); suspendRunBtnStyle(); finishBtnStyle(); - connect(ui->closeBtn, SIGNAL(clicked()), this, SLOT(set_dialog_close()) ); + connect(closeBtn, SIGNAL(clicked()), this, SLOT(set_dialog_close()) ); //左上闹钟图标 - ui->clockIcon->setPixmap(QIcon::fromTheme("kylin-alarm-clock").pixmap(24,24)); + clockIcon->setPixmap(QIcon::fromTheme("kylin-alarm-clock").pixmap(24,24)); //闹钟时间字体改为灰色 QPalette pa; pa.setColor(QPalette::WindowText,Qt::gray); //主窗口connect - connect(ui->mainBtn, SIGNAL(clicked()), this, SLOT(showMainWindow()) ); + connect(mainBtn, SIGNAL(clicked()), this, SLOT(showMainWindow()) ); //显示,但不可移动 settingsStyle(); - updateWidgetRadius(); - + updateWidgetRadius(); + bool onTablet = GsettingSubject::getInstance()->getOnTablet(); + updatePosition(onTablet); } @@ -84,15 +101,32 @@ void tinyCountdown::showThisWindow() tinyCountdown::~tinyCountdown() { - delete ui; +// delete ui; } + +void tinyCountdown::setupUi(QWidget *tinyCountdown) +{ + if (tinyCountdown->objectName().isEmpty()) + tinyCountdown->setObjectName(QString::fromUtf8("tinyCountdown")); + tinyCountdown->resize(320, 50); + + retranslateUi(tinyCountdown); + + QMetaObject::connectSlotsByName(tinyCountdown); +}// setupUi + +void tinyCountdown::retranslateUi(QWidget *tinyCountdown) +{ + tinyCountdown->setWindowTitle(QApplication::translate("tinyCountdown", "Form", nullptr)); +} // retranslateUi + /** * @brief 显示倒计时时间 */ void tinyCountdown::updateTimeInfo(QString str) { - ui->timeLabel->setText(str); - ui->timeLabel->setAlignment(Qt::AlignVCenter); + timeLabel->setText(str); + timeLabel->setAlignment(Qt::AlignVCenter); } @@ -209,7 +243,7 @@ void tinyCountdown::paintEvent(QPaintEvent * event) */ void tinyCountdown::clearData() { - ui->timeLabel->setText("00:00:00"); + timeLabel->setText("00:00:00"); this->set_dialog_close(); updateOnRunState(true); } @@ -258,73 +292,78 @@ void tinyCountdown::settingsStyle() this->whiteStyle(); }); connect(subject,&GsettingSubject::iconChnaged, this,[=](){ - ui->clockIcon->setPixmap(QIcon::fromTheme("kylin-alarm-clock").pixmap(24,24)); + clockIcon->setPixmap(QIcon::fromTheme("kylin-alarm-clock").pixmap(24,24)); + }); + connect(subject,&GsettingSubject::tabletModeChange, this,[=](bool currentTablet){ + updatePosition(currentTablet); }); subject->iniWidgetStyle(); + subject->iniTabletMode(); } void tinyCountdown::whiteStyle() { - ui->mainBtn->setIcon(QIcon(":image/miniIcon/restore_active-w.png")); + mainBtn->setIcon(QIcon(":image/miniIcon/restore_active-w.png")); finishBtnIcon(0); suspendRunBtnIcon(0); } void tinyCountdown::blackStyle() { - ui->mainBtn->setIcon(QIcon(":image/miniIcon/restore-active-b.png")); + mainBtn->setIcon(QIcon(":image/miniIcon/restore-active-b.png")); finishBtnIcon(1); suspendRunBtnIcon(1); } void tinyCountdown::closeStyle() { - ui->closeBtn->setToolTip(tr("close")); - ui->closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); - ui->closeBtn->setProperty("isWindowButton", 0x2); - ui->closeBtn->setProperty("useIconHighlightEffect", 0x8); - ui->closeBtn->setFlat(true); + closeBtn->setToolTip(tr("close")); + closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); + closeBtn->setProperty("isWindowButton", 0x2); + closeBtn->setProperty("useIconHighlightEffect", 0x8); + closeBtn->setFlat(true); } void tinyCountdown::switchStyle() { - ui->mainBtn->setToolTip(tr("main window")); - ui->mainBtn->setProperty("useButtonPalette", true); - ui->mainBtn->setIcon(QIcon(":image/miniIcon/restore_active-w.png")); - ui->mainBtn->setIconSize(QSize(24,24)); + mainBtn->setToolTip(tr("main window")); + mainBtn->setProperty("useButtonPalette", true); + mainBtn->setIcon(QIcon(":image/miniIcon/restore_active-w.png")); +// mainBtn->setIconSize(QSize(24,24)); //手动改成透明色 - Utils::setBtnBackgroundColorTransparent(ui->mainBtn); + Utils::setBtnBackgroundColorTransparent(mainBtn); } /** * @brief 暂停运行按钮样式 */ void tinyCountdown::suspendRunBtnStyle() { - ui->suspendRunBtn->setToolTip(tr("suspend")); - ui->suspendRunBtn->setRadius(14); - ui->suspendRunBtn->setFlag(RoundBtn::ICON_FLAG); - ui->suspendRunBtn->setIconSize(QSize(32,32)); + suspendRunBtn->setToolTip(tr("suspend")); +// suspendRunBtn->setRadius(14); + suspendRunBtn->setRadius(28); + suspendRunBtn->setFlag(RoundBtn::ICON_FLAG); +// suspendRunBtn->setIconSize(QSize(32,32)); QColor defaultColor = QColor(0, 0, 0, 0); - ui->suspendRunBtn->setBtnColor(defaultColor,defaultColor,defaultColor); + suspendRunBtn->setBtnColor(defaultColor,defaultColor,defaultColor); //初始化是运行中 m_onRun = true; suspendRunBtnIcon(theme::themetype); - connect(ui->suspendRunBtn,&QPushButton::clicked,this,[=](){ + connect(suspendRunBtn,&QPushButton::clicked,this,[=](){ m_onRun = !m_onRun; suspendRunBtnIcon(theme::themetype); emit suspendClick(m_onRun); }); - } void tinyCountdown::finishBtnStyle() { - ui->finishBtn->setToolTip(tr("finish")); - ui->finishBtn->setRadius(12); - ui->finishBtn->setFlag(RoundBtn::ICON_FLAG); - ui->finishBtn->setIconSize(QSize(28,28)); + finishBtn->setToolTip(tr("finish")); +// finishBtn->setRadius(12); + finishBtn->setRadius(24); + finishBtn->setFlag(RoundBtn::ICON_FLAG); +// finishBtn->setIconSize(QSize(28,28)); QColor defaultColor = QColor(0, 0, 0, 0); - ui->finishBtn->setBtnColor(defaultColor,defaultColor,defaultColor); + finishBtn->setBtnColor(defaultColor,defaultColor,defaultColor); finishBtnIcon(theme::themetype); - connect(ui->finishBtn,&QPushButton::clicked,this,[=](){ + connect(finishBtn,&QPushButton::clicked,this,[=](){ emit finishClick(); }); @@ -333,11 +372,11 @@ void tinyCountdown::finishBtnStyle() void tinyCountdown::finishBtnIcon(int themeStatus) { if(themeStatus==0){ - ui->finishBtn->setAllIconPatn(":image/miniIcon/finish-light-normal.png" + finishBtn->setAllIconPatn(":image/miniIcon/finish-light-normal.png" ,":image/miniIcon/finish-light-hover.png" ,":image/miniIcon/finish-light-click.png"); }else{ - ui->finishBtn->setAllIconPatn(":image/miniIcon/finish-dark-normal.png" + finishBtn->setAllIconPatn(":image/miniIcon/finish-dark-normal.png" ,":image/miniIcon/finish-dark-hover.png" ,":image/miniIcon/finish-dark-click.png"); } @@ -348,27 +387,72 @@ void tinyCountdown::suspendRunBtnIcon(int themeStatus) qDebug()<<"dbq-m_onRun"<suspendRunBtn->setAllIconPatn(":image/miniIcon/suspend-normal-light.png" + suspendRunBtn->setAllIconPatn(":image/miniIcon/suspend-normal-light.png" ,":image/miniIcon/suspend-hover-light.png" ,":image/miniIcon/suspend-click-light.png"); }else{ - ui->suspendRunBtn->setAllIconPatn(":image/miniIcon/suspend-normal-dark.png" + suspendRunBtn->setAllIconPatn(":image/miniIcon/suspend-normal-dark.png" ,":image/miniIcon/suspend-hover-dark.png" ,":image/miniIcon/suspend-click-dark.png"); } }else{ if(themeStatus==0){ - ui->suspendRunBtn->setAllIconPatn(":image/miniIcon/start-normal-light.png" + suspendRunBtn->setAllIconPatn(":image/miniIcon/start-normal-light.png" ,":image/miniIcon/start-hover-light.png" ,":image/miniIcon/start-hover-light.png"); }else{ - ui->suspendRunBtn->setAllIconPatn(":image/miniIcon/start-normal-dark.png" + suspendRunBtn->setAllIconPatn(":image/miniIcon/start-normal-dark.png" ,":image/miniIcon/start-hover-dark.png" ,":image/miniIcon/start-hover-dark.png"); } } } +void tinyCountdown::updatePosition(bool onTbalet) +{ + if(onTbalet){ + this->setFixedSize(498,80); + clockIcon->move(16,28); + timeLabel->move(52,24); + QFont font; + font.setPointSize(36); + timeLabel->setFont(font); + timeLabel->setFixedSize(200,36); + suspendRunBtn->move(262,12); + suspendRunBtn->setFixedSize(56,56); + suspendRunBtn->setIconSize(QSize(56, 56)); + finishBtn->move(331,16); + finishBtn->setFixedSize(48,48); + finishBtn->setIconSize(QSize(48, 48)); + mainBtn->move(396,16); + mainBtn->setFixedSize(48,48); + mainBtn->setIconSize(QSize(48, 48)); + closeBtn->move(444,16); + closeBtn->setFixedSize(48,48); + closeBtn->setIconSize(QSize(48, 48)); + }else{ + this->setFixedSize(320,50); + clockIcon->move(20,13); + timeLabel->move(52,9); + QFont font; + font.setPointSize(18); + timeLabel->setFont(font); + timeLabel->setFixedSize(94,32); + suspendRunBtn->move(154,9); + suspendRunBtn->setFixedSize(32,32); + suspendRunBtn->setIconSize(QSize(32, 32)); + finishBtn->move(194,11); + finishBtn->setFixedSize(28,28); + finishBtn->setIconSize(QSize(28, 28)); + mainBtn->move(248,13); + mainBtn->setFixedSize(24,24); + mainBtn->setIconSize(QSize(16, 16)); + closeBtn->move(280,13); + closeBtn->setFixedSize(24,24); + closeBtn->setIconSize(QSize(16, 16)); + } +} + diff --git a/tinycountdown.h b/tinycountdown.h index 6767e36..2e2fc47 100644 --- a/tinycountdown.h +++ b/tinycountdown.h @@ -31,6 +31,7 @@ #include "gsettingsubject.h" #include "xatom-helper.h" #include "commontooltip.h" +#include "roundbtn.h" namespace Ui { class tinyCountdown; } @@ -42,6 +43,15 @@ class tinyCountdown : public QWidget public: explicit tinyCountdown(QWidget *parent = nullptr); ~tinyCountdown(); + void setupUi(QWidget *tinyCountdown); + void retranslateUi(QWidget *tinyCountdown); + QLabel *clockIcon; + QPushButton *closeBtn; + RoundBtn *finishBtn; + QPushButton *mainBtn; + RoundBtn *suspendRunBtn; + QLabel *timeLabel; + void updateTimeInfo(QString str); #ifdef onTooltip void mousePressEvent(QMouseEvent *event) override; @@ -90,6 +100,7 @@ private: void finishBtnIcon(int themeStatus); void suspendRunBtnIcon(int themeStatus); bool m_onRun = false; + void updatePosition(bool onTbalet); }; #endif // TINYCOUNTDOWN_H diff --git a/translations/ukui-clock_bo_CN.qm b/translations/ukui-clock_bo_CN.qm index ee651ce..aff260c 100644 Binary files a/translations/ukui-clock_bo_CN.qm and b/translations/ukui-clock_bo_CN.qm differ diff --git a/translations/ukui-clock_bo_CN.ts b/translations/ukui-clock_bo_CN.ts index 7b9bc21..b09deb1 100644 --- a/translations/ukui-clock_bo_CN.ts +++ b/translations/ukui-clock_bo_CN.ts @@ -79,12 +79,12 @@ 闹钟 - - - - - - + + + + + + start 开始 འགོ་ཚུགས་པ། @@ -113,10 +113,10 @@ 60分钟 - - - - + + + + suspend ལས་མཚམས་བཞག་པ། @@ -125,16 +125,15 @@ 迷你窗口 - + add 添加 ཁ་སྣོན་བྱས་པ། - no alarm 无闹钟 - ཉེན་བརྡ་མི་གཏོང་བ། + ཉེན་བརྡ་མི་གཏོང་བ། delete @@ -142,7 +141,7 @@ 删除 - + save 保存 ཉར་ཚགས། @@ -152,10 +151,9 @@ 提醒铃声 - - - - + + + PM ཕྱི་དྲོ། @@ -169,21 +167,21 @@ 点击闹钟显示剩余时间 - + reset བསྐྱར་དུ་བཀོད་སྒྲིག་བྱེད་པ། - - - + + + count གྲངས་ཀ་རྩིས་རྒྱག - - - + + + Count down དུས་ཚོད་ལྡོག་རྩིས་བྱེད་པ། @@ -208,7 +206,7 @@ 12小时43分后铃声响 - + cancel ཕྱིར་འཐེན། @@ -221,9 +219,8 @@ 闹钟名 - repeat - ཡང་བསྐྱར་ཐེངས་གཅིག + ཡང་བསྐྱར་ཐེངས་གཅིག Remind @@ -242,13 +239,6 @@ start start - - - - - 00:00:00 - - 5分钟 5min @@ -299,120 +289,135 @@ 继续 - + interval བར་མཚམས་ཆད་པ། - + + Version: + པར་གཞི་འདི་ལྟ་སྟེ། + + + recent alarm ཉེ་ཆར་ཉེན་བརྡ་བཏང་། - - - + + + + AM སྔ་དྲོ། - - - - + + no Alarm + + + + + Option + འདེམས་ཚན། + + + + + + Mon གཟའ་ཟླ་བ། - - - - + + + + Tue གཟའ་མིག་དམར། - - - - + + + + Wed གཟའ་ལྷག་པ། - - - - + + + + Thu གཟའ་ཕུར་བུ། - - - - + + + + Fri གཟའ་པ་སངས། - - - - + + + + Sat གཟའ་སྤེན་པ། - - - - + + + + Sun ཉི་མ། - 60 Seconds to close - སྒོ་རྒྱག་པའི་དུས་ཚོད་སྐར་ཆ་60 + སྒོ་རྒྱག་པའི་དུས་ཚོད་སྐར་ཆ་60 - - + + five mins late སྐར་མ་ལྔ་འགོར་འགྱངས་བྱས་པ། - - + + ten mins late སྐར་མ་བཅུའི་རྗེས། - - + + twenty mins late སྐར་མ་ཉི་ཤུའི་རྗེས་སུ། - - + + thirsty mins late 30སྐར་མ་རྗེས་སུ། - - + + one hour late ཆུ་ཚོད་གཅིག་འགོར་རྗེས། - + mini window སྒེའུ་ཁུང་ཆུང་ཆུང་མངོན་པ། - + 2min སྐར་མ2 @@ -426,49 +431,49 @@ 计次 - + Watch སྐར་ཆའི་རེའུ་མིག - icon - མཚོན་རྟགས། + མཚོན་རྟགས། - - - + + + + + bell ཅོང་བརྡ། - + Minimize 最小化 ཆེས་ཆུང་དུ་བསྒྱུར་བ། - - + + Quit 退出 ཕྱིར་འཐེན་བྱ་རྒྱུ། - Menu 菜单 - འདེམས་པང་། + འདེམས་པང་། - + Delete 删除 བསུབ་པ། - + ClearAll 全部清空 ཚང་མ་གཙང་སེལ། @@ -484,35 +489,36 @@ 帮助 - + Help 帮助 རོགས་རམ་བྱེད་པ། - + About 关于 འབྲེལ་ཡོད་ཀྱི་སྐོར། - + Close - 退出 + 关闭 སྒོ་རྒྱག་པ། - + up to 100 times ཆེས་མང་ན་ཐེངས་100ལ་སླེབས་པ། - + remind ཅུང་ཙམ་གྱི་རྗེས་ནས་གསལ་འདེབས། - + + name ཅོང་བརྡའི་མིང་། @@ -521,44 +527,44 @@ 退出 - + edit རྩོམ་སྒྲིག - + mute སྐད་ཆ་མི་བཤད་པ། - + All bells are off ཅོང་བརྡ་ཚང་མ་ལྷུང་སོང་། - + 3min སྐར་མ3 - + 4min སྐར་མ4 - + 6min སྐར་མ6 - - - - - - - - + + + + + + + + No repetition བསྐྱར་ཟློས་མི་བྱེད་པ། @@ -567,31 +573,31 @@ 秒后关闭 - - - - - + + + + + Workingday ལས་ཞག་ཉིན། - + (default) (སོར་བཞག) - - - - - + + + + + none གཅིག་ཀྱང་མེད། - - + + Please set alarm name! 请设置闹钟名! ཉེན་བརྡའི་མིང་ཞིག་འགོད་རོགས། @@ -622,7 +628,7 @@ 小时 - + glass ཤེལ་སྒོ། @@ -654,34 +660,34 @@ 雨滴 - - + + continue མུ་མཐུད་དུ། - + warning ཐ་ཚིག་སྒྲོག་པ། - + the number of alarms reaches limit!! ཉེན་བརྡའི་གྲངས་འབོར་ཚད་བཀག་ལ་སླེབས་ཡོད། - + yes གཏན་འཁེལ། - - + + work ལས་ཀ་བྱེད་པ། - + 工作日 ལས་ཀའི་ཉིན། @@ -694,40 +700,40 @@ 时间到 - + End མཇུག་སྒྲིལ། - + after tomorrow གནང་ཉིན། - + Tomorrow སང་ཉིན། - + hour དུས་ཚོད། - + min སྐར་མ། - + sec སྐར་ཆ། - - - - + + + + Every day ཉིན་ལྟར། @@ -833,7 +839,7 @@ ring time - + On མུ་མཐུད་དུ་བཤད་ @@ -1056,7 +1062,7 @@ sec - + 不重复 No repetition 不重复 @@ -1149,7 +1155,7 @@ - + Remind later ཅུང་ཙམ་གྱི་རྗེས་ནས་གསལ་འདེབས། @@ -1158,20 +1164,25 @@ 关闭 - Ring prompt - ཅོང་བརྡ་གྲགས་བྱུང་། + ཅོང་བརྡ་གྲགས་བྱུང་། - + none གཅིག་ཀྱང་མེད། - + Time out དུས་ཚོད་ཕྱིར་འཐེན་བྱེད་པ། + + + + Alarm + + glass 玻璃 @@ -1189,7 +1200,8 @@ 雨滴 - + + Seconds to close དུས་ཚོད་སྐར་ཆ་ཙམ་ཡང་སྒོ་རྒྱག་པ། @@ -1236,22 +1248,22 @@ QObject - + Hint གསལ་འདེབས་བྱེད་པ། - + Are you sure to delete? ཁྱོད་ཀྱིས་ངེས་པར་དུ་ཅོང་བརྡ་བསུབ་དགོས་སམ། - + sure གཏན་འཁེལ་བྱ་དགོས། - + cancel ཕྱིར་འཐེན། @@ -1362,29 +1374,31 @@ close_or_hide - + + Dialog རྣམ་བཞག་ཅན། - + sure གཏན་འཁེལ་བྱ་དགོས། - + 请选择关闭后的状态 སྒོ་བརྒྱབ་རྗེས་ཀྱི་རྣམ་པ་འདེམས་རོགས། - + cancel ཕྱིར་འཐེན། - + + backstage རྒྱབ་སྟེགས་ལག་བསྟར་བྱེད་པ། @@ -1393,15 +1407,20 @@ 后台运行 - + Exit program ཐད་ར་ཕྱིར་འཐེན། - + Please select the state after closing: སྒོ་བརྒྱབ་རྗེས་གནས་ཚུལ་གདམ་གསེས་གནང་རོགས། + + + Exit program + ཐད་ར་ཕྱིར་འཐེན། + delete_msg @@ -1429,7 +1448,7 @@ item_new - + Form རེའུ་མིག @@ -1615,18 +1634,18 @@ 最长 - + Form རེའུ་མིག - - + + max ཆེས་རིང་བ། - + min ཆེས་ཐུང་བ། @@ -1639,6 +1658,7 @@ tinyCountdown + Form རེའུ་མིག @@ -1656,22 +1676,22 @@ 切换 - + close སྒོ་རྒྱག་པ། - + main window སྒེའུ་ཁུང་གཙོ་བོ། - + suspend ལས་མཚམས་བཞག་པ། - + finish མཇུག་སྒྲིལ། diff --git a/translations/ukui-clock_tr.qm b/translations/ukui-clock_tr.qm index 3f45491..e2657c3 100644 Binary files a/translations/ukui-clock_tr.qm and b/translations/ukui-clock_tr.qm differ diff --git a/translations/ukui-clock_tr.ts b/translations/ukui-clock_tr.ts index e13a8f2..7956768 100644 --- a/translations/ukui-clock_tr.ts +++ b/translations/ukui-clock_tr.ts @@ -71,22 +71,15 @@ Saat - - - - - - + + + + + + start Başlat - - - - - 00:00:00 - - 5min 5 dk @@ -108,34 +101,28 @@ 60 dk - - - - + + + + suspend Askıya Al - - icon - - - - + add Ekle - no alarm - no Alarm + no Alarm delete Sil - + save Cts @@ -144,10 +131,9 @@ Hatırlat - - - - + + + PM ÖS @@ -160,21 +146,21 @@ Kalan süre - + reset Sıfırla - - - + + + count İşaret - - - + + + Count down Geri Sayım @@ -200,7 +186,7 @@ 12 saat 43 dk zil çalıyor - + cancel İptal @@ -213,9 +199,8 @@ İsim - repeat - Tekrarla + Tekrarla Remind @@ -230,7 +215,7 @@ Çalma Zamanı - + On Açık @@ -239,51 +224,52 @@ Devam Et - + interval Aralık - - - + + + + AM ÖÖ - + 2min 2 dk - + remind - + 3min 3 dk - + 4min 4 dk - + 6min 6 dk - - - - - - - - + + + + + + + + No repetition Tekrar yok @@ -292,22 +278,22 @@ saniye sonra kapanacak - - - - - + + + + + Workingday İş günü - + (default) (varsayılan) - - + + Please set alarm name! Lütfen alarm adını ayarlayın! @@ -332,7 +318,7 @@ Geri Sayım - + Watch Kronometre @@ -345,35 +331,36 @@ Saat - + glass Bardak - - - + + + + + bell - + Minimize küçültmek - - + + Quit Çık - Menu - Menü + Menü - + Help Yardım @@ -382,12 +369,13 @@ Havlama - + + name - + edit @@ -400,17 +388,17 @@ Damla - + up to 100 times - + mute - + All bells are off @@ -423,40 +411,40 @@ Zaman doldu - + End Son - + after tomorrow Yarından sonra - + Tomorrow Yarın - + hour Saat - + min Dk - + sec Sn - - - - + + + + Mon Pzt @@ -465,18 +453,18 @@ Kapat - + Delete Sil - + ClearAll - - + + continue @@ -485,153 +473,167 @@ ayarlandır - + About hakkında - + Close kapat - + + no Alarm + + + + + Option + + + + + Version: + + + + recent alarm - - - - + + + + Tue Sal - - - - + + + + Wed Çar - - - - + + + + Thu Per - - - - + + + + Fri Cum - - - - + + + + Sat Cts - - - - + + + + Sun Paz - - - - + + + + Every day Her gün - - - - - + + + + + none - + warning - + the number of alarms reaches limit!! - + yes - - + + work İş - + 工作日 - + 不重复 - 60 Seconds to close - Kapatmak için 360 Saniye {60 ?} + Kapatmak için 360 Saniye {60 ?} - - + + five mins late - - + + ten mins late - - + + twenty mins late - - + + thirsty mins late - - + + one hour late - + mini window @@ -695,7 +697,7 @@ - + Remind later Hatırlat @@ -704,20 +706,25 @@ Kapat - Ring prompt - Çalma İsteği + Çalma İsteği - + none - + Time out Zaman doldu + + + + Alarm + + glass Bardak @@ -735,7 +742,8 @@ Damla - + + Seconds to close dakika sonra kapanacak @@ -782,22 +790,22 @@ QObject - + Hint - + Are you sure to delete? - + sure Tamam - + cancel İptal @@ -896,29 +904,31 @@ close_or_hide - + + Dialog - + sure Tamam - + 请选择关闭后的状态 - + cancel İptal - + + backstage Arka Çalış @@ -927,15 +937,20 @@ Arka Çalış - + Exit program Kapat - + Please select the state after closing: + + + Exit program + Kapat + delete_msg @@ -963,7 +978,7 @@ item_new - + Form @@ -1139,18 +1154,18 @@ stopwatch_item - + Form - - + + max - + min Dk @@ -1159,6 +1174,7 @@ tinyCountdown + Form @@ -1168,22 +1184,22 @@ - + close Kapat - + main window - + suspend Askıya Al - + finish diff --git a/translations/ukui-clock_zh_CN.qm b/translations/ukui-clock_zh_CN.qm index abd8211..f05631d 100644 Binary files a/translations/ukui-clock_zh_CN.qm and b/translations/ukui-clock_zh_CN.qm differ diff --git a/translations/ukui-clock_zh_CN.ts b/translations/ukui-clock_zh_CN.ts index 858f1e3..bb85001 100644 --- a/translations/ukui-clock_zh_CN.ts +++ b/translations/ukui-clock_zh_CN.ts @@ -79,12 +79,12 @@ 闹钟 - - - - - - + + + + + + start 开始 开始 @@ -113,10 +113,10 @@ 60分钟 - - - - + + + + suspend 暂停 @@ -125,16 +125,15 @@ 迷你窗口 - + add 添加 添加 - no alarm 无闹钟 - 无闹钟 + 无闹钟 delete @@ -142,7 +141,7 @@ 删除 - + save 保存 保存 @@ -152,10 +151,9 @@ 提醒铃声 - - - - + + + PM 下午 @@ -169,21 +167,21 @@ 点击闹钟显示剩余时间 - + reset 复位 - - - + + + count 计次 - - - + + + Count down 倒计时 @@ -208,7 +206,7 @@ 12小时43分后铃声响 - + cancel 取消 @@ -221,9 +219,8 @@ 闹钟名 - repeat - 重复 + 重复 Remind @@ -242,13 +239,6 @@ start start - - - - - 00:00:00 - - 5分钟 5min @@ -299,120 +289,135 @@ 继续 - + interval 间隔 - + + Version: + 版本: + + + recent alarm 最近闹钟 - - - + + + + AM 上午 - - - - + + no Alarm + + + + + Option + 选项 + + + + + + Mon 星期一 - - - - + + + + Tue 星期二 - - - - + + + + Wed 星期三 - - - - + + + + Thu 星期四 - - - - + + + + Fri 星期五 - - - - + + + + Sat 星期六 - - - - + + + + Sun 星期日 - 60 Seconds to close - 60秒后自动关闭 + 60秒后自动关闭 - - + + five mins late 5分钟后 - - + + ten mins late 10分钟后 - - + + twenty mins late 20分钟后 - - + + thirsty mins late 30分钟后 - - + + one hour late 1小时后 - + mini window 小窗显示 - + 2min 2分钟 @@ -426,49 +431,45 @@ 计次 - + Watch 秒表 - - icon - - - - - - + + + + + bell 铃声 - + Minimize 最小化 最小化 - - + + Quit 退出 退出 - Menu 菜单 - 菜单 + 菜单 - + Delete 删除 删除 - + ClearAll 全部清空 全部清空 @@ -484,35 +485,36 @@ 帮助 - + Help 帮助 帮助 - + About 关于 关于 - + Close - 退出 - 退出 + 关闭 + 关闭 - + up to 100 times 最多可记100次 - + remind 稍后提醒 - + + name 闹钟名 @@ -521,44 +523,44 @@ 退出 - + edit 编辑 - + mute 静音 - + All bells are off 所有铃声已关闭 - + 3min 3分钟 - + 4min 4分钟 - + 6min 6分钟 - - - - - - - - + + + + + + + + No repetition 不重复 @@ -567,31 +569,31 @@ 秒后关闭 - - - - - + + + + + Workingday 工作日 - + (default) (默认) - - - - - + + + + + none - - + + Please set alarm name! 请设置闹钟名! 请设置闹钟名! @@ -622,7 +624,7 @@ 小时 - + glass 玻璃 @@ -654,34 +656,34 @@ 雨滴 - - + + continue 继续 - + warning 警告 - + the number of alarms reaches limit!! 闹钟数量已达上限! - + yes 确认 - - + + work 工作日 - + 工作日 @@ -694,40 +696,40 @@ 时间到 - + End 结束 - + after tomorrow 后天 - + Tomorrow 明天 - + hour - + min - + sec - - - - + + + + Every day 每天 @@ -833,7 +835,7 @@ ring time - + On on @@ -1056,7 +1058,7 @@ sec - + 不重复 No repetition No repetition @@ -1149,7 +1151,7 @@ - + Remind later 稍后提醒 @@ -1158,20 +1160,25 @@ 关闭 - Ring prompt - 响铃提示 + 响铃提示 - + none - + Time out 时间到 + + + + Alarm + 闹钟 + glass 玻璃 @@ -1189,7 +1196,8 @@ 雨滴 - + + Seconds to close 秒后自动关闭 @@ -1236,22 +1244,22 @@ QObject - + Hint 提示 - + Are you sure to delete? 您确定删除当前闹钟吗? - + sure 确定 - + cancel 取消 @@ -1362,29 +1370,31 @@ close_or_hide - + + Dialog - + sure 确定 - + 请选择关闭后的状态 - + cancel 取消 - + + backstage 后台运行 @@ -1393,15 +1403,20 @@ 后台运行 - + Exit program 直接退出 - + Please select the state after closing: 请选择关闭后状态: + + + Exit program + 直接退出 + delete_msg @@ -1429,7 +1444,7 @@ item_new - + Form @@ -1615,18 +1630,18 @@ 最长 - + Form - - + + max 最长 - + min 最短 @@ -1639,6 +1654,7 @@ tinyCountdown + Form @@ -1656,22 +1672,22 @@ 切换 - + close 关闭 - + main window 主窗口 - + suspend 暂停 - + finish 结束 diff --git a/verticalScroll24.cpp b/verticalScroll24.cpp index f6997fc..5e8d4d9 100644 --- a/verticalScroll24.cpp +++ b/verticalScroll24.cpp @@ -163,7 +163,7 @@ void VerticalScroll_24::paintNum_24(QPainter &painter, int Height) } else { paintNum(painter, m_minRange, m_deviation + Height / devide); } - m_Pclock->ui->timeFormatOnTimeWheel->hide(); + m_Pclock->timeFormatOnTimeWheel->hide(); } void VerticalScroll_24::paintNum_12(QPainter &painter, int Height) @@ -202,7 +202,7 @@ void VerticalScroll_24::paintNum_12(QPainter &painter, int Height) } else { paintNum(painter, m_minRange, m_deviation + Height / devide); } - m_Pclock->ui->timeFormatOnTimeWheel->hide(); + m_Pclock->timeFormatOnTimeWheel->hide(); //换用上下午滚轮 // if (m_currentValue>=12) { // m_Pclock->ui->timeFormatOnTimeWheel->setText(tr("PM"));