コード例 #1
0
ファイル: refusedlg.cpp プロジェクト: nic0lae/freebsddistro
CRefuseDlg::CRefuseDlg(unsigned long _nUin, QString t, QWidget* parent)
   : LicqDialog(parent, "RefuseDialog", true)
{
  ICQUser *u = gUserManager.FetchUser(_nUin, LOCK_R);
  QLabel *lbl = new QLabel(tr("Refusal message for %1 with ").arg(t) + QString::fromUtf8(u->GetAlias()) + ":", this);
  gUserManager.DropUser(u);

  mleRefuseMsg = new MLEditWrap(true, this);

  QPushButton *btnRefuse = new QPushButton(tr("Refuse"), this );
  connect( btnRefuse, SIGNAL(clicked()), SLOT(accept()) );
  QPushButton *btnCancel = new QPushButton(tr("Cancel"), this );
  connect( btnCancel, SIGNAL(clicked()), SLOT(reject()) );
  int bw = 75;
  bw = QMAX(bw, btnRefuse->sizeHint().width());
  bw = QMAX(bw, btnCancel->sizeHint().width());
  btnRefuse->setFixedWidth(bw);
  btnCancel->setFixedWidth(bw);

  QGridLayout *lay = new QGridLayout(this, 3, 5, 15, 10);
  lay->addMultiCellWidget(lbl, 0, 0, 0, 4);
  lay->addMultiCellWidget(mleRefuseMsg, 1, 1, 0, 4);
  lay->addWidget(btnRefuse, 2, 1);
  lay->addWidget(btnCancel, 2, 3);
  lay->setColStretch(0, 2);
  lay->setColStretch(4, 2);
  lay->addColSpacing(2, 10);

  setCaption(tr("Licq %1 Refusal").arg(t));
}
コード例 #2
0
ファイル: update_screen.cpp プロジェクト: cwarden/quasar
UpdateScreen::UpdateScreen(const CompanyDefn& company)
    : QMainWindow(0, "UpdateScreen", WType_TopLevel | WDestructiveClose),
      _connection(NULL)
{
    QFrame* frame = new QFrame(this);

    QLabel* fromLabel = new QLabel(tr("From Version:"), frame);
    _fromVersion = new LineEdit(14, frame);
    _fromVersion->setFocusPolicy(NoFocus);

    QLabel* toLabel = new QLabel(tr("To Version:"), frame);
    _toVersion = new ComboBox(frame);
    toLabel->setBuddy(_toVersion);

    QFrame* buttons = new QFrame(frame);
    _update = new QPushButton(tr("&Update"), buttons);
    _close = new QPushButton(tr("&Close"), buttons);

    connect(_update, SIGNAL(clicked()), SLOT(slotUpdate()));
    connect(_close, SIGNAL(clicked()), SLOT(slotClose()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(6);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(_update, 0, 1);
    buttonGrid->addWidget(_close, 0, 2);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(2, 1);
    grid->addColSpacing(2, 20);
    grid->addWidget(fromLabel, 0, 0);
    grid->addWidget(_fromVersion, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(toLabel, 0, 3);
    grid->addWidget(_toVersion, 0, 4, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(buttons, 1, 1, 0, 4);

    ServerConfig config;
    config.load();

    _fromVersion->setText(company.version());

    QDir dir(parseDir(config.dataDir), "*.xml");
    dir.cd("models");
    QStringList entries = dir.entryList();
    for (unsigned int i = 0; i < entries.size(); ++i) {
	QString version = QFileInfo(entries[i]).baseName();
	if (version < company.version()) continue;
	_toVersion->insertItem(version);
    }
    _toVersion->setCurrentItem(company.version());

    _company = company;

    setCentralWidget(frame);
    setCaption(tr("Version Update: %1").arg(company.name()));
}
コード例 #3
0
ファイル: forwarddlg.cpp プロジェクト: nic0lae/freebsddistro
CForwardDlg::CForwardDlg(CSignalManager *sigMan, CUserEvent *e, QWidget *p)
  : LicqDialog(p, "UserForwardDialog", false, WDestructiveClose | WType_TopLevel)
{
  sigman = sigMan;

  m_nEventType = e->SubCommand();
  m_nUin = 0;
  m_szId = 0;
  m_nPPID = 0;

  QString t;
  switch (e->SubCommand())
  {
    case ICQ_CMDxSUB_MSG:
      t = tr("Message");
      s1 = QString::fromLocal8Bit(((CEventMsg *)e)->Message());
      break;
    case ICQ_CMDxSUB_URL:
      t = tr("URL");
      s1 = QString::fromLocal8Bit(((CEventUrl *)e)->Url());
      s2 = QString::fromLocal8Bit(((CEventUrl *)e)->Description());
      break;
    default:
      WarnUser(this, tr("Unable to forward this message type (%d).").arg(e->SubCommand()));
      return;
  }

  setCaption(tr("Forward %1 To User").arg(t));
  setAcceptDrops(true);

  QGridLayout *lay = new QGridLayout(this, 3, 5, 10, 5);
  QLabel *lbl = new QLabel(tr("Drag the user to forward to here:"), this);
  lay->addMultiCellWidget(lbl, 0, 0, 0, 4);
  edtUser = new CInfoField(this, true);
  edtUser->setAcceptDrops(false);
  lay->addMultiCellWidget(edtUser, 1, 1, 0, 4);

  lay->setColStretch(0, 2);
  btnOk = new QPushButton(tr("&Forward"), this);
  lay->addWidget(btnOk, 2, 1);

  lay->addColSpacing(2, 10);
  btnCancel = new QPushButton(tr("&Cancel"), this);
  lay->addWidget(btnCancel, 2, 3);
  lay->setColStretch(4, 2);

  int bw = 75;
  bw = QMAX(bw, btnOk->sizeHint().width());
  bw = QMAX(bw, btnCancel->sizeHint().width());
  btnOk->setFixedWidth(bw);
  btnCancel->setFixedWidth(bw);

  connect(btnOk, SIGNAL(clicked()), SLOT(slot_ok()));
  connect(btnCancel, SIGNAL(clicked()), SLOT(close()));
}
コード例 #4
0
void KWStatisticsDialog::addBoxGeneral( QFrame *page, QLabel **resultLabel )
{
    // Layout Managers
    QVBoxLayout *topLayout = new QVBoxLayout( page, 0, 7 );
    QGroupBox *box = new QGroupBox( i18n( "Statistics" ), page );
    QGridLayout *grid = new QGridLayout( box, 9, 3, KDialog::marginHint(), KDialog::spacingHint() );
    grid->setRowStretch (9, 1);
    // margins
    int fHeight = box->fontMetrics().height();
    grid->setMargin( fHeight );
    grid->addColSpacing( 1, fHeight );
    grid->addRowSpacing( 0, fHeight );

    // insert labels
    QLabel *label1 = new QLabel( i18n( "Number of pages:" ), box );
    grid->addWidget( label1, 1, 0, 1 );
    resultLabel[0] = new QLabel( "", box );
    grid->addWidget( resultLabel[0], 1, 2, 2 );

    QLabel *label2 = new QLabel( i18n( "Number of frames:" ), box );
    grid->addWidget( label2, 2, 0, 1 );
    resultLabel[1] = new QLabel( "", box );
    grid->addWidget( resultLabel[1], 2, 2, 2 );

    QLabel *label3 = new QLabel( i18n( "Number of pictures:" ), box );
    grid->addWidget( label3, 3, 0, 1 );
    resultLabel[2] = new QLabel( "", box );
    grid->addWidget( resultLabel[2], 3, 2, 2 );


    QLabel *label4 = new QLabel( i18n( "Number of tables:" ), box );
    grid->addWidget( label4, 4, 0, 1 );
    resultLabel[3] = new QLabel( "", box );
    grid->addWidget( resultLabel[3], 4, 2, 2 );

    QLabel *label5 = new QLabel( i18n( "Number of embedded objects:" ), box );
    grid->addWidget( label5, 5, 0, 1 );
    resultLabel[4] = new QLabel( "", box );
    grid->addWidget( resultLabel[4], 5, 2, 2 );

    QLabel *label6 = new QLabel( i18n( "Number of formula frameset:" ), box );
    grid->addWidget( label6, 6, 0, 1 );
    resultLabel[5] = new QLabel( "", box );
    grid->addWidget( resultLabel[5], 6, 2, 2 );

    topLayout->addWidget( box );
}
コード例 #5
0
ファイル: column_edit.cpp プロジェクト: cwarden/quasar
void
ColumnEdit::createWidgets()
{
    setCaption("Column Edit");
    menuBar();

    QFrame* main = new QFrame(this);
    QVBox* body = new QVBox(main);
    QFrame* top = new QFrame(body);
    QFrame* mid = new QFrame(body);
    QVBox* right = new QVBox(main);

    QLabel* nameLabel = new QLabel("&Name:", top);
    _name = new LineEdit(top);
    nameLabel->setBuddy(_name);

    QLabel* descLabel = new QLabel("&Description:", top);
    _desc = new MultiLineEdit(top);
    descLabel->setBuddy(_desc);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setRowStretch(2, 1);
    topGrid->setColStretch(1, 1);
    topGrid->addWidget(nameLabel, 0, 0);
    topGrid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addMultiCellWidget(_desc, 1, 2, 1, 1);

    QLabel* typeLabel = new QLabel("&Type:", mid);
    _type = new ComboBox(mid);
    typeLabel->setBuddy(_type);

    QLabel* lengthLabel = new QLabel("&Length:", mid);
    _length = new LineEdit(mid);
    lengthLabel->setBuddy(_length);

    _manditory = new QCheckBox("Manditory?", mid);
    _unique = new QCheckBox("Unique?", mid);

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(2, 1);
    midGrid->addColSpacing(2, 20);
    midGrid->addWidget(typeLabel, 0, 0);
    midGrid->addWidget(_type, 0, 1, AlignLeft | AlignVCenter);
    midGrid->addWidget(lengthLabel, 1, 0);
    midGrid->addWidget(_length, 1, 1, AlignLeft | AlignVCenter);
    midGrid->addMultiCellWidget(_manditory, 2, 2, 0, 1,AlignLeft|AlignVCenter);
    midGrid->addMultiCellWidget(_unique, 3, 3, 0, 1,AlignLeft|AlignVCenter);

    QPushButton* ok = new QPushButton("&Ok", right);
    QPushButton* next = new QPushButton("&Next", right);
    QPushButton* reset = new QPushButton("&Reset", right);
    QPushButton* cancel = new QPushButton("&Cancel", right);

    QGridLayout* grid = new QGridLayout(main);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(0, 1);
    grid->addWidget(body, 0, 0);
    grid->addWidget(right, 0, 1, AlignTop | AlignLeft);

    connect(ok, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(next, SIGNAL(clicked()), this, SLOT(slotNext()));
    connect(reset, SIGNAL(clicked()), this, SLOT(slotReset()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(slotCancel()));
    connect(_type, SIGNAL(activated(int)), this, SLOT(slotTypeChanged()));

    for (int type = 0; type <= ColumnDefn::TYPE_QUANTITY; ++type)
	_type->insertItem(ColumnDefn::typeName(type));

    setCentralWidget(main);

    QPopupMenu* file = new QPopupMenu(this);
    file->insertItem(tr("&Ok"), this, SLOT(slotOk()));
    file->insertItem(tr("&Next"), this, SLOT(slotNext()));
    file->insertItem(tr("&Reset"), this, SLOT(slotReset()));
    file->insertSeparator();
    file->insertItem(tr("&Cancel"), this, SLOT(slotCancel()), ALT+Key_Q);
    menuBar()->insertItem(tr("&File"), file);
}
コード例 #6
0
ファイル: channelgroupconf.cpp プロジェクト: opieproject/opie
ChannelGroupConf::ChannelGroupConf(QWidget *parent, const char *name):QWidget(parent,name)
{
	QGridLayout *layout = new QGridLayout(this);
	QVBoxLayout *volLayout = new QVBoxLayout(this);
	QVBoxLayout *chanLayout = new QVBoxLayout(this);

	layout->addRowSpacing(1,5);
	layout->addRowSpacing(3,5);
	layout->addRowSpacing(5,5);

	layout->addColSpacing(1,1);
	layout->addColSpacing(3,1);
	layout->addColSpacing(5,1);
	layout->addColSpacing(7,1);

	QPushButton *one = new QPushButton("1", this, "one");
	layout->addWidget(one, 0, 2, 0);
	connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *two = new QPushButton("2", this, "two");
	layout->addWidget(two, 0, 4, 0);
	connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *three = new QPushButton("3", this, "three");
	layout->addWidget(three, 0, 6, 0);
	connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *four = new QPushButton("4", this, "four");
	layout->addWidget(four, 2, 2, 0);
	connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *five = new QPushButton("5", this, "five");
	layout->addWidget(five, 2, 4, 0);
	connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *six = new QPushButton("6", this, "six");
	layout->addWidget(six, 2, 6, 0);
	connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *seven = new QPushButton("7", this, "seven");
	layout->addWidget(seven, 4, 2, 0);
	connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *eight = new QPushButton("8", this, "eight");
	layout->addWidget(eight, 4, 4, 0);
	connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *nine = new QPushButton("9", this, "nine");
	layout->addWidget(nine, 4, 6, 0);
	connect(nine, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *zero = new QPushButton("0", this, "zero");
	layout->addWidget(zero, 6, 4, 0);
	connect(zero, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	layout->addMultiCellLayout(volLayout, 0, 6, 0, 0, 0);
	layout->addMultiCellLayout(chanLayout, 0, 6, 8, 8, 0);

	QPushButton *volUp = new QPushButton("+", this, "volUp");
	volLayout->addWidget(volUp, 1, 0);
	connect(volUp, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QLabel *volLabel = new QLabel("Volume ", this, "volLabel");
	volLayout->addWidget(volLabel, 0, 0);

	QPushButton *volDown = new QPushButton("-", this, "volDown");
	volLayout->addWidget(volDown, 1, 0);
	connect(volDown, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );


	QPushButton *chanUp = new QPushButton("+", this, "chanUp");
	chanLayout->addWidget(chanUp, 1, 0);
	connect(chanUp, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QLabel *chanLabel = new QLabel("Channel", this, "chanLabel");
	chanLayout->addWidget(chanLabel, 0, 0);

	QPushButton *chanDown = new QPushButton("-", this, "chanDown");
	chanLayout->addWidget(chanDown, 1, 0);
	connect(chanDown, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

}
コード例 #7
0
ファイル: TMOGUIAdjust.cpp プロジェクト: cadik/TMS
TMOGUIAdjust::TMOGUIAdjust(QWidget* parent, const char * name):
	QFrame(parent, name)
{
	iMode = 0;
	pValues = 0;
	bLog = true;
	bUpdate = false;

	setFrameStyle( QFrame::Panel | QFrame::Sunken );
	QGridLayout *pLayout = new QGridLayout(this, 8, 4);
	pLayout->setColStretch(0,0);
	pLayout->setColStretch(1,1);
	pLayout->setColStretch(2,0);
	pLayout->setColStretch(3,0);
	pLayout->addColSpacing(2,20);
	
	QSlider *pSlider = new QSlider(this, "HistoSlider");
	pSlider->setFixedSize(16,64);
	pSlider->setRange(-50, 50);
	pSlider->setValue(0);
	pSlider->setOrientation(Vertical);
	pSlider->setTickmarks(QSlider::Right);
	pSlider->setTickInterval(10);
	pLayout->addMultiCellWidget(pSlider, 0, 3, 0, 0);

	pHisto = new TMOGUIHisto(this, "Histogram");
	pLayout->addMultiCellWidget(pHisto, 0, 3, 1, 1, AlignBottom);

	pLayout->addRowSpacing(4, 2);

	pToneSlider = new TMOGUIToneSlider(this, "ToneSlider");
	pLayout->addWidget(pToneSlider, 5, 1);

	pRed = new QPushButton(this, "RedButton");
	pRed->setFlat(true);
	pRed->setFixedSize(16,16);
	pRed->setPixmap(*TMOResource::pResource->IconRed->pixmap());
	QToolTip::add(pRed, "Select Red Channel");
	pLayout->addWidget(pRed, 0, 2, AlignCenter);
	
	pGreen = new QPushButton(this, "GreenButton");
	pGreen->setFlat(true);
	pGreen->setFixedSize(16,16);
	pGreen->setPixmap(*TMOResource::pResource->IconGreen->pixmap());
	QToolTip::add(pGreen, "Select Green Channel");
	pLayout->addWidget(pGreen, 1, 2, AlignCenter);

	pBlue = new QPushButton(this, "BlueButton");
	pBlue->setFlat(true);
	pBlue->setFixedSize(16,16);
	pBlue->setPixmap(*TMOResource::pResource->IconBlue->pixmap());
	QToolTip::add(pBlue, "Select Blue Channel");
	pLayout->addWidget(pBlue, 2, 2, AlignCenter);

	pLum = new QPushButton(this, "LumButton");
	pLum->setFlat(true);
	pLum->setFixedSize(16,16);
	pLum->setPixmap(*TMOResource::pResource->IconLumDown->pixmap());	
	QToolTip::add(pLum, "Select Luminance");
	pLayout->addWidget(pLum, 3, 2, AlignCenter);
	
	pLinear = new QPushButton(this, "LinearButton");
	pLinear->setFlat(true);
	pLinear->setFixedSize(32,32);
	pLinear->setPixmap(*TMOResource::pResource->IconLin->pixmap());
	QToolTip::add(pLinear, "View In Linear Distribution");
	pLayout->addMultiCellWidget(pLinear, 0, 1, 3, 3, AlignCenter);

	pLog = new QPushButton(this, "LogarithmicButton");
	pLog->setFlat(true);
	pLog->setFixedSize(32,32);
	pLog->setPixmap(*TMOResource::pResource->IconLogDown->pixmap());
	QToolTip::add(pLog, "View In Logarithmic Distribution");
	pLayout->addMultiCellWidget(pLog, 2, 3, 3, 3, AlignCenter);
	
	pLayout->addRowSpacing(6, 2);

	QHBoxLayout* hbox = new QHBoxLayout();
	QLabel* pLabel = new QLabel(this, "BlackLabel");
	pLabel->setPixmap(*TMOResource::pResource->IconBlack->pixmap());
	pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	hbox->addWidget(pLabel);
	pBlack = new QLineEdit(this, "EditBlack");
	pBlack->setAlignment(Qt::AlignRight);
	pBlack->setFixedWidth(72);
	hbox->addWidget(pBlack);
	hbox->insertStretch(-1,1);
	pLabel = new QLabel(this, "GammaLabel");
	pLabel->setPixmap(*TMOResource::pResource->IconGamma->pixmap());
	pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	hbox->addWidget(pLabel);
	pGamma = new QLineEdit(this, "EditGamma");
	pGamma->setAlignment(Qt::AlignRight);
	pGamma->setFixedWidth(72);
	hbox->addWidget(pGamma);
	hbox->insertStretch(-1,1);
	pLabel = new QLabel(this, "WhiteLabel");
	pLabel->setPixmap(*TMOResource::pResource->IconWhite->pixmap());
	pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	hbox->addWidget(pLabel);
	pWhite = new QLineEdit(this, "EditWhite");
	pWhite->setAlignment(Qt::AlignRight);
	pWhite->setFixedWidth(72);
	hbox->addWidget(pWhite);
	pLayout->addLayout(hbox, 7, 1);


	connect (pSlider, SIGNAL(sliderMoved(int)), this, SLOT(scalechanged(int)));
	connect (pLinear, SIGNAL(clicked()), pHisto, SLOT(setlinear()));
	connect (pLog, SIGNAL(clicked()), pHisto, SLOT(setlog()));
	connect (pRed, SIGNAL(clicked()), pHisto, SLOT(setr()));
	connect (pGreen, SIGNAL(clicked()), pHisto, SLOT(setg()));
	connect (pBlue, SIGNAL(clicked()), pHisto, SLOT(setb()));
	connect (pLum, SIGNAL(clicked()), pHisto, SLOT(setl()));
	connect (pLinear, SIGNAL(clicked()), pToneSlider, SLOT(setlinear()));
	connect (pLog, SIGNAL(clicked()), pToneSlider, SLOT(setlog()));
	connect (pRed, SIGNAL(clicked()), pToneSlider, SLOT(setr()));
	connect (pGreen, SIGNAL(clicked()), pToneSlider, SLOT(setg()));
	connect (pBlue, SIGNAL(clicked()), pToneSlider, SLOT(setb()));
	connect (pLum, SIGNAL(clicked()), pToneSlider, SLOT(setl()));
	connect (pRed, SIGNAL(clicked()), this, SLOT(setr()));
	connect (pGreen, SIGNAL(clicked()), this, SLOT(setg()));
	connect (pBlue, SIGNAL(clicked()), this, SLOT(setb()));
	connect (pLum, SIGNAL(clicked()), this, SLOT(setl()));
	connect (pBlack, SIGNAL(textChanged(const QString &)), this, SLOT(setblack(const QString &)));
	connect (pWhite, SIGNAL(textChanged(const QString &)), this, SLOT(setwhite(const QString &)));
	connect (pGamma, SIGNAL(textChanged(const QString &)), this, SLOT(setgamma(const QString &)));
	connect (pBlack, SIGNAL(returnPressed()), this, SLOT(updateall()));
	connect (pWhite, SIGNAL(returnPressed()), this, SLOT(updateall()));
	connect (pGamma, SIGNAL(returnPressed()), this, SLOT(updateall()));
	connect (pLinear, SIGNAL(clicked()), this, SLOT(setlinear()));
	connect (pLog, SIGNAL(clicked()), this, SLOT(setlog()));
}
コード例 #8
0
NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
                                bool readOnly, QWidget *parent, const char *name )
  : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel,
                 Ok, parent, name, true ), mAddressee( addr )
{
  QWidget *page = plainPage();
  QGridLayout *layout = new QGridLayout( page );
  layout->setSpacing( spacingHint() );
  layout->addColSpacing( 2, 100 );
  QLabel *label;

  label = new QLabel( i18n( "Honorific prefixes:" ), page );
  layout->addWidget( label, 0, 0 );
  mPrefixCombo = new KComboBox( page );
  mPrefixCombo->setDuplicatesEnabled( false );
  mPrefixCombo->setEditable( true );
  mPrefixCombo->setEnabled( !readOnly );
  label->setBuddy( mPrefixCombo );
  layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 );

  QWhatsThis::add( mPrefixCombo, i18n( "The predefined honorific prefixes can be extended in the settings dialog." ) );

  label = new QLabel( i18n( "Given name:" ), page );
  layout->addWidget( label, 1, 0 );
  mGivenNameEdit = new KLineEdit( page );
  mGivenNameEdit->setReadOnly( readOnly );
  label->setBuddy( mGivenNameEdit );
  layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 );

  label = new QLabel( i18n( "Additional names:" ), page );
  layout->addWidget( label, 2, 0 );
  mAdditionalNameEdit = new KLineEdit( page );
  mAdditionalNameEdit->setReadOnly( readOnly );
  label->setBuddy( mAdditionalNameEdit );
  layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 );

  label = new QLabel( i18n( "Family names:" ), page );
  layout->addWidget( label, 3, 0 );
  mFamilyNameEdit = new KLineEdit( page );
  mFamilyNameEdit->setReadOnly( readOnly );
  label->setBuddy( mFamilyNameEdit );
  layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 );

  label = new QLabel( i18n( "Honorific suffixes:" ), page );
  layout->addWidget( label, 4, 0 );
  mSuffixCombo = new KComboBox( page );
  mSuffixCombo->setDuplicatesEnabled( false );
  mSuffixCombo->setEditable( true );
  mSuffixCombo->setEnabled( !readOnly );
  label->setBuddy( mSuffixCombo );
  layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 );

  QWhatsThis::add( mSuffixCombo, i18n( "The predefined honorific suffixes can be extended in the settings dialog." ) );

  label = new QLabel( i18n( "Formatted name:" ), page );
  layout->addWidget( label, 5, 0 );

  mFormattedNameCombo = new KComboBox( page );
  mFormattedNameCombo->setEnabled( !readOnly );
  layout->addWidget( mFormattedNameCombo, 5, 1 );
  connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) );

  mFormattedNameEdit = new KLineEdit( page );
  mFormattedNameEdit->setEnabled( type == CustomName && !readOnly );
  layout->addWidget( mFormattedNameEdit, 5, 2 );

  mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page );
  mParseBox->setEnabled( !readOnly );
  connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) );
  connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) );
  layout->addMultiCellWidget( mParseBox, 6, 6, 0, 1 );

  // Fill in the values
  mFamilyNameEdit->setText( addr.familyName() );
  mGivenNameEdit->setText( addr.givenName() );
  mAdditionalNameEdit->setText( addr.additionalName() );
  mFormattedNameEdit->setText( addr.formattedName() );

  // Prefix and suffix combos
  KConfig config( "kabcrc" );
  config.setGroup( "General" );

  QStringList sTitle;
  sTitle += "";
  sTitle += i18n( "Dr." );
  sTitle += i18n( "Miss" );
  sTitle += i18n( "Mr." );
  sTitle += i18n( "Mrs." );
  sTitle += i18n( "Ms." );
  sTitle += i18n( "Prof." );
  sTitle += config.readListEntry( "Prefixes" );
  sTitle.sort();

  QStringList sSuffix;
  sSuffix += "";
  sSuffix += i18n( "I" );
  sSuffix += i18n( "II" );
  sSuffix += i18n( "III" );
  sSuffix += i18n( "Jr." );
  sSuffix += i18n( "Sr." );
  sSuffix += config.readListEntry( "Suffixes" );
  sSuffix.sort();

  mPrefixCombo->insertStringList( sTitle );
  mSuffixCombo->insertStringList( sSuffix );

  mPrefixCombo->setCurrentText( addr.prefix() );
  mSuffixCombo->setCurrentText( addr.suffix() );

  mAddresseeConfig.setAddressee( addr );
  mParseBox->setChecked( mAddresseeConfig.automaticNameParsing() );

  KAcceleratorManager::manage( this );

  connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mFormattedNameCombo, SIGNAL( activated( int ) ),
           this, SLOT( modified() ) );
  connect( mFormattedNameCombo, SIGNAL( activated( int ) ),
           this, SLOT( formattedNameTypeChanged() ) );
  connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( modified() ) );
  connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ),
           this, SLOT( formattedNameChanged( const QString& ) ) );

  initTypeCombo();
  mFormattedNameCombo->setCurrentItem( type );
  mPrefixCombo->lineEdit()->setFocus();
  mChanged = false;
}
コード例 #9
0
QFontDialog::QFontDialog( QWidget *parent, const char *name,
			  bool modal, WFlags f )
    : QDialog( parent, name, modal, f )
{
    setSizeGripEnabled( TRUE );
    d = new QFontDialogPrivate;
    // grid
    d->familyEdit = new QLineEdit( this, "font family I" );
    d->familyEdit->setReadOnly( TRUE );
    d->familyList = new QListBox( this, "font family II" );
    d->familyEdit->setFocusProxy( d->familyList );

    d->familyAccel
	= new QLabel( d->familyList, tr("&Font"), this, "family accelerator" );
    d->familyAccel->setIndent( 2 );

    d->styleEdit = new QLineEdit( this, "font style I" );
    d->styleEdit->setReadOnly( TRUE );
    d->styleList = new QListBox( this, "font style II" );
    d->styleEdit->setFocusProxy( d->styleList );

    d->styleAccel
	= new QLabel( d->styleList, tr("Font st&yle"), this, "style accelerator" );
    d->styleAccel->setIndent( 2 );

    d->sizeEdit = new QLineEdit( this, "font size I" );
    d->sizeEdit->setFocusPolicy( ClickFocus );
    QIntValidator *validator = new QIntValidator( 1, 512, this );
    d->sizeEdit->setValidator( validator );
    d->sizeList = new QListBox( this, "font size II" );

    d->sizeAccel
	= new QLabel ( d->sizeEdit, tr("&Size"), this, "size accelerator" );
    d->sizeAccel->setIndent( 2 );

    // effects box
    d->effects = new QVGroupBox( tr("Effects"), this, "font effects" );
    d->strikeout = new QCheckBox( d->effects, "strikeout on/off" );
    d->strikeout->setText( tr("Stri&keout") );
    d->underline = new QCheckBox( d->effects, "underline on/off" );
    d->underline->setText( tr("&Underline") );

    d->sample = new QHGroupBox( tr("Sample"), this, "sample text" );
    d->sampleEdit = new QLineEdit( d->sample, "r/w sample text" );
    d->sampleEdit->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored) );
    d->sampleEdit->setAlignment( AlignCenter );
    // Note that the sample text is *not* translated with tr(), as the
    // characters used depend on the charset encoding.
    d->sampleEdit->setText( "AaBbYyZz" );

    d->scriptCombo = new QComboBox( FALSE, this, "font encoding" );

    d->scriptAccel
	= new QLabel( d->scriptCombo, tr("Scr&ipt"), this,"encoding label");
    d->scriptAccel->setIndent( 2 );

    d->size = 0;
    d->smoothScalable = FALSE;

    connect( d->scriptCombo, SIGNAL(activated(int)),
	     SLOT(scriptHighlighted(int)) );
    connect( d->familyList, SIGNAL(highlighted(int)),
	     SLOT(familyHighlighted(int)) );
    connect( d->styleList, SIGNAL(highlighted(int)),
	     SLOT(styleHighlighted(int)) );
    connect( d->sizeList, SIGNAL(highlighted(const QString&)),
	     SLOT(sizeHighlighted(const QString&)) );
    connect( d->sizeEdit, SIGNAL(textChanged(const QString&)),
	     SLOT(sizeChanged(const QString&)) );

    connect( d->strikeout, SIGNAL(clicked()),
	     SLOT(updateSample()) );
    connect( d->underline, SIGNAL(clicked()),
	     SLOT(updateSample()) );

    (void)d->familyList->sizeHint();
    (void)d->styleList->sizeHint();
    (void)d->sizeList->sizeHint();

    for (int i = 0; i < QFont::NScripts; i++) {
	QString scriptname = QFontDatabase::scriptName((QFont::Script) i);
	if ( !scriptname.isEmpty() )
	    d->scriptCombo->insertItem( scriptname );
    }

    updateFamilies();
    if ( d->familyList->count() != 0 )
	d->familyList->setCurrentItem( 0 );

    // grid layout
    QGridLayout * mainGrid = new QGridLayout( this, 9, 6, 12, 0 );

    mainGrid->addWidget( d->familyAccel, 0, 0 );
    mainGrid->addWidget( d->familyEdit, 1, 0 );
    mainGrid->addWidget( d->familyList, 2, 0 );

    mainGrid->addWidget( d->styleAccel, 0, 2 );
    mainGrid->addWidget( d->styleEdit, 1, 2 );
    mainGrid->addWidget( d->styleList, 2, 2 );

    mainGrid->addWidget( d->sizeAccel, 0, 4 );
    mainGrid->addWidget( d->sizeEdit, 1, 4 );
    mainGrid->addWidget( d->sizeList, 2, 4 );

    mainGrid->setColStretch( 0, 38 );
    mainGrid->setColStretch( 2, 24 );
    mainGrid->setColStretch( 4, 10 );

    mainGrid->addColSpacing( 1, 6 );
    mainGrid->addColSpacing( 3, 6 );
    mainGrid->addColSpacing( 5, 6 );

    mainGrid->addRowSpacing( 3, 12 );

    mainGrid->addWidget( d->effects, 4, 0 );

    mainGrid->addMultiCellWidget( d->sample, 4, 7, 2, 4 );

    mainGrid->addWidget( d->scriptAccel, 5, 0 );
    mainGrid->addRowSpacing( 6, 2 );
    mainGrid->addWidget( d->scriptCombo, 7, 0 );

    mainGrid->addRowSpacing( 8, 12 );

    QHBoxLayout *buttonBox = new QHBoxLayout;
    mainGrid->addMultiCell( buttonBox, 9, 9, 0, 4 );

    buttonBox->addStretch( 1 );
    QString okt = modal ? tr("OK") : tr("Apply");
    d->ok = new QPushButton( okt, this, "accept font selection" );
    buttonBox->addWidget( d->ok );
    if ( modal )
	connect( d->ok, SIGNAL(clicked()), SLOT(accept()) );
    d->ok->setDefault( TRUE );
    d->ok->setFixedWidth( 80 );

    buttonBox->addSpacing( 12 );

    QString cancelt = modal ? tr("Cancel") : tr("Close");
    d->cancel = new QPushButton( cancelt, this, "cancel/close" );
    buttonBox->addWidget( d->cancel );
    connect( d->cancel, SIGNAL(clicked()), SLOT(reject()) );
    d->cancel->setFixedWidth( 80 );


    resize( 500, 360 );

    d->sizeEdit->installEventFilter( this );
    d->familyList->installEventFilter( this );
    d->styleList->installEventFilter( this );
    d->sizeList->installEventFilter( this );

    d->familyList->setFocus();
}
コード例 #10
0
ファイル: promo_batch_master.cpp プロジェクト: cwarden/quasar
PromoBatchMaster::PromoBatchMaster(MainWindow* main, Id batch_id)
    : DataWindow(main, "PromoBatchMaster", batch_id)
{
    _helpSource = "promo_batch_master.html";

    QPushButton* print = new QPushButton(tr("Print"), _buttons);
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));

    QPushButton* labels = new QPushButton(tr("Labels"), _buttons);
    connect(labels, SIGNAL(clicked()), SLOT(slotLabels()));

    QPushButton* execute = new QPushButton(tr("Execute"), _buttons);
    connect(execute, SIGNAL(clicked()), SLOT(slotExecute()));

    QFrame* top = new QFrame(_frame);
    top->setFrameStyle(QFrame::Raised | QFrame::Panel);

    QLabel* numberLabel = new QLabel(tr("Batch No.:"), top);
    _number = new LineEdit(top);
    _number->setLength(10, '9');
    numberLabel->setBuddy(_number);

    QLabel* descLabel = new QLabel(tr("Description:"), top);
    _description = new LineEdit(top);
    _description->setLength(40);
    descLabel->setBuddy(_description);

    QLabel* storeLabel = new QLabel(tr("Store:"), top);
    _store = new LookupEdit(new StoreLookup(_main, this), top);
    _store->setLength(30);
    storeLabel->setBuddy(_store);
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    QLabel* fromDateLabel = new QLabel(tr("From:"), top);
    _fromDate = new DatePopup(top);
    fromDateLabel->setBuddy(_fromDate);

    QLabel* toDateLabel = new QLabel(tr("To:"), top);
    _toDate = new DatePopup(top);
    toDateLabel->setBuddy(_toDate);

    QLabel* execDateLabel = new QLabel(tr("Executed On:"), top);
    _execDate = new DateEdit(top);
    _execDate->setFocusPolicy(NoFocus);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setColStretch(2, 1);
    topGrid->addColSpacing(2, 20);
    topGrid->addWidget(numberLabel, 0, 0);
    topGrid->addWidget(_number, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addWidget(_description, 1, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(storeLabel, 2, 0);
    topGrid->addWidget(_store, 2, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(fromDateLabel, 0, 3);
    topGrid->addWidget(_fromDate, 0, 4, AlignLeft | AlignVCenter);
    topGrid->addWidget(toDateLabel, 1, 3);
    topGrid->addWidget(_toDate, 1, 4, AlignLeft | AlignVCenter);
    topGrid->addWidget(execDateLabel, 2, 3);
    topGrid->addWidget(_execDate, 2, 4, AlignLeft | AlignVCenter);

    QFrame* mid = new QFrame(_frame);
    mid->setFrameStyle(QFrame::Raised | QFrame::Panel);

    _items = new Table(mid);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setLeftMargin(fontMetrics().width("99999"));
    _items->setDisplayRows(10);
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
            SLOT(cellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
            SLOT(focusNext(bool&,int&,int&,int)));

    // Lookups
    _itemLookup = new ItemLookup(_main, this);
    _itemLookup->soldOnly = true;

    // Add columns
    new LookupColumn(_items, tr("Item Number"), 18, _itemLookup);
    new TextColumn(_items, tr("Description"), 20);
    new TextColumn(_items, tr("Size"), 8);
    new PriceColumn(_items, tr("Price"));
    new PriceColumn(_items, tr("Promo"));
    new NumberColumn(_items, tr("Ordered"));

    // Add editors
    _size = new QComboBox(false, _items);
    new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items));
    new ComboEditor(_items, 2, _size);
    new PriceEditor(_items, 4, new PriceEdit(_items));
    new NumberEditor(_items, 5, new DoubleEdit(_items));

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(0, 1);
    midGrid->addWidget(_items, 0, 0);

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setRowStretch(1, 1);
    grid->addWidget(top, 0, 0);
    grid->addWidget(mid, 1, 0);

    if (_quasar->storeCount() == 1) {
        storeLabel->hide();
        _store->hide();
    }

    setCaption(tr("Promotion Batch"));
    finalize();
}
コード例 #11
0
ファイル: customer_master.cpp プロジェクト: cwarden/quasar
CustomerMaster::CustomerMaster(MainWindow* main, Id customer_id)
    : DataWindow(main, "CustomerMaster", customer_id)
{
    _helpSource = "customer_master.html";

    QPushButton* email = new QPushButton(tr("Email"), _buttons);
    connect(email, SIGNAL(clicked()), SLOT(slotEmail()));

    // Create widgets
    _company = new QCheckBox(tr("&Company?"), _frame);
    connect(_company, SIGNAL(toggled(bool)), SLOT(companyChanged(bool)));

    _label1 = new QLabel(_frame);
    _entry1 = new LineEdit(30, _frame);
    _label1->setBuddy(_entry1);

    _label2 = new QLabel(_frame);
    _entry2 = new LineEdit(30, _frame);
    _label2->setBuddy(_entry2);

    QLabel* numberLabel = new QLabel(tr("Number:"), _frame);
    _number = new LineEdit(12, _frame);
    numberLabel->setBuddy(_number);

    QLabel* typeLabel = new QLabel(tr("Type:"), _frame);
    _type = new LookupEdit(new CustomerTypeLookup(_main, this), _frame);
    _type->setSizeInfo(12, 'x');
    _type->setMinCharWidth(12);
    _type->setMaxLength(20);
    typeLabel->setBuddy(_type);
    connect(_type, SIGNAL(validData()), this, SLOT(typeChanged()));

    QGroupBox* addr = new QGroupBox(tr("Address"), _frame);
    QGridLayout* grid1 = new QGridLayout(addr, 7, 4,
                                         addr->frameWidth() * 2);
    grid1->addRowSpacing(0, addr->fontMetrics().height());
    grid1->setColStretch(2, 1);

    QLabel* streetLabel = new QLabel(tr("Street:"), addr);
    _street = new LineEdit(addr);
    _street->setLength(60);
    streetLabel->setBuddy(_street);

    _street2 = new LineEdit(addr);
    _street2->setLength(60);

    QLabel* cityLabel = new QLabel(tr("City:"), addr);
    _city = new LineEdit(20, addr);
    cityLabel->setBuddy(_city);

    QLabel* provLabel = new QLabel(tr("Prov/State:"), addr);
    _province = new LineEdit(20, addr);
    provLabel->setBuddy(_province);

    QLabel* postalLabel = new QLabel(tr("Postal/Zip:"), addr);
    _postal = new LineEdit(20, addr);
    postalLabel->setBuddy(_postal);

    QLabel* countryLabel = new QLabel(tr("Country:"), addr);
    _country = new LineEdit(20, addr);
    countryLabel->setBuddy(_country);

    QLabel* phoneLabel = new QLabel(tr("Phone #:"), addr);
    _phone_num = new LineEdit(20, addr);
    phoneLabel->setBuddy(_phone_num);

    QLabel* phone2Label = new QLabel(tr("Phone2 #:"), addr);
    _phone2_num = new LineEdit(20, addr);
    phone2Label->setBuddy(_phone2_num);

    QLabel* faxLabel = new QLabel(tr("Fax #:"), addr);
    _fax_num = new LineEdit(20, addr);
    faxLabel->setBuddy(_fax_num);

    QLabel* emailLabel = new QLabel(tr("Email:"), addr);
    _email = new LineEdit(60, addr);
    emailLabel->setBuddy(_email);

    QLabel* webLabel = new QLabel(tr("Web Page:"), addr);
    _web_page = new LineEdit(60,addr);
    webLabel->setBuddy(_web_page);

    grid1->addWidget(streetLabel, 1, 0);
    grid1->addMultiCellWidget(_street, 1, 1, 1, 4, AlignLeft | AlignVCenter);
    grid1->addMultiCellWidget(_street2, 2, 2, 1, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(cityLabel, 3, 0);
    grid1->addWidget(_city, 3, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(provLabel, 3, 3);
    grid1->addWidget(_province, 3, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(postalLabel, 4, 0);
    grid1->addWidget(_postal, 4, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(countryLabel, 4, 3);
    grid1->addWidget(_country, 4, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(phoneLabel, 5, 0);
    grid1->addWidget(_phone_num, 5, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(phone2Label, 5, 3);
    grid1->addWidget(_phone2_num, 5, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(faxLabel, 6, 0);
    grid1->addWidget(_fax_num, 6, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(emailLabel, 7, 0);
    grid1->addMultiCellWidget(_email, 7, 7, 1, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(webLabel, 8, 0);
    grid1->addMultiCellWidget(_web_page, 8, 8, 1, 4, AlignLeft | AlignVCenter);

    QTabWidget* tabs = new QTabWidget(_frame);
    QFrame* control = new QFrame(tabs);
    QFrame* groupTab = new QFrame(tabs);
    QFrame* trans = new QFrame(tabs);
    QFrame* refsTab = new QFrame(tabs);
    QFrame* extraTab = new QFrame(tabs);
    tabs->addTab(control, tr("Control"));
    tabs->addTab(groupTab, tr("Groups"));
    tabs->addTab(trans, tr("Transactions"));
    tabs->addTab(refsTab, tr("References"));
    tabs->addTab(extraTab, tr("Extra Info"));

    QLabel* patgroupLabel = new QLabel(tr("Patronage Group:"), control);
    _patgroup_id = new LookupEdit(new PatGroupLookup(main, this), control);
    _patgroup_id->setLength(20);
    _patgroup_id->setFocusPolicy(NoFocus);
    patgroupLabel->setBuddy(_patgroup_id);

    QLabel* accountLabel = new QLabel(tr("AR Account:"), control);
    _account_id = new LookupEdit(new AccountLookup(main, this, Account::AR),
                                 control);
    _account_id->setLength(30);
    accountLabel->setBuddy(_account_id);

    QLabel* termLabel = new QLabel(tr("Terms:"), control);
    _term_id = new LookupEdit(new TermLookup(main, this), control);
    _term_id->setLength(30);
    termLabel->setBuddy(_term_id);

    QLabel* exemptLabel = new QLabel(tr("Tax Exempt:"), control);
    _exempt_id = new LookupEdit(new TaxLookup(main, this), control);
    _exempt_id->setLength(30);
    exemptLabel->setBuddy(_exempt_id);

    QLabel* creditLabel = new QLabel(tr("Credit Limit:"), control);
    _credit_limit = new MoneyEdit(control);
    _credit_limit->setLength(14);
    creditLabel->setBuddy(_credit_limit);

    _credit_hold = new QCheckBox(tr("Credit Hold?"), control);

    QLabel* scLabel = new QLabel(tr("Service Charge:"), control);
    _sc_rate = new PercentEdit(control);
    _sc_rate->setLength(8);
    scLabel->setBuddy(_sc_rate);

    _print_stmts = new QCheckBox(tr("Statements?"), control);

    QGridLayout* conGrid = new QGridLayout(control);
    conGrid->setSpacing(3);
    conGrid->setMargin(3);
    conGrid->setColStretch(3, 1);
    conGrid->addWidget(patgroupLabel, 0, 0);
    conGrid->addMultiCellWidget(_patgroup_id, 0,0,1,2,AlignLeft|AlignVCenter);
    conGrid->addWidget(accountLabel, 1, 0);
    conGrid->addMultiCellWidget(_account_id, 1,1,1,2,AlignLeft|AlignVCenter);
    conGrid->addWidget(termLabel, 2, 0);
    conGrid->addMultiCellWidget(_term_id, 2, 2, 1, 2, AlignLeft|AlignVCenter);
    conGrid->addWidget(exemptLabel, 3, 0);
    conGrid->addMultiCellWidget(_exempt_id, 3, 3, 1, 2,AlignLeft|AlignVCenter);
    conGrid->addWidget(creditLabel, 4, 0);
    conGrid->addWidget(_credit_limit, 4, 1, AlignLeft | AlignVCenter);
    conGrid->addWidget(_credit_hold, 4, 2, AlignLeft | AlignVCenter);
    conGrid->addWidget(scLabel, 5, 0);
    conGrid->addWidget(_sc_rate, 5, 1, AlignLeft | AlignVCenter);
    conGrid->addWidget(_print_stmts, 5, 2, AlignLeft | AlignVCenter);

    _groups = new Table(groupTab);
    _groups->setVScrollBarMode(QScrollView::AlwaysOn);
    _groups->setDisplayRows(2);
    _groups->setLeftMargin(fontMetrics().width("999"));
    connect(_groups, SIGNAL(cellChanged(int,int,Variant)),
            SLOT(groupCellChanged(int,int,Variant)));

    GroupLookup* groupLookup = new GroupLookup(_main, this, Group::CUSTOMER);
    new LookupColumn(_groups, tr("Group Name"), 20, groupLookup);
    new LookupEditor(_groups, 0, new LookupEdit(groupLookup, _groups));

    QGridLayout* groupGrid = new QGridLayout(groupTab);
    groupGrid->setSpacing(6);
    groupGrid->setMargin(3);
    groupGrid->setRowStretch(0, 1);
    groupGrid->setColStretch(0, 1);
    groupGrid->addWidget(_groups, 0, 0);

    _charge = new QCheckBox(tr("Can Charge?"), trans);
    _withdraw = new QCheckBox(tr("Can Withdraw?"), trans);
    _payment = new QCheckBox(tr("Can Make Payment?"), trans);
    _check_bal = new QCheckBox(tr("Check Withdraw Balance?"), trans);
    _second_rcpt = new QCheckBox(tr("Second Receipt?"), trans);

    _discs = new Table(trans);
    _discs->setVScrollBarMode(QScrollView::AlwaysOn);
    _discs->setDisplayRows(2);
    _discs->setLeftMargin(fontMetrics().width("999"));
    connect(_discs, SIGNAL(cellChanged(int,int,Variant)),
            SLOT(discountCellChanged(int,int,Variant)));

    DiscountLookup* discLookup = new DiscountLookup(_main, this);
    discLookup->txOnly = true;
    new LookupColumn(_discs, tr("Discount"), 20, discLookup);
    new LookupEditor(_discs, 0, new LookupEdit(discLookup, _discs));

    QGridLayout* transGrid = new QGridLayout(trans);
    transGrid->setSpacing(6);
    transGrid->setMargin(3);
    transGrid->setRowStretch(5, 1);
    transGrid->setColStretch(1, 1);
    transGrid->addWidget(_charge, 0, 0, AlignLeft | AlignVCenter);
    transGrid->addWidget(_withdraw, 1, 0, AlignLeft | AlignVCenter);
    transGrid->addWidget(_payment, 2, 0, AlignLeft | AlignVCenter);
    transGrid->addWidget(_check_bal, 3, 0, AlignLeft | AlignVCenter);
    transGrid->addWidget(_second_rcpt, 4, 0, AlignLeft | AlignVCenter);
    transGrid->addMultiCellWidget(_discs, 0, 5, 2, 2);

    _refs = new Table(refsTab);
    _refs->setVScrollBarMode(QScrollView::AlwaysOn);
    _refs->setDisplayRows(2);
    _refs->setLeftMargin(fontMetrics().width("999"));
    connect(_refs, SIGNAL(cellChanged(int,int,Variant)),
            SLOT(refCellChanged(int,int,Variant)));

    new TextColumn(_refs, tr("Reference"), 16);
    LineEdit* refEdit = new LineEdit(_refs);
    refEdit->setMaxLength(16);
    new LineEditor(_refs, 0, refEdit);

    QGridLayout* refGrid = new QGridLayout(refsTab);
    refGrid->setSpacing(6);
    refGrid->setMargin(3);
    refGrid->setRowStretch(0, 1);
    refGrid->setColStretch(0, 1);
    refGrid->addWidget(_refs, 0, 0);

    _extra = new Table(extraTab);
    _extra->setVScrollBarMode(QScrollView::AlwaysOn);
    _extra->setDisplayRows(2);
    _extra->setLeftMargin(fontMetrics().width("999"));
    connect(_extra, SIGNAL(focusNext(bool&,int&,int&,int)),
            SLOT(extraFocusNext(bool&,int&,int&,int)));

    ExtraLookup* extraLookup = new ExtraLookup(_main, this, "Customer");

    new LookupColumn(_extra, tr("Data Name"), 30, extraLookup);
    new TextColumn(_extra, tr("Value"), 30);

    new LineEditor(_extra, 1, new LineEdit(_extra));

    QPushButton* createData = new QPushButton(tr("Create Data"), extraTab);
    QPushButton* deleteData = new QPushButton(tr("Delete Data"), extraTab);
    QPushButton* renameData = new QPushButton(tr("Rename Data"), extraTab);

    connect(createData, SIGNAL(clicked()), SLOT(slotCreateData()));
    connect(deleteData, SIGNAL(clicked()), SLOT(slotDeleteData()));
    connect(renameData, SIGNAL(clicked()), SLOT(slotRenameData()));

    QGridLayout* extraGrid = new QGridLayout(extraTab);
    extraGrid->setSpacing(6);
    extraGrid->setMargin(3);
    extraGrid->setRowStretch(0, 1);
    extraGrid->setColStretch(0, 1);
    extraGrid->addMultiCellWidget(_extra, 0, 0, 0, 3);
    extraGrid->addWidget(createData, 1, 1);
    extraGrid->addWidget(deleteData, 1, 2);
    extraGrid->addWidget(renameData, 1, 3);

    _open_bal = new QGroupBox(tr("Opening Balance"), _frame);
    QGridLayout* i_grid = new QGridLayout(_open_bal, 2, 2,
                                          _open_bal->frameWidth() * 2);
    i_grid->addRowSpacing(0, _open_bal->fontMetrics().height());

    QLabel* asOfLabel = new QLabel(tr("As of"), _open_bal);
    _as_of = new DatePopup(_open_bal);
    asOfLabel->setBuddy(_as_of);

    QLabel* openBalLabel = new QLabel(tr("Balance:"), _open_bal);
    _open_balance = new MoneyEdit(_open_bal);
    _open_balance->setLength(20);
    openBalLabel->setBuddy(_open_balance);

    i_grid->setColStretch(2, 1);
    i_grid->addWidget(asOfLabel, 1, 0, AlignLeft);
    i_grid->addWidget(_as_of, 2, 0, AlignLeft | AlignVCenter);
    i_grid->addWidget(openBalLabel, 1, 1, AlignLeft);
    i_grid->addWidget(_open_balance, 2, 1, AlignLeft | AlignVCenter);

    Company company;
    _quasar->db()->lookup(company);
    if (_id != INVALID_ID || company.historicalBalancing() == INVALID_ID)
        _open_bal->hide();

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setRowStretch(4, 1);
    grid->setColStretch(2, 1);
    grid->addColSpacing(2, 10);
    grid->addWidget(_company, 0, 0);
    grid->addWidget(_label1, 1, 0, AlignLeft | AlignVCenter);
    grid->addWidget(_entry1, 1, 1, AlignLeft | AlignVCenter);
    grid->addWidget(_label2, 2, 0, AlignLeft | AlignVCenter);
    grid->addWidget(_entry2, 2, 1, AlignLeft | AlignVCenter);
    grid->addWidget(numberLabel, 1, 3, AlignLeft | AlignVCenter);
    grid->addWidget(_number, 1, 4, AlignLeft | AlignVCenter);
    grid->addWidget(typeLabel, 2, 3, AlignLeft | AlignVCenter);
    grid->addWidget(_type, 2, 4, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(addr, 3, 3, 0, 4);
    grid->addMultiCellWidget(tabs, 4, 4, 0, 4);
    grid->addMultiCellWidget(_open_bal, 5, 5, 0, 4);

    setCaption(tr("Customer Master"));
    finalize();
}
コード例 #12
0
void AddresseeEditorWidget::setupTab1()
{
  // This is the General tab
  QWidget *tab1 = new QWidget( mTabWidget );

  QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
  layout->setMargin( KDialogBase::marginHint() );
  layout->setSpacing( KDialogBase::spacingHint() );

  QLabel *label;
  KSeparator* bar;
  QPushButton *button;

  //////////////////////////////////
  // Upper left group (person info)

  // Person icon
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop,
                                                      KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 0, 1, 0, 0 );

  // First name
  button = new QPushButton( i18n( "Edit Name..." ), tab1 );
  QToolTip::add( button, i18n( "Edit the contact's name" ) );
  mNameEdit = new KLineEdit( tab1, "mNameEdit" );
  connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( nameTextChanged( const QString& ) ) );
  connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
  mNameLabel = new KSqueezedTextLabel( tab1 );

  if ( KABPrefs::instance()->automaticNameParsing() ) {
    mNameLabel->hide();
    mNameEdit->show();
  } else {
    mNameEdit->hide();
    mNameLabel->show();
  }

  layout->addWidget( button, 0, 1 );
  layout->addWidget( mNameEdit, 0, 2 );
  layout->addWidget( mNameLabel, 0, 2 );
  label = new QLabel( i18n( "<roleLabel>:", "%1:" ).arg( KABC::Addressee::roleLabel() ), tab1 );
  mRoleEdit = new KLineEdit( tab1 );
  connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( textChanged( const QString& ) ) );
  label->setBuddy( mRoleEdit );
  layout->addWidget( label, 1, 1 );
  layout->addWidget( mRoleEdit, 1, 2 );

  // Organization
  label = new QLabel( i18n( "<organizationLabel>:", "%1:" ).arg( KABC::Addressee::organizationLabel() ), tab1 );
  mOrgEdit = new KLineEdit( tab1 );
  label->setBuddy( mOrgEdit );
  connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( organizationTextChanged( const QString& ) ) );
  layout->addWidget( label, 2, 1 );
  layout->addWidget( mOrgEdit, 2, 2 );

  // File as (formatted name)
  label = new QLabel( i18n( "Formatted name:" ), tab1 );
  mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
  layout->addWidget( label, 3, 1 );
  layout->addWidget( mFormattedNameLabel, 3, 2 );

  // Left hand separator. This separator doesn't go all the way
  // across so the dialog still flows from top to bottom
  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 4, 4, 0, 2 );

  //////////////////////////////////////
  // Phone numbers (upper right)
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook",
                    KIcon::Desktop, KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 0, 1, 3, 3 );

  mPhoneEditWidget = new PhoneEditWidget( tab1 );
  connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );

  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 4, 4, 3, 6 );

  //////////////////////////////////////
  // Addresses (lower left)
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "kfm_home", KIcon::Desktop,
                                                     KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 5, 6, 0, 0 );

  mAddressEditWidget = new AddressEditWidget( tab1 );
  connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mAddressEditWidget, 5, 10, 1, 2 );

  //////////////////////////////////////
  // Email / Web (lower right)
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop,
                                                     KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 5, 6, 3, 3 );

  mEmailWidget = new EmailEditWidget( tab1 );
  connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );

  // add the separator
  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 7, 7, 3, 6 );

  QHBoxLayout *homePageLayout = new QHBoxLayout( 0, 11, 7 );

  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop,
                                                     KIcon::SizeMedium ) );
  homePageLayout->addWidget( label );

  label = new QLabel( i18n( "<urlLabel>:", "%1:" ).arg( KABC::Addressee::urlLabel() ), tab1 );
  mURLEdit = new KLineEdit( tab1 );
  connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( textChanged( const QString& ) ) );
  label->setBuddy( mURLEdit );
  homePageLayout->addWidget( label );
  homePageLayout->addWidget( mURLEdit );
  layout->addMultiCellLayout( homePageLayout, 8, 8, 3, 6 );

  QHBoxLayout *blogLayout = new QHBoxLayout( 0, 11, 7 );
  label = new QLabel( i18n("Blog feed:"), tab1 );
  blogLayout->addWidget( label );
  mBlogEdit = new KLineEdit( tab1 );
  blogLayout->addWidget( mBlogEdit );
  connect( mBlogEdit, SIGNAL( textChanged( const QString & ) ),
           SLOT( textChanged( const QString & ) ) );
  label->setBuddy( mBlogEdit );
  layout->addMultiCellLayout( blogLayout, 9, 9, 4, 6 );

  mIMWidget = new IMEditWidget( tab1, mAddressee );
  connect( mIMWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mIMWidget, 10, 10, 4, 6 );

  layout->addColSpacing( 6, 50 );

  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 11, 11, 0, 6 );

  ///////////////////////////////////////
  QHBox *categoryBox = new QHBox( tab1 );
  categoryBox->setSpacing( KDialogBase::spacingHint() );

  // Categories
  mCategoryButton = new QPushButton( i18n( "Select Categories..." ), categoryBox );
  connect( mCategoryButton, SIGNAL( clicked() ), SLOT( selectCategories() ) );

  mCategoryEdit = new KLineEdit( categoryBox );
  mCategoryEdit->setReadOnly( true );
  connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( textChanged( const QString& ) ) );

  mSecrecyWidget = new SecrecyWidget( categoryBox );
  connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );

  layout->addMultiCellWidget( categoryBox, 12, 12, 0, 6 );

  // Build the layout and add to the tab widget
  layout->activate(); // required

  mTabWidget->addTab( tab1, i18n( "&General" ) );
}
コード例 #13
0
ファイル: item_transfer.cpp プロジェクト: cwarden/quasar
ItemTransfer::ItemTransfer(MainWindow* main, Id transfer_id)
    : DataWindow(main, "ItemTransfer", transfer_id)
{
    _helpSource = "item_transfer.html";

    // Search button
    QPushButton* search = new QPushButton(tr("Search"), _buttons);
    connect(search, SIGNAL(clicked()), SLOT(slotSearch()));

    // Get the company for deposit info
    _quasar->db()->lookup(_company);

    // Create widgets
    _gltxFrame = new GltxFrame(main, tr("Adjustment No."), _frame);
    _gltxFrame->setTitle(tr("From"));
    connect(_gltxFrame->store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    _items = new Table(_frame);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setLeftMargin(fontMetrics().width("99999"));
    _items->setDisplayRows(6);
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(cellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(focusNext(bool&,int&,int&,int)));
    connect(_items, SIGNAL(rowInserted(int)), SLOT(rowInserted(int)));
    connect(_items, SIGNAL(rowDeleted(int)), SLOT(rowDeleted(int)));

    // Lookups
    _lookup = new ItemLookup(_main, this);
    _lookup->inventoriedOnly = true;

    // Add columns
    new LookupColumn(_items, tr("Item Number"), 18, _lookup);
    new TextColumn(_items, tr("Description"), 20);
    new TextColumn(_items, tr("Size"), 10);
    new NumberColumn(_items, tr("On Hand"), 6);
    new NumberColumn(_items, tr("Quantity"), 6);
    new MoneyColumn(_items, tr("Amount"));
    if (_company.depositAccount() != INVALID_ID)
	new MoneyColumn(_items, tr("Deposit"), 4);

    // Add editors
    _size = new QComboBox(_items);
    new LookupEditor(_items, 0, new ItemEdit(_lookup, _items));
    new ComboEditor(_items, 2, _size);
    new NumberEditor(_items, 4, new DoubleEdit(_items));
    new NumberEditor(_items, 5, new MoneyEdit(_items));
    if (_company.depositAccount() != INVALID_ID)
	new NumberEditor(_items, 6, new MoneyEdit(_items));

    QGroupBox* to = new QGroupBox(tr("To"), _frame);

    QLabel* toNumberLabel = new QLabel(tr("Adjustment No."), to);
    _toNumber = new LineEdit(9, to);
    toNumberLabel->setBuddy(_toNumber);

    QLabel* toShiftLabel = new QLabel(tr("Shift:"), to);
    _toShift = new LookupEdit(new GltxLookup(_main, this, DataObject::SHIFT),
			      to);
    _toShift->setLength(10);
    _toShift->setFocusPolicy(ClickFocus);
    toShiftLabel->setBuddy(_toShift);

    QLabel* toStoreLabel = new QLabel(tr("Store:"), to);
    _toStore = new LookupEdit(new StoreLookup(_main, this), to);
    _toStore->setLength(30);
    toStoreLabel->setBuddy(_toStore);

    QGridLayout* toGrid = new QGridLayout(to, 1, 1, to->frameWidth() * 2);
    toGrid->setSpacing(3);
    toGrid->setMargin(6);
    toGrid->setColStretch(2, 1);
    toGrid->addColSpacing(2, 10);
    toGrid->setColStretch(5, 1);
    toGrid->addColSpacing(5, 10);
    toGrid->addRowSpacing(0, to->fontMetrics().height());
    toGrid->addWidget(toNumberLabel, 1, 0);
    toGrid->addWidget(_toNumber, 1, 1, AlignLeft | AlignVCenter);
    toGrid->addWidget(toShiftLabel, 1, 3);
    toGrid->addWidget(_toShift, 1, 4, AlignLeft | AlignVCenter);
    toGrid->addWidget(toStoreLabel, 1, 6);
    toGrid->addWidget(_toStore, 1, 7, AlignLeft | AlignVCenter);

    QLabel* accountLabel = new QLabel(tr("Transfer Account:"), _frame);
    AccountLookup* lookup = new AccountLookup(main, this, 
					      Account::OtherCurLiability);
    _account = new LookupEdit(lookup, _frame);
    _account->setLength(30);
    accountLabel->setBuddy(_account);

    QLabel* totalLabel = new QLabel(tr("Transfer Amount:"), _frame);
    _total = new MoneyEdit(_frame);
    _total->setLength(14);
    _total->setFocusPolicy(NoFocus);
    totalLabel->setBuddy(_total);

    _inactive->setText(tr("Voided?"));

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(2, 1);
    grid->setRowStretch(1, 1);
    grid->addMultiCellWidget(_gltxFrame, 0, 0, 0, 4);
    grid->addMultiCellWidget(_items, 1, 1, 0, 4);
    grid->addMultiCellWidget(to, 2, 2, 0, 4);
    grid->addWidget(accountLabel, 3, 0);
    grid->addWidget(_account, 3, 1, AlignLeft | AlignVCenter);
    grid->addWidget(totalLabel, 3, 3);
    grid->addWidget(_total, 3, 4, AlignLeft | AlignVCenter);

    setCaption(tr("Item Transfer"));
    finalize();
}
コード例 #14
0
K3bDataPropertiesDialog::K3bDataPropertiesDialog( K3bDataItem* dataItem, QWidget* parent, const char* name )
  : KDialogBase( Plain, i18n("File Properties"), Ok|Cancel, Ok, parent, name, true, false )
{
  m_dataItem = dataItem;

  QLabel* labelMimeType = new QLabel( plainPage() );
  QLabel* extraInfoLabel = new QLabel( plainPage() );
  m_editName = new KLineEdit( plainPage() );
  m_labelType = new QLabel( plainPage() );
  m_labelLocation = new KCutLabel( plainPage() );
  m_labelSize = new QLabel( plainPage() );
  m_labelBlocks = new QLabel( plainPage() );
  m_labelLocalName = new KCutLabel( plainPage() );
  m_labelLocalLocation = new KCutLabel( plainPage() );


  QGridLayout* grid = new QGridLayout( plainPage() );
  grid->setSpacing( spacingHint() );
  grid->setMargin( marginHint() );

  grid->addWidget( labelMimeType, 0, 0 );
  grid->addWidget( m_editName, 0, 2 );
  QFrame* line = new QFrame( plainPage() );
  line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
  grid->addMultiCellWidget( line, 1, 1, 0, 2 );
  grid->addWidget( new QLabel( i18n("Type:"), plainPage() ), 2, 0 );
  grid->addWidget( new QLabel( i18n("Location:"), plainPage() ), 4, 0 );
  grid->addWidget( new QLabel( i18n("Size:"), plainPage() ), 5, 0 );
  grid->addWidget( new QLabel( i18n("Used blocks:"), plainPage() ), 6, 0 );
  grid->addWidget( m_labelType, 2, 2 );
  grid->addWidget( extraInfoLabel, 3, 2 );
  grid->addWidget( m_labelLocation, 4, 2 );
  grid->addWidget( m_labelSize, 5, 2 );
  grid->addWidget( m_labelBlocks, 6, 2 );
  line = new QFrame( plainPage() );
  line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
  grid->addMultiCellWidget( line, 7, 7, 0, 2 );
  QLabel* label1 = new QLabel( i18n("Local name:"), plainPage() );
  grid->addWidget(  label1, 8, 0 );
  QLabel* label2 = new QLabel( i18n("Local location:"), plainPage() );
  grid->addWidget( label2, 9, 0 );
  grid->addWidget( m_labelLocalName, 8, 2 );
  grid->addWidget( m_labelLocalLocation, 9, 2 );

  grid->addColSpacing( 1, 50 );
  grid->setColStretch( 2, 1 );



  if( K3bFileItem* fileItem = dynamic_cast<K3bFileItem*>(dataItem) ) {
    KFileItem kFileItem( KFileItem::Unknown, KFileItem::Unknown, KURL::fromPathOrURL(fileItem->localPath()) );
    labelMimeType->setPixmap( kFileItem.pixmap(KIcon::SizeLarge) );
    if( fileItem->isSymLink() )
      m_labelType->setText( i18n("Link to %1").arg(kFileItem.mimeComment()) );
    else
      m_labelType->setText( kFileItem.mimeComment() );
    m_labelLocalName->setText( kFileItem.name() );
    QString localLocation = kFileItem.url().path(-1);
    localLocation.truncate( localLocation.findRev('/') );
    m_labelLocalLocation->setText( localLocation );
    m_labelSize->setText( KIO::convertSize(dataItem->size()) );
  }
  else if( K3bDirItem* dirItem = dynamic_cast<K3bDirItem*>(dataItem) ) {
    labelMimeType->setPixmap( KMimeType::pixmapForURL( KURL( "/" )) );
    m_labelType->setText( i18n("Directory") );
    label1->hide();
    label2->hide();
    m_labelLocalName->hide();
    m_labelLocalLocation->hide();
    line->hide();
    m_labelSize->setText( KIO::convertSize(dataItem->size()) + "\n(" +
			  i18n("in 1 file", "in %n files", dirItem->numFiles()) + " " +
			  i18n("and 1 directory", "and %n directories", dirItem->numDirs()) + ")" );
  }
  else {
    labelMimeType->setPixmap( DesktopIcon("unknown", KIcon::SizeLarge) );
    m_labelType->setText( i18n("Special file") );
    m_labelLocalName->hide();
    m_labelLocalLocation->hide();
    label1->hide();
    label2->hide();
    line->hide();
    m_labelSize->setText( KIO::convertSize(dataItem->size()) );
  }

  m_editName->setText( dataItem->k3bName() );
  m_labelBlocks->setText( QString::number(dataItem->blocks().lba()) );

  QString location = "/" + dataItem->k3bPath();
  if( location[location.length()-1] == '/' )
    location.truncate( location.length()-1 );
  location.truncate( location.findRev('/') );
  if( location.isEmpty() )
    location = "/";
  m_labelLocation->setText( location );
  extraInfoLabel->setText( QString( "(%1)" ).arg(dataItem->extraInfo()) );
  if( dataItem->extraInfo().isEmpty() )
    extraInfoLabel->hide();

  // OPTIONS
  // /////////////////////////////////////////////////
  QTabWidget* optionTab = new QTabWidget( plainPage() );
  line = new QFrame( plainPage() );
  line->setFrameStyle( QFrame::HLine | QFrame::Sunken );

  grid->addMultiCellWidget( line, 10, 10, 0, 2 );
  grid->addMultiCellWidget( optionTab, 12, 12, 0, 2 );
  grid->setRowStretch( 11, 1 );

  QWidget* hideBox = new QWidget( optionTab );
  QGridLayout* hideBoxGrid = new QGridLayout( hideBox );
  hideBoxGrid->setSpacing( spacingHint() );
  hideBoxGrid->setMargin( marginHint() );
  m_checkHideOnRockRidge = new QCheckBox( i18n("Hide on Rockridge"), hideBox );
  m_checkHideOnJoliet = new QCheckBox( i18n("Hide on Joliet"), hideBox );
  hideBoxGrid->addWidget( m_checkHideOnRockRidge, 0, 0 );
  hideBoxGrid->addWidget( m_checkHideOnJoliet, 1, 0 );
  hideBoxGrid->setRowStretch( 2, 1 );
//   grid->addMultiCellWidget( m_checkHideOnRockRidge, 10, 10, 0, 2 );
//   grid->addMultiCellWidget( m_checkHideOnJoliet, 11, 11, 0, 2 );

  QWidget* sortingBox = new QWidget( optionTab );
  QGridLayout* sortingBoxGrid = new QGridLayout( sortingBox );
  sortingBoxGrid->setSpacing( spacingHint() );
  sortingBoxGrid->setMargin( marginHint() );
  m_editSortWeight = new KLineEdit( sortingBox );
  m_editSortWeight->setValidator( new QIntValidator( -2147483647, 2147483647, m_editSortWeight ) );
  m_editSortWeight->setAlignment( Qt::AlignRight );
  sortingBoxGrid->addWidget( new QLabel( i18n("Sort weight:"), sortingBox ), 0, 0 );
  sortingBoxGrid->addWidget( m_editSortWeight, 0, 1 );
  sortingBoxGrid->setColStretch( 1, 1 );
  sortingBoxGrid->setRowStretch( 1, 1 );

  optionTab->addTab( hideBox, i18n("Settings") );
  optionTab->addTab( sortingBox, i18n("Advanced") );


  m_checkHideOnJoliet->setChecked( dataItem->hideOnJoliet() );
  m_checkHideOnRockRidge->setChecked( dataItem->hideOnRockRidge() );
  m_editSortWeight->setText( QString::number(dataItem->sortWeight()) );

  // if the parent is hidden the value cannot be changed (see K3bDataItem::setHide...)
  if( dataItem->parent() ) {
    m_checkHideOnRockRidge->setDisabled( dataItem->parent()->hideOnRockRidge() );
    m_checkHideOnJoliet->setDisabled( dataItem->parent()->hideOnJoliet() );
  }

  if( !dataItem->isHideable() ) {
    m_checkHideOnJoliet->setDisabled(true);
    m_checkHideOnRockRidge->setDisabled(true);
    //    line->hide();
  }

  QToolTip::add( m_checkHideOnRockRidge, i18n("Hide this file in the RockRidge filesystem") );
  QToolTip::add( m_checkHideOnJoliet, i18n("Hide this file in the Joliet filesystem") );
  QToolTip::add( m_editSortWeight, i18n("Modify the physical sorting") );
  QWhatsThis::add( m_checkHideOnRockRidge, i18n("<p>If this option is checked, the file or directory "
						"(and its entire contents) will be hidden on the "
						"ISO9660 and RockRidge filesystem.</p>"
						"<p>This is useful, for example, for having different README "
						"files for RockRidge and Joliet, which can be managed "
						"by hiding README.joliet on RockRidge and README.rr "
						"on the Joliet filesystem.</p>") );
  QWhatsThis::add( m_checkHideOnJoliet, i18n("<p>If this option is checked, the file or directory "
					     "(and its entire contents) will be hidden on the "
					     "Joliet filesystem.</p>"
					     "<p>This is useful, for example, for having different README "
					     "files for RockRidge and Joliet, which can be managed "
					     "by hiding README.joliet on RockRidge and README.rr "
					     "on the Joliet filesystem.</p>") );
  QWhatsThis::add( m_editSortWeight, i18n("<p>This value modifies the physical sort order of the files "
					  "in the ISO9660 filesystem. A higher weighting means that the "
					  "file will be located closer to the beginning of the image "
					  "(and the disk)."
					  "<p>This option is useful in order to optimize the data layout "
					  "on a CD/DVD."
					  "<p><b>Caution:</b> This does not sort the order of the file "
					  "names that appear in the ISO9660 directory."
					  "It sorts the order in which the file data is "
					  "written to the image.") );

  m_editName->setValidator( K3bValidators::iso9660Validator( false, this ) );
  m_editName->setReadOnly( !dataItem->isRenameable() );
  m_editName->setFocus();
}
コード例 #15
0
void KWStatisticsDialog::addBox( QFrame *page, QLabel **resultLabel, bool calcWithFootNoteCheckbox )
{
    // Layout Managers
    QVBoxLayout *topLayout = new QVBoxLayout( page, 0, 7 );
    if ( calcWithFootNoteCheckbox )
    {
        QWidget *w = new QWidget(page);
        topLayout->addWidget( w );
        QVBoxLayout *noteLayout = new QVBoxLayout( w, KDialog::marginHint(), 0 );
        QCheckBox *calcWithFootNote = new QCheckBox( i18n("&Include text from foot- and endnotes"), w);
        noteLayout->addWidget( calcWithFootNote );
        connect( calcWithFootNote, SIGNAL(toggled ( bool )), this, SLOT( slotRefreshValue(bool)));
    }


    QGroupBox *box = new QGroupBox( i18n( "Statistics" ), page );
    QGridLayout *grid = new QGridLayout( box, 9, 3, KDialog::marginHint(), KDialog::spacingHint() );
    grid->setRowStretch (9, 1);

    // margins
    int fHeight = box->fontMetrics().height();
    grid->setMargin( fHeight );
    grid->addColSpacing( 1, fHeight );
    grid->addRowSpacing( 0, fHeight );

    //maximum size for result column (don't know how to do this better..)
    QString init = i18n("approximately %1").arg( "00000000" );

    // insert labels
    QLabel *label1 = new QLabel( i18n( "Characters including spaces:" ), box );
    grid->addWidget( label1, 1, 0, 1 );
    resultLabel[0] = new QLabel( "", box );
    grid->addWidget( resultLabel[0], 1, 2, 2 );

    QLabel *label2 = new QLabel( i18n( "Characters without spaces:" ), box );
    grid->addWidget( label2, 2, 0, 1 );
    resultLabel[1] = new QLabel( "", box );
    grid->addWidget( resultLabel[1], 2, 2, 2 );

    QLabel *label3 = new QLabel( i18n( "Syllables:" ), box );
    grid->addWidget( label3, 3, 0, 1 );
    resultLabel[2] = new QLabel( "", box );
    grid->addWidget( resultLabel[2], 3, 2, 2 );

    QLabel *label4 = new QLabel( i18n( "Words:" ), box );
    grid->addWidget( label4, 4, 0, 1 );
    resultLabel[3] = new QLabel( "", box );
    grid->addWidget( resultLabel[3], 4, 2, 2 );

    QLabel *label5 = new QLabel( i18n( "Sentences:" ), box );
    grid->addWidget( label5, 5, 0, 1 );
    resultLabel[4] = new QLabel( "", box );
    grid->addWidget( resultLabel[4], 5, 2, 2 );

    QLabel *label6 = new QLabel( i18n( "Lines:" ), box );
    grid->addWidget( label6, 6, 0, 1 );
    resultLabel[5] = new QLabel( "", box );
    grid->addWidget( resultLabel[5], 6, 2, 2 );


    QLabel *label7 = new QLabel( i18n( "Flesch reading ease:" ), box );
    grid->addWidget( label7, 7, 0, 1 );
    resultLabel[6] = new QLabel( init, box );
    grid->addWidget( resultLabel[6], 7, 2, 2 );

    topLayout->addWidget( box );
}
コード例 #16
0
ファイル: cash_reconcile.cpp プロジェクト: cwarden/quasar
CashReconcile::CashReconcile(MainWindow* main)
    : QuasarWindow(main, "CashReconcile")
{
    _helpSource = "cash_reconcile.html";

    Company company;
    _quasar->db()->lookup(_company);

    QFrame* frame = new QFrame(this);

    QLabel* dateLabel = new QLabel(tr("Date:"), frame);
    _date = new DatePopup(frame);
    dateLabel->setBuddy(_date);
    connect(_date, SIGNAL(validData()), SLOT(slotRefresh()));

    QLabel* storeLabel = new QLabel(tr("Store:"), frame);
    _store = new LookupEdit(new StoreLookup(main, this), frame);
    _store->setLength(30);
    storeLabel->setBuddy(_store);
    connect(_store, SIGNAL(validData()), SLOT(slotRefresh()));

    _lines = new ListView(frame);
    _lines->addTextColumn(tr("Number"), 10, AlignRight);
    if (_company.shiftMethod() == Company::BY_STATION)
	_lines->addTextColumn(tr("Station"), 20);
    else
	_lines->addTextColumn(tr("Employee"), 20);
    _lines->addNumberColumn(tr("Not Rungoff"));
    _lines->addNumberColumn(tr("Shifts"));
    _lines->addNumberColumn(tr("Counts"));
    _lines->setAllColumnsShowFocus(true);
    _lines->setShowSortIndicator(true);
    connect(_lines, SIGNAL(selectionChanged()), this,
	    SLOT(slotLineChanged()));
    connect(_lines, SIGNAL(doubleClicked(QListViewItem*)), this,
	    SLOT(slotLineSelected()));

    QFrame* mid = new QFrame(frame);

    _tabs = new QTabWidget(mid);
    _info = new QFrame(_tabs);
    _setup = new QFrame(_tabs);
    _tabs->addTab(_info, tr("Shifts && Counts"));
    _tabs->addTab(_setup, tr("Setup"));

    _shiftList = new ListView(_info);
    _shiftList->addTextColumn(tr("Shift #"), 10, AlignRight);
    _shiftList->addDateColumn(tr("Date"));
    _shiftList->setAllColumnsShowFocus(true);
    _shiftList->setShowSortIndicator(true);
    _shiftList->setResizeMode(QListView::AllColumns);
    connect(_shiftList, SIGNAL(doubleClicked(QListViewItem*)), this,
	    SLOT(slotShiftSelected()));

    _countList = new ListView(_info);
    _countList->addTextColumn(tr("Count #"), 10, AlignRight);
    _countList->addDateColumn(tr("Date"));
    _countList->setAllColumnsShowFocus(true);
    _countList->setShowSortIndicator(true);
    _countList->setResizeMode(QListView::AllColumns);
    connect(_countList, SIGNAL(doubleClicked(QListViewItem*)), this,
	    SLOT(slotCountSelected()));

    QGridLayout* infoGrid = new QGridLayout(_info);
    infoGrid->setSpacing(3);
    infoGrid->setMargin(3);
    infoGrid->setRowStretch(0, 1);
    infoGrid->setColStretch(0, 1);
    infoGrid->setColStretch(1, 1);
    infoGrid->addWidget(_shiftList, 0, 0);
    infoGrid->addWidget(_countList, 0, 1);

    QLabel* safeStoreLabel = new QLabel(tr("Safe Store:"), _setup);
    _safeStore = new LookupEdit(new StoreLookup(main, this), _setup);
    _safeStore->setLength(30);
    safeStoreLabel->setBuddy(_safeStore);

    QLabel* safeIdLabel;
    if (_company.shiftMethod() == Company::BY_STATION) {
	safeIdLabel = new QLabel(tr("Safe Station:"), _setup);
	_safeId = new LookupEdit(new StationLookup(main, this), _setup);
    } else {
	safeIdLabel = new QLabel(tr("Safe Employee:"), _setup);
	_safeId = new LookupEdit(new EmployeeLookup(main, this), _setup);
    }
    _safeId->setLength(30);
    safeIdLabel->setBuddy(_safeId);

    QLabel* adjustLabel = new QLabel(tr("Over/Short Account:"), _setup);
    _adjust = new LookupEdit(new AccountLookup(main, this), _setup);
    _adjust->setLength(30);
    adjustLabel->setBuddy(_adjust);

    QLabel* transferLabel = new QLabel(tr("Transfer Account:"), _setup);
    _transfer = new LookupEdit(new AccountLookup(main, this), _setup);
    _transfer->setLength(30);
    transferLabel->setBuddy(_transfer);

    QGridLayout* setupGrid = new QGridLayout(_setup);
    setupGrid->setSpacing(3);
    setupGrid->setMargin(3);
    setupGrid->setRowStretch(4, 1);
    setupGrid->setColStretch(2, 1);
    setupGrid->addWidget(safeStoreLabel, 0, 0);
    setupGrid->addWidget(_safeStore, 0, 1);
    setupGrid->addWidget(safeIdLabel, 1, 0);
    setupGrid->addWidget(_safeId, 1, 1);
    setupGrid->addWidget(adjustLabel, 2, 0);
    setupGrid->addWidget(_adjust, 2, 1);
    setupGrid->addWidget(transferLabel, 3, 0);
    setupGrid->addWidget(_transfer, 3, 1);

    QFrame* txb = new QFrame(mid);
    _shiftClose = new QPushButton(tr("Ringoff"), txb);
    _countCreate = new QPushButton(tr("Create Count"), txb);
    _bankDeposit = new QPushButton(tr("Bank Deposit"), txb);
    QPushButton* adjust = new QPushButton(tr("Adjustment"), txb);
    QPushButton* transfer = new QPushButton(tr("Transfer"), txb);

    connect(_shiftClose, SIGNAL(clicked()), SLOT(slotShiftClose()));
    connect(_countCreate, SIGNAL(clicked()), SLOT(slotCreateCount()));
    connect(_bankDeposit, SIGNAL(clicked()), SLOT(slotBankDeposit()));
    connect(adjust, SIGNAL(clicked()), SLOT(slotTenderAdjust()));
    connect(transfer, SIGNAL(clicked()), SLOT(slotTenderTransfer()));

    QGridLayout* txbGrid = new QGridLayout(txb);
    txbGrid->setSpacing(3);
    txbGrid->setMargin(3);
    txbGrid->setRowStretch(0, 1);
    txbGrid->addRowSpacing(4, 12);
    txbGrid->addWidget(_shiftClose, 1, 0);
    txbGrid->addWidget(_countCreate, 2, 0);
    txbGrid->addWidget(_bankDeposit, 3, 0);
    txbGrid->addWidget(adjust, 5, 0);
    txbGrid->addWidget(transfer, 6, 0);

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(0, 1);
    midGrid->addColSpacing(1, 10);
    midGrid->addWidget(_tabs, 0, 0);
    midGrid->addWidget(txb, 0, 2);

    QFrame* buttons = new QFrame(frame);
    QPushButton* refresh = new QPushButton(tr("Refresh"), buttons);
    QPushButton* summary = new QPushButton(tr("Summary"), buttons);
    _reconcile = new QPushButton(tr("Reconcile"), buttons);
    QPushButton* cancel = new QPushButton(tr("Cancel"), buttons);

    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));
    connect(summary, SIGNAL(clicked()), SLOT(slotSummary()));
    connect(_reconcile, SIGNAL(clicked()), SLOT(slotReconcile()));
    connect(cancel, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(2, 1);
    buttonGrid->addWidget(refresh, 0, 0);
    buttonGrid->addWidget(summary, 0, 1);
    buttonGrid->addWidget(_reconcile, 0, 3);
    buttonGrid->addWidget(cancel, 0, 4);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(3);
    grid->setRowStretch(2, 1);
    grid->setColStretch(2, 1);
    grid->addWidget(dateLabel, 0, 0);
    grid->addWidget(_date, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(storeLabel, 1, 0);
    grid->addWidget(_store, 1, 1, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(_lines, 2, 2, 0, 2);
    grid->addMultiCellWidget(mid, 3, 3, 0, 2);
    grid->addMultiCellWidget(buttons, 4, 4, 0, 2);

    _date->setDate(QDate::currentDate());
    _store->setId(_quasar->defaultStore());
    _safeStore->setId(_company.safeStore());
    if (_company.shiftMethod() == Company::BY_STATION)
	_safeId->setId(_company.safeStation());
    else
	_safeId->setId(_company.safeEmployee());
    _adjust->setId(_company.overShortAccount());
    _transfer->setId(_company.transferAccount());
    _lines->setFocus();
    slotRefresh();

    setCentralWidget(frame);
    setCaption(tr("Cash Reconcile"));
    finalize();
}
コード例 #17
0
ファイル: card_transfer.cpp プロジェクト: cwarden/quasar
CardTransfer::CardTransfer(MainWindow* main, Id transfer_id)
    : DataWindow(main, "CardTransfer", transfer_id)
{
    _helpSource = "card_transfer.html";

    // Create widgets
    _gltxFrame = new GltxFrame(main, tr("Transfer No."), _frame);
    _gltxFrame->setTitle(tr("From"));
    _gltxFrame->hideMemo();

    QFrame* mid = new QFrame(_frame);
    mid->setFrameStyle(QFrame::Raised | QFrame::Panel);

    QLabel* fromLabel = new QLabel(tr("From:"), mid);
    CardLookup* fromLookup = new CardLookup(main, this);
    fromLookup->type->setCurrentItem(tr("Customer and Vendor"));
    fromLookup->type->setEnabled(false);
    _from = new LookupEdit(fromLookup, mid);
    _from->setLength(30);
    fromLabel->setBuddy(_from);
    connect(_from, SIGNAL(validData()), SLOT(slotFromChanged()));

    QLabel* fromBalanceLabel = new QLabel(tr("Balance:"), mid);
    _fromBalance = new MoneyEdit(mid);
    _fromBalance->setFocusPolicy(NoFocus);

    QLabel* toLabel = new QLabel(tr("To:"), mid);
    CardLookup* toLookup = new CardLookup(main, this);
    toLookup->type->setCurrentItem(tr("Customer and Vendor"));
    toLookup->type->setEnabled(false);
    _to = new LookupEdit(toLookup, mid);
    _to->setLength(30);
    toLabel->setBuddy(_to);
    connect(_to, SIGNAL(validData()), SLOT(slotToChanged()));

    QLabel* toBalanceLabel = new QLabel(tr("Balance:"), mid);
    _toBalance = new MoneyEdit(mid);
    _toBalance->setFocusPolicy(NoFocus);

    QLabel* amountLabel = new QLabel(tr("Amount:"), mid);
    _amount = new MoneyEdit(mid);
    amountLabel->setBuddy(_amount);

    QLabel* memoLabel = new QLabel(tr("&Memo:"), mid);
    _memo = new LineEdit(mid);
    _memo->setMaxLength(40);
    _memo->setMinimumWidth(_memo->fontMetrics().width('x') * 40);
    memoLabel->setBuddy(_memo);

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(2, 1);
    midGrid->addWidget(fromLabel, 0, 0);
    midGrid->addWidget(_from, 0, 1, AlignLeft | AlignVCenter);
    midGrid->addWidget(fromBalanceLabel, 0, 2, AlignRight | AlignVCenter);
    midGrid->addWidget(_fromBalance, 0, 3, AlignLeft | AlignVCenter);
    midGrid->addWidget(toLabel, 1, 0);
    midGrid->addWidget(_to, 1, 1, AlignLeft | AlignVCenter);
    midGrid->addWidget(toBalanceLabel, 1, 2, AlignRight | AlignVCenter);
    midGrid->addWidget(_toBalance, 1, 3, AlignLeft | AlignVCenter);
    midGrid->addWidget(amountLabel, 2, 0);
    midGrid->addWidget(_amount, 2, 1, AlignLeft | AlignVCenter);
    midGrid->addWidget(memoLabel, 3, 0);
    midGrid->addMultiCellWidget(_memo, 3, 3, 1, 3);

    QGroupBox* to = new QGroupBox(tr("To"), _frame);

    QLabel* toNumberLabel = new QLabel(tr("Transfer No."), to);
    _toNumber = new LineEdit(9, to);
    toNumberLabel->setBuddy(_toNumber);

    QLabel* toShiftLabel = new QLabel(tr("Shift:"), to);
    _toShift = new LookupEdit(new GltxLookup(_main, this, DataObject::SHIFT),
			       to);
    _toShift->setLength(10);
    _toShift->setFocusPolicy(ClickFocus);
    toShiftLabel->setBuddy(_toShift);

    QGridLayout* toGrid = new QGridLayout(to, 1, 1, to->frameWidth() * 2);
    toGrid->setSpacing(3);
    toGrid->setMargin(6);
    toGrid->setColStretch(2, 1);
    toGrid->addColSpacing(2, 10);
    toGrid->addRowSpacing(0, to->fontMetrics().height());
    toGrid->addWidget(toNumberLabel, 1, 0);
    toGrid->addWidget(_toNumber, 1, 1, AlignLeft | AlignVCenter);
    toGrid->addWidget(toShiftLabel, 1, 3);
    toGrid->addWidget(_toShift, 1, 4, AlignLeft | AlignVCenter);

    QLabel* accountLabel = new QLabel(tr("Transfer Account:"), _frame);
    AccountLookup* lookup = new AccountLookup(main, this, Account::Expense);
    _account = new LookupEdit(lookup, _frame);
    _account->setLength(30);
    accountLabel->setBuddy(_account);

    _inactive->setText(tr("Voided?"));

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(2, 1);
    grid->setRowStretch(1, 1);
    grid->addMultiCellWidget(_gltxFrame, 0, 0, 0, 4);
    grid->addMultiCellWidget(mid, 1, 1, 0, 4);
    grid->addMultiCellWidget(to, 2, 2, 0, 4);
    grid->addWidget(accountLabel, 3, 0);
    grid->addWidget(_account, 3, 1, AlignLeft | AlignVCenter);

    setCaption(tr("Card Transfer"));
    finalize();
}
コード例 #18
0
ファイル: count_master.cpp プロジェクト: cwarden/quasar
CountMaster::CountMaster(MainWindow* main, Id count_id)
    : DataWindow(main, "CountMaster", count_id)
{
    _helpSource = "count_master.html";

    QFrame* top = new QFrame(_frame);
    top->setFrameStyle(QFrame::Raised | QFrame::Panel);

    QLabel* numberLabel = new QLabel(tr("Count No.:"), top);
    _number = new LineEdit(top);
    _number->setLength(14, '9');
    numberLabel->setBuddy(_number);

    QLabel* descLabel = new QLabel(tr("Description:"), top);
    _description = new LineEdit(top);
    _description->setLength(40);
    descLabel->setBuddy(_description);

    QLabel* dateLabel = new QLabel(tr("Date:"), top);
    _date = new DatePopup(top);
    dateLabel->setBuddy(_date);

    QLabel* locationLabel = new QLabel(tr("Location:"), top);
    _locLookup = new LocationLookup(_main, this);
    _location = new LookupEdit(_locLookup, top);
    _location->setLength(30);
    locationLabel->setBuddy(_location);

    QLabel* employeeLabel = new QLabel(tr("Employee:"), top);
    _employee = new LookupEdit(new EmployeeLookup(_main, this), top);
    _employee->setLength(30);
    employeeLabel->setBuddy(_employee);

    QLabel* storeLabel = new QLabel(tr("Store:"), top);
    _store = new LookupEdit(new StoreLookup(_main, this), top);
    _store->setFocusPolicy(ClickFocus);
    _store->setLength(30);
    storeLabel->setBuddy(_store);
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setColStretch(2, 1);
    topGrid->addColSpacing(2, 20);
    topGrid->addWidget(numberLabel, 0, 0);
    topGrid->addWidget(_number, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addWidget(_description, 1, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(dateLabel, 2, 0);
    topGrid->addWidget(_date, 2, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(locationLabel, 3, 0);
    topGrid->addWidget(_location, 3, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(employeeLabel, 4, 0);
    topGrid->addWidget(_employee, 4, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(storeLabel, 5, 0);
    topGrid->addWidget(_store, 5, 1, AlignLeft | AlignVCenter);

    QFrame* mid = new QFrame(_frame);
    mid->setFrameStyle(QFrame::Raised | QFrame::Panel);

    _items = new Table(mid);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setLeftMargin(fontMetrics().width("99999"));
    _items->setDisplayRows(5);
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(cellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(focusNext(bool&,int&,int&,int)));

    // Lookups
    _itemLookup = new ItemLookup(_main, this);
    _itemLookup->inventoriedOnly = true;

    // Add columns
    new LookupColumn(_items, tr("Item Number"), 18, _itemLookup);
    new TextColumn(_items, tr("Description"), 30);
    new TextColumn(_items, tr("Size"), 10);
    new NumberColumn(_items, tr("On Hand"));
    new NumberColumn(_items, tr("Counted"));

    LineEdit* descEdit = new LineEdit(_items);
    NumberEdit* qtyEdit = new DoubleEdit(_items);
    descEdit->setMaxLength(40);
    qtyEdit->setMaxLength(8);

    // Add editors
    _size = new QComboBox(false, _items);
    new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items));
    new LineEditor(_items, 1, descEdit);
    new ComboEditor(_items, 2, _size);
    new NumberEditor(_items, 4, qtyEdit);

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(0, 1);
    midGrid->addWidget(_items, 0, 0);

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setRowStretch(1, 1);
    grid->addWidget(top, 0, 0);
    grid->addWidget(mid, 1, 0);

    if (_quasar->storeCount() == 1) {
	storeLabel->hide();
	_store->hide();
    }

    setCaption(tr("Count Items"));
    finalize();
}
コード例 #19
0
ファイル: item_margin.cpp プロジェクト: cwarden/quasar
ItemMargin::ItemMargin(MainWindow* main)
    : QuasarWindow(main, "ItemMargin")
{
    _helpSource = "item_margin.html";

    QFrame* frame = new QFrame(this);

    QFrame* top = new QFrame(frame);

    _lookup = new ItemLookup(_main, this);
    _lookup->soldOnly = true;
    _lookup->store_id = _quasar->defaultStore();

    QLabel* itemLabel = new QLabel(tr("Item Number:"), top);
    _item = new ItemEdit(_lookup, top);
    _item->setLength(18, '9');
    itemLabel->setBuddy(_item);

    QLabel* descLabel = new QLabel(tr("Description:"), top);
    _desc = new LineEdit(top);
    _desc->setLength(30);
    _desc->setFocusPolicy(NoFocus);

    QLabel* storeLabel = new QLabel(tr("Store:"), top);
    _store = new LookupEdit(new StoreLookup(_main, this), top);
    _store->setLength(30);
    storeLabel->setBuddy(_store);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setMargin(3);
    topGrid->setSpacing(3);
    topGrid->setColStretch(2, 1);
    topGrid->addWidget(itemLabel, 0, 0);
    topGrid->addWidget(_item, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addWidget(_desc, 1, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(storeLabel, 2, 0);
    topGrid->addWidget(_store, 2, 1, AlignLeft | AlignVCenter);

    QGroupBox* price = new QGroupBox(tr("Price"), frame);
    QGridLayout* priceGrid = new QGridLayout(price,2,1,price->frameWidth()*2);
    priceGrid->addRowSpacing(0, price->fontMetrics().height());

    QLabel* priceSizeLabel = new QLabel(tr("Size:"), price);
    _priceSize = new ComboBox(price);
    priceSizeLabel->setBuddy(_priceSize);

    QLabel* priceLabel = new QLabel(tr("Price:"), price);
    _price = new PriceEdit(price);
    priceLabel->setBuddy(_price);

    QLabel* priceTaxLabel = new QLabel(tr("Tax:"), price);
    _priceTax = new MoneyEdit(price);
    _priceTax->setFocusPolicy(NoFocus);
    priceTaxLabel->setBuddy(_priceTax);

    QLabel* priceDepositLabel = new QLabel(tr("Deposit:"), price);
    _priceDeposit = new MoneyEdit(price);
    _priceDeposit->setFocusPolicy(NoFocus);
    priceDepositLabel->setBuddy(_priceDeposit);

    QLabel* priceBaseLabel = new QLabel(tr("Base:"), price);
    _priceBase = new MoneyEdit(price);
    priceBaseLabel->setBuddy(_priceBase);

    priceGrid->setColStretch(2, 1);
    priceGrid->addWidget(priceSizeLabel, 1, 0);
    priceGrid->addWidget(_priceSize, 1, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceLabel, 2, 0);
    priceGrid->addWidget(_price, 2, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceTaxLabel, 3, 0);
    priceGrid->addWidget(_priceTax, 3, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceDepositLabel, 4, 0);
    priceGrid->addWidget(_priceDeposit, 4, 1, AlignLeft | AlignVCenter);
    priceGrid->addWidget(priceBaseLabel, 5, 0);
    priceGrid->addWidget(_priceBase, 5, 1, AlignLeft | AlignVCenter);

    QGroupBox* cost = new QGroupBox(tr("Rep Cost"), frame);
    QGridLayout* costGrid = new QGridLayout(cost,2,1,cost->frameWidth()*2);
    costGrid->addRowSpacing(0, cost->fontMetrics().height());

    QLabel* costSizeLabel = new QLabel(tr("Size:"), cost);
    _costSize = new ComboBox(cost);
    costSizeLabel->setBuddy(_costSize);

    QLabel* costLabel = new QLabel(tr("Cost:"), cost);
    _cost = new PriceEdit(cost);
    costLabel->setBuddy(_cost);

    QLabel* costTaxLabel = new QLabel(tr("Tax:"), cost);
    _costTax = new MoneyEdit(cost);
    _costTax->setFocusPolicy(NoFocus);
    costTaxLabel->setBuddy(_costTax);

    QLabel* costDepositLabel = new QLabel(tr("Deposit:"), cost);
    _costDeposit = new MoneyEdit(cost);
    _costDeposit->setFocusPolicy(NoFocus);
    costDepositLabel->setBuddy(_costDeposit);

    QLabel* costBaseLabel = new QLabel(tr("Base:"), cost);
    _costBase = new MoneyEdit(cost);
    costBaseLabel->setBuddy(_costBase);

    costGrid->setColStretch(2, 1);
    costGrid->addWidget(costSizeLabel, 1, 0);
    costGrid->addWidget(_costSize, 1, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costLabel, 2, 0);
    costGrid->addWidget(_cost, 2, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costTaxLabel, 3, 0);
    costGrid->addWidget(_costTax, 3, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costDepositLabel, 4, 0);
    costGrid->addWidget(_costDeposit, 4, 1, AlignLeft | AlignVCenter);
    costGrid->addWidget(costBaseLabel, 5, 0);
    costGrid->addWidget(_costBase, 5, 1, AlignLeft | AlignVCenter);

    QGroupBox* margin = new QGroupBox(tr("Margin"), frame);
    QGridLayout* marginGrid = new QGridLayout(margin, 2, 1,
					      margin->frameWidth()*2);
    marginGrid->addRowSpacing(0, margin->fontMetrics().height());

    QLabel* marginSizeLabel = new QLabel(tr("Size:"), margin);
    _marginSize = new ComboBox(margin);
    marginSizeLabel->setBuddy(_marginSize);

    QLabel* marginPriceLabel = new QLabel(tr("Price:"), margin);
    _marginPrice = new MoneyEdit(margin);
    marginPriceLabel->setBuddy(_marginPrice);

    QLabel* targetLabel = new QLabel(tr("Target GM:"), margin);
    _targetGM = new PercentEdit(margin);
    _targetGM->setFocusPolicy(NoFocus);
    targetLabel->setBuddy(_targetGM);

    QLabel* repCostLabel = new QLabel(tr("Rep Cost:"), margin);
    _repCost = new MoneyEdit(margin);
    repCostLabel->setBuddy(_repCost);

    QLabel* repProfitLabel = new QLabel(tr("Rep Profit:"), margin);
    _repProfit = new MoneyEdit(margin);
    repProfitLabel->setBuddy(_repProfit);

    QLabel* repMarginLabel = new QLabel(tr("Rep Margin:"), margin);
    _repMargin = new PercentEdit(margin);
    repMarginLabel->setBuddy(_repMargin);

    QLabel* lastCostLabel = new QLabel(tr("Last Cost:"), margin);
    _lastCost = new MoneyEdit(margin);
    _lastCost->setFocusPolicy(NoFocus);
    lastCostLabel->setBuddy(_lastCost);

    QLabel* lastProfitLabel = new QLabel(tr("Last Profit:"), margin);
    _lastProfit = new MoneyEdit(margin);
    lastProfitLabel->setBuddy(_lastProfit);

    QLabel* lastMarginLabel = new QLabel(tr("Last Margin:"), margin);
    _lastMargin = new PercentEdit(margin);
    lastMarginLabel->setBuddy(_lastMargin);

    QLabel* avgCostLabel = new QLabel(tr("Avg Cost:"), margin);
    _avgCost = new MoneyEdit(margin);
    _avgCost->setFocusPolicy(NoFocus);
    avgCostLabel->setBuddy(_avgCost);

    QLabel* avgProfitLabel = new QLabel(tr("Avg Profit:"), margin);
    _avgProfit = new MoneyEdit(margin);
    avgProfitLabel->setBuddy(_avgProfit);

    QLabel* avgMarginLabel = new QLabel(tr("Avg Margin:"), margin);
    _avgMargin = new PercentEdit(margin);
    avgMarginLabel->setBuddy(_avgMargin);

    marginGrid->setColStretch(2, 1);
    marginGrid->setColStretch(5, 1);
    marginGrid->addColSpacing(2, 10);
    marginGrid->addColSpacing(5, 10);
    marginGrid->addWidget(marginSizeLabel, 1, 0);
    marginGrid->addWidget(_marginSize, 1, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(marginPriceLabel, 1, 3);
    marginGrid->addWidget(_marginPrice, 1, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(targetLabel, 1, 6);
    marginGrid->addWidget(_targetGM, 1, 7, AlignLeft | AlignVCenter);
    marginGrid->addWidget(repCostLabel, 2, 0);
    marginGrid->addWidget(_repCost, 2, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(repProfitLabel, 2, 3);
    marginGrid->addWidget(_repProfit, 2, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(repMarginLabel, 2, 6);
    marginGrid->addWidget(_repMargin, 2, 7, AlignLeft | AlignVCenter);
    marginGrid->addWidget(lastCostLabel, 3, 0);
    marginGrid->addWidget(_lastCost, 3, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(lastProfitLabel, 3, 3);
    marginGrid->addWidget(_lastProfit, 3, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(lastMarginLabel, 3, 6);
    marginGrid->addWidget(_lastMargin, 3, 7, AlignLeft | AlignVCenter);
    marginGrid->addWidget(avgCostLabel, 4, 0);
    marginGrid->addWidget(_avgCost, 4, 1, AlignLeft | AlignVCenter);
    marginGrid->addWidget(avgProfitLabel, 4, 3);
    marginGrid->addWidget(_avgProfit, 4, 4, AlignLeft | AlignVCenter);
    marginGrid->addWidget(avgMarginLabel, 4, 6);
    marginGrid->addWidget(_avgMargin, 4, 7, AlignLeft | AlignVCenter);

    QFrame* box = new QFrame(frame);

    QPushButton* refresh = new QPushButton(tr("&Refresh"), box);
    refresh->setMinimumSize(refresh->sizeHint());
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));

    QPushButton* save = new QPushButton(tr("&Save"), box);
    save->setMinimumSize(refresh->sizeHint());
    connect(save, SIGNAL(clicked()), SLOT(slotSave()));

    QPushButton* close = new QPushButton(tr("Cl&ose"), box);
    close->setMinimumSize(refresh->sizeHint());
    connect(close, SIGNAL(clicked()), SLOT(slotClose()));

    QGridLayout* boxGrid = new QGridLayout(box);
    boxGrid->setSpacing(6);
    boxGrid->setMargin(6);
    boxGrid->setColStretch(1, 1);
    boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    boxGrid->addWidget(save, 0, 1, AlignRight | AlignVCenter);
    boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->addMultiCellWidget(top, 0, 0, 0, 1);
    grid->addWidget(price, 1, 0);
    grid->addWidget(cost, 1, 1);
    grid->addMultiCellWidget(margin, 2, 2, 0, 1);
    grid->addMultiCellWidget(box, 3, 3, 0, 1);

    connect(_item, SIGNAL(validData()), SLOT(slotItemChanged()));
    connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged()));
    connect(_priceSize, SIGNAL(activated(int)), SLOT(slotPriceSizeChanged()));
    connect(_price, SIGNAL(validData()), SLOT(slotPriceChanged()));
    connect(_priceBase, SIGNAL(validData()), SLOT(slotPriceBaseChanged()));
    connect(_costSize, SIGNAL(activated(int)), SLOT(slotCostSizeChanged()));
    connect(_cost, SIGNAL(validData()), SLOT(slotCostChanged()));
    connect(_costBase, SIGNAL(validData()), SLOT(slotCostBaseChanged()));
    connect(_marginSize, SIGNAL(activated(int)),SLOT(slotMarginSizeChanged()));
    connect(_marginPrice, SIGNAL(validData()), SLOT(slotMarginPriceChanged()));
    connect(_repCost, SIGNAL(validData()), SLOT(slotRepCostChanged()));
    connect(_repProfit, SIGNAL(validData()), SLOT(slotRepProfitChanged()));
    connect(_repMargin, SIGNAL(validData()), SLOT(slotRepMarginChanged()));
    connect(_lastProfit, SIGNAL(validData()), SLOT(slotLastProfitChanged()));
    connect(_lastMargin, SIGNAL(validData()), SLOT(slotLastMarginChanged()));
    connect(_avgProfit, SIGNAL(validData()), SLOT(slotAvgProfitChanged()));
    connect(_avgMargin, SIGNAL(validData()), SLOT(slotAvgMarginChanged()));

    setStoreId(_quasar->defaultStore());
    _item->setFocus();

    setCentralWidget(frame);
    setCaption(tr("Item Margin"));
    finalize();
}
コード例 #20
0
KBellConfig::KBellConfig(QWidget *parent, const char *name):
    KCModule(parent, name)
{
  QBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());

  int row = 0;
  QGroupBox *box = new QGroupBox( i18n("Bell Settings"), this );
  box->setColumnLayout( 0, Qt::Horizontal );
  layout->addWidget(box);
  layout->addStretch();
  QGridLayout *grid = new QGridLayout(box->layout(), KDialog::spacingHint());
  grid->setColStretch(0, 0);
  grid->setColStretch(1, 1);
  grid->addColSpacing(0, 30);

  m_useBell = new QCheckBox( i18n("&Use system bell instead of system notification" ), box );
  QWhatsThis::add(m_useBell, i18n("You can use the standard system bell (PC speaker) or a "
				  "more sophisticated system notification, see the "
				  "\"System Notifications\" control module for the "
				  "\"Something Special Happened in the Program\" event."));
  connect(m_useBell, SIGNAL( toggled( bool )), SLOT( useBell( bool )));
  row++;
  grid->addMultiCellWidget(m_useBell, row, row, 0, 1);

  setQuickHelp( i18n("<h1>System Bell</h1> Here you can customize the sound of the standard system bell,"
    " i.e. the \"beep\" you always hear when there is something wrong. Note that you can further"
    " customize this sound using the \"Accessibility\" control module; for example, you can choose"
    " a sound file to be played instead of the standard bell."));

  m_volume = new KIntNumInput(50, box);
  m_volume->setLabel(i18n("&Volume:"));
  m_volume->setRange(0, 100, 5);
  m_volume->setSuffix("%");
  m_volume->setSteps(5,25);
  grid->addWidget(m_volume, ++row, 1);
  QWhatsThis::add( m_volume, i18n("Here you can customize the volume of the system bell. For further"
    " customization of the bell, see the \"Accessibility\" control module.") );

  m_pitch = new KIntNumInput(m_volume, 800, box);
  m_pitch->setLabel(i18n("&Pitch:"));
  m_pitch->setRange(20, 2000, 20);
  m_pitch->setSuffix(i18n(" Hz"));
  m_pitch->setSteps(40,200);
  grid->addWidget(m_pitch, ++row, 1);
  QWhatsThis::add( m_pitch, i18n("Here you can customize the pitch of the system bell. For further"
    " customization of the bell, see the \"Accessibility\" control module.") );

  m_duration = new KIntNumInput(m_pitch, 100, box);
  m_duration->setLabel(i18n("&Duration:"));
  m_duration->setRange(1, 1000, 50);
  m_duration->setSuffix(i18n(" msec"));
  m_duration->setSteps(20,100);
  grid->addWidget(m_duration, ++row, 1);
  QWhatsThis::add( m_duration, i18n("Here you can customize the duration of the system bell. For further"
    " customization of the bell, see the \"Accessibility\" control module.") );

  QBoxLayout *boxLayout = new QHBoxLayout();
  m_testButton = new QPushButton(i18n("&Test"), box, "test");
  boxLayout->addWidget(m_testButton, 0, AlignRight);
  grid->addLayout( boxLayout, ++row, 1 );
  connect( m_testButton, SIGNAL(clicked()), SLOT(ringBell()));
  QWhatsThis::add( m_testButton, i18n("Click \"Test\" to hear how the system bell will sound using your changed settings.") );

  // watch for changes
  connect(m_volume, SIGNAL(valueChanged(int)), SLOT(changed()));
  connect(m_pitch, SIGNAL(valueChanged(int)), SLOT(changed()));
  connect(m_duration, SIGNAL(valueChanged(int)), SLOT(changed()));
  
  KAboutData *about =
    new KAboutData(I18N_NOOP("kcmbell"), I18N_NOOP("KDE Bell Control Module"),
                  0, 0, KAboutData::License_GPL,
                  I18N_NOOP("(c) 1997 - 2001 Christian Czezatke, Matthias Elter"));

  about->addAuthor("Christian Czezatke", I18N_NOOP("Original author"), "*****@*****.**");
  about->addAuthor("Bernd Wuebben", 0, "*****@*****.**");
  about->addAuthor("Matthias Elter", I18N_NOOP("Current maintainer"), "*****@*****.**");
  about->addAuthor("Carsten Pfeiffer", 0, "*****@*****.**");
  setAboutData(about);

  load();
}
コード例 #21
0
ファイル: kcookiesdlg.cpp プロジェクト: kthxbyte/KDE1-Linaro
KCookiesOptions::KCookiesOptions(QWidget *parent, const char *name)
  : KConfigWidget(parent, name)
{

  QGridLayout *lay = new QGridLayout(this,ROW_BOTTOM+1,5,10,5);
  lay->addRowSpacing(0,10);
  lay->addRowSpacing(2,10);
  lay->addRowSpacing(4,10);
  lay->addRowSpacing(5,30); // no idea why 10 isn't enough... David.
  lay->addColSpacing(0,10);
  lay->addColSpacing(2,10);
  lay->addColSpacing(4,10);
  
  lay->setRowStretch(0,0);
  lay->setRowStretch(1,0); // ROW_ENABLE_COOKIES
  lay->setRowStretch(2,1);
  lay->setRowStretch(3,1); // ROW_DEFAULT_ACCEPT
  lay->setRowStretch(4,1);
  lay->setRowStretch(5,0);
  lay->setRowStretch(6,1); // ROW_CHANGE_DOMAIN
  lay->setRowStretch(7,10); // ROW_BOTTOM
  
  lay->setColStretch(0,0);
  lay->setColStretch(1,1);
  lay->setColStretch(2,0);
  lay->setColStretch(3,1);
  lay->setColStretch(4,0);
  
  cb_enableCookies = new QCheckBox( i18n("&Enable Cookies"), this );
  cb_enableCookies->adjustSize();
  cb_enableCookies->setMinimumSize(cb_enableCookies->size());
  connect( cb_enableCookies, SIGNAL( clicked() ), this, SLOT( changeCookiesEnabled() ) );
  lay->addWidget(cb_enableCookies,ROW_ENABLE_COOKIES,1);

  {
    QButtonGroup *bg = new QButtonGroup( i18n("Default accept policy"), this );
    bg1 = bg;
    bg->setExclusive( TRUE );
    QGridLayout *bgLay = new QGridLayout(bg,3,3,10,5);
    bgLay->addRowSpacing(0,10);
    bgLay->addRowSpacing(2,5);
    bgLay->setRowStretch(0,0);
    bgLay->setRowStretch(1,0);

    rb_gbPolicyAccept = new QRadioButton( i18n("Accept"), bg );
    rb_gbPolicyAccept->adjustSize();
    rb_gbPolicyAccept->setMinimumSize(rb_gbPolicyAccept->size());
    bgLay->addWidget(rb_gbPolicyAccept, 1, 0);

    rb_gbPolicyAsk = new QRadioButton( i18n("Ask"), bg );
    rb_gbPolicyAsk->adjustSize();
    rb_gbPolicyAsk->setMinimumSize(rb_gbPolicyAsk->size());
    bgLay->addWidget(rb_gbPolicyAsk, 1, 1);

    rb_gbPolicyReject = new QRadioButton( i18n("Reject"), bg );
    rb_gbPolicyReject->adjustSize();
    rb_gbPolicyReject->setMinimumSize(rb_gbPolicyReject->size());
    bgLay->addWidget(rb_gbPolicyReject, 1, 2);

    bgLay->activate();
    lay->addMultiCellWidget(bg,ROW_DEFAULT_ACCEPT,ROW_DEFAULT_ACCEPT+1,3,3);
  }

  // CREATE SPLIT LIST BOX
  wList = new KSplitList( this );
  wList->setMinimumHeight(80);
  lay->addMultiCellWidget( wList, ROW_DEFAULT_ACCEPT+1, ROW_BOTTOM, 1, 1 );

  // associated label (has to be _after_)
  wListLabel = new QLabel( wList, i18n("Domain specific settings:"), this );
  lay->addWidget( wListLabel, ROW_DEFAULT_ACCEPT, 1 );
  wListLabel->setFixedHeight( wListLabel->sizeHint().height() );

  connect( wList, SIGNAL( highlighted( int ) ), SLOT( updateDomain( int ) ) );
  connect( wList, SIGNAL( selected( int ) ), SLOT( updateDomain( int ) ) );
  {
    QButtonGroup *bg = new QButtonGroup( i18n("Change domain accept policy"), this );
    bg2 = bg;
    bg->setExclusive( TRUE );
    QGridLayout *bgLay = new QGridLayout(bg,6,3,10,5);
    bgLay->addRowSpacing(0,10);
    bgLay->addRowSpacing(2,10);
    bgLay->setRowStretch(0,0);
    bgLay->setRowStretch(1,0);
    bgLay->setRowStretch(2,1);
    bgLay->setRowStretch(3,0);
    bgLay->setRowStretch(4,1);
    bgLay->setRowStretch(5,0);

    le_domain = new QLineEdit(bg);
    le_domain->adjustSize();
    le_domain->setMinimumSize(le_domain->size());
    bgLay->addMultiCellWidget(le_domain,1,1,0,2);
              
    rb_domPolicyAccept = new QRadioButton( i18n("Accept"), bg );
    rb_domPolicyAccept->adjustSize();
    rb_domPolicyAccept->setMinimumSize(rb_domPolicyAccept->size());
    bgLay->addWidget(rb_domPolicyAccept, 3, 0);

    rb_domPolicyAsk = new QRadioButton( i18n("Ask"), bg );
    rb_domPolicyAsk->adjustSize();
    rb_domPolicyAsk->setMinimumSize(rb_domPolicyAsk->size());
    bgLay->addWidget(rb_domPolicyAsk, 3, 1);

    rb_domPolicyReject = new QRadioButton( i18n("Reject"), bg );
    rb_domPolicyReject->adjustSize();
    rb_domPolicyReject->setMinimumSize(rb_domPolicyReject->size());
    rb_domPolicyAsk->setChecked( true );
    bgLay->addWidget(rb_domPolicyReject, 3, 2);

    KButtonBox *bbox = new KButtonBox( bg );
    bbox->addStretch( 20 );
        
    b0 = bbox->addButton( i18n("Change") );
    connect( b0, SIGNAL( clicked() ), this, SLOT( changePressed() ) );
                
    bbox->addStretch( 10 );
                    
    b1 = bbox->addButton( i18n("Delete") );
    connect( b1, SIGNAL( clicked() ), this, SLOT( deletePressed() ) );
                            
    bbox->addStretch( 20 );
                                
    bbox->layout();
    bgLay->addMultiCellWidget( bbox, 5,5,0,2);
                                            
    lay->addWidget(bg,ROW_CHANGE_DOMAIN,3);
  }

  lay->activate();

  setMinimumSize(480,300);

  // finally read the options
  loadSettings();
}
コード例 #22
0
ファイル: utilitydlg.cpp プロジェクト: nic0lae/freebsddistro
CUtilityDlg::CUtilityDlg(CUtility *u, const char *szId, unsigned long nPPID,
  CICQDaemon *_server)
  : QWidget(0, "UtilityDialog",  WDestructiveClose)
{
  m_szId = szId ? strdup(szId) : 0;
  m_nPPID = nPPID;
  m_xUtility = u;
  server = _server;
  m_bIntWin = false;
  intwin = NULL;
  snOut = snErr = NULL;

  m_xUtility->SetFields(m_szId, m_nPPID);

  QGridLayout *lay = new QGridLayout(this, 1, 3, 8, 4);
  lay->setColStretch(2, 2);
  lay->addColSpacing(1, 8);
  setCaption(QString(tr("Licq Utility: %1")).arg(m_xUtility->Name()));
  lblUtility = new QLabel(tr("Command:"), this);
  lay->addWidget(lblUtility, 0, 0);
  nfoUtility = new CInfoField(this, true);
  nfoUtility->setMinimumWidth(nfoUtility->sizeHint().width()*2);
  lay->addWidget(nfoUtility, 0, 2);
  nfoUtility->setText(m_xUtility->FullCommand());

  lay->addWidget(new QLabel(tr("Window:"), this), 1, 0);
  nfoWinType = new CInfoField(this, true);
  lay->addWidget(nfoWinType, 1, 2);
  switch (m_xUtility->WinType())
  {
    case UtilityWinGui: nfoWinType->setText(tr("GUI")); break;
    case UtilityWinTerm: nfoWinType->setText(tr("Terminal")); break;
    case UtilityWinLicq: nfoWinType->setText(tr("Internal")); break;
  }

  lay->addWidget(new QLabel(tr("Description:"), this), 2, 0);
  nfoDesc = new CInfoField(this, true);
  lay->addWidget(nfoDesc, 2, 2);
  nfoDesc->setText(m_xUtility->Description());

  chkEditFinal = new QCheckBox(tr("Edit final command"), this);
  lay->addMultiCellWidget(chkEditFinal, 3, 3, 0, 2);

  boxFields = new QGroupBox(1, Horizontal, tr("User Fields"), this);
  lay->addMultiCellWidget(boxFields, 4, 4, 0, 2);
  for (unsigned short i = 0; i < m_xUtility->NumUserFields(); i++)
  {
    QString s;
    s.sprintf("%s (%%%d): ", m_xUtility->UserField(i)->Title(), i+1);
    QLabel *lbl = new QLabel(s, boxFields);
    lblFields.push_back(lbl);
    QLineEdit *edt = new QLineEdit(boxFields);
    edt->setText(m_xUtility->UserField(i)->FullDefault());
    edt->setMinimumSize(edt->sizeHint());
    edtFields.push_back(edt);
  }

  splOutput = new QSplitter(Vertical, boxFields);
  splOutput->setOpaqueResize();
  mleOut = new MLEditWrap(true, splOutput);
  mleOut->setReadOnly(true);
  mleErr = new MLEditWrap(true, splOutput);
  mleErr->setReadOnly(true);

  splOutput->setResizeMode(mleErr, QSplitter::Stretch);//FollowSizeHint);
  splOutput->setResizeMode(mleOut, QSplitter::Stretch);
  splOutput->hide();
  if (m_xUtility->NumUserFields() == 0) boxFields->hide();

  QHBoxLayout *hlay = new QHBoxLayout();
  lay->addMultiCell(hlay, 5, 5, 0, 2);
  hlay->addStretch(1);
  btnRun = new QPushButton(tr("&Run"), this);
  btnRun->setDefault(true);
  btnRun->setMinimumWidth(75);
  hlay->addWidget(btnRun, 0, AlignRight);
  hlay->addSpacing(20);
  btnCancel = new QPushButton(tr("&Cancel"), this);
  btnCancel->setMinimumWidth(75);
  hlay->addWidget(btnCancel, 0, AlignLeft);

  connect(btnRun, SIGNAL(clicked()), SLOT(slot_run()));
  connect(btnCancel, SIGNAL(clicked()), SLOT(slot_cancel()));

  show();
}
コード例 #23
0
QtCalculator :: QtCalculator( Calculator *_corba, QWidget *parent, const char *name )
  : QDialog( parent, name )
{

    corba = _corba;
    mInternalSpacing=4;
    key_pressed = false;
    selection_timer = new QTimer;
    status_timer = new QTimer;

    connect(status_timer,SIGNAL(timeout()),this,SLOT(clear_status_label()));
    connect(selection_timer,SIGNAL(timeout()),this,SLOT(selection_timed_out()));

    readSettings();

    QFont buttonfont( KGlobalSettings::generalFont() );
    buttonfont.setStyleStrategy( QFont::PreferAntialias );

    // Set the window caption/title

    // connect(kapp,SIGNAL(kdisplayPaletteChanged()),this,SLOT(set_colors()));
    // setCaption( kapp->caption() );

    // create help button

    QPushButton *pb;

    pb = new QPushButton( this, "helpbutton" );
    pb->setText( "kCalc" );
    pb->setFont( QFont("times",12,QFont::Bold,FALSE) );
    QToolTip::add( pb, i18n("KCalc Setup/Help") );

    connect( pb, SIGNAL(clicked()), SLOT(configclicked()) );

    // Create the display
    calc_display = new DLabel( this, "display" );
    calc_display->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
    calc_display->setAlignment( AlignRight|AlignVCenter );
    calc_display->setFocus();
    calc_display->setFocusPolicy( QWidget::StrongFocus );

    connect(calc_display,SIGNAL(clicked()),this,SLOT(display_selected()));

    statusINVLabel = new QLabel( this, "INV" );
    Q_CHECK_PTR( statusINVLabel );
    statusINVLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    statusINVLabel->setAlignment( AlignCenter );
    statusINVLabel->setText("NORM");

    statusHYPLabel = new QLabel( this, "HYP" );
    Q_CHECK_PTR( statusHYPLabel );
    statusHYPLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    statusHYPLabel->setAlignment( AlignCenter );

    statusERRORLabel = new QLabel( this, "ERROR" );
    Q_CHECK_PTR( statusERRORLabel );
    statusERRORLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    statusERRORLabel->setAlignment( AlignLeft|AlignVCenter );

    // create angle button group

    QAccel *accel = new QAccel( this );

    QButtonGroup *angle_group = new QButtonGroup( 3, Horizontal,this, "AngleButtons" );
    angle_group->setTitle(i18n( "Angle") );

    anglebutton[0] = new QRadioButton( angle_group );
    anglebutton[0]->setText( "&Deg" )   ;
    anglebutton[0]->setChecked(   TRUE);
    accel->connectItem( accel->insertItem(Key_D + ALT), this ,
                        SLOT(Deg_Selected()) );

    anglebutton[1] = new QRadioButton( angle_group );
    anglebutton[1]->setText( "&Rad" );
    accel->connectItem( accel->insertItem(Key_R + ALT), this ,
                        SLOT(Rad_Selected()) );

    anglebutton[2] = new QRadioButton( angle_group );
    anglebutton[2]->setText( "&Gra" );
    accel->connectItem( accel->insertItem(Key_G + ALT), this ,
                        SLOT(Gra_Selected()) );

    connect( angle_group, SIGNAL(clicked(int)), SLOT(angle_selected(int)) );


//////////////////////////////////////////////////////////////////////
//
// Create Number Base Button Group
//



    QButtonGroup *base_group = new QButtonGroup( 4, Horizontal,this, "BaseButtons" );
    base_group->setTitle( i18n("Base") );

    basebutton[0] = new QRadioButton( base_group );
    basebutton[0]->setText( "&Hex" );
    accel->connectItem( accel->insertItem(Key_H + ALT), this ,
                        SLOT(Hex_Selected()) );

    basebutton[1] = new QRadioButton( base_group );
    basebutton[1]->setText( "D&ec" );
    basebutton[1]->setChecked(TRUE);
    accel->connectItem( accel->insertItem(Key_E + ALT), this ,
                        SLOT(Dec_Selected()) );

    basebutton[2] = new QRadioButton( base_group );
    basebutton[2]->setText( "&Oct" );
    accel->connectItem( accel->insertItem(Key_O + ALT), this ,
                        SLOT(Oct_Selected()) );

    basebutton[3] = new QRadioButton( base_group);
    basebutton[3]->setText( "&Bin" );
    accel->connectItem( accel->insertItem(Key_B + ALT), this ,
                        SLOT(Bin_Selected()) );

    connect( base_group, SIGNAL(clicked(int)), SLOT(base_selected(int)) );

////////////////////////////////////////////////////////////////////////
//
//  Create Calculator Buttons
//


    // First the widgets that are the parents of the buttons
    mSmallPage = new QWidget(this);
    mLargePage = new QWidget(this);

    pbhyp = new QPushButton("Hyp", mSmallPage, "hypbutton" );
    connect( pbhyp, SIGNAL(toggled(bool)), SLOT(pbhyptoggled(bool)));
    pbhyp->setToggleButton(TRUE);

    pbinv = new QPushButton( "Inv", mSmallPage, "InverseButton" );
    connect( pbinv, SIGNAL(toggled(bool)), SLOT(pbinvtoggled(bool)));
    pbinv->setToggleButton(TRUE);

    pbA = new QPushButton("A",mSmallPage, "Abutton" );
    connect( pbA, SIGNAL(toggled(bool)), SLOT(pbAtoggled(bool)));
    pbA->setToggleButton(TRUE);

    pbSin = new QPushButton("Sin",mSmallPage, "Sinbutton" );
    connect( pbSin, SIGNAL(toggled(bool)), SLOT(pbSintoggled(bool)));
    pbSin->setToggleButton(TRUE);

    pbplusminus = new QPushButton( "+/-", mSmallPage, "plusminusbutton" );
    connect( pbplusminus, SIGNAL(toggled(bool)), SLOT(pbplusminustoggled(bool)));
    pbplusminus->setToggleButton(TRUE);
    pbplusminus->setFont(buttonfont);

    pbB = new QPushButton("B", mSmallPage, "Bbutton" );
    connect( pbB, SIGNAL(toggled(bool)), SLOT(pbBtoggled(bool)));
    pbB->setToggleButton(TRUE);

    pbCos = new QPushButton("Cos",mSmallPage, "Cosbutton" );
    pbCos->setText( "Cos" );
    connect( pbCos, SIGNAL(toggled(bool)), SLOT(pbCostoggled(bool)));
    pbCos->setToggleButton(TRUE);


    pbreci = new QPushButton("1/x",mSmallPage, "recibutton" );
    connect( pbreci, SIGNAL(toggled(bool)), SLOT(pbrecitoggled(bool)));
    pbreci->setToggleButton(TRUE);

    pbC = new QPushButton( "C", mSmallPage, "Cbutton" );
    connect( pbC, SIGNAL(toggled(bool)), SLOT(pbCtoggled(bool)));
    pbC->setToggleButton(TRUE);

    pbTan = new QPushButton("Tan" ,mSmallPage,  "Tanbutton" );
    connect( pbTan, SIGNAL(toggled(bool)), SLOT(pbTantoggled(bool)));
    pbTan->setToggleButton(TRUE);

    pbfactorial = new QPushButton("x!",mSmallPage, "factorialbutton" );
    connect( pbfactorial, SIGNAL(toggled(bool)), SLOT(pbfactorialtoggled(bool)));
    pbfactorial->setToggleButton(TRUE);

    pbD = new QPushButton("D",mSmallPage,  "Dbutton" );
    connect( pbD, SIGNAL(toggled(bool)), SLOT(pbDtoggled(bool)));
    pbD->setToggleButton(TRUE);

    pblog = new QPushButton("Log",mSmallPage, "logbutton" );
    connect( pblog, SIGNAL(toggled(bool)), SLOT(pblogtoggled(bool)));
    pblog->setToggleButton(TRUE);

    pbsquare = new QPushButton( "x^2", mSmallPage,  "squarebutton" );
    connect( pbsquare, SIGNAL(toggled(bool)), SLOT(pbsquaretoggled(bool)));
    pbsquare->setToggleButton(TRUE);

    pbE = new QPushButton("E",mSmallPage, "Ebutton" );
    connect( pbE, SIGNAL(toggled(bool)), SLOT(pbEtoggled(bool)));
    pbE->setToggleButton(TRUE);


    pbln = new QPushButton( "Ln", mSmallPage, "lnbutton" );
    connect( pbln, SIGNAL(toggled(bool)), SLOT(pblntoggled(bool)));
    pbln->setToggleButton(TRUE);

    pbpower = new QPushButton("x^y",mSmallPage,  "powerbutton" );
    connect( pbpower, SIGNAL(toggled(bool)), SLOT(pbpowertoggled(bool)));
    pbpower->setToggleButton(TRUE);

    pbF = new QPushButton("F",mSmallPage, "Fbutton" );
    connect( pbF, SIGNAL(toggled(bool)), SLOT(pbFtoggled(bool)));
    pbF->setToggleButton(TRUE);

    pbEE = new QPushButton("EE",mLargePage,  "EEbutton" );
    pbEE->setToggleButton(TRUE);
    connect( pbEE, SIGNAL(toggled(bool)), SLOT(EEtoggled(bool)));

    pbMR = new QPushButton("MR",mLargePage,  "MRbutton" );
    connect( pbMR, SIGNAL(toggled(bool)), SLOT(pbMRtoggled(bool)));
    pbMR->setToggleButton(TRUE);
    pbMR->setFont(buttonfont);

    pbMplusminus = new QPushButton("M+-",mLargePage,  "Mplusminusbutton" );
    connect( pbMplusminus, SIGNAL(toggled(bool)), SLOT(pbMplusminustoggled(bool)));
    pbMplusminus->setToggleButton(TRUE);

    pbMC = new QPushButton("MC",mLargePage,  "MCbutton" );
    connect( pbMC, SIGNAL(toggled(bool)), SLOT(pbMCtoggled(bool)));
    pbMC->setToggleButton(TRUE);

    pbClear = new QPushButton("C",mLargePage,  "Clearbutton" );
    connect( pbClear, SIGNAL(toggled(bool)), SLOT(pbCleartoggled(bool)));
    pbClear->setToggleButton(TRUE);

    pbAC = new QPushButton("AC", mLargePage,  "ACbutton" );
    connect( pbAC, SIGNAL(toggled(bool)), SLOT(pbACtoggled(bool)));
    pbAC->setToggleButton(TRUE);

    pb7 = new QPushButton("7",mLargePage, "7button" );
    connect( pb7, SIGNAL(toggled(bool)), SLOT(pb7toggled(bool)));
    pb7->setToggleButton(TRUE);

    pb8 = new QPushButton("8",mLargePage, "8button" );
    connect( pb8, SIGNAL(toggled(bool)), SLOT(pb8toggled(bool)));
    pb8->setToggleButton(TRUE);

    pb9 = new QPushButton("9",mLargePage,"9button" );
    connect( pb9, SIGNAL(toggled(bool)), SLOT(pb9toggled(bool)));
    pb9->setToggleButton(TRUE);

    pbparenopen = new QPushButton("(",mLargePage,  "parenopenbutton" );
    connect( pbparenopen, SIGNAL(toggled(bool)), SLOT(pbparenopentoggled(bool)));
    pbparenopen->setToggleButton(TRUE);

    pbparenclose = new QPushButton(")",mLargePage, "parenclosebutton" );
    connect( pbparenclose, SIGNAL(toggled(bool)), SLOT(pbparenclosetoggled(bool)));
    pbparenclose->setToggleButton(TRUE);

    pband = new QPushButton("And",mLargePage, "andbutton" );
    connect( pband, SIGNAL(toggled(bool)), SLOT(pbandtoggled(bool)));
    pband->setToggleButton(TRUE);
    pband->setFont(buttonfont);

    pb4 = new QPushButton("4",mLargePage,  "4button" );
    connect( pb4, SIGNAL(toggled(bool)), SLOT(pb4toggled(bool)));
    pb4->setToggleButton(TRUE);

    pb5 = new QPushButton("5",mLargePage,  "5button" );
    connect( pb5, SIGNAL(toggled(bool)), SLOT(pb5toggled(bool)));
    pb5->setToggleButton(TRUE);

    pb6 = new QPushButton("6",mLargePage,  "6button" );
    connect( pb6, SIGNAL(toggled(bool)), SLOT(pb6toggled(bool)));
    pb6->setToggleButton(TRUE);

    pbX = new QPushButton("X",mLargePage, "Multiplybutton" );
    connect( pbX, SIGNAL(toggled(bool)), SLOT(pbXtoggled(bool)));
    pbX->setToggleButton(TRUE);

    pbdivision = new QPushButton("/",mLargePage,  "divisionbutton" );
    connect( pbdivision, SIGNAL(toggled(bool)), SLOT(pbdivisiontoggled(bool)));
    pbdivision->setToggleButton(TRUE);

    pbor = new QPushButton("Or",mLargePage,  "orbutton" );
    connect( pbor, SIGNAL(toggled(bool)), SLOT(pbortoggled(bool)));
    pbor->setToggleButton(TRUE);

    pb1 = new QPushButton("1",mLargePage,  "1button" );
    connect( pb1, SIGNAL(toggled(bool)), SLOT(pb1toggled(bool)));
    pb1->setToggleButton(TRUE);

    pb2 = new QPushButton("2",mLargePage,  "2button" );

    connect( pb2, SIGNAL(toggled(bool)), SLOT(pb2toggled(bool)));
    pb2->setToggleButton(TRUE);

    pb3 = new QPushButton("3",mLargePage,  "3button" );
    connect( pb3, SIGNAL(toggled(bool)), SLOT(pb3toggled(bool)));
    pb3->setToggleButton(TRUE);

    pbplus = new QPushButton("+",mLargePage, "plusbutton" );
    connect( pbplus, SIGNAL(toggled(bool)), SLOT(pbplustoggled(bool)));
    pbplus->setToggleButton(TRUE);


    pbminus = new QPushButton("-",mLargePage,  "minusbutton" );
    connect( pbminus, SIGNAL(toggled(bool)), SLOT(pbminustoggled(bool)));
    pbminus->setToggleButton(TRUE);

    pbshift = new QPushButton("Lsh",mLargePage, "shiftbutton" );
    connect( pbshift, SIGNAL(toggled(bool)), SLOT(pbshifttoggled(bool)));
    pbshift->setToggleButton(TRUE);

    pbperiod = new QPushButton(".",mLargePage,  "periodbutton" );
    connect( pbperiod, SIGNAL(toggled(bool)), SLOT(pbperiodtoggled(bool)));
    pbperiod->setToggleButton(TRUE);

    pb0 = new QPushButton("0",mLargePage,  "0button" );
    connect( pb0, SIGNAL(toggled(bool)), SLOT(pb0toggled(bool)));
    pb0->setToggleButton(TRUE);

    pbequal = new QPushButton("=",mLargePage,  "equalbutton" );
    connect( pbequal, SIGNAL(toggled(bool)), SLOT(pbequaltoggled(bool)));
    pbequal->setToggleButton(TRUE);

    pbpercent = new QPushButton("%",mLargePage, "percentbutton" );
    connect( pbpercent, SIGNAL(toggled(bool)), SLOT(pbpercenttoggled(bool)));
    pbpercent->setToggleButton(TRUE);

    pbnegate = new QPushButton("Cmp",mLargePage,  "OneComplementbutton" );
    connect( pbnegate, SIGNAL(toggled(bool)), SLOT(pbnegatetoggled(bool)));
    pbnegate->setToggleButton(TRUE);

    pbmod = new QPushButton("Mod",mLargePage,  "modbutton" );
    connect( pbmod, SIGNAL(toggled(bool)), SLOT(pbmodtoggled(bool)));
    pbmod->setToggleButton(TRUE);

    QGridLayout *smallBtnLayout = new QGridLayout(mSmallPage, 6, 3, 0,
                                                  mInternalSpacing);
    QGridLayout *largeBtnLayout = new QGridLayout(mLargePage, 5, 6, 0,
                                                  mInternalSpacing);

    QHBoxLayout *topLayout		= new QHBoxLayout();
    QHBoxLayout *radioLayout	= new QHBoxLayout();
    QHBoxLayout *btnLayout		= new QHBoxLayout();
    QHBoxLayout *statusLayout	= new QHBoxLayout();

    // bring them all together
    QVBoxLayout *mainLayout = new QVBoxLayout(this, mInternalSpacing,
                                              mInternalSpacing );

    mainLayout->addLayout(topLayout );
    mainLayout->addLayout(radioLayout, 1);
    mainLayout->addLayout(btnLayout);
    mainLayout->addLayout(statusLayout);

    // button layout
    btnLayout->addWidget(mSmallPage,0,AlignTop);
    btnLayout->addSpacing(mInternalSpacing);
    btnLayout->addWidget(mLargePage,0,AlignTop);

    // small button layout
    smallBtnLayout->addWidget(pbhyp, 0, 0);
    smallBtnLayout->addWidget(pbinv, 0, 1);
    smallBtnLayout->addWidget(pbA, 0, 2);

    smallBtnLayout->addWidget(pbSin, 1, 0);
    smallBtnLayout->addWidget(pbplusminus, 1, 1);
    smallBtnLayout->addWidget(pbB, 1, 2);

    smallBtnLayout->addWidget(pbCos, 2, 0);
    smallBtnLayout->addWidget(pbreci, 2, 1);
    smallBtnLayout->addWidget(pbC, 2, 2);

    smallBtnLayout->addWidget(pbTan, 3, 0);
    smallBtnLayout->addWidget(pbfactorial, 3, 1);
    smallBtnLayout->addWidget(pbD, 3, 2);

    smallBtnLayout->addWidget(pblog, 4, 0);
    smallBtnLayout->addWidget(pbsquare, 4, 1);
    smallBtnLayout->addWidget(pbE, 4, 2);

    smallBtnLayout->addWidget(pbln, 5, 0);
    smallBtnLayout->addWidget(pbpower, 5, 1);
    smallBtnLayout->addWidget(pbF, 5, 2);

    smallBtnLayout->setRowStretch(0, 0);
    smallBtnLayout->setRowStretch(1, 0);
    smallBtnLayout->setRowStretch(2, 0);
    smallBtnLayout->setRowStretch(3, 0);
    smallBtnLayout->setRowStretch(4, 0);
    smallBtnLayout->setRowStretch(5, 0);

    // large button layout
    largeBtnLayout->addWidget(pbEE, 0, 0);
    largeBtnLayout->addWidget(pbMR, 0, 1);
    largeBtnLayout->addWidget(pbMplusminus, 0, 2);
    largeBtnLayout->addWidget(pbMC, 0, 3);
    largeBtnLayout->addWidget(pbClear, 0, 4);
    largeBtnLayout->addWidget(pbAC, 0, 5);

    largeBtnLayout->addWidget(pb7, 1, 0);
    largeBtnLayout->addWidget(pb8, 1, 1);
    largeBtnLayout->addWidget(pb9, 1, 2);
    largeBtnLayout->addWidget(pbparenopen, 1, 3);
    largeBtnLayout->addWidget(pbparenclose, 1, 4);
    largeBtnLayout->addWidget(pband, 1, 5);

    largeBtnLayout->addWidget(pb4, 2, 0);
    largeBtnLayout->addWidget(pb5, 2, 1);
    largeBtnLayout->addWidget(pb6, 2, 2);
    largeBtnLayout->addWidget(pbX, 2, 3);
    largeBtnLayout->addWidget(pbdivision, 2, 4);
    largeBtnLayout->addWidget(pbor, 2, 5);

    largeBtnLayout->addWidget(pb1, 3, 0);
    largeBtnLayout->addWidget(pb2, 3, 1);
    largeBtnLayout->addWidget(pb3, 3, 2);
    largeBtnLayout->addWidget(pbplus, 3, 3);
    largeBtnLayout->addWidget(pbminus, 3, 4);
    largeBtnLayout->addWidget(pbshift, 3, 5);

    largeBtnLayout->addWidget(pbperiod, 4, 0);
    largeBtnLayout->addWidget(pb0, 4, 1);
    largeBtnLayout->addWidget(pbequal, 4, 2);
    largeBtnLayout->addWidget(pbpercent, 4, 3);
    largeBtnLayout->addWidget(pbnegate, 4, 4);
    largeBtnLayout->addWidget(pbmod, 4, 5);

    largeBtnLayout->addColSpacing(0,10);
    largeBtnLayout->addColSpacing(1,10);
    largeBtnLayout->addColSpacing(2,10);
    largeBtnLayout->addColSpacing(3,10);
    largeBtnLayout->addColSpacing(4,10);
    topLayout->addWidget(pb);
    topLayout->addWidget(calc_display, 10);


    // radiobutton layout
    radioLayout->addWidget(base_group);
    radioLayout->addWidget(angle_group);

    // status layout
    statusLayout->addWidget(statusINVLabel);
    statusLayout->addWidget(statusHYPLabel);
    statusLayout->addWidget(statusERRORLabel, 10);

    mNumButtonList.append(pb0);
    mNumButtonList.append(pb1);
    mNumButtonList.append(pb2);
    mNumButtonList.append(pb3);
    mNumButtonList.append(pb4);
    mNumButtonList.append(pb5);
    mNumButtonList.append(pb6);
    mNumButtonList.append(pb7);
    mNumButtonList.append(pb8);
    mNumButtonList.append(pb9);

    mFunctionButtonList.append(pbhyp);
    mFunctionButtonList.append(pbinv);
    mFunctionButtonList.append(pbSin);
    mFunctionButtonList.append(pbplusminus);
    mFunctionButtonList.append(pbCos);
    mFunctionButtonList.append(pbreci);
    mFunctionButtonList.append(pbTan);
    mFunctionButtonList.append(pbfactorial);
    mFunctionButtonList.append(pblog);
    mFunctionButtonList.append(pbsquare);
    mFunctionButtonList.append(pbln);
    mFunctionButtonList.append(pbpower);

    mHexButtonList.append(pbA);
    mHexButtonList.append(pbB);
    mHexButtonList.append(pbC);
    mHexButtonList.append(pbD);
    mHexButtonList.append(pbE);
    mHexButtonList.append(pbF);

    mMemButtonList.append(pbEE);
    mMemButtonList.append(pbMR);
    mMemButtonList.append(pbMplusminus);
    mMemButtonList.append(pbMC);
    mMemButtonList.append(pbClear);
    mMemButtonList.append(pbAC);

    mOperationButtonList.append(pbX);
    mOperationButtonList.append(pbparenopen);
    mOperationButtonList.append(pbparenclose);
    mOperationButtonList.append(pband);
    mOperationButtonList.append(pbdivision);
    mOperationButtonList.append(pbor);
    mOperationButtonList.append(pbplus);
    mOperationButtonList.append(pbminus);
    mOperationButtonList.append(pbshift);
    mOperationButtonList.append(pbperiod);
    mOperationButtonList.append(pbequal);
    mOperationButtonList.append(pbpercent);
    mOperationButtonList.append(pbnegate);
    mOperationButtonList.append(pbmod);

    set_colors();
    set_precision();
    set_style();
    updateGeometry();
    setFixedHeight(minimumHeight());
    InitializeCalculator();
}
コード例 #24
0
ファイル: sounddlg.cpp プロジェクト: serghei/kde3-kdepim
SoundDlg::SoundDlg(const QString &file, float volume, float fadeVolume, int fadeSeconds, bool repeat,
                   const QString &caption, QWidget *parent, const char *name)
    : KDialogBase(parent, name, true, caption, Ok | Cancel, Ok, false),
      mReadOnly(false),
      mArtsDispatcher(0),
      mPlayObject(0),
      mPlayTimer(0)
{
    QWidget *page = new QWidget(this);
    setMainWidget(page);
    QVBoxLayout *layout = new QVBoxLayout(page, 0, spacingHint());

    // File play button
    QHBox *box = new QHBox(page);
    layout->addWidget(box);
    mFilePlay = new QPushButton(box);
    mFilePlay->setPixmap(SmallIcon("player_play"));
    mFilePlay->setFixedSize(mFilePlay->sizeHint());
    connect(mFilePlay, SIGNAL(clicked()), SLOT(playSound()));
    QToolTip::add(mFilePlay, i18n("Test the sound"));
    QWhatsThis::add(mFilePlay, i18n("Play the selected sound file."));

    // File name edit box
    mFileEdit = new LineEdit(LineEdit::Url, box);
    mFileEdit->setAcceptDrops(true);
    QWhatsThis::add(mFileEdit, i18n("Enter the name or URL of a sound file to play."));

    // File browse button
    mFileBrowseButton = new PushButton(box);
    mFileBrowseButton->setPixmap(SmallIcon("fileopen"));
    mFileBrowseButton->setFixedSize(mFileBrowseButton->sizeHint());
    connect(mFileBrowseButton, SIGNAL(clicked()), SLOT(slotPickFile()));
    QToolTip::add(mFileBrowseButton, i18n("Choose a file"));
    QWhatsThis::add(mFileBrowseButton, i18n("Select a sound file to play."));

    // Sound repetition checkbox
    mRepeatCheckbox = new CheckBox(i18n_p_Repeat(), page);
    mRepeatCheckbox->setFixedSize(mRepeatCheckbox->sizeHint());
    QWhatsThis::add(mRepeatCheckbox,
                    i18n("If checked, the sound file will be played repeatedly for as long as the message is displayed."));
    layout->addWidget(mRepeatCheckbox);

    // Volume
    QGroupBox *group = new QGroupBox(i18n("Volume"), page);
    layout->addWidget(group);
    QGridLayout *grid = new QGridLayout(group, 4, 3, marginHint(), spacingHint());
    grid->addRowSpacing(0, fontMetrics().height() - marginHint() + spacingHint());
    grid->setColStretch(2, 1);
    int indentWidth = 3 * KDialog::spacingHint();
    grid->addColSpacing(0, indentWidth);
    grid->addColSpacing(1, indentWidth);
    // Get alignment to use in QGridLayout (AlignAuto doesn't work correctly there)
    int alignment = QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft;

    // 'Set volume' checkbox
    box = new QHBox(group);
    box->setSpacing(spacingHint());
    grid->addMultiCellWidget(box, 1, 1, 0, 2);
    mVolumeCheckbox = new CheckBox(i18n_v_SetVolume(), box);
    mVolumeCheckbox->setFixedSize(mVolumeCheckbox->sizeHint());
    connect(mVolumeCheckbox, SIGNAL(toggled(bool)), SLOT(slotVolumeToggled(bool)));
    QWhatsThis::add(mVolumeCheckbox,
                    i18n("Select to choose the volume for playing the sound file."));

    // Volume slider
    mVolumeSlider = new Slider(0, 100, 10, 0, Qt::Horizontal, box);
    mVolumeSlider->setTickmarks(QSlider::Below);
    mVolumeSlider->setTickInterval(10);
    mVolumeSlider->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    QWhatsThis::add(mVolumeSlider, i18n("Choose the volume for playing the sound file."));
    mVolumeCheckbox->setFocusWidget(mVolumeSlider);

    // Fade checkbox
    mFadeCheckbox = new CheckBox(i18n("Fade"), group);
    mFadeCheckbox->setFixedSize(mFadeCheckbox->sizeHint());
    connect(mFadeCheckbox, SIGNAL(toggled(bool)), SLOT(slotFadeToggled(bool)));
    QWhatsThis::add(mFadeCheckbox,
                    i18n("Select to fade the volume when the sound file first starts to play."));
    grid->addMultiCellWidget(mFadeCheckbox, 2, 2, 1, 2, alignment);

    // Fade time
    mFadeBox = new QHBox(group);
    mFadeBox->setSpacing(spacingHint());
    grid->addWidget(mFadeBox, 3, 2, alignment);
    QLabel *label = new QLabel(i18n("Time period over which to fade the sound", "Fade time:"), mFadeBox);
    label->setFixedSize(label->sizeHint());
    mFadeTime = new SpinBox(1, 999, 1, mFadeBox);
    mFadeTime->setLineShiftStep(10);
    mFadeTime->setFixedSize(mFadeTime->sizeHint());
    label->setBuddy(mFadeTime);
    label = new QLabel(i18n("seconds"), mFadeBox);
    label->setFixedSize(label->sizeHint());
    QWhatsThis::add(mFadeBox, i18n("Enter how many seconds to fade the sound before reaching the set volume."));

    // Fade slider
    mFadeVolumeBox = new QHBox(group);
    mFadeVolumeBox->setSpacing(spacingHint());
    grid->addWidget(mFadeVolumeBox, 4, 2);
    label = new QLabel(i18n("Initial volume:"), mFadeVolumeBox);
    label->setFixedSize(label->sizeHint());
    mFadeSlider = new Slider(0, 100, 10, 0, Qt::Horizontal, mFadeVolumeBox);
    mFadeSlider->setTickmarks(QSlider::Below);
    mFadeSlider->setTickInterval(10);
    mFadeSlider->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    label->setBuddy(mFadeSlider);
    QWhatsThis::add(mFadeVolumeBox, i18n("Choose the initial volume for playing the sound file."));

    // Restore the dialogue size from last time
    QSize s;
    if(KAlarm::readConfigWindowSize(SOUND_DIALOG_NAME, s))
        resize(s);

    // Initialise the control values
    mFileEdit->setText(file);
    mRepeatCheckbox->setChecked(repeat);
    mVolumeCheckbox->setChecked(volume >= 0);
    mVolumeSlider->setValue(volume >= 0 ? static_cast<int>(volume * 100) : 100);
    mFadeCheckbox->setChecked(fadeVolume >= 0);
    mFadeSlider->setValue(fadeVolume >= 0 ? static_cast<int>(fadeVolume * 100) : 100);
    mFadeTime->setValue(fadeSeconds);
    slotVolumeToggled(volume >= 0);
}
コード例 #25
0
ファイル: edit.cpp プロジェクト: kthxbyte/KDE1-Linaro
DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name )
  : QWidget(parent, name)
{
  QGridLayout *tl = new QGridLayout(this, 3, 3, 10, 10);
  tl->addRowSpacing(0, fontMetrics().lineSpacing() - 10);
  box = new QGroupBox(this);
  box->setTitle(i18n("DNS Servers"));
  tl->addMultiCellWidget(box, 0, 2, 0, 2);
  tl->setRowStretch(1, 1);
  tl->setColStretch(1, 1);
  tl->addColSpacing(0, 15);
  tl->addColSpacing(2, 15);
  tl->addRowSpacing(2, 10);

  QVBoxLayout *l1 = new QVBoxLayout;
  tl->addLayout(l1, 1, 1);
  l1->addSpacing(10);

  QGridLayout *l11 = new QGridLayout(5, 2);
  l1->addLayout(l11);

  dnsdomain_label = newLabel(i18n("Domain Name:"), this);
  l11->addWidget(dnsdomain_label, 0, 0);

  dnsdomain = new QLineEdit(this);
  dnsdomain->setMaxLength(DOMAIN_SIZE);
  FIXED_HEIGHT(dnsdomain);
  MIN_WIDTH(dnsdomain);
  l11->addWidget(dnsdomain, 0, 1);
  l11->addRowSpacing(1, 15);
  KQuickHelp::add(dnsdomain_label,
  KQuickHelp::add(dnsdomain, 
		  i18n("If you enter a domain name here, this domain\n"
		       "name is used for your computer while you are\n"
		       "connected. When the connection is closed, the\n"
		       "original domain name of your computer is\n"
		       "restored.\n"
		       "\n"
		       "If you leave this field blank, no changes are\n"
		       "made to the domain name.")));

  dns_label = newLabel(i18n("DNS IP Address:"), this);
  l11->addWidget(dns_label, 2, 0);

  QHBoxLayout *l110 = new QHBoxLayout;
  l11->addLayout(l110, 2, 1);
  dnsipaddr = new IPLineEdit(this);
  connect(dnsipaddr, SIGNAL(returnPressed()), 
	  SLOT(adddns()));
  connect(dnsipaddr, SIGNAL(textChanged(const char *)), 
	  SLOT(DNS_Edit_Changed(const char *)));
  FIXED_HEIGHT(dnsipaddr);
  l110->addWidget(dnsipaddr, 4);
  l110->addStretch(3);
  KQuickHelp::add(dns_label, 
  KQuickHelp::add(dnsipaddr, 
		  i18n("Allows you to specify a new DNS server to be\n"
		       "used while you are connected. When the\n"
		       "connection is closed, this DNS entry will be\n"
		       "removed again.\n"
		       "\n"
		       "To add a DNS server, type in the IP address of\n"
		       "of the DNS server here and click on <b>Add</b>")));

  QHBoxLayout *l111 = new QHBoxLayout;
  l11->addLayout(l111, 3, 1);
  add = new QPushButton(i18n("Add"), this);
  connect(add, SIGNAL(clicked()), SLOT(adddns()));
  FIXED_HEIGHT(add);
  int width = add->sizeHint().width();
  width = QMAX(width,60);
  add->setMinimumWidth(width);
  l111->addWidget(add);
  l111->addStretch(1);
  KQuickHelp::add(add,
		  i18n("Click this button to add the DNS server\n"
		       "specified in the field above. The entry\n"
		       "will then be added to the list below"));
		  
  remove = new QPushButton(i18n("Remove"), this);
  connect(remove, SIGNAL(clicked()), SLOT(removedns()));
  FIXED_HEIGHT(remove);
  width = remove->sizeHint().width();
  width = QMAX(width,60);
  remove->setMinimumWidth(width);
  l111->addWidget(remove);
  KQuickHelp::add(remove,
		  i18n("Click this button to remove the selected DNS\n"
		       "server entry from the list below"));

  servers_label = newLabel(i18n("DNS Address List:"), this);
  servers_label->setAlignment(AlignTop|AlignLeft);
  l11->addWidget(servers_label, 4, 0);
 
  dnsservers = new QListBox(this);
  dnsservers->setMinimumSize(150, 100);
  connect(dnsservers, SIGNAL(highlighted(int)),
	  SLOT(DNS_Entry_Selected(int)));
  l11->addWidget(dnsservers, 4, 1);
  KQuickHelp::add(servers_label,
  KQuickHelp::add(dnsservers,
		  i18n("This shows all defined DNS servers to use\n"
		       "while you are connected. Use the <b>Add</b> and\n"
		       "<b>Remove</b> buttons to modify the list")));

  exdnsdisabled_toggle = newCheckBox(i18n(
     "Disable existing DNS Servers during Connection"),
				       this);
  exdnsdisabled_toggle->setChecked(gpppdata.exDNSDisabled());
  l1->addStretch(2);
  l1->addWidget(exdnsdisabled_toggle);
  l1->addStretch(1);
  KQuickHelp::add(exdnsdisabled_toggle,
		  i18n("When this option is selected, all DNS\n"
		       "servers specified in <i>/etc/resolv.conf</i> are\n"
		       "temporary disabled while the dialup connection\n"
		       "is established. After the connection is\n"
		       "closed, the servers will be re-enabled\n"
		       "\n"
		       "Typically, there is no reason to use this\n"
		       "option, but it may become useful under \n"
		       "some circumstances"));
 
  // restore data if editing
  if(!isnewaccount) {
    QStrList &dnslist = gpppdata.dns();
    for(char *dns = dnslist.first(); dns; dns = dnslist.next())
      dnsservers->insertItem(dns);
    dnsdomain->setText(gpppdata.domain());
  }

  // disable buttons
  DNS_Edit_Changed("");
  remove->setEnabled(false);

  tl->activate();
}