void ServerMaintenanceTool::start_clicked() { std::string worldname = ui.cb_WorldName->currentText().toAscii().data(); AppendOutput("Starting world " + worldname + "..."); AppendOutput("In case of success the server status should go to ONLINE"); qApp->processEvents(); AppendOutput(_rch.StartWorld(worldname)); }
void ServerMaintenanceTool::update_clicked() { std::string worldname = ui.cb_WorldName->currentText().toAscii().data(); AppendOutput("Updating world " + worldname + "..."); AppendOutput("This operation can take up to several minutes..."); qApp->processEvents(); AppendOutput(_rch.UpdateWorld(worldname)); }
void ServerMaintenanceTool::stop_clicked() { std::string worldname = ui.cb_WorldName->currentText().toAscii().data(); AppendOutput("Stoping world " + worldname + "..."); AppendOutput("This operation takes up to several minutes..."); AppendOutput("In case of success the server status should go to OFFLINE"); qApp->processEvents(); AppendOutput(_rch.StopWorld(worldname)); }
int Console::Flush() { bool done_output = false; int num_running = 0; for(int i = 0; i < processes.GetCount(); i++) if(!!processes[i].process) num_running++; if(num_running) { int time = msecs(); for(int i = 0; i < processes.GetCount(); i++) { Slot& slot = processes[i]; if(!!slot.process) { Group& group = groups.GetAdd(slot.group); group.msecs += (time - slot.last_msecs) / num_running; group.raw_msecs += time - slot.last_msecs; slot.last_msecs = time; } } } bool running = false; for(int i = 0; i < processes.GetCount(); i++) { Slot& slot = processes[i]; if(!slot.process) continue; String s; slot.process->Read(s); if(!IsNull(s)) { done_output = true; if(slot.outfile) slot.outfile->Put(s); if(!slot.quiet) { if(console_lock < 0 || console_lock == i) { console_lock = i; AppendOutput(s); } else slot.output.Cat(s); } } if(!slot.process->IsRunning()) { Kill(i); if(slot.exitcode != 0 && verbosebuild) spooled_output.Cat("Error executing " + slot.cmdline + "\n"); if(console_lock == i) console_lock = -1; FlushConsole(); CheckEndGroup(); continue; } running = true; } return !running ? -1 : done_output ? 1 : 0; }
void CCommandLineDisplay::Output (const CString &sOutput, CG32bitPixel rgbColor) // Output // // Output the given string { int i; if (m_pFonts == NULL || m_pFonts->Console.GetAverageWidth() == 0) return; if (rgbColor.IsNull()) rgbColor = TEXT_COLOR; if (sOutput.IsBlank()) { AppendOutput(NULL_STR, rgbColor); return; } int cxCol = m_pFonts->Console.GetAverageWidth(); int iCols = Max(1, (RectWidth(m_rcRect) - (LEFT_SPACING + RIGHT_SPACING)) / cxCol); // Split into lines TArray<CString> Lines; m_pFonts->Console.BreakText(sOutput, (RectWidth(m_rcRect) - (LEFT_SPACING + RIGHT_SPACING)), &Lines); // Split the string into parts for (i = 0; i < Lines.GetCount(); i++) AppendOutput(Lines[i], rgbColor); }
void GroupCell::AppendInput(MathCell *cell) { if (m_input == NULL) { m_input = cell; } else { if (m_input->m_next == NULL) m_input->AppendCell(cell); else if (m_input->m_next->GetValue().Length() == 0) { delete m_input->m_next; m_input->m_next = m_input->m_nextToDraw = NULL; m_input->AppendCell(cell); } else { AppendOutput(cell); m_hide = false; } } }
RipCD::RipCD(QWidget* parent) : QDialog(parent), transcoder_(new Transcoder(this)), queued_(0), finished_success_(0), finished_failed_(0), ui_(new Ui_RipCD) { // Init ui_->setupUi(this); // Set column widths in the QTableWidget. ui_->tableWidget->horizontalHeader()->setResizeMode( kCheckboxColumn, QHeaderView::ResizeToContents); ui_->tableWidget->horizontalHeader()->setResizeMode( kTrackNumberColumn, QHeaderView::ResizeToContents); ui_->tableWidget->horizontalHeader()->setResizeMode(kTrackTitleColumn, QHeaderView::Stretch); // Add a rip button rip_button_ = ui_->button_box->addButton(tr("Start ripping"), QDialogButtonBox::ActionRole); cancel_button_ = ui_->button_box->button(QDialogButtonBox::Cancel); close_button_ = ui_->button_box->button(QDialogButtonBox::Close); // Hide elements cancel_button_->hide(); ui_->progress_group->hide(); connect(ui_->select_all_button, SIGNAL(clicked()), SLOT(SelectAll())); connect(ui_->select_none_button, SIGNAL(clicked()), SLOT(SelectNone())); connect(ui_->invert_selection_button, SIGNAL(clicked()), SLOT(InvertSelection())); connect(rip_button_, SIGNAL(clicked()), SLOT(ClickedRipButton())); connect(cancel_button_, SIGNAL(clicked()), SLOT(Cancel())); connect(close_button_, SIGNAL(clicked()), SLOT(hide())); connect(transcoder_, SIGNAL(JobComplete(QString, bool)), SLOT(JobComplete(QString, bool))); connect(transcoder_, SIGNAL(AllJobsComplete()), SLOT(AllJobsComplete())); connect(transcoder_, SIGNAL(JobOutputName(QString)), SLOT(AppendOutput(QString))); connect(this, SIGNAL(RippingComplete()), SLOT(ThreadedTranscoding())); connect(this, SIGNAL(SignalUpdateProgress()), SLOT(UpdateProgress())); connect(ui_->options, SIGNAL(clicked()), SLOT(Options())); connect(ui_->select, SIGNAL(clicked()), SLOT(AddDestination())); setWindowTitle(tr("Rip CD")); AddDestinationDirectory(QDir::homePath()); cdio_ = cdio_open(nullptr, DRIVER_UNKNOWN); if (!cdio_) { qLog(Error) << "Failed to read CD drive"; return; } else { i_tracks_ = cdio_get_num_tracks(cdio_); ui_->tableWidget->setRowCount(i_tracks_); for (int i = 1; i <= i_tracks_; i++) { QCheckBox* checkbox_i = new QCheckBox(ui_->tableWidget); checkbox_i->setCheckState(Qt::Checked); checkboxes_.append(checkbox_i); ui_->tableWidget->setCellWidget(i - 1, kCheckboxColumn, checkbox_i); ui_->tableWidget->setCellWidget(i - 1, kTrackNumberColumn, new QLabel(QString::number(i))); QString track_title = QString("Track %1").arg(i); QLineEdit* line_edit_track_title_i = new QLineEdit(track_title, ui_->tableWidget); track_names_.append(line_edit_track_title_i); ui_->tableWidget->setCellWidget(i - 1, kTrackTitleColumn, line_edit_track_title_i); } } // Get presets QList<TranscoderPreset> presets = Transcoder::GetAllPresets(); qSort(presets.begin(), presets.end(), ComparePresetsByName); for (const TranscoderPreset& preset : presets) { ui_->format->addItem( QString("%1 (.%2)").arg(preset.name_, preset.extension_), QVariant::fromValue(preset)); } // Load settings QSettings s; s.beginGroup(kSettingsGroup); last_add_dir_ = s.value("last_add_dir", QDir::homePath()).toString(); QString last_output_format = s.value("last_output_format", "ogg").toString(); for (int i = 0; i < ui_->format->count(); ++i) { if (last_output_format == ui_->format->itemData(i).value<TranscoderPreset>().extension_) { ui_->format->setCurrentIndex(i); break; } } ui_->progress_bar->setValue(0); ui_->progress_bar->setMaximum(100); }
GroupCell::GroupCell(int groupType, wxString initString) : MathCell() { m_input = NULL; m_output = NULL; m_hiddenTree = NULL; m_hiddenTreeParent = NULL; m_outputRect.x = -1; m_outputRect.y = -1; m_outputRect.width = 0; m_outputRect.height = 0; m_group = this; m_forceBreakLine = true; m_breakLine = true; m_type = MC_TYPE_GROUP; m_indent = MC_GROUP_LEFT_INDENT; m_hide = false; m_working = false; m_groupType = groupType; m_lastInOutput = NULL; m_appendedCells = NULL; // set up cell depending on groupType, so we have a working cell if (groupType != GC_TYPE_PAGEBREAK) { if (groupType == GC_TYPE_CODE) m_input = new TextCell(EMPTY_INPUT_LABEL); else m_input = new TextCell(wxT(" ")); m_input->SetType(MC_TYPE_MAIN_PROMPT); } bool match = true; bool insertAns = false; wxConfig::Get()->Read(wxT("matchParens"), &match); wxConfig::Get()->Read(wxT("insertAns"), &insertAns); EditorCell *editor = new EditorCell(); editor->SetMatchParens(match); editor->SetInsertAns(insertAns); switch (groupType) { case GC_TYPE_CODE: editor->SetType(MC_TYPE_INPUT); AppendInput(editor); break; case GC_TYPE_TEXT: m_input->SetType(MC_TYPE_TEXT); editor->SetType(MC_TYPE_TEXT); AppendInput(editor); break; case GC_TYPE_TITLE: m_input->SetType(MC_TYPE_TITLE); editor->SetType(MC_TYPE_TITLE); AppendInput(editor); break; case GC_TYPE_SECTION: m_input->SetType(MC_TYPE_SECTION); editor->SetType(MC_TYPE_SECTION); AppendInput(editor); break; case GC_TYPE_SUBSECTION: m_input->SetType(MC_TYPE_SUBSECTION); editor->SetType(MC_TYPE_SUBSECTION); AppendInput(editor); break; case GC_TYPE_SUBSUBSECTION: m_input->SetType(MC_TYPE_SUBSUBSECTION); editor->SetType(MC_TYPE_SUBSUBSECTION); AppendInput(editor); break; case GC_TYPE_IMAGE: m_input->SetType(MC_TYPE_TEXT); editor->SetType(MC_TYPE_TEXT); editor->SetValue(wxEmptyString); AppendInput(editor); break; default: delete editor; editor = NULL; break; } if (editor != NULL) editor->SetValue(initString); // when creating an image cell, if a string is provided // it loads an image (without deleting it) if ((groupType == GC_TYPE_IMAGE) && (initString.Length() > 0)) { ImgCell *ic = new ImgCell(initString, false); AppendOutput(ic); } SetParent(this); }