// constructor
LineObjectDialog::LineObjectDialog (QWidget * parent):
  QDialog (parent), ui (new Ui::LineObjectDialog)
{
  QAbstractButton *button;		
  ui->setupUi (this);
  this->setWindowFlags(Qt::CustomizeWindowHint);
  
  color = Qt::white;
  pixmap = new QPixmap (16, 16);
  icon = new QIcon;
  pixmap->fill (color);
  icon->addPixmap (*pixmap, QIcon::Normal, QIcon::On);
  ui->colorButton->setIcon (*icon);
#ifdef Q_OS_WIN  
  colorDialog = new QColorDialog (this);
#else
  colorDialog = new QColorDialog; // (this);
#endif    
  colorDialog->setModal (true);
  
  foreach (button, ui->buttonBox->buttons ())
    button->setFocusPolicy (Qt::NoFocus);
  
  connect(ui->colorButton, SIGNAL(clicked (bool)), this, SLOT(color_clicked(void)));
  connect (colorDialog, SIGNAL (accepted ()), this, SLOT (colorDialog_accepted ()));
  connect(ui->buttonBox, SIGNAL(accepted ()), this, SLOT(ok_clicked ()));
  connect(ui->buttonBox, SIGNAL(rejected ()), this, SLOT(cancel_clicked ()));
  
  correctWidgetFonts (this);
}
Example #2
0
customer::customer(QWidget *parent,QSqlDatabase* db1,int mode,QString cusid) :
    QDialog(parent),
    ui(new Ui::customer)
{
    this->db1=db1;
    this->mode=mode;
    this->cusid=cusid;
    ui->setupUi(this);
    QIcon* icon =new QIcon((QString)APATH+"add.jpg");
    QIcon* icon1 =new QIcon((QString)APATH+"cancel.png");
    QIcon* icon2 =new QIcon((QString)APATH+"edit.png");
    ui->pushAddDebit->setIcon(*icon);
    ui->pushAddDebit->setIconSize(QSize( ui->pushAddDebit->size().width()-5,ui->pushAddDebit->size().height()-5 ));
    ui->pushLeave->setIcon(*icon1);
    ui->pushLeave->setIconSize(QSize( ui->pushLeave->size().width()-5,ui->pushLeave->size().height()-5 ));
    ui->pushCusInsert->setIcon(*icon);
    ui->pushCusInsert->setIconSize(QSize( ui->pushCusInsert->size().width()-5,ui->pushCusInsert->size().height()-5 ));
    ui->pushDeleteDebit->setIcon(*icon1);
    ui->pushDeleteDebit->setIconSize(QSize( ui->pushDeleteDebit->size().width()-5,ui->pushDeleteDebit->size().height()-5 ));
    ui->pushEditDebit->setIcon(*icon2);
    ui->pushEditDebit->setIconSize(QSize( ui->pushEditDebit->size().width()-5,ui->pushEditDebit->size().height()-5 ));

    if (mode==0)
        //INSERT MODE
    {
        ui->pushAddDebit->setEnabled(FALSE);
        ui->pushCusInsert->setEnabled(FALSE);
        ui->pushDeleteDebit->setEnabled(FALSE);
        ui->pushEditDebit->setEnabled(FALSE);

    }
    if (mode==1)
    {
        QSqlQuery query(*db1);
        query.exec("select name,email1,email2,active,phone from customers where id="+cusid);
        query.next();
        ui->lineEdit->setText(query.value(0).toString());
        ui->lineEmail1->setText(query.value(1).toString());
        ui->lineEmail2->setText(query.value(2).toString());
        if(query.value(3).toInt()==0)
            ui->checkActive->setCheckState(Qt::Unchecked);
        else
            ui->checkActive->setCheckState(Qt::Checked);
        ui->linePhone->setText((query.value(4).toString()));
        ui->pushCusInsert->setEnabled(FALSE);
        refresh_sql();
    }
    connect(ui->lineEdit,SIGNAL(textChanged(QString)),this,SLOT(text_changed()));
    connect(ui->lineEmail1,SIGNAL(textChanged(QString)),this,SLOT(text_changed()));
    connect(ui->lineEmail2,SIGNAL(textChanged(QString)),this,SLOT(text_changed()));
    connect(ui->linePhone,SIGNAL(textChanged(QString)),this,SLOT(text_changed()));
    connect(ui->pushCusInsert,SIGNAL(released()),this,SLOT(insert_customer()));
    connect(ui->pushAddDebit,SIGNAL(released()),this,SLOT(insert_debit_type()));
    connect(ui->checkActive,SIGNAL(clicked()),this,SLOT(check_clicked()));
    connect(ui->pushLeave,SIGNAL(released()),this,SLOT(cancel_clicked()));

}
Example #3
0
/*
 *  Constructs a Pscan as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
Pscan::Pscan(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : QDialog(parent, name, modal, fl)
{
    setupUi(this);
    connect(cancel, SIGNAL(clicked()), this, SLOT(cancel_clicked()));

    init();
    QSettings qs;

    restoreGeometry(qs.value("pscan/geometry").toByteArray());
}
bool FormImpl::on_key_release(GdkEventKey* event, bool *status, const bool is_run, ::mforms::Button *accept, ::mforms::Button *cancel)
{
  if (event->keyval == GDK_Escape)
  {
    *status = false;
    cancel_clicked(status, is_run);
    if (cancel)
      cancel->callback();
  }
  return false;
}
Example #5
0
CCreateWaveDlg::CCreateWaveDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCreateWaveDlg::IDD, pParent)
{
//   IDD_CREATEWAV DIALOGEX 0, 0, 151, 173
   CRect rect(CPoint(0,0),CSize(151,173));
   MapDialogRect(&rect);
   setFixedSize(rect.Width(),rect.Height());
   
//       DEFPUSHBUTTON   "Begin",IDC_BEGIN,37,152,52,14
   CButton* mfc1 = new CButton(this);
   CRect r1(CPoint(37,152),CSize(52,14));
   MapDialogRect(&r1);
   mfc1->Create(_T("Begin"),0,r1,this,IDC_BEGIN);
   mfc1->setDefault(true);
   mfcToQtWidget.insert(IDC_BEGIN,mfc1);
   QObject::connect(mfc1,SIGNAL(clicked()),this,SLOT(begin_clicked()));
//       PUSHBUTTON      "Cancel",IDCANCEL,92,152,52,14
   CButton* mfc2 = new CButton(this);
   CRect r2(CPoint(92,152),CSize(52,14));
   MapDialogRect(&r2);
   mfc2->Create(_T("Cancel"),0,r2,this,IDCANCEL);
   mfcToQtWidget.insert(IDCANCEL,mfc2);
   QObject::connect(mfc2,SIGNAL(clicked()),this,SLOT(cancel_clicked()));
//       GROUPBOX        "Song length",IDC_STATIC,7,7,137,47
   CGroupBox* mfc3 = new CGroupBox(this);
   mfc3->setTitle("Song length");
   CRect r3(CPoint(7,7),CSize(137,47));
   MapDialogRect(&r3);
   mfc3->setGeometry(r3);
   // IDC_STATIC do not get added to MFC-to-Qt map.
//       CONTROL         "Play the song",IDC_RADIO_LOOP,"Button",BS_AUTORADIOBUTTON,14,20,59,10
   CButton* mfc4 = new CButton(this);
   CRect r4(CPoint(14,20),CSize(59,10));
   MapDialogRect(&r4);
   mfc4->Create(_T("Play the song"),BS_AUTORADIOBUTTON,r4,this,IDC_RADIO_LOOP);
   mfcToQtWidget.insert(IDC_RADIO_LOOP,mfc4);
   QObject::connect(mfc4,SIGNAL(clicked()),this,SLOT(radioLoop_clicked()));
//       CONTROL         "Play for",IDC_RADIO_TIME,"Button",BS_AUTORADIOBUTTON,14,38,41,10
   CButton* mfc5 = new CButton(this);
   CRect r5(CPoint(14,38),CSize(41,10));
   MapDialogRect(&r5);
   mfc5->Create(_T("Play for"),BS_AUTORADIOBUTTON,r5,this,IDC_RADIO_TIME);
   mfcToQtWidget.insert(IDC_RADIO_TIME,mfc5);
   QObject::connect(mfc5,SIGNAL(clicked()),this,SLOT(radioTime_clicked()));
//       EDITTEXT        IDC_TIMES,73,19,36,12,ES_AUTOHSCROLL
//       CONTROL         "",IDC_SPIN_LOOP,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,105,17,11,17
//       LTEXT           "time(s)",IDC_STATIC,115,20,21,10,SS_CENTERIMAGE
//       EDITTEXT        IDC_SECONDS,53,37,44,12,ES_AUTOHSCROLL
//       CONTROL         "",IDC_SPIN_TIME,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,93,36,11,14
//       LTEXT           "mm:ss",IDC_STATIC,106,38,21,10,SS_CENTERIMAGE
//       GROUPBOX        "Channels",IDC_STATIC,7,60,137,87
//       LISTBOX         IDC_CHANNELS,14,71,124,70,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
}
Example #6
0
cNewProjectWindow::cNewProjectWindow(cMainController *parent) :
  QDialog(parent->get_main_window_ref()),
  ui(new Ui::cNewProjectWindow)
{
  ui->setupUi(this);

  m_controller = parent;

  setWindowTitle("New Project");
  setModal(true);

  connect(ui->btn_ok,SIGNAL(clicked()),this,SLOT(ok_clicked()));
  connect(ui->btn_cancel,SIGNAL(clicked()),this,SLOT(cancel_clicked()));

}
Example #7
0
/*******************************************************************************
    initScene
*******************************************************************************/
void SettingsScene::initScene()
{
    // create pages
    m_pages[SETTINGS::GENERAL]   = new PageGeneral(parentView());
    m_pages[SETTINGS::PLAYER]    = new PagePlayer(parentView());
    m_pages[SETTINGS::LIBRARY]   = new PageLibrary(parentView());
    m_pages[SETTINGS::SHORTCUT]  = new PageShortcut(parentView());
    m_pages[SETTINGS::SCROBBLER] = new PageScrobbler(parentView());
    m_pages[SETTINGS::SONGINFO]  = new PageSongInfo(parentView());

    connect(m_pages[SETTINGS::GENERAL], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::PLAYER], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::LIBRARY], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SHORTCUT], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SCROBBLER], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SONGINFO], SIGNAL(layout_changed()), this, SLOT(populateScene()));

    m_header = new HeaderItem(qobject_cast<QGraphicsView*> (parentView())->viewport());
    m_header->setText( tr("Settings") );

    /* bottom widget */
    m_bottomWidget  = new BottomWidget();
    connect(m_bottomWidget, SIGNAL(save_clicked()), this, SLOT(slot_apply_settings()));
    connect(m_bottomWidget, SIGNAL(cancel_clicked()), this, SLOT(slot_cancel_settings()));
    
    
    this->addItem(m_header);
    this->addItem(m_pages.value(SETTINGS::GENERAL));
    this->addItem(m_pages.value(SETTINGS::PLAYER));
    this->addItem(m_pages.value(SETTINGS::LIBRARY));
    this->addItem(m_pages.value(SETTINGS::SHORTCUT));
    this->addItem(m_pages.value(SETTINGS::SCROBBLER));
    this->addItem(m_pages.value(SETTINGS::SONGINFO));

    /* first init => always restore settings */
    restore_settings();

    /* il faut interdire la modification des parametres de collection si un database builder est en cours */
    connect(ThreadManager::instance(), SIGNAL(dbBuildStart()), this, SLOT(slot_dbBuilder_stateChange()));
    connect(ThreadManager::instance(), SIGNAL(dbBuildFinished()), this, SLOT(slot_dbBuilder_stateChange()));
    
    setInit(true);
}
Example #8
0
static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
	if (event && event->keyval == GDK_KEY_Escape)
		cancel_clicked(NULL, NULL);
	return FALSE;
}
/**
 * Constructor.
 */
CQSBMLSaveOptionsDialog::CQSBMLSaveOptionsDialog(QWidget * pParent , const char * name): QDialog(pParent, name, true)
    , mCompressionType(CQSBMLSaveOptionsDialog::NONE)
    , mSaveCOPASIMIRIAM(true)
    , mpLayout(new QVBoxLayout(this))
    , mpVersionBox(new QComboBox(false, this))
    , mpMIRIAMCheckbox(new QCheckBox("Save COPASI MIRIAM annotation", this))
    , mpCompressionGroup(new QButtonGroup(2, Qt::Horizontal, "Compression", this))
    , mpOKButton(new QPushButton("Export", this))
    , mpCancelButton(new QPushButton("Cancel", this))
{
  // add the widgets to the layout
  std::vector<std::pair<unsigned C_INT32, unsigned C_INT32> > levelsAndVersions;
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(1, 2));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 1));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 2));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 3));
  levelsAndVersions.push_back(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 4));
  this->setLevelsAndVersions(levelsAndVersions);
  this->setLevelAndVersion(std::pair<unsigned C_INT32, unsigned C_INT32>(2, 3));
  // that the widget has a fixed size determined by it's elements
  this->mpLayout->setResizeMode(QLayout::Fixed);
  this->mpLayout->addSpacing(5);
  QHBoxLayout* pLayout = new QHBoxLayout();
  this->mpLayout->addLayout(pLayout);
  pLayout->addSpacing(5);
  pLayout->addWidget(new QLabel("SBML Version:", this));
  pLayout->addSpacing(5);
  pLayout->addWidget(this->mpVersionBox);
  pLayout->addSpacing(5);
  // the compression feature is disabled for now since the libsbml we use
  // does not have the dependencies
  //this->mpLayout->addSpacing(8);
  //this->mpLayout->addWidget(this->mpCompressionGroup);
  // add the buttons to the compression group
  this->mpCompressionGroup->setRadioButtonExclusive(true);
  new QRadioButton("none", this->mpCompressionGroup);
  new QRadioButton("zip", this->mpCompressionGroup);
  new QRadioButton("gzip", this->mpCompressionGroup);
  new QRadioButton("bzip2", this->mpCompressionGroup);
  this->mpCompressionGroup->setButton(this->mCompressionType);
  this->mpCompressionGroup->hide();
  this->mpLayout->addSpacing(8);
  pLayout = new QHBoxLayout();
  this->mpLayout->addLayout(pLayout);
  QToolTip::add(this->mpMIRIAMCheckbox, "Export additional MIRIAM annotation in the COPASI namespace.");
  this->mpMIRIAMCheckbox->setChecked(this->mSaveCOPASIMIRIAM);
  pLayout->addStretch();
  pLayout->addWidget(this->mpMIRIAMCheckbox);
  pLayout->addStretch();
  this->mpLayout->addSpacing(8);
  pLayout = new QHBoxLayout();
  this->mpLayout->addLayout(pLayout);
  // make OK button the default
  // add some space between the buttons and before and after them
  pLayout->addStretch();
  pLayout->addWidget(this->mpOKButton);
  pLayout->addStretch();
  pLayout->addWidget(this->mpCancelButton);
  pLayout->addStretch();
  this->mpOKButton->setDefault(true);
  this->mpLayout->addSpacing(5);
  // set the tab order
  this->setTabOrder(this->mpVersionBox, this->mpCompressionGroup);
  this->setTabOrder(this->mpCompressionGroup, this->mpMIRIAMCheckbox);
  this->setTabOrder(this->mpMIRIAMCheckbox, this->mpOKButton);
  this->setTabOrder(this->mpOKButton, this->mpCancelButton);

  // connect the signals and slots
  connect(this->mpMIRIAMCheckbox, SIGNAL(toggled(bool)), this, SLOT(miriam_toggled(bool)));
  connect(this->mpCompressionGroup, SIGNAL(clicked(int)), this, SLOT(compression_clicked(int)));
  connect(this->mpOKButton, SIGNAL(clicked()), this, SLOT(ok_clicked()));
  connect(this->mpCancelButton, SIGNAL(clicked()), this, SLOT(cancel_clicked()));
}