コード例 #1
0
ファイル: phrase.cpp プロジェクト: xingzb14/LearningProject
bool phrase::notget(QString English)//在词组学习界面点击“没记住”,调用这个函数,需要传给这个函数现在显示的英文
{
        QSqlDatabase db=createConnection();
        if(!db.isValid())return false;
        QSqlQuery sql15(db);
        sql15.exec("update phrase set time='unsure' where English='"+English+"'");//将时间归0方便下次调用
        return true;
}
コード例 #2
0
ファイル: RightSidebar.cpp プロジェクト: mnikn/ManageSystem
RightSidebar::RightSidebar(QWidget *parent) :
    QWidget(parent)
{
    initLayout();
    createConnection();
    slotGetAllApply();

}
コード例 #3
0
ファイル: phrase.cpp プロジェクト: xingzb14/LearningProject
bool phrase::doget(QString English)//在词组学习界面点击“记住了”调用这个函数,需要传给这个函数现在显示的英文
{
    QSqlDatabase db=createConnection();
    if(!db.isValid())return false;
    QSqlQuery sql14(db);
    sql14.exec("update phrase set note='learned' where English='"+English+"'");
    return true;
}
コード例 #4
0
void MediaList::refreshList() {
    if (createConnection()) {
        delete mediaList;
        mediaList = new QList<Media>;
        buildList();
        closeConnection();
    }
}
コード例 #5
0
void QmlProfilerClientManager::connectToTcpServer()
{
    if (m_connection.isNull()) {
        QTC_ASSERT(m_qmlclientplugin.isNull(), disconnectClient());
        createConnection();
        QTC_ASSERT(m_connection, emit connectionFailed(); return);
        m_connection->connectToHost(m_tcpHost, m_tcpPort.number());
    }
コード例 #6
0
	ClientController::ClientController()
		: mThread(new QThread())
	{
		mWorker = createWorker();

		mConnection = createConnection(mWorker);

		mThread->start();
	}
コード例 #7
0
ファイル: AsyncClientWorker.cpp プロジェクト: Hsin/fbthrift
AsyncRunner *AsyncClientWorker::createRunner(std::shared_ptr<TAsyncSocket> socket) {
  LoadTestClientPtr client = createConnection(socket);
  AsyncRunner *r = new AsyncRunner(getConfig(), getScoreBoard(),
                                   client, getConfig()->pickOpsPerConnection(),
                                   getConfig()->getAsyncOpsPerClient());
  clients_.push_back(r);
  r->startRun();
  return r;
}
コード例 #8
0
void MysqlConnectionPool::startConnections(int number){
	connection_number_=number;
	sLog.outString("Starting %d mysql connections", number);

	for(int i=0; i<number;i++){
		pool_[i] = createConnection();
	}

}
コード例 #9
0
ファイル: rocksdb_driver.cpp プロジェクト: ruo91/fastonosql
        common::Error createConnection(RocksdbConnectionSettings* settings, rocksdb::DB** context)
        {
            if(!settings){
                return common::make_error_value("Invalid input argument", common::ErrorValue::E_ERROR);
            }

            rocksdbConfig config = settings->info();
            return createConnection(config, context);
        }
コード例 #10
0
/*
  ARTHUR 27/11 : Création sur base du travail de Paul
 */
MediaList::MediaList() {
    db = new QSqlDatabase();
    mediaList = new QList<Media>();
    if (createConnection()) {
        buildList();
        closeConnection();
    } else {
        qDebug() << "Error !" << endl;
    }
}
コード例 #11
0
ファイル: main.cpp プロジェクト: Andreas665/qt
//! [0]
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    if (!createConnection())
        return 1;

    TableEditor editor("person");
    editor.show();
    return editor.exec();
}
コード例 #12
0
        common::ErrorValueSPtr createConnection(LeveldbConnectionSettings* settings, leveldb::DB** context)
        {
            if(!settings){
                return common::make_error_value("Invalid input argument", common::ErrorValue::E_ERROR);
            }

            leveldbConfig config = settings->info();
            SSHInfo sinfo = settings->sshInfo();
            return createConnection(config, sinfo, context);
        }
コード例 #13
0
ファイル: SpiceInfo.cpp プロジェクト: ray-zong/spice
//查询主要成分的模糊匹配字段//
QStringList SpiceInfo::queryHazyContent(const QString &name)
{
    QStringList listText;

    QSqlDatabase db;
    if(!createConnection(db))
    {
        // 连接使用完后需要释放回数据库连接池
        ConnectionPool::closeConnection(db);
        return listText;
    }

    bool isChinese = name.contains(QRegExp("[\\x4e00-\\x9fa5]+"));

    QSqlQuery query(db);
    QString text;
    //content
    if(!isChinese)
    {
        query.prepare("SELECT englishName FROM content WHERE englishName like :englishName");
        query.bindValue(":englishName","%" + name + "%");
        if(!query.exec())
        {
            qDebug() << __FILE__ << __LINE__ << query.lastError().text();
        }

        while(query.next())
        {
            text = query.value(0).toString();
            if(!text.isEmpty())
            {
                listText << text;
            }
        }
    }

    query.prepare("SELECT chineseName FROM content WHERE chineseName like :chineseName");
    query.bindValue(":chineseName","%" + name + "%");
    if(!query.exec())
    {
        qDebug() << __FILE__ << __LINE__ << query.lastError().text();
    }

    while(query.next())
    {
        text = query.value(0).toString();
        if(!text.isEmpty())
        {
            listText << text;
        }
    }
    // 连接使用完后需要释放回数据库连接池
    ConnectionPool::closeConnection(db);
    return listText;
}
コード例 #14
0
ファイル: main.cpp プロジェクト: Mr-Phoebe/QT-learning
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    if (!createConnection())
        return 1;

    MainWindow w;
    w.show();

    return a.exec();
}
コード例 #15
0
ファイル: maemosshthread.cpp プロジェクト: gidlbn/dlbn_02
bool MaemoSshDeployer::runInternal()
{
    createConnection();
    if (!m_connection->start())
        return false;
    if (stopRequested())
        return true;

    connect(m_connection.data(), SIGNAL(fileCopied(QString)),
            this, SIGNAL(fileCopied(QString)));
    return m_connection->transferFiles(m_deploySpecs);
}
コード例 #16
0
void NewAccount::on_RegisterButton_clicked()
{
       //Password confirmation handled by Signals and Slots...Get the Inputs

       New_username = ui->NewUsernameBox->text();
       New_password = ui->NewPasswordBox->text();
       Confirm_password = ui->ConfirmPasswordBox->text();

       QString Reg_query, M_id_Label = "MID";

       if(confirm_password_check() && createConnection())
       {
           //Hash the password
           QByteArray password_hashkey ;
           password_hashkey.append(New_password);
           QCryptographicHash passwordHasher(QCryptographicHash::Sha1);
           passwordHasher.addData(password_hashkey);
           QByteArray hash_key_result = passwordHasher.result();
           qDebug()<< "New-account, reg button clicked"+hash_key_result;

           M_id_Label.append(char(M_id));

           QSqlDatabase db=QSqlDatabase::database("passwordmanager");
           QSqlQuery Reg_query(db);
           Reg_query.prepare("INSERT INTO pwmanager (Username,MasterPassword) VALUES(:username,:password)");
           //Reg_query.bindValue(":mid",M_id_Label); //this is not working as expected o.O :D
           Reg_query.bindValue(":username",New_username);
           Reg_query.bindValue(":password",hash_key_result);
           Reg_query.exec();
           if(!Reg_query.exec())
           {
               QMessageBox::information(this,"Error", Reg_query.lastError().text());
           }
           else
           {
               QMessageBox::StandardButton registered;
               registered = QMessageBox::information(this,"Successfull Register","Your account has been registered!<br>Please log in to continue!");
               if(registered)
               {
                   Dialog *s = new Dialog;
                   s->show();
                   db.close();
                   close();
               }

               M_id++; // thought of unique ID this way, but resets when quitting :D
           }



       }
}
コード例 #17
0
Login::Login(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Login)
{
    loginCount=1;
    ui->setupUi(this);
    if (createConnection())
    {
        ui->label_status->setText("Database is connected");
    }
    else
        ui->label_status->setText("Database is not connected");
}
コード例 #18
0
ファイル: main.cpp プロジェクト: Ladis72/tienda
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    conf = new Configuracion;
    if (!createConnection())
        return 1;

    Tienda w;
    w.show();
    
    return a.exec();
}
コード例 #19
0
void ConnectionFactory::fullConection(NeuronLayer *fromLayer, NeuronLayer *toLayer) {
	
    for(Neuron *fromNeuron : fromLayer->getNeurons()) {
        for (Neuron *toNeuron : toLayer->getNeurons()) {
				if (!dynamic_cast<BiasNeuron*>(toNeuron)) {
					Connection *conn = createConnection(fromNeuron, toNeuron);
					toNeuron->addInputConnection(conn);
					fromNeuron->addOutputConnection(conn);
				}
			}
		}

}
コード例 #20
0
ファイル: main.cpp プロジェクト: dnkbln/Housekeepingbook
int main(int argc, char *argv[])
{

    QApplication app(argc, argv);

    if (!createConnection())
        return 1;

    HousekeepingBookWindow window;
    window.show();

    return app.exec();
}
コード例 #21
0
Node::Node () :
  processing_interval_(0.1), keyframe_interval_(60.0),
  base_frame_("base_footprint"), fixed_frame_("map"),
  diff_coll_("ros_logging.robot_state_log"),
  joint_name_coll_("ros_logging.joint_state_names"),
  distance_threshold_(0.01), conn_(createConnection("localhost", 27017)),
  state_sub_(nh_.subscribe("joint_states", 1, &Node::jointStateCB, this))
{
  conn_->ensureIndex(diff_coll_, BSON("receipt_time" << 1));
  conn_->ensureIndex(diff_coll_, BSON("keyframe" << 1));
  conn_->ensureIndex(diff_coll_, BSON("pose" << "2d"));
  ROS_INFO ("Robot state logger initialized");
}
コード例 #22
0
ファイル: main.cpp プロジェクト: shutup/smart_home
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
//    Widget w;
//    w.show();

    MainWindow m;
    m.show();
    if (!createConnection())
        return 1;

    return a.exec();
}
コード例 #23
0
ファイル: main.cpp プロジェクト: zweecn/Bowling
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QTextCodec *codec = QTextCodec::codecForName("gb2312");
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForTr(codec);

    app.setApplicationName("bowling");
    QPixmapCache::setCacheLimit(100 * 1024); // 100 MB
    if (!createConnection())
            return -1;

    const char *map =
            "#####=######"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          *"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          $"
            "#          #"
            "#          #"
            "#######(####";

    QVector<Light> lights;
    lights << Light(QPointF(3.5, 2.5), 1)
           << Light(QPointF(3.5, 6.5), 1)
           << Light(QPointF(1.5, 10.5), 0.3);

    MazeScene *scene = new MazeScene(lights, map, 12, 20);

    View view;
    view.resize(800, 600);
    view.setScene(scene);
    view.show();

    scene->toggleRenderer();

    return app.exec();
}
コード例 #24
0
ファイル: scaffold.c プロジェクト: dzerbino/oases
static void computeLocalNodeToNodeMappingsFromConnections(Connection *
							  connect,
							  Connection *
							  connect2)
{
	Node *node1 = getTwinNode(getConnectionDestination(connect));
	Node *node2 = getTwinNode(getConnectionDestination(connect2));
	IDnum nodeID1 = getNodeID(node1);
	IDnum nodeID2 = getNodeID(node2);
	Coordinate distance =
	    getNodeLength(node1)/2 + getNodeLength(node2)/2;
	Arc *arc;

	if (getUniqueness(node1) || getUniqueness(node2))
		return;


	if ((arc = getArcBetweenNodes(node1, node2, graph))
	    && !getConnectionBetweenNodes(node1, getTwinNode(node2))) {
		createConnection(nodeID1, -nodeID2, getMultiplicity(arc),
				 0, distance,
				 1 / (double) getMultiplicity(arc));
		incrementConnectionWeight(getConnectionBetweenNodes
					  (node1, getTwinNode(node2)),
					  getMultiplicity(arc));
	}

	if ((arc = getArcBetweenNodes(node2, node1, graph))
	    && !getConnectionBetweenNodes(node2, getTwinNode(node1))) {
		createConnection(nodeID2, -nodeID1, getMultiplicity(arc),
				 0, distance,
				 1 / (double) getMultiplicity(arc));
		incrementConnectionWeight(getConnectionBetweenNodes
					  (node2, getTwinNode(node1)),
					  getMultiplicity(arc));
	}

}
コード例 #25
0
void ConnectionDialog::connectToBDD()
{
    QString id= m_id->text();
    QString password= m_password->text();

    bool connected= createConnection(id, password);
    if( connected){
        writeSettings();
        accept();
    }
    else{
        QMessageBox::information( this, "Connexion", "La connexion à échouer");
    }
}
コード例 #26
0
ファイル: main.cpp プロジェクト: maxxant/qt
//! [0]
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    if (!createConnection())
        return 1;

    TableEditor editor("person");
#if defined(Q_OS_SYMBIAN)
    editor.showMaximized();
#else
    editor.show();
#endif
    return app.exec();
}
コード例 #27
0
ファイル: RaftConsensus.cpp プロジェクト: joegen/oss_core
RaftConsensus::Connection::Ptr RaftConsensus::findOrCreateConnection(Node& node)
{
  Connection::Ptr pConnection;
  pConnection = findConnection(node.getId());
  if (!pConnection)
  {
    pConnection = createConnection(node);
    if (pConnection)
    {
      storeConnection(node.getId(), pConnection);
    }
  }
  return pConnection;
}
コード例 #28
0
ファイル: main.cpp プロジェクト: RSATom/Qt
int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(masterdetail);

    QApplication app(argc, argv);

    if (!createConnection())
        return EXIT_FAILURE;

    QFile albumDetails("albumdetails.xml");
    MainWindow window("artists", "albums", &albumDetails);
    window.show();
    return app.exec();
}
コード例 #29
0
ファイル: QCaLineEdit.cpp プロジェクト: emayssat/sandbox
/*!
    Start updating.
    Implementation of VariableNameManager's virtual funtion to establish a connection to a PV as the variable name has changed.
    This function may also be used to initiate updates when loaded as a plugin.
*/
void QCaLineEdit::establishConnection( unsigned int variableIndex ) {

    // Create a connection.
    // If successfull, the QCaObject object that will supply data update signals will be returned
    qcaobject::QCaObject* qca = createConnection( variableIndex );

    // If a QCaObject object is now available to supply data update signals, connect it to the appropriate slots
    if(  qca ) {
        QObject::connect( qca,  SIGNAL( stringChanged( const QString&, QCaAlarmInfo&, QCaDateTime&, const unsigned int& ) ),
                          this, SLOT( setTextIfNoFocus( const QString&, QCaAlarmInfo&, QCaDateTime&, const unsigned int& ) ) );
        QObject::connect( qca,  SIGNAL( connectionChanged( QCaConnectionInfo& ) ),
                          this, SLOT( connectionChanged( QCaConnectionInfo& ) ) );
    }
}
コード例 #30
0
ファイル: maemosshthread.cpp プロジェクト: gidlbn/dlbn_02
bool MaemoSshRunner::runInternal()
{
    createConnection();
    connect(m_connection.data(), SIGNAL(remoteOutput(QByteArray)),
            this, SLOT(handleRemoteOutput(QByteArray)));
    initState();
    if (!m_connection->start())
        return false;
    if (stopRequested())
        return true;

    waitForStop();
    return !m_connection->hasError();
}