public HttpServerExample(QWidget parent) {
    server = new HttpServer(this);
    if (!server.start()) {
      QMessageBox.critical(
          this, tr("HTTP Server"), tr("Unable to start the server: ") + server.errorString());
      close();
    }

    QPushButton publishButton = new QPushButton(this);
    publishButton.setText("Publish");
    editor = new QTextEdit(this);

    editor.setPlainText(
        "<h1>Server is up and running!</h1>"
            + "You should be able to view it in a normal web browser."
            + " Try this address: http://localhost:"
            + server.serverPort());

    QGridLayout layout = new QGridLayout(this);
    setLayout(layout);
    layout.addWidget(publishButton);
    layout.addWidget(editor);

    publishButton.clicked.connect(this, "publish()");

    setWindowTitle(tr("Simple HTTP Server"));
    setWindowIcon(new QIcon("classpath:com/trolltech/images/qt-logo.png"));
  }
 private void removeSongs() {
   if (QMessageBox.question(
           this,
           Translations.get("dialog_remove_filter_record_title"),
           Translations.get("dialog_remove_filter_record_text"),
           QMessageBox.StandardButton.Yes,
           QMessageBox.StandardButton.No)
       != QMessageBox.StandardButton.Yes.value()) {
     return;
   }
   Vector<SearchRecord> selectedRecords = getSelectedRecords();
   Vector<SongRecord> selectedSongs = new Vector<SongRecord>(selectedRecords.size());
   FilterRecord filterRecord =
       ((FilterProfile) ProfileWidgetUI.instance.getCurrentProfile()).getFilterRecord();
   if (log.isDebugEnabled())
     log.debug("removeSongs(): removing songs=" + selectedSongs + ", from filter=" + filterRecord);
   for (SearchRecord record : selectedRecords) selectedSongs.add((SongRecord) record);
   boolean containsInternal = false;
   boolean containsExternal = false;
   for (SongRecord song : selectedSongs) {
     if (song.isExternalItem()) containsExternal = true;
     else containsInternal = true;
   }
   filterRecord.removeSongRecords(selectedSongs);
   if (containsInternal) filterRecord.computeNumSongRecords();
   if (containsExternal) filterRecord.computeNumExternalSongRecords();
   filterRecord.update();
 }
Exemplo n.º 3
0
 private void about() {
   QMessageBox.about(
       this,
       tr("About Icons"),
       tr(
           "The <b>Icons</b> example illustrates how Qt renders an icon in "
               + "different modes (active, normal, disabled, and selected) and "
               + "states (on and off) based on a set of images."));
 }
 protected void hideRecords() {
   if (QMessageBox.question(
           this,
           Translations.get("dialog_hide_recommended_title"),
           Translations.get("dialog_hide_recommended_text"),
           QMessageBox.StandardButton.Yes,
           QMessageBox.StandardButton.No)
       != QMessageBox.StandardButton.Yes.value()) {
     return;
   }
   Vector<SearchRecord> selectedSearchRecords = getSelectedRecords();
   for (SearchRecord searchRecord : selectedSearchRecords) {
     searchRecord.setDisabled(true);
     searchRecord.update();
   }
 }
Exemplo n.º 5
0
 private void about() {
   QMessageBox.about(
       this,
       tr("About Scribble"),
       tr(
           "<p>The <b>Scribble</b> example shows how to use QMainWindow as the "
               + "base widget for an application, and how to reimplement some of "
               + "QWidget's event handlers to receive the events generated for "
               + "the application's widgets:</p><p> We reimplement the mouse event "
               + "handlers to facilitate drawing, the paint event handler to "
               + "update the application and the resize event handler to optimize "
               + "the application's appearance. In addition we reimplement the "
               + "close event handler to intercept the close events before "
               + "terminating the application.</p><p> The example also demonstrates "
               + "how to use QPainter to draw an image in real time, as well as "
               + "to repaint widgets.</p>"));
 }
Exemplo n.º 6
0
  public void delete() {
    boolean status = Controller.getInstance().deleteStudent(_id);
    QMessageBox t = new QMessageBox();
    t.setWindowIcon(new QIcon(new QPixmap("classpath:admin_resource/eot_icon.png")));

    if (status) {
      holder.hide();
      holder.close();
      t.setText("The deletion was a success");
      t.setWindowTitle("Success");
      t.exec();
      // Controller.getInstance().work();
    } else {
      t.setText("The deletion failed");
      t.setWindowTitle("Failed");
      t.exec();
      // Controller.getInstance().work();
    }
  }
Exemplo n.º 7
0
  private boolean maybeSave() {
    if (scribbleArea.isModified()) {
      QMessageBox.StandardButton ret;
      ret =
          QMessageBox.warning(
              this,
              tr("Scribble"),
              tr("The image has been modified.\n" + "Do you want to save your changes?"),
              new QMessageBox.StandardButtons(
                  QMessageBox.StandardButton.Save, QMessageBox.StandardButton.Discard));

      if (ret == QMessageBox.StandardButton.Save) {
        return saveFile("png");
      } else if (ret == QMessageBox.StandardButton.Cancel) {
        return false;
      }
    }
    return true;
  }