Exemplo n.º 1
0
void KardView::slotMatch()
{
    kDebug() << "in slot match" << endl;
    tries++;
    
    emit signalChangeStatusbar(i18n("Tries: %1", tries), IDS_TRY);
    
    co=0;

    if (((theme == "colors") && (color[0]==color[1])) || ((theme == "syllables") && (mText[0]==mText[1])) )  {//if same color or same picture
	kardW[0]->slotDisappear(); //hide the 2 same cards
	kardW[1]->slotDisappear();
	count=count+2; //count the cards that are matched by pairs
	if (count==noc)  {
	    slotAll();
	    return;
	}
    }
    else if ((theme == "house" || theme == "opposites" ||  theme == "animals" ||  theme == "food") && (getRef[0]==getRef[1]))  {
	kardW[0]->slotDisappear(); //hide the 2 same cards
	kardW[1]->slotDisappear();
	count=count+2; //count the cards that are matched by pairs
	if (count==noc)  {
	    slotAll();
	    return;
	}
    }
    else {
	kardW[0]->slotShow();
	kardW[1]->slotShow();
    }

    slotConnect();
}
Exemplo n.º 2
0
void ATSkeletonWindow::wireSignals()
{
	// Connect buttons
	ATVERIFY( connect( ui.btnAddTunnel,    SIGNAL( clicked() ), this, SLOT( slotAddTunnel() ) ) );
	ATVERIFY( connect( ui.btnSave,         SIGNAL( clicked() ), this, SLOT( slotSave() ) ) );
	ATVERIFY( connect( ui.btnEditTunnel,   SIGNAL( clicked() ), this, SLOT( slotEditTunnel() ) ) );
	ATVERIFY( connect( ui.btnDuplicate,    SIGNAL( clicked() ), this, SLOT( slotDuplicateTunnel() ) ) );
	ATVERIFY( connect( ui.btnDeleteTunnel, SIGNAL( clicked() ), this, SLOT( slotDeleteTunnel() ) ) );
	ATVERIFY( connect( ui.btnConnect,      SIGNAL( clicked() ), this, SLOT( slotConnect() ) ) );
	ATVERIFY( connect( ui.btnDisconnect,   SIGNAL( clicked() ), this, SLOT( slotDisconnect() ) ) );
	ATVERIFY( connect( ui.btnBrowseSSHKeyFile,   SIGNAL( clicked() ), this, SLOT( slotBrowseKeyFile() ) ) );

	// Connect option related controls
	ATVERIFY( connect( &m_timerReadOptions,		SIGNAL( timeout() ),					this, SLOT( slotReadOptions() ) ) );
	ATVERIFY( connect( ui.editHotkey,			SIGNAL( textChanged(const QString&) ),	this, SLOT( slotDelayReadOptions() ) ) );
	ATVERIFY( connect( ui.comboHotkey1,			SIGNAL( currentIndexChanged(int) ),		this, SLOT( slotDelayReadOptions() ) ) );
	ATVERIFY( connect( ui.comboHotkey2,			SIGNAL( currentIndexChanged(int) ),		this, SLOT( slotDelayReadOptions() ) ) );
	ATVERIFY( connect( ui.checkMinimizeToTray,	SIGNAL( stateChanged(int) ),			this, SLOT( slotDelayReadOptions() ) ) );
	ATVERIFY( connect( ui.checkConfirmOnQuit,	SIGNAL( stateChanged(int) ),			this, SLOT( slotDelayReadOptions() ) ) );
	ATVERIFY( connect( ui.groupHotkey,			SIGNAL( toggled(bool) ),				this, SLOT( slotDelayReadOptions() ) ) );

	// Connect tab widget
	ATVERIFY( connect( ui.tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( slotTabChanged() ) ) );

	// Connect tree
	ATVERIFY( connect( ui.treeTunnels, SIGNAL( itemSelectionChanged() ), this, SLOT( slotSelectTunnel() ) ) );
	ATVERIFY( connect( ui.treeTunnels, SIGNAL( activated(const QModelIndex &) ), this, SLOT( slotItemActivated() ) ) );

	// Connect buttons
	ATVERIFY( connect( this, SIGNAL( signalAutoConnect(Tunnel_c*) ), this, SLOT( slotAutoConnect(Tunnel_c*) ), Qt::QueuedConnection ) );
}
Exemplo n.º 3
0
void MainWindow::setIdents( QString name, QString pass )
{
    username = name;
    userpass = pass;

    slotConnect();
}
PowerlineQos::PowerlineQos(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PowerlineQos)
{
    ui->setupUi(this);

	setHeaderStyle();
	slotConnect();
}
Exemplo n.º 5
0
void Harmonizer::slotDisconnect()
{
    connect(butConnect,SIGNAL(clicked()),this,SLOT(slotConnect()));
    disconnect(butConnect,SIGNAL(clicked()),this,SLOT(slotDisconnect()));
    butConnect->setText(trUtf8("Připojit"));
    ui->memo->appendPlainText(trUtf8("Odpojeno"));

    roznout(false);
    comport->close();
}
Exemplo n.º 6
0
void wifiscanssid::init(QString device)
{
   DeviceName = device;
   pushSelect->setEnabled(FALSE);
    
   QTimer::singleShot(500,  this,  SLOT(slotRescan()));

   connect( pushRescan, SIGNAL( clicked() ), this, SLOT(slotRescan()) );
   connect( pushSelect, SIGNAL( clicked() ), this, SLOT(slotConnect()) );
   connect( pushCancel, SIGNAL( clicked() ), this, SLOT(slotCancel()) );
}
Exemplo n.º 7
0
USBManager::USBManager(QObject *parent) :
    QObject(parent),
    mVID(0x04B4),
    mPID(0xF232),
    mUSBDevice(NULL),
    mDeviceHandle(NULL),
    mDeviceState(false),
    mLogger(0),
    mConnectorChecker(NULL),

    mSampleArrayGyroX(NULL),
    mSampleArrayGyroY(NULL),
    mSampleArrayGyroZ(NULL),

    mGyroXX({0,0,0}),
    mGyroXY({0,0,0}),

    mGyroYX({0,0,0}),
    mGyroYY({0,0,0}),

    mGyroZX({0,0,0}),
    mGyroZY({0,0,0}),
    mFilterType(FilterParams::NONE)
{
    slotInitUSB();
    mSampleArrayGyroX = new double[SAMPLE_COUNT];
    mSampleArrayGyroY = new double[SAMPLE_COUNT];
    mSampleArrayGyroZ = new double[SAMPLE_COUNT];
    for (int i = 0; i < SAMPLE_COUNT; i++)
    {
        mSampleArrayGyroX[i] = 0;
        mSampleArrayGyroY[i] = 0;
        mSampleArrayGyroZ[i] = 0;
    }

    mConnectorChecker = new QTimer(this);
    mConnectorChecker->setTimerType(Qt::PreciseTimer);
    connect(mConnectorChecker, SIGNAL(timeout()), this, SLOT(slotConnect()));
    mConnectorChecker->start(10000);
    slotConnect();
}
Exemplo n.º 8
0
void ATSkeletonWindow::slotItemActivated()
{
	QTreeWidgetItem *twi = ui.treeTunnels->currentItem();
	if ( twi == NULL ) return;

	ui.tabWidget->setCurrentIndex( PAGE_CONNECT );

	const Tunnel_c *pt = getTunnelFromTreeItem( twi );
	ATASSERT( pt );

	if (pt->pProcess)
		slotDisconnect();
	else
		slotConnect();
}
Exemplo n.º 9
0
int MyWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotConnect(); break;
        case 1: slotReadReady(); break;
        case 2: slotSendMessage(); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
Exemplo n.º 10
0
void MainWidget::slotConnectInternet()
{	
	if (LineEdit1->text() == QString(""))
	{
		NoticeDlg = new ZNoticeDlg(ZNoticeDlg::Type(0),"Введите текст для перевода!","",this);
		NoticeDlg->setTitle("Ошибка:");
		QPixmap pixmap = QPixmap(QString("img/notice/error.png"));
		NoticeDlg->setTitleIcon(pixmap);
		NoticeDlg->exec();
		delete NoticeDlg;
		return;
	}
/*	
	if (GPRS_Profile_Old != GPRS_Profile)
	{
		nconnect = false;
		GPRS_Profile_Old = GPRS_Profile;
		if (netconnection)
		{
			netconnection->Disconnect();
			delete netconnection;
		}
	}
*/	
	if (!nconnect)
	{
		if (GPRS_Profile == "0")
		{
			QStringList qslList = NAPIManager::getProfiles();
			ZSingleSelectDlg *dlg = new ZSingleSelectDlg("Выберите профиль:", "", this);
			dlg->addItemsList(qslList);
			if ( dlg->exec() == QDialog::Accepted )
			{
				int n=dlg->getCheckedItemIndex();
				if (n>=0){
					netconnection = new Connection(this);
					connect(netconnection, SIGNAL(connected()), SLOT(slotConnect()));
					
					connect(&socket, SIGNAL(connected()), this, SLOT(next()));
					connect(&socket, SIGNAL(error(int)), this, SLOT(error(int))); 
					connect(&socket, SIGNAL(readyRead()), this, SLOT(bytesWritten()));	
		
					netconnection->Connect(*(qslList.at(n)));
					nconnect = true;
					}
			}
Exemplo n.º 11
0
void Harmonizer::slotConnect()
{
    comport->setPortName(comboPorts->currentText());
    comport->open(QextSerialPort::ReadWrite);

    if (comport->isOpen())
    {
        ui->memo->appendPlainText(trUtf8("Připojeno"));
        butConnect->setText("Odpojit");
        disconnect(butConnect,SIGNAL(clicked()),this,SLOT(slotConnect()));
        connect(butConnect,SIGNAL(clicked()),this,SLOT(slotDisconnect()));
        roznout(true);
    }
    else
    {
        ui->memo->appendPlainText(trUtf8("Nepovedlo se připojit!!!!!"));
    }
}
Exemplo n.º 12
0
MyWidget::MyWidget(QWidget *parent) :
    QWidget(parent)
{
    server = new QTcpServer(this);
    server->listen(QHostAddress::Any, 8900);

    connect(server, SIGNAL(newConnection()), this, SLOT(slotConnect()));

    edit1 = new QTextEdit();
    edit2 = new QTextEdit();
    button = new QPushButton("Send");

    quit = new  QPushButton("Quit");
    connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));

    #if 1
    QVBoxLayout* rightLayout = new QVBoxLayout();
    rightLayout->addWidget(button);
    rightLayout->addWidget(quit);

    QHBoxLayout* downLayout = new QHBoxLayout();
    downLayout->addWidget(edit1, 10);
    downLayout->addLayout(rightLayout);

    QVBoxLayout* layout = new QVBoxLayout();
    layout->addWidget(edit2, 1);
    layout->addLayout(downLayout);
    #endif

    #if 0
    QVBoxLayout* layout = new QVBoxLayout();
    layout->addWidget(edit2, 10);
    layout->addWidget(edit1, 1);
    layout->addWidget(button);
    layout->addWidget(quit);
    #endif

    setLayout(layout);
    setWindowTitle(tr("Dialog"));
    //setFixedHeight(sizeHint().height());

    connect(button, SIGNAL(clicked()), this, SLOT(slotSendMessage()));

}
int CouchDBQtChangeNotifier::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            notification((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QVariant(*)>(_a[2])));
            break;
        case 1:
            slotNotification((*reinterpret_cast< const QHttpResponseHeader(*)>(_a[1])));
            break;
        case 2:
            slotConnect((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])));
            break;
        default:
            ;
        }
        _id -= 3;
    }
    return _id;
}
Exemplo n.º 14
0
void PageNet::connectSignals()
{
    connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect()));
}
Exemplo n.º 15
0
void KardView::game()
{
    co = 0;
    count = 0;
    tries = 0;
    emit signalChangeStatusbar(i18n("Tries: %1", tries), IDS_TRY);

    if (theme == "syllables")
	loadSyllables();
    else if (theme != "colors") {
	loadPixmaps();
    }
    m_listButtons.clear();

    switch ( noc )  {
	case 4:
		n=2;
		m=2;
	break;

	case 8:
		n=2;
		m=4;
	break;

	case 12:
		n=3;
		m=4;
	break;

	default:
	case 16:
		n=4;
		m=4;
	break;

	case 20:
		n=5;
		m=4;
	break;

	case 24:
		n=4;
		m=6;
	break;
    }
    setAutoFillBackground(true);
    //create the GUI
    grid = new QGridLayout;
    grid->setSpacing(3);
    grid->setMargin(2);
    //create the cards
    for (int i=0; i<n; i++)  {
	for (int j=0; j<m; j++)  {
	    k[i][j]=new KardWidget(this, "wid");
	    grid->addWidget( k[i][j], i, j );
	    m_listButtons.append(k[i][j]);
	    k[i][j]->m_kardW->setAutoFillBackground(true);
	    k[i][j]->m_gray->setAutoFillBackground(true);
	    k[i][j]->show();
	}
    }
    setLayout(grid);
    /*QPalette pal;
    pal.setBrush( QPalette::Window, Qt::darkGray);
    setPalette(pal);*/

    //choose the cards colors in random
    srand((unsigned int)time((time_t *)NULL));
    int p= rand()%24;       //p will be the first colour
    if (p%2==1) {
	p=(p+1)%24; //p must be even
    }
    //shuffle the cards
    for (int i=0; i<noc; i++)  {
	t[i]=rand()%(noc);
	for (int j=0; j<i; j++)  {
	    if (t[i]==t[j])
		    i=i-1;
	}
    }
    int ni=0;
    for (int i=0; i<n; i++)  {
	for (int j=0; j<m; j++)  {
	    shuffle[i][j]=(t[ni]+p)%24;
	    QPalette pal;
	    switch (KardSettings::kardTheme()) {
		case KardSettings::EnumKardTheme::colors:
		    pal.setColor(QPalette::Active, QPalette::Window, QColor(a[shuffle[i][j]]));
		    k[i][j]->m_kardW->setPalette(pal);
		    break;
		case KardSettings::EnumKardTheme::house:
		    k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]);
		    k[i][j]->m_kardW->setScaledContents(true);
		    break;
		case KardSettings::EnumKardTheme::opposites:
		    k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]);
		    k[i][j]->m_kardW->setScaledContents(true);
		    break;
		case KardSettings::EnumKardTheme::syllables:
		    k[i][j]->m_kardW->setText(text[shuffle[i][j]]);
		    k[i][j]->m_kardW->setFont(QFont(KGlobalSettings::generalFont().family(), 44, QFont::Bold));
		    k[i][j]->m_kardW->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
		    k[i][j]->m_kardW->setScaledContents(true);
		    break;
		case KardSettings::EnumKardTheme::animals:
		    k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]);
		    k[i][j]->m_kardW->setScaledContents(true);
		    break;
		case KardSettings::EnumKardTheme::food:
		    k[i][j]->m_kardW->setPixmap(px[shuffle[i][j]]);
		    k[i][j]->m_kardW->setScaledContents(true);
		    break;
	    }
	    ni++;
	}
    }
    //enable the connections
    slotConnect();
    updateGeometry();//this is very important
}
Exemplo n.º 16
0
Harmonizer::Harmonizer(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Harmonizer)
{
    ui->setupUi(this);

    ui->butVypnout->setProperty("Command","off");
    ui->butZapnout->setProperty("Command","on");

    ui->spinBalance->setProperty("Command","volume");
    ui->spinKey->setProperty("Command","key");
    ui->spinMode->setProperty("Command","mode");
    ui->spinShift->setProperty("Command","harmony");

    connect(ui->butVypnout,SIGNAL(clicked()),this,SLOT(butSloty()));
    connect(ui->butZapnout,SIGNAL(clicked()),this,SLOT(butSloty()));

    connect(ui->spinBalance,SIGNAL(valueChanged(int)),this,SLOT(spinSloty(int)));
    connect(ui->spinKey,SIGNAL(valueChanged(int)),this,SLOT(spinSloty(int)));
    connect(ui->spinMode,SIGNAL(valueChanged(int)),this,SLOT(spinSloty(int)));
    connect(ui->spinShift,SIGNAL(valueChanged(int)),this,SLOT(spinSloty(int)));


    butConnect = new QPushButton;
    butConnect->setText(trUtf8("Připojit"));
    connect(butConnect,SIGNAL(clicked()),this,SLOT(slotConnect()));

    comboPorts = new QComboBox;
    ledka = new HLed;

    statusBar()->addPermanentWidget(comboPorts);
    statusBar()->addPermanentWidget(butConnect);
    statusBar()->addPermanentWidget(ledka);

    PortSettings nastaveni;
    nastaveni.BaudRate = BAUD115200;
    nastaveni.DataBits = DATA_8;
    nastaveni.FlowControl = FLOW_HARDWARE;
    nastaveni.Parity = PAR_NONE;
    nastaveni.StopBits = STOP_1;
    nastaveni.Timeout_Millisec = 100;

    comport = new QextSerialPort(nastaveni,QextSerialPort::EventDriven,this);
    QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
    connect(comport,SIGNAL(readyRead()),this,SLOT(comport_new_data()));
    QStringList list;

    for (int i = 0 ; i < ports.count() ; i++)
    {

    #ifdef Q_OS_WIN
         list << ports.at(i).portName;
    #else
        list << ports.at(i).physName;

    #endif

    }

    #ifndef Q_OS_WIN
    list << "/tmp/interceptty";
    #endif

    comboPorts->addItems(list);
    roznout(false);
}
Exemplo n.º 17
0
MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this) ;

    device = new epocDevice() ;
    th = new epocThread(device) ;
    timerDraw = new QTimer() ;
    timerDraw->setInterval(100) ;

    ui->graphSignal->setScene(&sceneSignal) ;

    QPixmap pix ;
    pix.fromImage(QImage("../epocWatch/images/head.jpg")) ;
    QGraphicsScene scenePosition ;
    ui->graphPosition->setScene(&scenePosition) ;
    scenePosition.addPixmap(pix) ;

    vecDataAF3.fill(0, 1024) ;
    vecDataAF4.fill(0, 1024) ;
    vecDataF3.fill(0, 1024) ;
    vecDataF4.fill(0, 1024) ;
    vecDataF7.fill(0, 1024) ;
    vecDataF8.fill(0, 1024) ;
    vecDataFC5.fill(0, 1024) ;
    vecDataFC6.fill(0, 1024) ;
    vecDataT7.fill(0, 1024) ;
    vecDataT8.fill(0, 1024) ;
    vecDataP7.fill(0, 1024) ;
    vecDataP8.fill(0, 1024) ;
    vecDataO1.fill(0, 1024) ;
    vecDataO2.fill(0, 1024) ;

    vecFoufou.fill(0, 1024) ;

    isCheckedAF34 = false ;
    isCheckedF34 = false ;
    isCheckedF78 = false ;
    isCheckedFC56 = false ;
    isCheckedO12 = false ;
    isCheckedP78 = false ;
    isCheckedT78 = false ;

    ui->progressDelta->setStyleSheet(ui->progressDelta->property("defaultStyleSheet").toString() +
                                       " QProgressBar::chunk { background: yellow; }") ;
    ui->progressTheta->setStyleSheet(ui->progressTheta->property("defaultStyleSheet").toString() +
                                       " QProgressBar::chunk { background: orange; }") ;
    ui->progressAlpha->setStyleSheet(ui->progressAlpha->property("defaultStyleSheet").toString() +
                                       " QProgressBar::chunk { background: blue; }") ;
    ui->progressBeta->setStyleSheet(ui->progressBeta->property("defaultStyleSheet").toString() +
                                       " QProgressBar::chunk { background: green; }") ;
    ui->progressGamma->setStyleSheet(ui->progressGamma->property("defaultStyleSheet").toString() +
                                       " QProgressBar::chunk { background: red; }") ;


    connect(ui->cbAF34, SIGNAL(clicked()), this, SLOT(slotChecked())) ;
    connect(ui->cbF34, SIGNAL(clicked()), this, SLOT(slotChecked())) ;
    connect(ui->cbF78, SIGNAL(clicked()), this, SLOT(slotChecked())) ;
    connect(ui->cbFC56, SIGNAL(clicked()), this, SLOT(slotChecked())) ;
    connect(ui->cbO12, SIGNAL(clicked()), this, SLOT(slotChecked())) ;
    connect(ui->cbP78, SIGNAL(clicked()), this, SLOT(slotChecked())) ;
    connect(ui->cbT78, SIGNAL(clicked()), this, SLOT(slotChecked())) ;
    connect(ui->cbAll, SIGNAL(clicked()), this, SLOT(slotCheckedAll())) ;

    connect(timerDraw, SIGNAL(timeout()), this, SLOT(slotDraw())) ;

    connect(ui->pbConnect, SIGNAL(clicked()), this, SLOT(slotConnect())) ;
    connect(ui->pbStart, SIGNAL(clicked()), this, SLOT(slotStart())) ;
    connect(ui->pbQuit, SIGNAL(clicked()), this, SLOT(close())) ;
}