Exemple #1
0
/*------------------------------------------------------------------------------
 *  Open the connection
 *----------------------------------------------------------------------------*/
bool
CastSink :: open ( void )                       throw ( Exception )
{
    if ( isOpen() ) {
        return false;
    }

    if ( !getSink()->open() ) {
        return false;
    }

    if ( !sendLogin() ) {
        close();
        return false;
    }

    if ( streamDump != 0 ) {
        if ( !streamDump->isOpen() ) {
            if ( !streamDump->open() ) {
                reportEvent( 2, "can't open stream dump");
            }
        }
    }
    
    return true;
}
void connection::readData(const quint16 &length)
{
	if ( length < 10 )
	{
		protocolVersion = buffer->read(4);
		if ( (length -4) > 0 )
			buffer->read(length -4);
	}
	if ( !connectedToBos )
		emit sendLogin();
}
Exemple #3
0
bool ProtocolGame854::parsePacket(uint8_t cmd, NetworkMessage& msg)
{
    // example for overrides
    printf("%s\n", __PRETTY_FUNCTION__);
    printf("Packet %02x\n", cmd);
    switch(cmd){
    case 0x1F:
        //m_connection->setChecksumState(false);
        sendLogin(&msg);
        return true;
    }
    return ProtocolGame::parsePacket(cmd,msg);
}
Exemple #4
0
LoginDialog::LoginDialog(QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::LoginDialog),
    settings("cyan.com", "VaultManager")
{
    m_ui->setupUi(this);
    QDir dir(".");
    QStringList filters;
    filters.append("*.ini");
    dir.setNameFilters(filters);
    m_ui->shardSelectBox->insertItems(0, dir.entryList());
    QString shardName = settings.value("Shard", "").toString();
    int shardIndex = dir.entryList().indexOf(shardName);
    if(shardIndex == -1)
        shardIndex = 0;
    m_ui->shardSelectBox->setCurrentIndex(shardIndex);
    shardName = m_ui->shardSelectBox->itemText(shardIndex);
    recallShard(shardName);
    connect(m_ui->shardSelectBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(recallShard(QString)));
    connect(this, SIGNAL(accepted()), this, SLOT(sendLogin()));
}
Exemple #5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    db=QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName("mydb.sqlite");
    db.setPassword("qwerty");
    if(!db.open()){
        QMessageBox::information(this,"Message","Not connected");
    }
    //QString str="create table 'student'('number' integer PRIMARY KEY NOT NULL, 'fio' VARCHAR(36), 'group' integer);";
    /*model = new QSqlTableModel(0, db);
    model->setTable("student2");          // Имя таблицы базы данных.
    model->select();
    ui->tableView->setModel(model);*/
    ui->pushButton->setEnabled(false);
    ui->pushButton_4->setEnabled(false);
    ui->pushButton_5->setEnabled(false);
    ui->pushButton_3->setEnabled(false);
    formd=new DialogUpdate(this);
    form=new Dialog(this);
    forms=new Dialogsearch(this);
    forml=new Dialoglogin(this);
    //connect(ui->pushButton_4,SIGNAL(clicked()),this,SLOT(onButtonSend()));
    connect(this,SIGNAL(sendData(QString,QString,QString)),formd,SLOT(recieveData(QString,QString,QString)));
    connect(form,SIGNAL(refresh()),this,SLOT(onRefresh()));
    connect(formd,SIGNAL(refresh()),this,SLOT(onRefresh()));
    connect(forml,SIGNAL(sendLogin(QString, QString,QString)),this,SLOT(onLogin(QString,QString,QString)));
    connect(this,SIGNAL(sendTable(QString)),form,SLOT(onTable(QString)));
    connect(this,SIGNAL(sendTable(QString)),formd,SLOT(onTable(QString)));
    connect(this,SIGNAL(sendTable(QString)),forms,SLOT(onTable(QString)));
    QMessageBox::information(this,"Warnign!","You are working in costumer mod");
    ui->listWidget->addItems(db.tables());
    ui->lineEdit->setText("create table 'student'('number' integer PRIMARY KEY NOT NULL, 'fio' VARCHAR(36), 'group' integer)");
}