コード例 #1
0
server_options_dialog::server_options_dialog(QWidget *parent)
  : QDialog(parent)
{ 
  port_label = new QLabel(tr("Port Number:  "));
  portno_edit = new QLineEdit("2000");
  port_label->setBuddy(portno_edit);

  host_label = new QLabel(tr("Host Address: "));
  host_edit = new QLineEdit("localhost");
  host_label->setBuddy(host_edit);

  accept_button = new QPushButton(tr("Accept"));
  accept_button->setDefault(true);
  accept_button->setEnabled(true);
  cancel_button = new QPushButton(tr("Cancel"));
  
  connect(portno_edit, SIGNAL(textChanged(const QString &)),
	  this, SLOT(enable_accept_button(const QString &)));
  connect(accept_button, SIGNAL(clicked()),
	  this, SLOT(accept_clicked()));
  connect(accept_button, SIGNAL(clicked()),
	  this, SLOT(close()));
  connect(host_edit, SIGNAL(textChanged(const QString &)),
	  this, SLOT(enable_accept_button(const QString &)));
  connect(accept_button, SIGNAL(clicked()),
	  this, SLOT(accept_clicked()));
  connect(cancel_button, SIGNAL(clicked()),
	  this, SLOT(close()));

  QHBoxLayout * topLayout = new QHBoxLayout;
  topLayout->addWidget(port_label);
  topLayout->addWidget(portno_edit);
  
  QHBoxLayout * middleLayout = new QHBoxLayout;
  middleLayout->addWidget(host_label);
  middleLayout->addWidget(host_edit);

  QHBoxLayout * bottomLayout = new QHBoxLayout;
  bottomLayout->addWidget(accept_button);
  bottomLayout->addWidget(cancel_button);

  QVBoxLayout * mainLayout = new QVBoxLayout;
  mainLayout->addLayout(topLayout);
  mainLayout->addLayout(middleLayout);
  mainLayout->addLayout(bottomLayout);
  setLayout(mainLayout);

  setWindowTitle(tr("Options"));
  setFixedHeight(sizeHint().height());
}
コード例 #2
0
ファイル: dccgui.c プロジェクト: UIKit0/picogui
static void
recv_row_selected (GtkWidget * clist, gint row, gint column,
						 GdkEventButton * even)
{
	if (even && even->type == GDK_2BUTTON_PRESS)
		accept_clicked (0, 0);
}
コード例 #3
0
ファイル: dccgui.c プロジェクト: TingPing/conspire
static void
dcc_dclick_cb (GtkTreeView *view, GtkTreePath *path,
					GtkTreeViewColumn *column, gpointer data)
{
	struct DCC *dcc;
	GSList *list;

	list = dcc_get_selected ();
	if (!list)
		return;
	dcc = list->data;
	g_slist_free (list);

	if (dcc->type == TYPE_RECV)
	{
		accept_clicked (0, 0);
		return;
	}

	switch (dcc->dccstat)
	{
	case STAT_FAILED:
	case STAT_ABORTED:
	case STAT_DONE:
		dcc_abort (dcc->serv->front_session, dcc);
	}
}