Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include "storewindow.h"
- #include <QPushButton>
- #include <QtGui>
- #include <QWSServer>
- /* déclaration de output ici */
- StoreWindow::StoreWindow(QWidget *parent)
- :QWidget(parent)
- {
- //setAttribute(Qt::WA_DeleteOnClose);
- /* initialisation de output ici */
- storeAction = new QPushButton("Action Store");
- storeAction->setCheckable(true);
- //output =new AsHmsOutput();
- quit = new QPushButton;
- quit->setIcon(QIcon(QString(":/qss/qss/close.png")));
- connect(storeAction, SIGNAL(toggled(bool)), this, SLOT(storeActioned(bool)));
- cout<<"Afficher pass 1"<<endl;
- //connect(storeAction, SIGNAL(clicked()), this, SLOT(storeActioned()));
- connect(quit, SIGNAL(clicked()), this, SLOT(close()));
- QHBoxLayout* closeLayout = new QHBoxLayout;
- closeLayout->addStretch();
- closeLayout->addWidget(quit);
- QHBoxLayout* buttonLayout = new QHBoxLayout;
- buttonLayout->addStretch();
- buttonLayout->addWidget(storeAction);
- buttonLayout->addStretch();
- QVBoxLayout* mainLayout = new QVBoxLayout;
- mainLayout->addLayout(closeLayout);
- mainLayout->addStretch();
- mainLayout->addLayout(buttonLayout);
- mainLayout->addStretch();
- setLayout(mainLayout);
- outputHandler = new AsHmsOutput;
- outputHandler->init();
- }
- void StoreWindow::storeActioned(bool checked)
- {
- AsHmsOutput *output;
- output =new AsHmsOutput();
- /* initialize output */
- if(output->init() < 0)
- {
- cout<<"Can't initialize output"<<endl;
- }
- else
- {
- cout<<"can initialize output"<<endl;
- }
- /* Here you can set the store gpio to opened (0=close, 1=open) */
- if (checked)
- {
- // monter
- cout<<"monter"<<endl;
- output->writeChan(1, 1);
- output->writeChan(2, 0);
- }
- else
- {
- //descendre
- cout<<"descendre"<<endl;
- output->writeChan(1, 0);
- output->writeChan(2, 1);
- }
- delete output; /* vire moi ça */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement