static void OnExecuteCommand(Gtk::ComboBoxEntryText& cmd_ent, Gtk::FileChooserButton& ch_btn) { ExecState& es = GetES(); Execution::Data& edat = es.eDat; if( !es.isExec ) { ConsoleSetter ess(es); Gtk::Entry& ent = *cmd_ent.get_entry(); std::string cmd = ent.get_text().raw(); if( cmd.size() ) { Gtk::TextView& txt_view = es.detailsView; // переставим команду наверх по истории cmd_ent.remove_text(cmd); cmd_ent.prepend_text(cmd); ent.set_text(""); // очищаем AppendCommandText(txt_view, "Execute Command: '" + cmd + "'"); ConsoleOF cof; ExitData ed = ExecuteAsync(ch_btn.get_filename().c_str(), cmd.c_str(), OF2RRF(cof), &edat.pid); std::string exit_str = ExitDescription(ed); AppendCommandText(txt_view, "Exit Status: " + exit_str + "."); es.SetStatus(ed.IsGood() ? std::string() : exit_str); } } else edat.StopExecution("\"command\""); }
/* ============ idCmdSystemLocal::BufferCommandText ============ */ void idCmdSystemLocal::BufferCommandText( cmdExecution_t exec, const char* text ) { switch( exec ) { case CMD_EXEC_NOW: { ExecuteCommandText( text ); break; } case CMD_EXEC_INSERT: { InsertCommandText( text ); break; } case CMD_EXEC_APPEND: { AppendCommandText( text ); break; } default: { break; //CHRIS //common->FatalError( "idCmdSystemLocal::BufferCommandText: bad exec type" ); } } }
/* ============ idCmdSystemLocal::BufferCommandArgs ============ */ void idCmdSystemLocal::BufferCommandArgs( cmdExecution_t exec, const idCmdArgs &args ) { switch ( exec ) { case CMD_EXEC_NOW: { ExecuteTokenizedString( args ); break; } case CMD_EXEC_APPEND: { AppendCommandText( "_execTokenized\n" ); tokenizedCmds.Append( args ); break; } default: { common->FatalError( "idCmdSystemLocal::BufferCommandArgs: bad exec type" ); } } }
static bool RunMuxing(const std::string& dest_path, const std::string& args) { Gtk::Dialog dlg(BF_("Muxing \"%1%\"") % fs::name_str(dest_path) % bf::stop); SetDialogStrict(dlg, 400, -1); Gtk::TextView& txt_view = NewManaged<Gtk::TextView>(); Execution::Data edat; Gtk::ProgressBar& prg_bar = NewManaged<Gtk::ProgressBar>(); { Gtk::VBox& box = *dlg.get_vbox(); PackStart(box, prg_bar); Gtk::Expander& expdr = PackStart(box, NewManaged<Gtk::Expander>(_("Show/_hide Details"), true)); txt_view.set_editable(false); txt_view.set_size_request(0, 200); expdr.add(PackDetails(txt_view)); dlg.get_action_area()->set_layout(Gtk::BUTTONBOX_CENTER); dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dlg.signal_response().connect(bb::bind(&OnResponse, boost::ref(edat), _1)); dlg.show_all(); } //dlg.run(); ExitData ed; { Execution::Pulse pls(prg_bar); std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop; AppendCommandText(txt_view, cmd); ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid); } if( !ed.IsGood() && !edat.userAbort ) { MessageBox(_("Muxing error"), Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, BF_("The reason is \"%1%\" (see Details)") % ExitDescription(ed) % bf::stop); dlg.run(); } return ed.IsGood(); }