コード例 #1
0
dCacheMainWindow::dCacheMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::dCacheMainWindow)
{
	ui->setupUi(this);
	this->setWindowTitle("dCache GUI"); //set title of the GUI

	m_logger = new Logger(this); //init Logger Widget
	m_proxy = new ProxyTools(this); //init Proxy handler object

	timertime = 500; //timer to update the GUI in ms

	/**
	 * Initialization of the member variables
	 */
	timeleft = 0;
	type = -1;
	InputDir = "";
	BaseDir = "";
	OutputDir = "";
	isLabview = false;
	isEUDAQ = false;
	isLED = false;
	isRaw = false;
	isOther = false;
	isSingleFile = false;
	type = -1;
	m_running = false;

	/**
	 * Connection of the signals and slots
	 */

	//Connect the GUI to forward message to the logger
	connect(this, SIGNAL(log(QString,QString)), m_logger, SLOT(Log(QString,QString)));

	//Connect the proxy object to forward message to the logger
	connect(m_proxy, SIGNAL(log(QString,QString)), m_logger, SLOT(Log(QString,QString)));
	//Connect the proxy to the GUI to prompt window when password is asked
	connect(m_proxy, SIGNAL(PasswordRequired()), this, SLOT(showPassword()));
	//Connect the proxy to the GUI to update the time of the proxy left
	connect(m_proxy, SIGNAL(ProxyStatus(QString)), this, SLOT(updateProxy(QString)));

	//Logging starting
	emit log("MESSAGE", "dCache-GUI started");

	m_logger->show();//Show the logger widget

	/**
	 * Connection of the different UI objects to slots
	 */
	connect(ui->StartProxy, SIGNAL(clicked(bool)), m_proxy, SLOT(StartProxy()));
	connect(ui->CheckProxy, SIGNAL(clicked(bool)), m_proxy, SLOT(CheckProxy()));

	connect(ui->Configure, SIGNAL(clicked(bool)), this, SLOT(Configure()));
	connect(ui->StartCopy, SIGNAL(clicked(bool)), this, SLOT(StartCopy()));
	connect(ui->StopCopy, SIGNAL(clicked(bool)), this, SLOT(StopCopy()));
	connect(ui->CheckCopy, SIGNAL(clicked(bool)), this, SLOT(CheckCopy()));
	connect(ui->ListFiles, SIGNAL(clicked(bool)), this, SLOT(ListFiles()));
	connect(ui->Exit, SIGNAL(clicked(bool)), this, SLOT(Close()));

	/**
	 * Initialization of the state of the buttons and input text
	 */
	ui->StartCopy->setEnabled(false);
	ui->StopCopy->setEnabled(false);
	ui->ListFiles->setEnabled(false);
	ui->toolButton->setEnabled(false);
	ui->InputDir->setReadOnly(true);
	ui->BaseDir->setReadOnly(true);
	ui->OutputDir->setReadOnly(true);
	ui->Configure->setEnabled(false);

	/**
	 * Initialization of some labels on the GUI
	 */
	ui->ProxyValid_label->setText("<font color='Red'>Check Proxy!</font>");
	//Native base directory for calice
	ui->BaseDir->setText("tb-desy/native/");
	ui->LastRun->setText(".....");

	/**
	 * Setup the timer and connect the timeout signal to the slot that updates the GUI
	 */
	timer = new QTimer();
	connect(timer, SIGNAL(timeout()), this, SLOT(updateMainWindow()));
	timer->start(timertime);//Updates every 500 ms
}
コード例 #2
0
void OpzioniDialog::on_okButton_clicked()
{
    globopt["use-proxy"] = m_ui->CheckUsaProxy->isChecked() ? "yes" : "no";
    globopt["use-proxy-auth"] = m_ui->usaAutenticazione->isChecked() ? "yes" : "no";
    globopt["proxy-port"] = m_ui->TextPort->text();
    globopt["proxy-username"] = m_ui->proxyUsername->text();
    globopt["proxy-password"] = m_ui->proxyPassword->text();
    globopt["proxy"] = m_ui->TextServer->text();

    if (m_ui->RadioHttp->isChecked())
        globopt["proxy-type"] = "http";
    else if (m_ui->RadioSocks5->isChecked())
        globopt["proxy-type"] = "socks5";

    globopt["auto-login"] = m_ui->opzAutoLogin->isChecked() ? "yes" : "no";

    // rimuovo intanto che non sono ancora implementate
    /*
    libJackSMS::dataTypes::optionsType::const_iterator iter=opt.find("language");
    if (iter == opt.end()) {
        globopt["language"] = m_ui->languageComboBox->currentText();
        translateGui();
        emit translate();
    } else {
        if (iter.value() != m_ui->languageComboBox->currentText()) {
            globopt["language"] = m_ui->languageComboBox->currentText();
            translateGui();
            emit translate();
        }
    }
    */

    libJackSMS::localApi::optionManager globOptMan("", globopt);

    try {
        globOptMan.save();
    } catch (libJackSMS::exceptionXmlError e) {
        QMessageBox::critical(this, "Freesmee", "Errore durante il salvataggio delle opzioni\n" + QString(e.what()));
    } catch (...) {
        QMessageBox::critical(this, "Freesmee", "Errore sconosciuto");
    }

    if (!loggedIn)
    {
        emit updateProxy();
    }
    else
    {
        // se autologin è su si allora dobbiamo anche salvare la password nelle opzioni
        if (globopt["auto-login"] == "yes")
            opt["password"] = pass;

        opt["save-local"] = m_ui->checkSalvalocale->isChecked() ? "yes" : "no";
        opt["successfull-send-popup"] = m_ui->successSmsPopup->isChecked() ? "yes" : "no";
        opt["display-captcha-popup"] = m_ui->captchaPopup->isChecked() ? "yes" : "no";
        opt["error-send-popup"] = m_ui->errorSmsPopup->isChecked() ? "yes" : "no";
        opt["svuota-invio-corretto"] = m_ui->opzSvuotaInvioCorretto->isChecked() ? "yes" : "no";
        opt["dont-cookies"] = m_ui->nonSalvaCookies->isChecked() ? "yes" : "no";
        opt["hide-service-update"] = m_ui->hideServiceUpdate->isChecked() ? "yes" : "no";
        opt["tray-style"] = m_ui->trayStyleCombo->currentText();

        opt["enable-jms-service"] = m_ui->enableJmsService->isChecked() ? "yes" : "no";

#ifndef __APPLE__
        opt["suono-free"] = m_ui->suonoJMS->isChecked() ? "yes" : "no";
#endif

        opt["show-popup-jms-status"] = m_ui->showPopupJmsStatus->isChecked() ? "yes" : "no";
        opt["show-popup-new-free"] = m_ui->showPopupNewJms->isChecked() ? "yes" : "no";

        // rimuovo intanto che non sono ancora implementate
        //opt["captcha-zoom"] = m_ui->comboZoomCaptcha->currentText();
        //opt["use-captcha"] = (m_ui->checkUseCaptcha->isChecked()) ? "yes" : "no";

        libJackSMS::localApi::optionManager optMan(userDirectory, opt);

        try {
            optMan.save();
        } catch (libJackSMS::exceptionXmlError e) {
            QMessageBox::critical(this, "Freesmee", "Errore durante il salvataggio delle opzioni\n"+QString(e.what()));
        } catch (...) {
            QMessageBox::critical(this, "Freesmee", "Errore sconosciuto");
        }
    }

    emit UpdateGuiFromOptions();
    close();
}