static void destroyCB(Widget widget, xfselControlBlkType *ctrlBlk,
                 XmListCallbackStruct *call_data)
{
    /* Prevent double destruction of the font selection dialog */
    ctrlBlk->destroyedFlag = TRUE;
    cancelAction(widget, ctrlBlk, call_data);
}
kXneurApp::addUserAction::addUserAction(QString nm, QString key, QString cmd, QWidget *parent) :QDialog(parent),ui(new Ui::addUserAction)
{
    ui->setupUi(this);
    ui->txtActionName->setText(nm);
    ui->lblHotKey->setText(key);
    ui->txtCommandAction->setText(cmd);
    connect(ui->cmdSave, SIGNAL(clicked()), SLOT(saveAction()));
    connect(ui->cmdCancel,SIGNAL(clicked()),SLOT(cancelAction()));
}
bool CActionManager::cancelActionById(int id)
{
    CAction* currentAction = findAction(id);
    if (currentAction)
    {
        return cancelAction(currentAction);
    } else {
        return false;
    }
}
Exemple #4
0
void XxxForm::createActions(void) {
	connect(statusTimer, SIGNAL(timeout()), this, SLOT(timerStatusAction()));

	connect(nextPushButton, SIGNAL(released()), this, SLOT(nextAction()));
	connect(previousPushButton, SIGNAL(released()), this,
			SLOT(previousAction()));

	connect(savePushButton, SIGNAL(released()), this, SLOT(saveAction()));
	connect(saveAndContinueSavingPushButton, SIGNAL(released()), this, SLOT(
			saveAndContinueSavingAction()));
	connect(removePushButton, SIGNAL(released()), this, SLOT(removeAction()));
	connect(cancelPushButton, SIGNAL(released()), this, SLOT(cancelAction()));
}
Exemple #5
0
void IngameMenu::processEvents(const sf::Event &event)
{
	if(event.Type == sf::Event::Closed)
		Application::getInstance()->window->Close();

	else if(event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Key::Escape)
	{
		cancelAction();
	}

	bQuit.processEvents(event);
	bCancel.processEvents(event);
}
ConfirmWindow::ConfirmWindow(QWidget *parent) :
    QWidget(parent)
{
    QVBoxLayout *v = new QVBoxLayout(this);
    QHBoxLayout *h = new QHBoxLayout();
    confirmText = new QLabel("Вы точно хотите это сделать?", this);
    okButton = new QPushButton("OK",this);
    cancelButton = new QPushButton("Отмена",this);
    v->addWidget(confirmText);
    v->addStrut(10);
    v->addItem(h);
    h->addWidget(okButton);
    h->addWidget(cancelButton);
    this->setLayout(v);
    QObject::connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelAction()));
    QObject::connect(okButton,SIGNAL(clicked()),this,SLOT(confirmAction()));
}
void ProviderWindow::setupConnections()
{
// signals and slots connections

	// Standard Actions for buttons
	connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelAction() ) );
	connect( saveButton, SIGNAL( clicked() ), this, SLOT( saveAction() ) );
	connect (deleteButton, SIGNAL( clicked() ), this, SLOT( deleteAction() ) );
	// These to connects are for detecting if the ok/save button should be
	// activated. 
	connect( lastnameEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( activatesaveButton() ) );
	connect( firstnameEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( activatesaveButton() ) );

	// Detects if the signature on file checkbox changed, and if so
	// runs sofchanged() to activate or deactivate signature on file date box.
	connect (sofCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( sofchanged() ) );


}
void handleButtonPress(AppInfo *app, XEvent *event)
{
   DialogInfo *d = app->dialog;

   cancelInputTimeout(app);
   if (event->xbutton.button != Button1) {
      return;
   }
   if (ButtonPress == event->type) {
      if (eventIsInsideButton(app, event, d->okButton)) {
	 d->pressedButton = OK_BUTTON;
	 d->okButton.pressed = True;
	 paintButton(app, d->dialogWindow, d->okButton);
      } else if (eventIsInsideButton(app, event, d->cancelButton)) {
	 d->pressedButton = CANCEL_BUTTON;
	 d->cancelButton.pressed = True;
	 paintButton(app, d->dialogWindow, d->cancelButton);
      } else {
	 d->pressedButton = NO_BUTTON;
      }
   } else if (ButtonRelease == event->type) {
      if (OK_BUTTON == d->pressedButton) {
	 if (eventIsInsideButton(app, event, d->okButton)) {
	    acceptAction(app);
	 } else {
	    if (d->okButton.pressed) {
	       d->okButton.pressed = False;
	       paintButton(app, d->dialogWindow, d->okButton);
	    }
	 }
      } else if (CANCEL_BUTTON == d->pressedButton) {
	 if (eventIsInsideButton(app, event, d->cancelButton)) {
	    cancelAction(app);
	 } else {
	    if (d->cancelButton.pressed) {
	       d->cancelButton.pressed = False;
	       paintButton(app, d->dialogWindow, d->cancelButton);
	    }
	 }
      }
      d->pressedButton = NO_BUTTON;
   }
}
void handleKeyPress(AppInfo *app, XEvent *event)
{
   char s[2];
   int n;
   
   if (event->xkey.send_event) {
      /* Pay no attention to synthetic key events. */
      return;
   }
   cancelInputTimeout(app);
   n = XLookupString(&(event->xkey), s, 1, NULL, NULL);
   
   if (1 != n) {
      return;
   }
   s[1] = '\0';
   switch (s[0]) {
    case '\010':
    case '\177':
      backspacePassphrase(app);
      break;
    case '\025':
    case '\030':
      erasePassphrase(app);
      break;
    case '\012':
    case '\015':
      acceptAction(app);
      break;
    case '\033':
      cancelAction(app);
      break;
    default:
      addToPassphrase(app, s[0]);
      break;
   }
}
int main(int argc, char **argv)
{
   AppInfo app;
   XEvent event;

   memset(&app, 0, sizeof(app));
   
   progclass = "SshAskpass";
   app.toplevelShell = XtAppInitialize(&(app.appContext), progclass,
					NULL, 0, &argc, argv,
					defaults, NULL, 0);
   app.argc = argc;
   app.argv = argv;
   app.dpy = XtDisplay(app.toplevelShell);
   app.screen = DefaultScreenOfDisplay(app.dpy);
   app.rootWindow = RootWindowOfScreen(app.screen);
   app.black = BlackPixel(app.dpy, DefaultScreen(app.dpy));
   app.white = WhitePixel(app.dpy, DefaultScreen(app.dpy));
   app.colormap = DefaultColormapOfScreen(app.screen);
   app.resourceDb = XtDatabase(app.dpy);
   XtGetApplicationNameAndClass(app.dpy, &progname, &progclass);
   app.appName = progname;
   app.appClass = progclass;
   /* For resources.c. */
   db = app.resourceDb;
   
   /* Seconds after which keyboard/pointer grab fail. */
   app.grabFailTimeout = 5;
   /* Number of seconds to wait between grab attempts. */
   app.grabRetryInterval = 1;
   
   app.pid = getpid();

   {
      struct rlimit resourceLimit;
      int status;
      
      status = getrlimit(RLIMIT_CORE, &resourceLimit);
      if (-1 == status) {
	 fprintf(stderr, "%s[%ld]: getrlimit failed (%s)\n", app.appName,
		 (long) app.pid, strerror(errno));
	 exit(EXIT_STATUS_ERROR);
      }
      resourceLimit.rlim_cur = 0;
      status = setrlimit(RLIMIT_CORE, &resourceLimit);
      if (-1 == status) {
	 fprintf(stderr, "%s[%ld]: setrlimit failed (%s)\n", app.appName,
		 (long) app.pid, strerror(errno));
	 exit(EXIT_STATUS_ERROR);
      }
   }
   
   app.xResolution =
      WidthOfScreen(app.screen) * 1000 / WidthMMOfScreen(app.screen);
   app.yResolution =
      HeightOfScreen(app.screen) * 1000 / HeightMMOfScreen(app.screen);
   
   createDialog(&app);
   createGCs(&app);
   
   app.eventMask = 0;
   app.eventMask |= ExposureMask;
   app.eventMask |= ButtonPressMask;
   app.eventMask |= ButtonReleaseMask;
   app.eventMask |= Button1MotionMask;
   app.eventMask |= KeyPressMask;

   createDialogWindow(&app);
   
   XMapWindow(app.dpy, app.dialog->dialogWindow);
   if (app.inputTimeout > 0) {
      app.inputTimeoutActive = True;
      app.inputTimeoutTimerId =
	 XtAppAddTimeOut(app.appContext, app.inputTimeout,
			 handleInputTimeout, (XtPointer) &app);
   }

   
   while(True) {
      XtAppNextEvent(app.appContext, &event);
      switch (event.type) {
       case Expose:
	 grabServer(&app);
	 grabKeyboard(&app);
	 grabPointer(&app);
	 if (event.xexpose.count) {
	    break;
	 }
	 paintDialog(&app);
	 break;
       case ButtonPress:
       case ButtonRelease:
	 handleButtonPress(&app, &event);
	 break;
       case MotionNotify:
	 handlePointerMotion(&app, &event);
       case KeyPress:
	 handleKeyPress(&app, &event);
	 break;
       case ClientMessage:
	 if ((32 == event.xclient.format) &&
	     ((unsigned long) event.xclient.data.l[0] ==
	      app.wmDeleteWindowAtom)) {
	    cancelAction(&app);
	 }
	 break;
       default:
	 break;
      }
   }

   fprintf(stderr, "%s[%ld]: This should not happen.\n", app.appName,
	   (long) app.pid);
   return(EXIT_STATUS_ANOMALY);
}
Exemple #11
0
CVolumeProperties::CVolumeProperties(CVolume *volume)
{
	setWindowTitle(tr("Volume Properties"));
	tmpVolume = volume;
	
	QVBoxLayout *vLayout = new QVBoxLayout(this);

	nameLabel = new QLabel(tr("Name of volume"));
	name = new QLineEdit();
	name->setText(volume->getName());
	vLayout->addWidget(nameLabel);
	vLayout->addWidget(name);

	QHBoxLayout *dLayout = new QHBoxLayout();
	dimensionsBox = new QGroupBox(tr("Dimension of volume"));
	dimensionsLabel = new QLabel(tr("%1 x %2 x %3").arg(volume->getWidth()).arg(volume->getHeight()).arg(volume->getDepth()));
	dLayout->addWidget(dimensionsLabel);
	dimensionsBox->setLayout(dLayout);

	vLayout->addWidget(dimensionsBox);

	QHBoxLayout *pLayout = new QHBoxLayout();
	positionBox = new QGroupBox(tr("Position"));
	x = new QLabel(tr("X:"));
	y = new QLabel(tr("Y:"));
	z = new QLabel(tr("Z:"));
	xv = new QDoubleSpinBox();
	xv->setMinimum(-1000);
	xv->setMaximum(1000);
	yv = new QDoubleSpinBox();
	yv->setMinimum(-1000);
	yv->setMaximum(1000);
	zv = new QDoubleSpinBox();
	zv->setMinimum(-1000);
	zv->setMaximum(1000);
	xv->setValue(volume->getPosition().getX());
	yv->setValue(volume->getPosition().getY());
	zv->setValue(volume->getPosition().getZ());
	pLayout->addWidget(x);
	pLayout->addWidget(xv);
	pLayout->addWidget(y);
	pLayout->addWidget(yv);
	pLayout->addWidget(z);
	pLayout->addWidget(zv);
	positionBox->setLayout(pLayout);

	vLayout->addWidget(positionBox);

	QHBoxLayout *arLayout = new QHBoxLayout();
	aspectRatioBox = new QGroupBox(tr("Aspect Ratio"));
	xr = new QLabel(tr("X:"));
	yr = new QLabel(tr("Y:"));
	zr = new QLabel(tr("Z:"));
	xvr = new QDoubleSpinBox();
	xvr->setMinimum(-10);
	xvr->setMaximum(10);
	yvr = new QDoubleSpinBox();
	yvr->setMinimum(-10);
	yvr->setMaximum(10);
	zvr = new QDoubleSpinBox();
	zvr->setMinimum(-10);
	zvr->setMaximum(10);
	xvr->setValue(volume->getAspectRatio(VISc::dX));
	yvr->setValue(volume->getAspectRatio(VISc::dY));
	zvr->setValue(volume->getAspectRatio(VISc::dZ));
	arLayout->addWidget(xr);
	arLayout->addWidget(xvr);
	arLayout->addWidget(yr);
	arLayout->addWidget(yvr);
	arLayout->addWidget(zr);
	arLayout->addWidget(zvr);
	aspectRatioBox->setLayout(arLayout);

	vLayout->addWidget(aspectRatioBox);

	QHBoxLayout *cLayout = new QHBoxLayout();
	colorLabel = new QLabel(tr("Color:"));
	colorShower = new QLineEdit();
	colorShower->setEnabled(false);
	QPalette palette( colorShower->palette() );
	palette.setColor( QPalette::Base, volume->getColor() );
	colorShower->setPalette(palette);
	tmpColor = volume->getColor();

	colorPicker = new QPushButton(tr("Color"));
	connect(colorPicker, SIGNAL(clicked()), this, SLOT(colorPickerAction()));
	cLayout->addWidget(colorLabel);
	cLayout->addWidget(colorShower);
	cLayout->addWidget(colorPicker);
	vLayout->addLayout(cLayout);

	//QHBoxLayout *iLayout = new QHBoxLayout();
	//intensityLabel = new QLabel(tr("Intensity"));
	//intensity = new QDoubleSpinBox();
	//intensity->setMinimum(0.0);
	//intensity->setMaximum(1.0);
	//intensity->setValue(light->getIntensity());
	//iLayout->addWidget(intensityLabel);
	//iLayout->addWidget(intensity);
	//intensity->setValue(light->getIntensity());

	//vLayout->addLayout(iLayout);

	QHBoxLayout *buttons = new QHBoxLayout();
	ok = new QPushButton(tr("OK"));
	ok->setDefault(true);
	connect(ok, SIGNAL(clicked()), this, SLOT(okAction()));
	cancel = new QPushButton(tr("Cancel"));
	connect(cancel, SIGNAL(clicked()), this, SLOT(cancelAction()));
	buttons->addWidget(ok);
	buttons->addWidget(cancel);

	vLayout->addLayout(buttons);
}
Exemple #12
0
void Checkout::onDoCheckout()
{
    if (!checkInputs())
        return;
    switchToPageMessages();
    saveInputValues();

    groupBoxRepository->setEnabled(false);
    buttonBox->button(QDialogButtonBox::Abort)->setVisible(true);
    buttonBox->button(QDialogButtonBox::Cancel)->setVisible(false);
    buttonBox->button(QDialogButtonBox::Ok)->setVisible(false);

    action = new QSvnClientCheckoutAction(m_selectedURL, m_selectedPath);
    connect(action, SIGNAL(notify(QString, QString)), this, SLOT(onNotify(QString, QString)));
    connect(action, SIGNAL(finished()), this, SLOT(onCheckoutFinished()));
    connect(action, SIGNAL(finished(QString)), this, SIGNAL(finished(QString)));
    connect(action, SIGNAL(doGetLogin(QString,QString,QString,bool)), this, SLOT(onGetLogin(QString,QString,QString,bool)));
    connect(action, SIGNAL(doGetSslServerTrustPrompt()), this, SLOT(onGetSslServerTrustPrompt()));
    connect(buttonBox->button(QDialogButtonBox::Abort), SIGNAL(clicked()), action, SLOT(cancelAction()));
    action->start();
}