int main(int argc, char* argv[]) { if (argc !=4) usage(); string hostsFile=argv[1]; ifstream diff(argv[2]); port = (unsigned short)atoi(argv[3]); if (diff.fail()) { cerr << "error: open diff file" << endl; usage(); } if (verbose) cout << "Reading diff..." << endl; assert(readChanges(diff)); if (verbose) cout << "Reading core info..." << endl; assert(getCores(hostsFile)); diff.close(); if (verbose) cout << "Getting addresses..."<<endl; errcheck(getAddrs()); if (verbose) cout << "Constructing stage data..."<<endl; errcheck(makeStages()); if (verbose) cout << "Opening connections..." << endl; errcheck(initConnections()); if (verbose) cout << "Transferring stage data..." << endl; errcheck(sendStages()); int i; for (i=0;i<3;i++) { if (verbose) cout << "Doing stage " << i << "..."<<endl; errcheck(doStage(i)); } if (verbose) cout << "Closing connections..." <<endl; errcheck(finishConnections()); if (verbose) cout<<"Reassign complete."<<endl; }
void RhoSettings::loadFromFile() { m_mapValues.clear(); m_mapChangedValues.clear(); String strSettings; CRhoFile::readStringFromFile(getConfFilePath().c_str(), strSettings); loadFromString( strSettings.c_str(), m_mapValues ); readChanges(); }
LogView::LogView(QWidget *parent) : QWidget(parent), watcher(parent) { ui.setupUi(this); setWindowTitle(QString::fromUtf8("Logfile viewer")); size = 0; changed = true; //To make sure the logfile exists and we can get its name ltr_int_log_message("Opening logfile viewer.\n"); const char *log_name = ltr_int_get_logfile_name(); watcher.addPath(QString::fromUtf8(log_name)); QObject::connect(&watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(const QString&))); lf = new QFile(QString::fromUtf8(log_name)); lf->open(QIODevice::ReadOnly); ts = new QTextStream(lf); timer = new QTimer(this); viewer = new QPlainTextEdit(this); ui.verticalLayout->insertWidget(0, viewer); QObject::connect(timer, SIGNAL(timeout()), this, SLOT(readChanges())); timer->start(250); }
ChangelogEntry ModXReader::readEntry() { ChangelogEntry entry; while (!atEnd()) { readNext(); if (isEndElement()) { break; } if (isStartElement()) { if (name() == "date") { entry.date = QDate::fromString(readElementText(), Qt::ISODate); } else if (name() == "rev-version") { entry.version = readElementText(); } else if (name() == "changelog") { QString lang = attributes().value("lang").toString(); entry.changes.insert(lang, readChanges()); } else { readUnknownElement(); } } } return entry; }