Ejemplo n.º 1
0
Archivo: gui.c Proyecto: cravo/damp
void gui_playlist_update(void)
{
   int x;
   char guitemp[1024];

   if(damp_using_gui)
   {
      gui_list_clear(damp_gui_win_playlist, damp_gui_list_playlist);
      for(x=0;x<damp_playlist_size;x++)
      {
         if(damp_playlist_random)
            sprintf(guitemp,get_filename(damp_playlist[damp_playlist_order[x]].filename));
         else
            sprintf(guitemp,get_filename(damp_playlist[x].filename));

         if(damp_beautify_filenames)
         {
            beautify(guitemp);
            gui_list_additem(damp_gui_win_playlist, damp_gui_list_playlist, guitemp);
         }
         else
            gui_list_additem(damp_gui_win_playlist, damp_gui_list_playlist, guitemp);
      }
      gui_window[damp_gui_win_playlist].content_changed = TRUE;
   }
}
Ejemplo n.º 2
0
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent){
    lineNumberArea = new LineNumberArea(this);

    findDialog_ = new FindDialog(this);
    findDialog_->setModal(false);
    findDialog_->setTextEdit(this);

    findReplaceDialog_ = new FindReplaceDialog(this);
    findReplaceDialog_->setModal(false);
    findReplaceDialog_->setTextEdit(this);

    qtScriptReservedWords_<<"break"<<"case"<<"catch"<<"continue"<<"debugger"<<"default"<<"delete"<<"do"<<"else"<<"finally"<<\
    "for"<<"function"<<"if"<<"in"<<"instanceof"<<"new"<<"return"<<"switch"<<"this"<<"throw"<<"try"<<\
    "typeof"<<"var"<<"void"<<"while"<<"with";

    syntaxHighlighter_ = new ScriptSyntaxHighlighter(this->document());

    s = Global::guiSettings(this);
    s->beginGroup("CodeEditor");
    QFont font = s->value("font",this->font()).value<QFont>();
    this->setFont(font);
    s->endGroup();

    findAction = new QAction("Find...",this);
    connect(findAction, SIGNAL(triggered()), this, SLOT(findDialog()));
    findAction->setShortcut(tr("Ctrl+F"));
    addAction(findAction);

    findReplaceAction = new QAction("Replace...",this);
    connect(findReplaceAction, SIGNAL(triggered()), this, SLOT(findReplaceDialog()));
    findReplaceAction->setShortcut(tr("Ctrl+R"));
    addAction(findReplaceAction);

    beautifyAction = new QAction("Beautify javascript code",this);
    connect(beautifyAction, SIGNAL(triggered()), this, SLOT(beautify()));
    beautifyAction->setShortcut(tr("Ctrl+B"));
    addAction(beautifyAction);


    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();

    completer_ = new QCompleter(this);
    completer_->setModel(modelFromStringList(qtScriptReservedWords_));
    completer_->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer_->setCaseSensitivity(Qt::CaseInsensitive);
    completer_->setWrapAround(false);
    this->setCompleter(completer_);

}
Ejemplo n.º 3
0
void closeCFile(fileinfo* fi, bool beautifyIt) {
  fclose(fi->fptr);
  //
  // We should beautify if (1) we were asked to and (2) either (a) we
  // were asked to save the C code or (b) we were asked to codegen cpp
  // #line information (note that this can affect the output in the
  // event of a failed C compilation whether or not the --savec option
  // is used because a C codegen error will report the Chapel line #,
  // which can be helpful.
  //
  // TODO: With some refactoring, we could simply do the #line part of
  // beautify without also improving indentation and such which could
  // save some time.
  //
  if (beautifyIt && (saveCDir[0] || printCppLineno))
    beautify(fi);
}
Ejemplo n.º 4
0
void print_ptr_rec(ptr x) {
  /*printf("%u\n", x);*/
  if (is_fixnum(x)) {
    printf("%d", to_fixnum(x));
  } else if (x == bool_f) {
    printf("#f");
  } else if (x == bool_t) {
    printf("#t");
  } else if (is_null(x)) {
    print_null();
  } else if (is_char(x)) {
    printf("%s", beautify(to_char(x)));
  } else if (is_pair(x)) {
    printf("(");
    print_pair(x);
    printf(")");
  } else {
    printf("#<unknown 0x%08x>", x);
  }
}
Ejemplo n.º 5
0
void QmlAnchors::setAnchor(AnchorLine::Type sourceAnchorLine,
                          const QmlItemNode &targetQmlItemNode,
                          AnchorLine::Type targetAnchorLine)
{
    RewriterTransaction transaction = qmlItemNode().qmlModelView()->beginRewriterTransaction();
    if (qmlItemNode().isInBaseState()) {
        if ((qmlItemNode().nodeInstance().hasAnchor("anchors.fill") && (sourceAnchorLine & AnchorLine::Fill))
             || ((qmlItemNode().nodeInstance().hasAnchor("anchors.centerIn") && (sourceAnchorLine & AnchorLine::Center)))) {
            removeAnchor(sourceAnchorLine);
        }

        const QString propertyName = anchorPropertyName(sourceAnchorLine);
        QString targetExpression = targetQmlItemNode.modelNode().validId();
        if (targetQmlItemNode.modelNode() == qmlItemNode().modelNode().parentProperty().parentModelNode())
            targetExpression = "parent";
        if (sourceAnchorLine != AnchorLine::Center && sourceAnchorLine != AnchorLine::Fill)
            targetExpression = targetExpression + QLatin1Char('.') + lineTypeToString(targetAnchorLine);
        qmlItemNode().modelNode().bindingProperty(propertyName).setExpression(targetExpression);
    }
    beautify();
}
LoginDialog::LoginDialog(QDialog *parent) :
    QDialog(parent)
{
    logoLabel = new QLabel(this);
    photoLabel = new QLabel(this);
    autologCheck = new QCheckBox(this);
    rememberCheck = new QCheckBox(this);
    userCombo = new QComboBox(this);
    keyEdit = new QLineEdit(this);
    loginButton = new QPushButton(this);
    exitButton = new QPushButton(this);
    minButton = new QPushButton(this);

    connect(loginButton, &QPushButton::clicked, this, &LoginDialog::on_loginButton_clicked);
    connect(exitButton, &QPushButton::clicked, this, &LoginDialog::close);
    connect(minButton, &QPushButton::clicked, this, &LoginDialog::showMinimized);

    this->setMouseTracking(true);
    logoLabel->setMouseTracking(true);
    exitButton->setMouseTracking(true);
    beautify();
    //判断数据库是否存在
    QDir *temp = new QDir;
    bool exist = temp->exists("history.db");

    if(exist)
        qDebug() << "exist";
    else
        newHistroy();

    //初始化输入框内容
    init_userCombo();
    init_keyEdit();
    //建立TCPSocket对象
    log = new QTcpSocket(this);
    con();
    ismousepressed = false;
}
Ejemplo n.º 7
0
void prettyPrint(const QueryData& q, const std::vector<std::string>& order) {
  std::cout << beautify(q, order);
}
Ejemplo n.º 8
0
static void showpartner()
{
  register int   i, k;
  register char *p, *p1;
  auto	   int	 firsttime[2][2];


  memset(firsttime, 0, sizeof(firsttime));

  for (k = 0; k < 2; k++) {
    if (((k == 0) && showincoming) || ((k == 1) && showoutgoing)) {

      for (i = 0; i < knowns; i++)
        if (partner[k][i].ncalls) {
          if (k) {

            if (!firsttime[k][0]) {
	      printf("\nAngerufene (dialout)      calls   Charge        Duration       Computed\n");
              strich('-', 71);
              firsttime[k][0] = 1;
            } /* if */

            printf("%-25s %5d   %12s %s   %12s\n",
              clip(onlynumbers ? partner[k][i].num : known[i]->who, 25),
              partner[k][i].ncalls,
              printRate(partner[k][i].pay),
              timestr(partner[k][i].duration),
              printRate(partner[k][i].compute));
          }
          else {

            if (!firsttime[k][0]) {
              printf("\nAnrufer (dialin)          calls  Duration\n");
              strich('-', 41);
              firsttime[k][0] = 1;
            } /* if */

            printf("%-25s %5d %s\n",
              clip(onlynumbers ? partner[k][i].num : known[i]->who, 25),
              partner[k][i].ncalls,
              timestr(partner[k][i].duration));
          } /* else */
        } /* if */

      printf("\n");

      for (i = 0; i < nunknown[k]; i++)
        if (unknown[k][i].ncalls) {
          p = beautify(unknown[k][i].num);

          if (k) {

            if (!firsttime[k][1]) {
	      printf("\nunbekannte Angerufene (dialout)     von          calls   Charge         Duration       Computed\n");
              strich('-', 95);
              firsttime[k][1] = 1;
            } /* if */

            p1 = msnsum[SUBTOTAL][unknown[k][i].si1][unknown[k][i].ihome].alias;

            printf("%-16s <- %-12s %5d   %12s  %s   %12s\n",
              p,
              clip(p1 ? p1 : "", 16),
              unknown[k][i].ncalls,
              printRate(unknown[k][i].pay),
              timestr(unknown[k][i].duration),
              printRate(unknown[k][i].compute));
          }
          else {

            if (!firsttime[k][1]) {
	      printf("\nunbekannte Anrufer (dialin)         an Rufnummer calls  Duration\n");
              strich('-', 64);
              firsttime[k][1] = 1;
            } /* if */

            printf("%-16s -> %-12s %5d %s\n",
              p,
              msnsum[SUBTOTAL][unknown[k][i].si1][unknown[k][i].ihome].alias,
              unknown[k][i].ncalls,
              timestr(unknown[k][i].duration));
          } /* else */
        } /* if */
      } /* if */
  } /* for */
} /* showpartner */
Ejemplo n.º 9
0
void closeCFile(fileinfo* fi, bool beautifyIt) {
  fclose(fi->fptr);
  if (beautifyIt && saveCDir[0])
    beautify(fi);
}