Example #1
0
void KArtsModule::slotTestSound()
{
	if (configChanged && (userSavedChanges() == KMessageBox::Yes) || !artsdIsRunning() )
		restartServer();

	KProcess test;
	test << "artsplay";
	test << locate("sound", "KDE_Startup_1.ogg");
	test.start(KProcess::DontCare);
}
Example #2
0
void KArtsModule::save()
{
	if (configChanged) {
		configChanged = false;
		saveParams();
		restartServer();
		updateWidgets();
	}
	emit changed( false );
}
Example #3
0
    TEST_F(ShardConnFixture, InvalidateBadConnInPool) {
        ShardConnection conn1(TARGET_HOST, "test.user");
        ShardConnection conn2(TARGET_HOST, "test.user");
        ShardConnection conn3(TARGET_HOST, "test.user");

        conn1.done();
        conn3.done();

        const uint64_t badCreationTime = mongo::curTimeMicros64();
        killServer();

        try {
            conn2.get()->query("test.user", mongo::Query());
        }
        catch (const mongo::SocketException&) {
        }

        conn2.done();

        restartServer();
        checkNewConns(assertGreaterThan, badCreationTime, 10);
    }
Example #4
0
    TEST_F(ShardConnFixture, BadConnClearsPoolWhenKilled) {
        ShardConnection conn1(TARGET_HOST, "test.user");
        ShardConnection conn2(TARGET_HOST, "test.user");
        ShardConnection conn3(TARGET_HOST, "test.user");

        conn1.done();
        killServer();

        try {
            conn3.get()->query("test.user", mongo::Query());
        }
        catch (const mongo::SocketException&) {
        }

        restartServer();

        const uint64_t badCreationTime = conn3.get()->getSockCreationMicroSec();
        conn3.kill();
        // attempting to put a 'bad' connection back to the pool
        conn2.done();

        checkNewConns(assertGreaterThan, badCreationTime, 10);
    }
ServerWindow::ServerWindow(QWidget* parent)
    :QWidget(parent)
{
    setWindowTitle("Qt TasServer Ui");

    monitor = new ServerMonitor();

    statusButton = new QPushButton("Check status");
    stopButton = new QPushButton("Stop");
    startButton = new QPushButton("Start");
    resetButton =  new QPushButton ("Reset server");
    loadPluginsButton = new QPushButton("Load Plugins");
#ifdef Q_OS_SYMBIAN
    pluginButton = new QPushButton ("Enable tas");    
    autoStart = new QCheckBox("Autostart"); 
    autoStart->setTristate(false);
    if(monitor->autostartState()){
        autoStart->setCheckState(Qt::Checked);
    }
    connect(autoStart, SIGNAL(toggled(bool)), monitor, SLOT(setAutoStart(bool)));
#endif

    QLabel* stateLabel = new QLabel("Server state:");
    QLabel* versionLabel = new QLabel("Server version:");   
    QLabel* stateValue = new QLabel("Unknown");
    QLabel* versionValue = new QLabel(TAS_VERSION);


    QLabel* hostBindingLabel =  new QLabel("Server Address Binding:");
    anyBindRadioButton = new QRadioButton("Any");
    localBindRadioButton = new QRadioButton("Localhost");
    anyBindRadioButton->setDisabled(true);
    localBindRadioButton->setDisabled(true);

    connect(monitor, SIGNAL(serverState(const QString&)), stateValue, SLOT(setText(const QString&)));
    connect(monitor, SIGNAL(beginMonitor()), this, SLOT(disableButtons()));
    connect(monitor, SIGNAL(stopMonitor()), this, SLOT(enableButtons()));
    connect(monitor, SIGNAL(disableReBinding()), this, SLOT(disableRadioButtons()));
    connect(monitor, SIGNAL(enableReBinding(const QString&)), this, SLOT(enableRadioButtons(const QString&)));

    QTextEdit* editField = new QTextEdit();
    editField->setReadOnly(true);
    connect(monitor, SIGNAL(serverDebug(const QString&)), editField, SLOT(append(const QString&)));

    connect(startButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(stopButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(resetButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(statusButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(loadPluginsButton, SIGNAL(clicked()), editField, SLOT(clear()));


    connect(anyBindRadioButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(localBindRadioButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(anyBindRadioButton, SIGNAL(clicked()), monitor, SLOT(setAnyBinding()));
    connect(localBindRadioButton, SIGNAL(clicked()), monitor, SLOT(setLocalBinding()));


#ifdef Q_OS_SYMBIAN
    connect(pluginButton, SIGNAL(clicked()), editField, SLOT(clear()));
    connect(pluginButton, SIGNAL(clicked()), monitor, SLOT(enablePluginLoad()));
#endif

    connect(statusButton, SIGNAL(clicked()), monitor, SLOT(serverState()));    
    connect(stopButton, SIGNAL(clicked()), monitor, SLOT(stopServer()));
    connect(startButton, SIGNAL(clicked()), monitor, SLOT(startServer()));
    connect(resetButton, SIGNAL(clicked()), monitor, SLOT(restartServer()));    
    connect(loadPluginsButton, SIGNAL(clicked()),monitor, SLOT(loadPlugins()));

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

    QGridLayout* mainLayout = new QGridLayout();
    mainLayout->addWidget(stateLabel, 0, 0, 1, 1);
    mainLayout->addWidget(stateValue, 0, 1, 1, 1);
    mainLayout->addWidget(versionLabel, 1, 0);
    mainLayout->addWidget(versionValue, 1, 1);

    // Server binding Radio
    mainLayout->addWidget(hostBindingLabel, 2, 0);
    mainLayout->addWidget(anyBindRadioButton, 2, 1);
    mainLayout->addWidget(localBindRadioButton, 3, 1);

    mainLayout->addWidget(editField, 4,0, 1, 2);
#ifdef Q_OS_SYMBIAN
    mainLayout->addWidget(statusButton, 5, 0);
    mainLayout->addWidget(pluginButton, 5, 1);
#else
    mainLayout->addWidget(statusButton, 5, 0);
    mainLayout->addWidget(loadPluginsButton, 5, 1);
#endif
    mainLayout->addWidget(stopButton, 6, 0);
    mainLayout->addWidget(startButton, 6, 1);
    mainLayout->addWidget(resetButton, 7, 0);
    mainLayout->addWidget(quitButton, 7, 1);
#ifdef Q_OS_SYMBIAN
    mainLayout->addWidget(autoStart, 8, 0);
    mainLayout->addWidget(loadPluginsButton, 8, 1);
#endif
    setLayout(mainLayout);     

//    QRect rect = qApp->desktop()->screenGeometry();    
//    if(rect.width() > 864)
//        setFixedSize(350,600);
//    else{
//        showFullScreen();    
//    }

}
/**
 * 构造函数传入WorkingStatus status初始化界面
 * @param newsinglewidgetapp 是否为单一界面程序(采集程序有可能为单一界面程序,其结束方式与复界面程序不用) @see closeEvent方法
 * @param status 工作状态,@see status.h
 * Collecting = 1 采集时
 * Calculating_Backuping = 5 计算备份同时进行
 */
MainWidget::MainWidget(bool newsinglewidgetapp, WorkingStatus initstatus, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWidget)
{
    ui->setupUi(this);

    // 初始化结束方式
    singlewidgetapp = newsinglewidgetapp;

    // 初始化工作状态
    workingstatus = initstatus;

    // 初始时采集工程文件名为空
    projectfilename = "";

    // 默认用户不知道是谁
    currentusername = "******";

    // 在主界面连接主控底层服务信号槽
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(makeGUIActive(WorkingStatus, bool)), this, SLOT(msgToGUICreateProjectWidget(WorkingStatus, bool)));
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(signalMsgToGUI(WorkingStatus, QString)), this, SLOT(appendMsg(WorkingStatus, QString)));
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(signalErrorToGUI(WorkingStatus, QString)), this, SLOT(appendError(WorkingStatus, QString)));
    // [采集转发消息]
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(signalToLights(HardwareType, QString, HardwareStatus)), this, SLOT(changeHardwareStatus(HardwareType, QString, HardwareStatus)));
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(signalToCameraFC(QString, qint64)), this, SLOT(changeCameraFC_slot(QString, qint64)));
    // [采集、计算、备份转发消息]
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(signalToCameraTask(WorkingStatus, QString, int, QString, QString)), this, SLOT(changeSlaveCameraTask_slot(WorkingStatus, QString, int, QString, QString)));
    // [计算转发消息]
    // 每个从控每个线程每个任务帧号反馈消息转发
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(signalToCameraTaskFC(WorkingStatus, QString, int, QString, long long)), this, SLOT(changeSlaveCameraTaskFC_slot(WorkingStatus, QString, int, QString, long long)));
    // 每个从控每个线程每个任务初始化界面(起始帧、终止帧)消息转发
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(signalToSlaveCameraTaskFC_init(WorkingStatus, QString, int, QString, long long, long long)), this, SLOT(changeSlaveCameraTaskFC_init_slot(WorkingStatus, QString, int, QString, long long, long long)));
    // [计算备份转发消息]
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(calcubackupProgressingBar(WorkingStatus, QString, int, int, int, bool)), this, SLOT(changecalcubackupProgressingBar_slot(WorkingStatus, QString, int, int, int, bool)));
    
    connect(MasterProgram::getMasterProgramInstance(), SIGNAL(turnOffAllHardware()), this, SLOT(turnOffLights()));
    //connect(MasterProgram::getMasterProgramInstance(), SIGNAL(makeGUIActive(bool)), this, SLOT(getCalcuBackupGUIActive(bool)));

    // 重启服务器按钮信号槽
    connect(ui->restartServerButton, SIGNAL(clicked()), this, SLOT(restartServer()));
    // 关闭服务器
    connect(ui->closeServerButton, SIGNAL(clicked()), this, SLOT(closeServer()));
 
    // 初始时关闭所有提示灯
    turnOffLights();
    // 开启网络连接从控计算机提示灯
    initConnectedSlaves();

    /******设置采集机、备份机、相机的状态,正常或者不正常**********/
    //   statuscollectmessage为从控机发送过来的采集机和备份机的状态信息,如0表示正常,则显示为黄色,1表示异常,则显示为红色。
    //     if 采集机异常
    //     ui->slave1Label_net->setPixmap(QPixmap(":/image/lightred.png"));

    this->setWindowTitle(QObject::tr("铁路隧道建筑限界测量系统-主控终端"));
    QIcon icon;
    icon.addFile(QString::fromUtf8(":image/icon.png"), QSize(), QIcon::Normal, QIcon::Off);
    this->setWindowIcon(icon);

    // 功能,设置小图标变灰
    ui->collectstatuslabel->setPixmap(QString::fromUtf8(":image//collectstatus1_2.png"));
    ui->backupstatuslabel->setPixmap(QString::fromUtf8(":image//up_alt_2.png"));
    ui->calculatestatuslabel->setPixmap(QString::fromUtf8(":image//Calculatorstatus1_2.png"));

    // 导入已有工程、创建新工程界面
    CreateProjectWidget * cpwidget = new CreateProjectWidget(workingstatus, ui->createprojwidget);
    connect(cpwidget, SIGNAL(sendproject_file_name(QString)), this, SLOT(slotprojectfilename(QString)));
    connect(this, SIGNAL(setCreateProjectWidgetEnabled(bool)), cpwidget, SLOT(setWidgetEnabled(bool)));

    // @author 范翔 3个界面合二为一之后,关闭重启服务器两个按钮无效
    ui->closeServerButton->setVisible(false);
    ui->restartServerButton->setVisible(false);

    if (workingstatus == Collecting)
    {        
        // Tab界面布局
        // ui->gridLayout_5是整个Window的最外层布局Layout。可从.ui文件中找出
        ui->gridLayout_5->addWidget(ui->page, 4, 0);
        CollectWidget * collectWidget = new CollectWidget(ui->page, MasterSetting::getSettingInstance()->getDefaultDistanceMode());

        QGridLayout *layout5 = new QGridLayout();
        layout5->addWidget(collectWidget);
        ui->page->setLayout(layout5);

        // 得到帧间隔里程
        connect(this, SIGNAL(sendproject_file_name(QString)), collectWidget,SLOT(getDistanceMode(QString)));

        // 界面信号槽
        connect(this, SIGNAL(changeCameraStatus(QString,HardwareStatus)), collectWidget, SLOT(changeCamera(QString, HardwareStatus)));
        connect(this, SIGNAL(changeLayserStatus(QString,HardwareStatus)), collectWidget, SLOT(changeLayser(QString, HardwareStatus)));
        connect(this, SIGNAL(changeCameraFC(QString,qint64)), collectWidget, SLOT(changeCameraFC(QString, qint64)));
        connect(this, SIGNAL(changeSlaveCameraTask(WorkingStatus, QString, int, QString, QString)), collectWidget, SLOT(changeCameraTask(WorkingStatus, QString, int, QString, QString)));
        connect(this, SIGNAL(turnOffAllHardware()), collectWidget, SLOT(turnOffHardwares()), Qt::DirectConnection);

        collectWidget->turnOffHardwares();

        // 【标记1】此处作废
        // 因为有master的单一实例模式+各种对应方法,此处无需接受底层界面发送的消息了,因为底层界面可以直接调用各类主控方法
        //connect(calcuWidget,SIGNAL(clicked111()),this,SLOT(sendToMaster(QString)));

        // 可以导入已有、创建新工程
        connect(ui->operationConfigButton, SIGNAL(clicked()), this, SLOT(configCurrentOperation()));
        connect(ui->operationConfigButton2, SIGNAL(clicked()), this, SLOT(configCurrentOperation2()));

        // 初始时的界面显示
        ui->page->setVisible(true);

        // projectclass
        projectclass = LzProjectClass::Collect;
        projectclassstr = "collect";
    }