コード例 #1
0
ファイル: kd.cpp プロジェクト: uwssg/ModifiedAPS
void kd_tree::check_tree(int where){
   int i,ancestor,j;
   
   //printf("checking %d of %d\n",where,data.get_rows());
   
   if(where<0)where=masterparent;
   
   /*first make sure that all nodes are somehow descended from the masterparent*/
   if(where!=masterparent){
      j=where;
      ancestor=tree.get_data(j,3);
      while(ancestor>=0){
          j=ancestor;
          ancestor=tree.get_data(j,3);
          
          //printf("%d %d %d\n",j,ancestor,masterparent);
      }
      
   
       if(j!=masterparent){
           printf("WARNING tree is not properly constructed\n");
           printf("could not reach the master parent\n");
           exit(1);
       }
   }
   
   /*make sure that the left hand branch is properly constructed*/
   if(tree.get_data(where,1)>-1)confirm(tree.get_data(where,0),where,1,tree.get_data(where,1));
   
   /*make sure that the right hand branch is properly constructed*/
   if(tree.get_data(where,2)>-1)confirm(tree.get_data(where,0),where,2,tree.get_data(where,2));

}
コード例 #2
0
ファイル: rm.c プロジェクト: Sunshine-OS/svr4-userland
static int
rmfile(const char *base, const struct stat *sp)
{
	if (iflag) {
		msg(sysv3 ? "%s ? " : "remove  %s: (y/n)? ", path);
		if (confirm() == 0)
			return 0;
	} else if ((sp->st_mode&S_IFMT) != S_IFDIR &&
			(sp->st_mode&S_IFMT) != S_IFLNK &&
			ontty && !fflag &&
			access(base, W_OK) < 0) {
		msg("%s: %o mode ? ", path, (int)(sp->st_mode & 0777));
		if (confirm() == 0)
			return 0;
	}
	if (((sp->st_mode&S_IFMT) == S_IFDIR ? rmdir : unlink)(base) < 0) {
#ifndef	SUS
		if ((sp->st_mode&S_IFMT) == S_IFDIR || !fflag || iflag)
#endif
			fprintf(stderr, (sp->st_mode&S_IFMT) == S_IFDIR ?
				"%s: Unable to remove directory %s\n%s\n" :
				"%s: %s not removed.\n%s\n",
				progname, path, strerror(errno));
		errcnt |= 1;
		return -1;
	}
	return 0;
}
コード例 #3
0
ファイル: ed.c プロジェクト: jollywho/nav
static void ed_direct_prompt(void **args)
{
    ed_data *data = args[0];

    if (get_opt_int("askrename")) {
        bool ans = 0;

        if (data->src.argc > 1)
            ans = confirm("Rename %d items to %s ?", data->src.argc, data->dst);
        else
            ans = confirm("Rename %s to %s ?", data->src.argv[0], data->dst);

        if (!ans)
            goto cleanup;
    }

    char from[PATH_MAX];
    char to[PATH_MAX];
    char *curdir = fs_pwd();

    //NOTE: multiargs rename all to same dest
    for (int i = 0; i < data->src.argc; i++) {
        log_err("ED", "[%s] [%s]", data->src.argv[i], data->dst);
        conspath_buf(from, curdir, data->src.argv[i]);
        conspath_buf(to,   curdir, data->dst);
        file_move_str(from, to, NULL);
    }
cleanup:
    del_param_list(data->src.argv,  data->src.argc);
    free(data->dst);
    free(data);
}
コード例 #4
0
ファイル: chatbox.cpp プロジェクト: jesyspa/4DGo
void Chatbox::parseString(QString str) {
	if (str[0] != '!') {
		emit message(str);
		return;
	}
	str[0] = ' ';
	str = str.trimmed().toLower();
	QStringList list = str.split(QRegExp("\\s+"));
	QStringList::const_iterator it = list.begin();
	if (it->contains(rgxPos)) {
		emit playStone(Position(*it));
	} else if (*it == "pass" || *it == "p") {
		emit pass();
	} else if (*it == "undo" || *it == "u") {
		emit undo();
	} else if (*it == "kill" || *it == "k") {
		if (++it == list.end() || !it->contains(rgxPos))
			display("Expected position as second argument.");
		else
			emit kill(Position(*it));
	} else if (*it == "exit" || *it == "e") {
		emit exit();
	} else if (*it == "connect" || *it == "c") {
		if (++it != list.end()) {
			emit setHost(*it);
			if (++it != list.end()) {
				emit setPort(it->toInt());
			}
		}
		emit cl_connect();
	} else if (*it == "disconnect" || *it == "dc") {
		emit cl_disconnect();
	} else if (*it == "yes" || *it == "y") {
		emit confirm(true);
	} else if (*it == "no" || *it == "n") {
		emit confirm(false);
	} else if (*it == "save" || *it == "s") {
		if (++it == list.end())
			display("Expected filename as second argument.");
		else
			emit writeLogToDisk(*it);
	} else if (*it == "help" || *it == "h" ) {
		display("4DGo -- A four-dimensional goban for online play.");
		display("All commands start with a '!'. Any input that does not is treated as a chat message. All comands are case-insensitive.");
		display("  Commands:");
		display("!connect [hostname] [port]: connect to the game server. By default, localhost:15493 will be used.");
		display("!disconnect: break connection to server and clear the goban.");
		display("!A4d4: on slice A4 (top-left), on intersection d4 (top-right).");
		display("!pass: end your turn without playing a stone.");
		display("!undo: request that your last move be undone.");
		display("!yes: allow the action your opponent requested (usually an undo or kill).");
		display("!yes: refuse to allow the action your opponent requested (usually an undo or kill).");
		display("!kill: request a certain group to be immediately taken off the board. Useful in endgame, to not need to play out all captures.");
		display("!save filename: save the current history to file filename.");
		display("!exit: disconnect and close the window.");
	} else {
		tbCBox_->append(QString("Unknown command: ")+*it);
	}
}
コード例 #5
0
ファイル: fsm.c プロジェクト: dashpay/keepkey-firmware
void fsm_msgChangePin(ChangePin *msg)
{
    bool removal = msg->has_remove && msg->remove;
    bool confirmed = false;

    if(removal)
    {
        if(storage_has_pin())
        {
            confirmed = confirm(ButtonRequestType_ButtonRequest_RemovePin,
                                "Remove PIN", "Do you want to remove PIN protection?");
        }
        else
        {
            fsm_sendSuccess("PIN removed");
            return;
        }
    }
    else
    {
        if(storage_has_pin())
            confirmed = confirm(ButtonRequestType_ButtonRequest_ChangePin,
                                "Change PIN", "Do you want to change your PIN?");
        else
            confirmed = confirm(ButtonRequestType_ButtonRequest_CreatePin,
                                "Create PIN", "Do you want to add PIN protection?");
    }

    if(!confirmed)
    {
        fsm_sendFailure(FailureType_Failure_ActionCancelled,
                        removal ? "PIN removal cancelled" : "PIN change cancelled");
        go_home();
        return;
    }

    if(!pin_protect("Enter Current PIN"))
    {
        go_home();
        return;
    }

    if(removal)
    {
        storage_set_pin(0);
        storage_commit();
        fsm_sendSuccess("PIN removed");
    }
    else
    {
        if(change_pin())
        {
            storage_commit();
            fsm_sendSuccess("PIN changed");
        }
    }

    go_home();
}
コード例 #6
0
ファイル: students.c プロジェクト: railsfanatic/SSE290E
/*	addStudents
	function with loop to add students one at a time
	in:  none
	out: none
*/
void addStudents()
{
	// declarations
	char firstName[32];		// store input first name
	char lastName[32];		// store input last name
	int completedCredits;	// store input completed credits
	struct DATE enrollmentDate;	// store input enrollment date
	struct STUDENT *s;		// pointer to a student record
	
	// print header
	printf("Add Students\n============\n\n"
		"Start entering students. Leave first name blank to stop.\n\n");
	
	// outer loop for entering another student
	do {
		// inner loop for repeating incorrect entry
		do {
			// print # entering
			printf("Student #%d\n", numStudents + 1);
			
			// get input from user
			strcpy(firstName, inputString("First name: ", 32));
			if (strcmp(firstName, "") == 0) return;
			
			strcpy(lastName, inputString("Last name: ", 32));
			if (strcmp(lastName, "") == 0) return;
			
			completedCredits = inputInteger("Completed credits: ");
			enrollmentDate = inputDate("Enrollment date (mm/dd/yyyy): ");
			
			// display input info back to user
			printf("\nFirst name: %s\n"
				"Last name: %s\n"
				"Completed credits: %d\n"
				"Enrollment date: %s\n",
					firstName,
					lastName,
					completedCredits,
					formatDate(enrollmentDate));
			
			// repeat if info incorrect
		} while (!confirm("Info correct (y/n) ?"));
		
		// get pointer to new student
		s = &students[numStudents];
		
		// put info into array at pointer
		strcpy(s->firstName, firstName);
		strcpy(s->lastName, lastName);
		s->completedCredits = completedCredits;
		s->enrollmentDate = enrollmentDate;
		
		// increment # of students
		numStudents ++;
	
	// loop if user wants to input another student
	} while (confirm("Add another student (y/n) ?"));
}
コード例 #7
0
QDialog *HistogramMatchProcessor::getOptionDialog(Area area, const MyImage& image)
{
  HistogramMatchDialog *result = new HistogramMatchDialog(image.getImage());
  connect(result,
          SIGNAL(confirm(QString)),
          this,
          SLOT(confirm(QString)));
  return result;
}
int main (int argc, char *argv[]) {
	int test1 = addOneToTen();
	if(confirm(test1)) {
		printTenPlusOneEqualsEleven();
	}
	int test2 = addOneToTen();
	if (confirm(test2)) {
		printTenPlusOneEqualsEleven();
	}
}
コード例 #9
0
QWidget *HistogramEqualizationProcessor::optionWidget()
{
  if (_optionWidget == NULL)
  {
    _optionWidget = new HistogramEqualizationOptionWidget(_tunel);
    connect(_optionWidget,
            SIGNAL(changeToTunel(ImageAlgorithm::RGBAField)),
            this,
            SLOT(changeToTunel(ImageAlgorithm::RGBAField)));
    connect(_optionWidget, SIGNAL(confirm()), this, SLOT(confirm()));
  }
  return _optionWidget;
}
コード例 #10
0
QWidget *ToGrayProcessor::optionWidget()
{
  if (_optionWidget == NULL)
  {
    _optionWidget = new ToGrayOptionWidget(_type);
    connect(_optionWidget,
            SIGNAL(optionChanged(ImageAlgorithm::ImageToGrayAlgorithmType)),
            this,
            SLOT(changeToType(ImageAlgorithm::ImageToGrayAlgorithmType)));
    connect(_optionWidget, SIGNAL(confirm()), this, SLOT(confirm()));
  }
  return _optionWidget;
}
コード例 #11
0
bool StaticPage::validateQuickSettings() {
    if(!(ui->quickConfigSlot1Radio->isChecked() ||
         ui->quickConfigSlot2Radio->isChecked())) {
        emit showStatusMessage(ERR_CONF_SLOT_NOT_SELECTED, 1);
        return false;
    }

    //Check if configuration slot 1 is being programmed
    if (ui->quickStaticLenTxt->text().toInt() == 0) {
        QMessageBox::critical(this, ERR, WARN_EMPTY_PASS);
        return false;
    }

    QSettings settings;

    //Check if configuration slot 1 is being programmed
    if (!settings.value(SG_OVERWRITE_CONF_SLOT1).toBool() &&
        ui->quickConfigSlot1Radio->isChecked() &&
        m_keysProgrammedCtr == 0) {
        //Confirm from client
        ConfirmBox confirm(this);
        confirm.setConfirmIndex(ConfirmBox::Confirm_ConfigurationSlot);
        int ret = confirm.exec();

        switch (ret) {
        case 1:     //Yes
            break;
        default:    //No
            return false;
        }
    }

    //Check if logging is disabled and
    //configuration protection is being enabled
    if(!settings.value(SG_ENABLE_CONF_PROTECTION).toBool() &&
       !YubiKeyLogger::isLogging() &&
       ui->quickConfigProtectionCombo->currentIndex() == CONFIG_PROTECTION_ENABLE) {
        //Confirm from client
        ConfirmBox confirm(this);
        confirm.setConfirmIndex(ConfirmBox::Confirm_ConfigurationProtection);
        int ret = confirm.exec();

        switch (ret) {
        case 1:     //Yes
            break;
        default:    //No
            return false;
        }
    }
    return true;
}
コード例 #12
0
int cmdReview (const std::vector <std::string>& args, bool autoClear)
{
  // Is there a specified limit?
  unsigned int limit = 0;
  if (args.size () == 2)
    limit = strtol (args[1].c_str (), NULL, 10);

  // Configure 'reviewed' UDA, but only if necessary.
  std::string input;
  std::string output;
  auto status = execute ("task", {"_get", "rc.uda.reviewed.type"}, input, output);
  if (status || output != "date\n")
  {
    if (confirm ("Tasksh needs to define a 'reviewed' UDA of type 'date' for all tasks.  Ok to proceed?"))
    {
      execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "uda.reviewed.type",  "date"},     input, output);
      execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "uda.reviewed.label", "Reviewed"}, input, output);
    }
  }

  // Configure '_reviewed' report, but only if necessary.
  status = execute ("task", {"_get", "rc.report._reviewed.columns"}, input, output);
  if (status || output != "uuid\n")
  {
    if (confirm ("Tasksh needs to define a '_reviewed' report to identify tasks needing review.  Ok to proceed?"))
    {
      execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.description",
                        "Tasksh review report.  Adjust the filter to your needs."                                              }, input, output);
      execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.columns", "uuid"               }, input, output);
      execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.sort",    "reviewed+,modified+"}, input, output);
      execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.filter",
                        "( reviewed.none: or reviewed.before:now-6days ) and ( +PENDING or +WAITING )"                         }, input, output);
    }
  }

  // Obtain a list of UUIDs to review.
  status = execute ("task",
                    {
                      "rc.color=off",
                      "rc.detection=off",
                      "rc._forcecolor=off",
                      "rc.verbose=nothing",
                      "_reviewed"
                    },
                    input, output);

  // Review the set of UUIDs.
  auto uuids = split (Lexer::trimRight (output, "\n"), '\n');
  reviewLoop (uuids, limit, autoClear);
  return 0;
}
コード例 #13
0
/*
 * confirm_cipher() - Show cipher confirmation
 *
 * INPUT
 *     - encrypt: true/false whether we are encrypting
 *     - key: string of key value
 * OUTPUT
 *     true/false of confirmation
 */
bool confirm_cipher(bool encrypt, const char *key)
{
    bool ret_stat;

	if(encrypt) {
		ret_stat = confirm(ButtonRequestType_ButtonRequest_Other,
			"Encrypt Key Value", key);
	} else {
		ret_stat = confirm(ButtonRequestType_ButtonRequest_Other,
			"Decrypt Key Value", key);
	}

    return(ret_stat);
}
コード例 #14
0
/*
 * confirm_encrypt_msg() - Show encrypt message confirmation
 *
 * INPUT
 *     - msg: message to encrypt 
 *     - signing: true/false whether we are signing along with encryption
 * OUTPUT
 *     true/false of confirmation
 */
bool confirm_encrypt_msg(const char *msg, bool signing)
{
    bool ret_stat;

	if(signing) {
		ret_stat = confirm(ButtonRequestType_ButtonRequest_ProtectCall,
			"Encrypt and Sign Message", msg);
    } else {
		 ret_stat = confirm(ButtonRequestType_ButtonRequest_ProtectCall,
			"Encrypt Message", msg);
    }

    return(ret_stat);
}
コード例 #15
0
/*
 * confirm_load_device() - Show load device confirmation
 *
 * INPUT
 *     - is_node: true/false whether this is an hdnode
 * OUTPUT
 *     true/false of confirmation
 *
 */
bool confirm_load_device(bool is_node)
{
    bool ret_stat;

	if(is_node) {
		ret_stat = confirm(ButtonRequestType_ButtonRequest_ProtectCall,
		    	"Import Private Key", "Importing is not recommended unless you understand the risks. Do you want to import private key?");
    } else {
		ret_stat = confirm(ButtonRequestType_ButtonRequest_ProtectCall,
		    	"Import Recovery Sentence", "Importing is not recommended unless you understand the risks. Do you want to import recovery sentence?");
    }

    return(ret_stat);
}
コード例 #16
0
AddManagerDialog::AddManagerDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AddManagerDialog)
{
    ui->setupUi(this);

    ui->passwordLineEdit->setEchoMode(QLineEdit::Password);
    ui->confirmPasswordLineEdit->setEchoMode(QLineEdit::Password);

    connect(ui->nameLineEdit,SIGNAL(textChanged(QString)),this,SLOT(confirm()));
    connect(ui->passwordLineEdit,SIGNAL(textChanged(QString)),this,SLOT(confirm()));
    connect(ui->confirmPasswordLineEdit,SIGNAL(textChanged(QString)),this,SLOT(confirm()));
    connect(this,SIGNAL(isConfirmed(bool)),ui->okButton,SLOT(setEnabled(bool)));
}
コード例 #17
0
/*
 * confirm_decrypt_msg() - Show decrypt message confirmation
 *
 * INPUT
 *      - msg: decrypted message
 *      - address: address used to sign message
 * OUTPUT
 *     true/false of confirmation
 *
 */
bool confirm_decrypt_msg(const char *msg, const char *address)
{
    bool ret_stat;

	if(address) {
		ret_stat = confirm(ButtonRequestType_ButtonRequest_Other,
                "Decrypted Signed Message", msg);
    } else {
		ret_stat = confirm(ButtonRequestType_ButtonRequest_Other,
                "Decrypted Message", msg);
    }

    return(ret_stat);
}
コード例 #18
0
ファイル: CmdConfig.cpp プロジェクト: JensErat/task
bool CmdConfig::setConfigVariable (std::string name, std::string value, bool confirmation /* = false */)
{
  // Read .taskrc (or equivalent)
  std::vector <std::string> contents;
  File::read (context.config._original_file, contents);

  bool found = false;
  bool change = false;

  std::vector <std::string>::iterator line;
  for (line = contents.begin (); line != contents.end (); ++line)
  {
    // If there is a comment on the line, it must follow the pattern.
    std::string::size_type comment = line->find ("#");
    std::string::size_type pos     = line->find (name + "=");

    if (pos != std::string::npos &&
        (comment == std::string::npos ||
         comment > pos))
    {
      found = true;
      if (!confirmation ||
          confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value)))
      {
        if (comment != std::string::npos)
          *line = name + "=" + json::encode (value) + " " + line->substr (comment);
        else
          *line = name + "=" + json::encode (value);

        change = true;
      }
    }
  }

  // Not found, so append instead.
  if (!found &&
      (!confirmation ||
       confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value))))
  {
    contents.push_back (name + "=" + json::encode (value));
    change = true;
  }

  if (change)
    File::write (context.config._original_file, contents);

  return change;
}
コード例 #19
0
ファイル: gdb-ui-break.c プロジェクト: Enrix835/geany-plugins
static void
delete_click(GtkWidget * w, gpointer p)
{
	BkPtDlgData *bpd = p;

	if (! bpd->bpi)
	{
		GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(gdbui_setup.main_window),
			GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
			_("No %s selected"), is_watchlist ? _("watchpoint") : _("breakpoint"));
		gtk_dialog_run(GTK_DIALOG(dialog));
		gtk_widget_destroy(dialog);
		return;
	}

	if (confirm(is_watchlist ? _("Delete selected watchpoint?") : _("Delete selected breakpoint?")))
	{
		gdbui_enable(FALSE);
		gdbio_delete_break(break_dlg, bpd->bpi->number);
		prev_resp = dlgRespDeleteConfirmed;
		gtk_dialog_response(GTK_DIALOG(bpd->dlg), dlgRespDeleteConfirmed);
	}
	else
	{
		gtk_dialog_response(GTK_DIALOG(bpd->dlg), dlgRespDeleteCancelled);
	}
}
コード例 #20
0
ファイル: resetwidget.cpp プロジェクト: tecton/HexGame
void ResetWidget::dealReleased(QPointF mousePos, Qt::MouseButton button)
{
  if (itemAtPressPos == confirmItem &&
      confirmItem->in(mousePos, LOGICAL_WIDTH, LOGICAL_HEIGHT))
  {
    // Exit
    emit giveControlTo(NULL, true);

    // Emit correct signal
    emit confirm();
    delete this;
    return;
  }
  else if (itemAtPressPos == cancelItem &&
           cancelItem->in(mousePos, LOGICAL_WIDTH, LOGICAL_HEIGHT))
  {
    // Exit
    emit giveControlTo(NULL, true);

    // Emit correct signal
    emit cancel();
    delete this;
    return;
  }

  itemAtPressPos = NULL;
}
コード例 #21
0
ファイル: configdocument.cpp プロジェクト: 4nykey/rockbox
bool ConfigDocument::requestClose()
{
    if(toPlainText() != saved)
    {
        /* Spawning the "Are you sure?" dialog */
        QMessageBox confirm(this);
        confirm.setWindowTitle(tr("Confirm Close"));
        confirm.setText(title() + tr(" has been modified."));
        confirm.setInformativeText(tr("Do you want to save your changes?"));
        confirm.setStandardButtons(QMessageBox::Save | QMessageBox::Discard
                                   | QMessageBox::Cancel);
        confirm.setDefaultButton(QMessageBox::Save);
        int confirmation = confirm.exec();

        switch(confirmation)
        {
        case QMessageBox::Save:
            save();
            /* After calling save, make sure the user actually went through */
            if(toPlainText() != saved)
                return false;
            else
                return true;

        case QMessageBox::Discard:
            return true;

        case QMessageBox::Cancel:
            return false;
        }
    }
    return true;
}
コード例 #22
0
ファイル: dependency.cpp プロジェクト: nigeil/task
////////////////////////////////////////////////////////////////////////////////
// Determine whether a dependency chain is being broken, assuming that 'task' is
// either completed or deleted.
//
//   blocked task blocking action
//   ------- ---- -------- -----------------------------
//           [1]  2        Chain broken
//                         Nag message generated
//                         Repair offered:  1 dep:-2
//
//           [1]  2        Chain broken
//                3        Nag message generated
//                         Repair offered:  1 dep:-2,-3
//
//   1       [2]           -
//
//   1,3     [2]           -
//
//   1       [2]  3        Chain broken
//                         Nag message generated
//                         Repair offered:  2 dep:-3
//                                          1 dep:-2,3
//
//   1,4     [2]  3,5      Chain broken
//                         Nag message generated
//                         Repair offered:  2 dep:-3,-5
//                                          1 dep:3,5
//                                          4 dep:3,5
//
void dependencyChainOnComplete (Task& task)
{
  std::vector <Task> blocking;
  dependencyGetBlocking (task, blocking);

  // If the task is anything but the tail end of a dependency chain.
  if (blocking.size ())
  {
    std::vector <Task> blocked;
    dependencyGetBlocked (task, blocked);

    // Nag about broken chain.
    if (context.config.getBoolean ("dependency.reminder"))
    {
      std::cout << format (STRING_DEPEND_BLOCKED, task.id)
                << "\n";

      std::vector <Task>::iterator b;
      for (b = blocking.begin (); b != blocking.end (); ++b)
        std::cout << "  " << b->id << " " << b->get ("description") << "\n";
    }

    // If there are both blocking and blocked tasks, the chain is broken.
    if (blocked.size ())
    {
      if (context.config.getBoolean ("dependency.reminder"))
      {
        std::cout << STRING_DEPEND_BLOCKING
                  << "\n";

        std::vector <Task>::iterator b;
        for (b = blocked.begin (); b != blocked.end (); ++b)
          std::cout << "  " << b->id << " " << b->get ("description") << "\n";
      }

      if (!context.config.getBoolean ("dependency.confirmation") ||
          confirm (STRING_DEPEND_FIX_CHAIN))
      {
        // Repair the chain - everything in blocked should now depend on
        // everything in blocking, instead of task.id.
        std::vector <Task>::iterator left;
        std::vector <Task>::iterator right;
        for (left = blocked.begin (); left != blocked.end (); ++left)
        {
          left->removeDependency (task.id);

          for (right = blocking.begin (); right != blocking.end (); ++right)
            left->addDependency (right->id);
        }

        // Now update TDB2, now that the updates have all occurred.
        for (left = blocked.begin (); left != blocked.end (); ++left)
          context.tdb2.modify (*left);

        for (right = blocking.begin (); right != blocking.end (); ++right)
          context.tdb2.modify (*right);
      }
    }
  }
}
コード例 #23
0
ファイル: vpemain2.cpp プロジェクト: Azarien/open-watcom-v2
bool VpeMain::execute( const WString& cmd )
{
    if( _config->debug() && !confirm( "Starting '%s'", cmd ) ) {
        return( false );
    }
    startWait();

    size_t icount = strlen( cmd );
    for( size_t i = 0; i < icount; ) {
        WString cbuff;
        while( isspace( cmd[i] ) ) i++;
        for( ; i < icount; ) {
            char ch = cmd[i];
            i++;
            if( ch == '\n' || ch == '\r' ) break;
            cbuff.concat( ch );
        }
        if( cbuff.size() > 0 ) {
            if( strnicmp( cbuff, "!Error ", 7 ) == 0 ) {
                WString msg;
                for( size_t i = 7; i < cbuff.size() && cbuff[i] != '$'; i++ ) {
                    msg.concat( cbuff[i] );
                }
                WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, msg );
                return( false );
            } else {
                if( !executeOne( cbuff ) ) {
                    return( false );
                }
            }
        }
    }
    return( true );
}
コード例 #24
0
ファイル: MappingWindow.cpp プロジェクト: degasus/dolphin
void MappingWindow::OnDeleteProfilePressed()
{
  const QString profile_name = m_profiles_combo->currentText();
  const QString profile_path = m_profiles_combo->currentData().toString();

  if (!File::Exists(profile_path.toStdString()))
  {
    QMessageBox error(this);
    error.setIcon(QMessageBox::Critical);
    error.setText(tr("The profile '%1' does not exist").arg(profile_name));
    error.exec();
    return;
  }

  QMessageBox confirm(this);

  confirm.setIcon(QMessageBox::Warning);
  confirm.setText(tr("Are you sure that you want to delete '%1'?").arg(profile_name));
  confirm.setInformativeText(tr("This cannot be undone!"));
  confirm.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);

  if (confirm.exec() != QMessageBox::Yes)
  {
    return;
  }

  m_profiles_combo->removeItem(m_profiles_combo->currentIndex());

  File::Delete(profile_path.toStdString());

  QMessageBox result(this);
  result.setIcon(QMessageBox::Information);
  result.setText(tr("Successfully deleted '%1'.").arg(profile_name));
}
コード例 #25
0
ファイル: treeviewsample.cpp プロジェクト: eriser/wxsqlite3
void
TreeviewSample::DeleteSelectedProject(int selectedRow)
{
  if (selectedRow >= 0)
  {
    const ProjectDescription& pd = m_projectView->GetProjectDescription(selectedRow);
    int      projectId     = pd.pid;
    wxString projectTitle  = pd.title;
    wxString msg = wxString(_("Do you really want to delete the project?")) + wxT("\n\n")
                 + wxString::Format(wxT("%d"), projectId) + wxString(wxT(" / ")) + projectTitle;
    wxMessageDialog confirm(this, msg, _("Delete project"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
    if (confirm.ShowModal() == wxID_YES)
    {
      if (DeleteFromDatabase(projectId))
      {
        RefreshProjectList();
        wxString msg = wxString(_("Project has been successfully deleted:")) + wxT("\n")
                     + wxString::Format(wxT("%d"), projectId) + wxString(wxT(" / ")) + projectTitle;
        wxMessageBox(msg, _("Delete project"), wxOK, this );
      }
      else
      {
        wxLogError(wxString(_("Unable to delete project:")) + wxT("\n") + wxString::Format(wxT("%d"), projectId) + wxString(wxT(" / ")) + projectTitle);
      }
    }
  }
  else
  {
    wxMessageBox(_("No project selected."), _("Delete project"), wxOK, this );
  }
}
コード例 #26
0
ファイル: GUI.cpp プロジェクト: Huynduet/Tetris
void GUI::quit( )		//thoat game
{
	if ( confirm( "EXIT" ) )
		exit = TRUE;		//thoat game neu confirm = true
	else 
		exit = FALSE;
}
コード例 #27
0
void gcta::update_sex(string sex_file)
{
    ifstream isex(sex_file.c_str());
    if(!isex) throw("Error: can not open the file ["+sex_file+"] to read.");
    int sex_buf=0, icount=0;
    string str_buf, fid, pid;
	cout<<"Reading sex information from ["+sex_file+"]."<<endl;
    map<string, int>::iterator iter, End=_id_map.end();
    _sex.clear();
    _sex.resize(_indi_num);
    vector<int> confirm(_indi_num);
	while(isex){
		isex>>fid;
		if(isex.eof()) break;
		isex>>pid;
		isex>>str_buf;
		if(str_buf!="1" && str_buf!="2" && str_buf!="M" && str_buf!="F") throw("Error: unrecognized sex code: \""+fid+" "+pid+" "+str_buf+"\" in ["+sex_file+"].");
		iter=_id_map.find(fid+":"+pid);
		if(iter!=End){
		    if(str_buf=="M" || str_buf=="1") _sex[iter->second]=1;
		    else if(str_buf=="F" || str_buf=="2") _sex[iter->second]=2;
		    confirm[iter->second]=1;
		    icount++;
		}
		getline(isex, str_buf);
	}
    isex.close();

    for(int i=0; i<_keep.size(); i++){
        if(confirm[_keep[i]]!=1) throw("Error: sex information for all of the included individuals should be updated.");
    }
	cout<<"Sex information for "<<icount<<" individuals are update from ["+sex_file+"]."<<endl;
}
コード例 #28
0
int load_romdump(const char *filename)
{
    int len, rc;
    int fd;
    
    if (!confirm("Restore firmware section (bootloader will be kept)?"))
        return -2;
    
    fd = rb->open(filename, O_RDONLY);
    if (fd < 0)
        return -1;
    
    len = rb->filesize(fd) - 8;
    if (len <= 0)
        return -1;
    
    rb->lseek(fd, 8, SEEK_SET);
    rc = rb->read(fd, audiobuf, len);
    rb->close(fd);
    
    if (rc != len)
    {
        rb->splash(HZ*2, "Read error");
        return -2;
    }
    
    if (len % 2)
        len++;
    
    if (len > BOOTLOADER_ENTRYPOINT - 8)
        len = BOOTLOADER_ENTRYPOINT - 8;
    
    return flash_original_fw(len);
}
コード例 #29
0
ファイル: screen.c プロジェクト: 00001/plan9port
static int
checkmouse(void)	/* return button touched if any */
{
	int c, b;
	char *p;
	extern int confirm(int);

	b = waitdown();
	last_but = 0;
	last_hit = -1;
	c = 0;
	if (button3(b)) {
		last_hit = emenuhit(3, &mouse, &mbut3);
		last_but = 3;
	} else if (button2(b)) {
		last_hit = emenuhit(2, &mouse, &mbut2);
		last_but = 2;
	} else {		/* button1() */
		pan();
		last_but = 1;
	}
	waitup();
	if (last_but == 3 && last_hit >= 0) {
		p = m3[last_hit];
		c = p[strlen(p) - 1];
	}
	if (c == '?' && !confirm(last_but))
		last_hit = -1;
	return last_but;
}
コード例 #30
0
ファイル: connectdialog.cpp プロジェクト: via/hw7
void ConnectDialog::on_connectButton_clicked()
{
    //connection magic
       //emit signal to thread class slot
  emit confirm(ui->ipLine->text(), ui->portLine->text(), ui->nickLine->text());
  accept();
}