void MConfig::applyDesktop() { if (toUserComboBox->currentText().isEmpty()) { QMessageBox::information(0, QString::null, tr("You must specify a 'copy to' destination. You can not copy to the desktop you are logged in to.")); return; } // verify int ans = QMessageBox::critical(0, QString::null, tr("Before copying, close all other applications. Be sure the copy to destination is large enough to contain the files you are copying. Copying between desktops may overwrite or delete your files or preferences on the destination desktop. Are you sure you want to proceed?"), tr("Yes"), tr("No")); if (ans != 0) { return; } QString fromDir = QString("/home/%1").arg(fromUserComboBox->currentText()); QString toDir = QString("/home/%1").arg(toUserComboBox->currentText()); if (docsRadioButton->isChecked()) { fromDir.append("/Documents"); toDir.append("/Documents"); } else if (qupRadioButton->isChecked()) { fromDir.append("/.config/.qupzilla"); toDir.append("/.config/.qupzilla"); } else if (sharedRadioButton->isChecked()) { fromDir.append("/Shared"); toDir.append("/Shared"); } fromDir.append("/"); setCursor(QCursor(Qt::WaitCursor)); if (syncRadioButton->isChecked()) { syncStatusEdit->setText(tr("Synchronizing desktop...")); } else { syncStatusEdit->setText(tr("Copying desktop...")); } disconnect(timer, SIGNAL(timeout()), 0, 0); connect(timer, SIGNAL(timeout()), this, SLOT(syncTime())); disconnect(proc, SIGNAL(started()), 0, 0); connect(proc, SIGNAL(started()), this, SLOT(syncStart())); disconnect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), 0, 0); connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(syncDone(int, QProcess::ExitStatus))); QString cmd = QString("rsync -qa "); if (syncRadioButton->isChecked()) { cmd.append("--delete-after "); } cmd.append(fromDir); cmd.append(" "); cmd.append(toDir); proc->start(cmd); }
void OptimisticTickSyncAlgo::timeStepStart(TIME currentTime) { #ifdef PROFILE if(!busywait) syncStart(); #endif if(currentTime < grantedTime){ if(this->isChild && comm!=NULL) comm->failTime=currentTime; return; } #if DEBUG_WITH_PROFILE CERR << "Start sync time step " << currentTime << " " << getCurTimeInMs() << endl; #elif DEBUG CERR << "Start sync time step " << currentTime << endl; #endif if(this->isChild){ //speculation worked so we kill the parent this->interface->waitforAll(); pid_t tempparId=this->parentPid; //try to send a kill signal comm->action=ACTION_SUCCESS; //detach from shm so parent can clean it. detachTimeShm(); becomeParent(); this->specFailTime=Infinity; #if DEBUG CERR << "I'm child my pid:" << this->mypid << "; killing parent " << tempparId << endl; #endif cout << "Success" << endl; //create new shared memory createTimeShm(); st->speculationSuceeded(currentTime); } else{ //cout << "I'm parent waiting for others!!" << endl; this->interface->waitforAll(); } }
WMTimer::WMTimer() { start_time = 0.0; syncStart(); }