Пример #1
0
EditNoteDialogue::EditNoteDialogue(MisliWindow *misliWindow_) :
    linkMenu(this),
    chooseNFMenu(tr("NoteFile"),&linkMenu),
    actionChooseTextFile(tr("Text file"),&linkMenu),
    actionChoosePicture(tr("Picure"),&linkMenu),
    actionSystemCallNote(tr("System call note (beta)"),&linkMenu),
    actionWebPageNote(tr("Web page note"),&linkMenu),
    ui(new Ui::EditNoteDialogue)
{
    ui->setupUi(this);
    misliWindow = misliWindow_;
    addAction(ui->actionEscape);

    linkMenu.addMenu(&chooseNFMenu);
    linkMenu.addAction(&actionChoosePicture);
    linkMenu.addAction(&actionChooseTextFile);
    linkMenu.addAction(&actionSystemCallNote);
    linkMenu.addAction(&actionWebPageNote);

    connect(ui->okButton,SIGNAL(clicked()),this,SLOT(inputDone()));
    connect(&chooseNFMenu,SIGNAL(aboutToShow()),this,SLOT(updateChooseNFMenu()));
    connect(ui->makeLinkButton,SIGNAL(clicked()),this,SLOT(showLinkMenu()));
    connect(&chooseNFMenu,SIGNAL(triggered(QAction*)),this,SLOT(makeLinkNote(QAction*)));
    connect(&actionChoosePicture,SIGNAL(triggered()),this,SLOT(choosePicture()));
    connect(&actionChooseTextFile,SIGNAL(triggered()),this,SLOT(chooseTextFile()));
    connect(&actionSystemCallNote,SIGNAL(triggered()),this,SLOT(setSystemCallPrefix()));
    //Set the web page note template
    connect(&actionWebPageNote,&QAction::triggered,[&](){
        ui->textEdit->setText("define_web_page_note:\nurl=\nname="+ui->textEdit->toPlainText());
        ui->textEdit->setFocus();
        ui->textEdit->moveCursor (QTextCursor::End);
    });
}
Пример #2
0
char getChar(void){

  int BUFSIZE = 3;
  char buffer[BUFSIZE];
  int count = 0;
  char choice = 0;

  while(count == 0 || count == EOF || choice < 0){

    printf("%s", "Input a char >> ");
    fflush(stdout);
    
    if(NULL != fgets(buffer, BUFSIZE, stdin)){
      count = sscanf(buffer, "%c", &choice);
      if(inputDone(buffer) == FALSE){
	while(getchar() != '\n');
      }
    }
  }
  return choice;
}