From b16181f6121a760cad408976a7e8f2540f5c54c5 Mon Sep 17 00:00:00 2001 From: "Tod E. Kurt" Date: Tue, 26 Aug 2014 16:27:28 -0700 Subject: [PATCH] blink1control: more ifttt fixes, even more work on preferences window --- qt/blink1control/images/gear.png | Bin 0 -> 5738 bytes qt/blink1control/mainwindow.cpp | 36 +++++++++++++----- qt/blink1control/mainwindow.h | 1 + qt/blink1control/myresources.qrc | 1 + .../qml/qml/PreferencesWindow.qml | 28 ++++++++++---- qt/blink1control/qml/qml/main.qml | 34 +++++++++-------- 6 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 qt/blink1control/images/gear.png diff --git a/qt/blink1control/images/gear.png b/qt/blink1control/images/gear.png new file mode 100644 index 0000000000000000000000000000000000000000..d134cc42d029c68d55e25da6a1dbe99345820b36 GIT binary patch literal 5738 zcmZ`+2{=@3`yWeo%93nZM#>U1wuZsTn%&q9CEHlC3^VrSwI+m+E&INYtWC-;k(4#N z5Mg9V_96YL_j|woUGI0U>zwnP`@VnA@BZD-ay=&su5*i)ij4{Y0MM$dDeIrUInHhh zvePG;b~XtBpiy>IQi7{1DRINmC_6`IBmkgBi#4$~G#q38h|{u4W9@CDP-FFDEHc60 zfyWEJ>Hv#_l~}DT;Wg}G^fBiyQX5MMT0d01X|3?e6~6ZR8$2wOA?zHx;O2B*T59sK zzc&`M;oaKY-!l7gf4c5H(Lgo*(&x`}>43&>iYm8#;w=?5%7eE6X>DOvVB($d{LrSh z@o|TPu`lb|ZTt(8X9OJZG z^K{{!OlsU6IsBPr9Ug_89z#bp_j|ALh_D22P`24p-;dS;xKeyNr;@M5^gu{;Tu&tB z4ZX$v>KrveWsZGl2QL~^0;~+-9xwdCr?Ygo8lDDYGT`sy==k0UR|;VT3iZ6De-D>C zmVY_T!B?KTDyAZ5ULF~#}Cqz~85O5G)&bo2Fxuf-6~%b$@}mObkeG)!V9V zcp>Hqsx_Ilwap!3+9_3ktOzJ>f)|g=uV%3tat)%P|E@W9iKfkFW$H4;3m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qt/blink1control/mainwindow.cpp @@ -16,6 +16,7 @@ #include + #include "patternsReadOnly.h" enum { @@ -34,7 +35,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { fromPattern=false; - mk2=false; + mk2=true; blinkStatus=""; iftttKey=""; blink1Id="none"; @@ -697,6 +698,7 @@ void MainWindow::loadSettings() QJsonArray qarr = doc.array(); qint64 nowSecs = QDateTime::currentDateTime().toMSecsSinceEpoch()/1000; + lastIftttDate = nowSecs; for( int i=0; i< qarr.size(); i++ ) { Blink1Pattern* bp = new Blink1Pattern(); @@ -728,19 +730,19 @@ void MainWindow::loadSettings() inputs.insert( bi->name(), bi ); // find most recent ifttt time if( bi->type() == "ifttt" ) { - //qDebug() << "iftttTime: "<date(); - if( bi->date() > nowSecs || bi->date() == 0 ) { // if bad stored date, fix it + qDebug() << "input name:"<name() <<" iftttTime: "<date() << " nowSecs: "<date() > nowSecs || bi->date() < 1 ) { // if bad stored date, fix it bi->setDate( nowSecs ); } - if( bi->date() > lastIftttDate ) - lastIftttDate = bi->date(); + //if( bi->date() > lastIftttDate ) + // lastIftttDate = bi->date(); } } } - if( lastIftttDate > nowSecs ) { - qDebug() << "lastIftttDate: bad date in input"; - lastIftttDate = nowSecs; - } + //if( lastIftttDate > nowSecs ) { + // qDebug() << "lastIftttDate: bad date in input: "<< lastIftttDate; + // lastIftttDate = nowSecs; + //} QString sButtStr = settings.value("bigbuttons2","").toString(); if( sButtStr.length() ) { @@ -882,6 +884,7 @@ void MainWindow::createActions() #endif minimizeAction = new QAction(tr("Start minimized"), this); connect(minimizeAction,SIGNAL(triggered()),this,SLOT(changeMinimizeOption())); + //connect(minimizeAction,SIGNAL(triggered()),this,SLOT(updatePreferences())); minimizeAction->setCheckable(true); minimizeAction->setChecked(startmin); restoreAction = new QAction(tr("&Restore"), this); @@ -893,10 +896,12 @@ void MainWindow::createActions() autorunAction->setCheckable(true); autorunAction->setChecked(autorun); connect(autorunAction,SIGNAL(triggered()),this,SLOT(setAutorun())); + //connect(autorunAction,SIGNAL(triggered()),this,SLOT(updatePreferences())); dockIconAction=new QAction("Show Dock Icon",this); dockIconAction->setCheckable(true); dockIconAction->setChecked(dockIcon); connect(dockIconAction,SIGNAL(triggered()),this,SLOT(showhideDockIcon())); + //connect(dockIconAction,SIGNAL(triggered()),this,SLOT(updatePreferences())); settingAction=new QAction("Open Settings",this); connect(settingAction,SIGNAL(triggered()),this,SLOT(showNormal())); alertsAction=new QAction("Reset Alerts",this); @@ -905,6 +910,7 @@ void MainWindow::createActions() serverAction->setCheckable(true); serverAction->setChecked(enableServer); connect(serverAction,SIGNAL(triggered()),this,SLOT(startStopServer())); + //connect(serverAction,SIGNAL(triggered()),this,SLOT(updatePreferences())); // shortcuts don't work apparently in traymenus //alertsAction->setShortcut(Qt::Key_R | Qt::CTRL); @@ -1071,7 +1077,7 @@ void MainWindow::showNormal(){ //viewer.setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); viewer.requestActivate(); //viewer.activateWindow(); // for Windows - } +} void MainWindow::playBigButton(int idx){ blink1timer->stop(); QString tmp=bigButtons2.at(idx)->getPatternName(); @@ -1154,6 +1160,16 @@ void MainWindow::startStopServer(){ addToLog("SERVER IS "+QString::number(httpserver->status())); } +void MainWindow::updatePreferences() { + qDebug() << "updatePreferences"; + + serverAction->setChecked( enableServer ); + dockIconAction->setChecked( dockIcon ); + + showhideDockIcon(); + startStopServer(); + +} QList MainWindow::getPatternsList(){ QList patternsList; diff --git a/qt/blink1control/mainwindow.h b/qt/blink1control/mainwindow.h index 6b4c9cc6..f5a04559 100644 --- a/qt/blink1control/mainwindow.h +++ b/qt/blink1control/mainwindow.h @@ -188,6 +188,7 @@ public slots: void updatePatternsList(); void changeInputName(QString oldName,QString newName); + void updatePreferences(); void setAutorun(); void showhideDockIcon(); void checkInput(QString key); diff --git a/qt/blink1control/myresources.qrc b/qt/blink1control/myresources.qrc index 5852b343..b1176442 100644 --- a/qt/blink1control/myresources.qrc +++ b/qt/blink1control/myresources.qrc @@ -172,5 +172,6 @@ images/layout/dropdown-bg.png images/layout/select-bg-right.png images/blink1-icon0-bw.png + images/gear.png diff --git a/qt/blink1control/qml/qml/PreferencesWindow.qml b/qt/blink1control/qml/qml/PreferencesWindow.qml index ffa22208..9b0f7873 100644 --- a/qt/blink1control/qml/qml/PreferencesWindow.qml +++ b/qt/blink1control/qml/qml/PreferencesWindow.qml @@ -4,12 +4,13 @@ import QtQuick.Layouts 1.1 import QtQuick.Controls.Styles 1.1 import QtQuick.Window 2.1 +//import "ToolTipTod2Creator.js" as ToolTipCreator Window { id: prefsWindow - width: mw.mac() ? 580 : 550 // Win version experimentally determined - height: mw.mac() ? 440 : 390 + width: mw.mac() ? 575 : 560 // Win version experimentally determined + height: mw.mac() ? 465 : 410 // FIXME: surely there's a shorter way of saying "no resize"? maximumWidth: width maximumHeight: height @@ -28,21 +29,26 @@ Window { ColumnLayout { id: mainLayout - spacing: 10 + spacing: 15 RowLayout { + id: mainbox + spacing: 20 ColumnLayout { id: leftcolumn Layout.alignment: Qt.AlignTop - Layout.minimumWidth: 280 - + Layout.minimumWidth: 260 + spacing: 15 + GroupBox { id: groupGeneral title: "General" + Layout.fillWidth: true ColumnLayout { CheckBox { id: minimizedCheckbox text: "Start minimized" checked: mw.startmin + //onHoveredChanged: { console.log("hello "+hovered); }//ToolTipCreator.create("text on the tooltip, yo", parentItem).show() } } CheckBox { id: loginCheckbox @@ -60,6 +66,7 @@ Window { GroupBox { id: groupAPIServer title: "API server configuration" + Layout.fillWidth: true GridLayout { anchors.fill: parent columns: 2 @@ -80,6 +87,7 @@ Window { GroupBox { id: groupProxyConfig title: "Proxy configuration" + Layout.fillWidth: true ColumnLayout { spacing: 10 RowLayout { @@ -123,11 +131,13 @@ Window { ColumnLayout { id: rightcolumn Layout.alignment: Qt.AlignTop - Layout.minimumWidth: 280 + Layout.minimumWidth: 260 + spacing: 15 GroupBox { id: groupBlink1ToUse title: "blink(1) device to use" + Layout.fillWidth: true ColumnLayout { ExclusiveGroup { id: blink1touseGroup } RadioButton { exclusiveGroup: blink1touseGroup @@ -142,8 +152,8 @@ Window { ComboBox { id: blink1touseComboBox model: mw.getBlink1Serials - onCurrentIndexChanged: { //onActivated: { + onCurrentIndexChanged: { console.log("blink1 serial: " + currentIndex + " , "+ currentText); mw.blink1Blink( currentText, "#333333", 500); } @@ -155,7 +165,7 @@ Window { GroupBox { id: groupBlink1Startup title: "blink(1) device no-computer behavior" - Layout.alignment: Qt.AlignTop + Layout.fillWidth: true ColumnLayout { ExclusiveGroup { id: blink1startupGroup } RadioButton { exclusiveGroup: blink1startupGroup @@ -237,6 +247,8 @@ Window { mw.setBlink1Index( 0 ); } + mw.updatePreferences(); + prefsWindow.visible = false } } diff --git a/qt/blink1control/qml/qml/main.qml b/qt/blink1control/qml/qml/main.qml index d7faa7c6..962d3c7f 100644 --- a/qt/blink1control/qml/qml/main.qml +++ b/qt/blink1control/qml/qml/main.qml @@ -148,21 +148,6 @@ Image{ radius: width*0.5 anchors.centerIn: parent } - Button { - tooltip: "Show Preferences window" - iconSource: "qrc:images/layout/select-bg-right.png" - anchors.right: parent.right - anchors.top: parent.top - anchors.rightMargin:-15 - anchors.topMargin:15 - //width: 20 - style: ButtonStyle { - background: Rectangle { - implicitWidth: 15 - } - } - onClicked: prefsWindow.visible = !prefsWindow.visible - } /* MouseArea{ anchors.fill: parent @@ -173,6 +158,25 @@ Image{ } */ } + Button { + tooltip: "Show Preferences window" + //iconSource: "qrc:images/layout/select-bg-right.png" + iconSource: "qrc:images/gear.png" + anchors.right: parent.right + anchors.top: parent.top + anchors.rightMargin:13 //-25 + anchors.topMargin:50 //15 + style: ButtonStyle { + background: Rectangle { + //implicitWidth: 15 + radius: 4 + border.color: control.hovered ? "#d2d2d2" : "transparent" + color: control.pressed ? "#f4f4f4" : "transparent" + } + } + onClicked: prefsWindow.visible = !prefsWindow.visible + } + //// KONIEC VIRTUAL BLINK Text{ text: "Status:"