Exemplo n.º 1
0
StoreManageDialog::StoreManageDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::StoreManageDialog)
{
    ui->setupUi(this);

    settings = Settings::instance();
    logger   = Logger::logger();
    ttyhstore = new QProcess();

    ui->log->setFont( QFontDatabase::systemFont(QFontDatabase::FixedFont) );

    connect(ui->cancelButton, &QPushButton::clicked,
            this, &StoreManageDialog::cancel);

    connect(ui->actionButton, &QPushButton::clicked,
            this, &StoreManageDialog::runCommand);

    // Connect process
    connect(ttyhstore, &QProcess::started,
            this, &StoreManageDialog::onStart);

    connect( ttyhstore, SIGNAL( finished(int) ),
             this, SLOT( onFinish(int) ) );

    connect(ttyhstore, &QProcess::readyReadStandardOutput,
            this, &StoreManageDialog::onOutput);

    connect(ttyhstore, &QProcess::readyReadStandardError,
            this, &StoreManageDialog::onOutput);

    connect( ttyhstore, SIGNAL( error(QProcess::ProcessError) ),
             this, SLOT( onError(QProcess::ProcessError) ) );

    // Connect fetcher
    connect(&fetcher, &DataFetcher::finished,
            this, &StoreManageDialog::onVersionsReply);

    // Connect command combo
    connect( ui->commandCombo, SIGNAL( currentIndexChanged(int) ),
             this, SLOT( onCommandSwitched(int) ) );

    QStringList commands;
    commands << "collect" << "clone" << "cleanup";
    ui->commandCombo->addItems(commands);

    requestVersions();
}
// sends the version of the last execution time to all the replication daemons,
// then asks the pool replication daemons to send their own versions to it,
// sets a timer to wait till the versions are received
void
ReplicatorStateMachine::beforePassiveStateHandler()
{
    REPLICATION_ASSERT(m_state == VERSION_REQUESTING);
    
    dprintf( D_ALWAYS, 
			"ReplicatorStateMachine::beforePassiveStateHandler started\n" ); 
    broadcastVersion( REPLICATION_NEWLY_JOINED_VERSION );
    requestVersions( );

    dprintf( D_FULLDEBUG, "ReplicatorStateMachine::beforePassiveStateHandler "
			"registering version requesting timer\n" );
    m_versionRequestingTimerId = daemonCore->Register_Timer( 
		m_newlyJoinedWaitingVersionInterval,
       (TimerHandlercpp) &ReplicatorStateMachine::versionRequestingTimer,
       "Time to pass to VERSION_DOWNLOADING state", this );
}