コード例 #1
0
// scale and adjust the upper slider group
void TriangleDensityWidget::resetSliders(double norm)
{
	TriangleList triangles = triangleScene->triangles();
	int n = 0;
	foreach (Triangle* t, triangles)
	{
		QSlider* sl = sliders[n];
		QLabel* la = slider_names[n];
		sl->blockSignals(true);
		sl->setSliderPosition((int)( t->xform()->density / norm * 1000. ));
		sl->blockSignals(false);
		sl->setVisible(true);
		la->setVisible(true);
		sl->setToolTip(triangleScene->getInfoLabel(t));
		if (genome_ptr->final_xform_enable
			&& genome_ptr->final_xform_index == n)
		{
			sl->setEnabled(false);
			la->setEnabled(false);
		}
		else
		{
			sl->setEnabled(true);
			la->setEnabled(true);
		}
		n++;
	}
コード例 #2
0
AnimationPropertiesDialog::AnimationPropertiesDialog(Animation *pAnim, QWidget *pParent) : QDialog(pParent), mpAnim(pAnim), mChangingTimes(false)
{
   bool timeBased = mpAnim->getFrameType() == FRAME_TIME;
   QLabel *pNameLabel = new QLabel("Name:", this);
   QLabel *pStartLabel = new QLabel("Start Time:", this);
   pStartLabel->setEnabled(timeBased);
   QLabel *pStopLabel = new QLabel("Stop Time:", this);
   pStopLabel->setEnabled(timeBased);
   mpName = new QLineEdit(QString::fromStdString(mpAnim->getName()), this);
   mpStart = new QDateTimeEdit(this);
   mpStart->setCalendarPopup(true);
   mpStart->setDisplayFormat("yyyy/MM/dd\nhh:mm:ss.zzzZ");
   mpStart->setEnabled(timeBased);
   mpStop = new QDateTimeEdit(this);
   mpStop->setCalendarPopup(true);
   mpStop->setDisplayFormat("yyyy/MM/dd\nhh:mm:ss.zzzZ");
   mpStop->setEnabled(timeBased);
   mpMaintainDuration = new QCheckBox("Maintain Duration", this);
   mpMaintainDuration->setChecked(true);
   mpMaintainDuration->setEnabled(timeBased);
   QDialogButtonBox *pButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);

   QVBoxLayout *pTopLayout = new QVBoxLayout(this);
   QHBoxLayout *pNameLayout = new QHBoxLayout();
   pTopLayout->addLayout(pNameLayout);
   pNameLayout->addWidget(pNameLabel);
   pNameLayout->addWidget(mpName, 5);
   QHBoxLayout *pTimeLayout = new QHBoxLayout();
   pTopLayout->addLayout(pTimeLayout);
   pTimeLayout->addWidget(pStartLabel);
   pTimeLayout->addWidget(mpStart, 5);
   pTimeLayout->addWidget(pStopLabel);
   pTimeLayout->addWidget(mpStop, 5);
   QHBoxLayout *pMaintainLayout = new QHBoxLayout();
   pTopLayout->addLayout(pMaintainLayout);
   pMaintainLayout->addWidget(mpMaintainDuration);
   pMaintainLayout->addStretch(5);
   pTopLayout->addWidget(pButtons);
   pTopLayout->addStretch();

   connect(mpStart, SIGNAL(dateTimeChanged(const QDateTime&)), this, SLOT(startTimeChanged(const QDateTime&)));
   connect(mpStop, SIGNAL(dateTimeChanged(const QDateTime&)), this, SLOT(stopTimeChanged(const QDateTime&)));
   connect(mpMaintainDuration, SIGNAL(toggled(bool)), this, SLOT(adjustDuration(bool)));
   connect(pButtons, SIGNAL(accepted()), this, SLOT(accept()));
   connect(pButtons, SIGNAL(rejected()), this, SLOT(reject()));

   if(timeBased)
   {
      mpStart->setDateTime(TimelineUtils::timetToQDateTime(mpAnim->getStartValue()));
      mpStop->setDateTime(TimelineUtils::timetToQDateTime(mpAnim->getStopValue()));
   }
}
コード例 #3
0
ファイル: settingswidget.cpp プロジェクト: BoltsJ/albert
/** ***************************************************************************/
void SettingsWidget::updatePluginInformations(const QModelIndex & current) {
    // Hidde the placehodler text
    QLayoutItem *i = ui.widget_pluginInfos->layout()->takeAt(1);
    delete i->widget();
    delete i;

    if (extensionManager_->extensionSpecs()[current.row()]->state() == ExtensionSpec::State::Loaded){
        Extension *extension = dynamic_cast<Extension*>(extensionManager_->extensionSpecs()[current.row()]->instance());
        if (!extension){
            qWarning() << "Cannot cast an object of extension spec to an extension!";
            return; // Should no happen
        }
        QWidget *pw = extension->widget();
        if ( pw->layout() != nullptr)
            pw->layout()->setMargin(0);
        ui.widget_pluginInfos->layout()->addWidget(pw);// Takes ownership
        ui.label_pluginTitle->setText(extension->name());
        ui.label_pluginTitle->show();
    }
    else{
        QString msg("Plugin not loaded.\n%1");
        QLabel *lbl = new QLabel(msg.arg(extensionManager_->extensionSpecs()[current.row()]->lastError()));
        lbl->setEnabled(false);
        lbl->setAlignment(Qt::AlignCenter);
        ui.widget_pluginInfos->layout()->addWidget(lbl);
        ui.label_pluginTitle->hide();
    }
}
コード例 #4
0
ファイル: CRaspiGPIO.cpp プロジェクト: CRLG/LABOTBOX
// _____________________________________________________________________
void CRaspiGPIO::setPinModeOutput(unsigned int gpio_num, unsigned int init_state)
{
    pinMode(gpio_num, OUTPUT);
    digitalWrite(gpio_num, init_state);

    QString txt = "O";
    QString tooltip = "Digital Output";
    QLabel *lbl = m_ihm.findChild<QLabel*>(PREFIX_MODE_GPIO + QString::number(gpio_num));
    if (lbl) {
        lbl->setText(txt);
        lbl->setToolTip(tooltip);
        lbl->setEnabled(true);
    }
    QLabel *lbl_name = m_ihm.findChild<QLabel*>(PREFIX_GPIO_NAME + QString::number(gpio_num));
    if (lbl_name) {
        lbl_name->setEnabled(true);
    }

    QCheckBox *checkbox = m_ihm.findChild<QCheckBox*>(PREFIX_CHECKBOX_WRITE + QString::number(gpio_num));
    if (checkbox) {
        checkbox->setEnabled(true);
    }
    m_raspi_pins_config[gpio_num] = tRaspiPinConfig { OUTPUT, PUD_OFF, init_state};

    // Crée la data dans le data manager et l'associe à une callback pour déclencher l'écriture sur le port sur changement de valeur de la data
    QString dataname = PREFIX_RASPI_OUT_DATANAME + QString::number(gpio_num);
    m_application->m_data_center->write(dataname, init_state);
    CData *data = m_application->m_data_center->getData(dataname);
    if (data) {
        connect (data, SIGNAL(valueUpdated(QVariant)), this, SLOT(onDataChangeWrite(QVariant)));
    }
}
コード例 #5
0
ファイル: KviOptionsWidget.cpp プロジェクト: kartagis/KVIrc
QLabel * KviOptionsWidget::addLabel(QWidget * pParent,const QString & text,bool bEnabled)
{
	QLabel * l = new QLabel(text,pParent);
	l->setWordWrap(true);
	l->setEnabled(bEnabled);
	return l;
}
コード例 #6
0
Kleo::CryptoConfigEntryURL::CryptoConfigEntryURL(
  CryptoConfigModule* module,
  Kleo::CryptoConfigEntry* entry, const QString& entryName,
  QGridLayout * glay, QWidget* widget )
    : CryptoConfigEntryGUI( module, entry, entryName ),
    mLineEdit( 0 )
#ifndef KDEPIM_ONLY_KLEO
      , mUrlRequester( 0 )
#endif
{
  const int row = glay->rowCount();
  QWidget * req;
#ifdef KDEPIM_ONLY_KLEO
  req = mLineEdit = new QLineEdit( widget );
#else
  req = mUrlRequester = new KUrlRequester( widget );
  mUrlRequester->setMode( KFile::File | KFile::ExistingOnly );
#endif
  QLabel *label = new QLabel( description(), widget );
  label->setBuddy( req );
  glay->addWidget( label, row, 1 );
  glay->addWidget( req, row, 2 );
  if ( entry->isReadOnly() ) {
    label->setEnabled( false );
#ifndef KDEPIM_ONLY_KLEO
    if ( mUrlRequester )
        mUrlRequester->setEnabled( false );
#endif
    if ( mLineEdit )
        mLineEdit->setEnabled( false );
  } else {
      connect( req, SIGNAL(textChanged(QString)),
               this, SLOT(slotChanged()) );
  }
}
コード例 #7
0
Kleo::CryptoConfigEntrySpinBox::CryptoConfigEntrySpinBox(
  CryptoConfigModule* module,
  Kleo::CryptoConfigEntry* entry, const QString& entryName,
  QGridLayout * glay, QWidget* widget )
  : CryptoConfigEntryGUI( module, entry, entryName )
{

  if ( entry->argType() == Kleo::CryptoConfigEntry::ArgType_None && entry->isList() ) {
    mKind = ListOfNone;
  } else if ( entry->argType() == Kleo::CryptoConfigEntry::ArgType_UInt ) {
    mKind = UInt;
  } else {
    Q_ASSERT( entry->argType() == Kleo::CryptoConfigEntry::ArgType_Int );
    mKind = Int;
  }

  const int row = glay->rowCount();
  mNumInput = new KIntNumInput( widget );
  QLabel *label = new QLabel( description(), widget );
  label->setBuddy( mNumInput );
  glay->addWidget( label, row, 1 );
  glay->addWidget( mNumInput, row, 2 );

  if ( entry->isReadOnly() ) {
    label->setEnabled( false );
    mNumInput->setEnabled( false );
  } else {
    if ( mKind == UInt || mKind == ListOfNone )
      mNumInput->setMinimum( 0 );
    connect( mNumInput, SIGNAL( valueChanged(int) ), SLOT( slotChanged() ) );
  }
}
コード例 #8
0
OptionsWidget_userListGrid::OptionsWidget_userListGrid(QWidget * parent)
    : KviOptionsWidget(parent)
{
	createLayout();
	KviBoolSelector * b = addBoolSelector(0, 0, 0, 0, __tr2qs_ctx("Draw nickname grid", "options"), KviOption_boolUserListViewDrawGrid);

	KviColorSelector * s = addColorSelector(0, 1, 0, 1, __tr2qs_ctx("Grid color:", "options"), KviOption_colorUserListViewGrid, KVI_OPTION_BOOL(KviOption_boolUserListViewDrawGrid));
	connect(b, SIGNAL(toggled(bool)), s, SLOT(setEnabled(bool)));

	KviTalHBox * hb = new KviTalHBox(this);
	addWidgetToLayout(hb, 0, 2, 0, 2);
	hb->setSpacing(4);

	QLabel * l = new QLabel(__tr2qs_ctx("Grid type:", "options"), hb);
	l->setEnabled(KVI_OPTION_BOOL(KviOption_boolUserListViewDrawGrid));
	connect(b, SIGNAL(toggled(bool)), l, SLOT(setEnabled(bool)));
	m_pGridTypeCombo = new QComboBox(hb);
	m_pGridTypeCombo->addItem(__tr2qs_ctx("3D Grid", "options"));
	m_pGridTypeCombo->addItem(__tr2qs_ctx("3D Buttons", "options"));
	m_pGridTypeCombo->addItem(__tr2qs_ctx("Plain Grid", "options"));
	m_pGridTypeCombo->addItem(__tr2qs_ctx("Dotted Grid", "options"));
	m_pGridTypeCombo->setCurrentIndex(KVI_OPTION_UINT(KviOption_uintUserListViewGridType));
	m_pGridTypeCombo->setEnabled(KVI_OPTION_BOOL(KviOption_boolUserListViewDrawGrid));
	connect(b, SIGNAL(toggled(bool)), m_pGridTypeCombo, SLOT(setEnabled(bool)));

	addRowSpacer(0, 3, 0, 3);
}
コード例 #9
0
ファイル: MD5CheckPage.cpp プロジェクト: KDE/kphotoalbum
void ImportExport::MD5CheckPage::createRow( QGridLayout* layout, int& row, const QString& name, const QString& title, bool anyClashes, bool allowMerge )
{
    if ( row % 3 == 0 ) {
        QFrame* line = new QFrame;
        line->setFrameShape( QFrame::HLine );
        layout->addWidget( line, ++row, 0, 1, 4 );
    }

    QLabel* label = new QLabel( title );
    label->setEnabled( anyClashes );
    layout->addWidget( label, ++row, 0 );

    QButtonGroup* group = new QButtonGroup(this);
    m_groups[name]=group;

    for ( int i = 1; i<4;++i ) {
        if ( i == 3 && !allowMerge )
            continue;

        QRadioButton* rb = new QRadioButton;
        layout->addWidget( rb, row, i  );
        group->addButton( rb, i );
        rb->setEnabled( anyClashes );
        if (i == 1 )
            rb->setChecked(true);
    }
}
コード例 #10
0
NewIdentityDialog::NewIdentityDialog(const QStringList &identities,
                                     QWidget *parent, const char *name,
                                     bool modal)
    : KDialogBase(parent, name, modal, i18n("New Identity"),
                  Ok | Cancel | Help, Ok, true)
{
    setHelp(QString::fromLatin1("configure-identity-newidentitydialog"));
    QWidget *page = makeMainWidget();
    QVBoxLayout *vlay = new QVBoxLayout(page, 0, spacingHint());

    // row 0: line edit with label
    QHBoxLayout *hlay = new QHBoxLayout(vlay);    // inherits spacing
    mLineEdit = new KLineEdit(page);
    mLineEdit->setFocus();
    hlay->addWidget(new QLabel(mLineEdit, i18n("&New identity:"), page));
    hlay->addWidget(mLineEdit, 1);
    connect(mLineEdit, SIGNAL(textChanged(const QString &)),
            this, SLOT(slotEnableOK(const QString &)));

    mButtonGroup = new QButtonGroup(page);
    mButtonGroup->hide();

    // row 1: radio button
    QRadioButton *radio = new QRadioButton(i18n("&With empty fields"), page);
    radio->setChecked(true);
    mButtonGroup->insert(radio, Empty);
    vlay->addWidget(radio);

    // row 2: radio button
    radio = new QRadioButton(i18n("&Use Control Center settings"), page);
    mButtonGroup->insert(radio, ControlCenter);
    vlay->addWidget(radio);

    // row 3: radio button
    radio = new QRadioButton(i18n("&Duplicate existing identity"), page);
    mButtonGroup->insert(radio, ExistingEntry);
    vlay->addWidget(radio);

    // row 4: combobox with existing identities and label
    hlay = new QHBoxLayout(vlay);   // inherits spacing
    mComboBox = new QComboBox(false, page);
    mComboBox->insertStringList(identities);
    mComboBox->setEnabled(false);
    QLabel *label = new QLabel(mComboBox, i18n("&Existing identities:"), page);
    label->setEnabled(false);
    hlay->addWidget(label);
    hlay->addWidget(mComboBox, 1);

    vlay->addStretch(1);   // spacer

    // enable/disable combobox and label depending on the third radio
    // button's state:
    connect(radio, SIGNAL(toggled(bool)),
            label, SLOT(setEnabled(bool)));
    connect(radio, SIGNAL(toggled(bool)),
            mComboBox, SLOT(setEnabled(bool)));

    enableButtonOK(false);   // since line edit is empty
}
コード例 #11
0
ファイル: KviOptionsWidget.cpp プロジェクト: kartagis/KVIrc
QLabel * KviOptionsWidget::addLabel(int x1,int y1,int x2,int y2,const QString & text,bool bEnabled)
{
	QLabel * l = new QLabel(text,this);
	l->setWordWrap(true);
	l->setEnabled(bEnabled);
	addWidgetToLayout(l,x1,y1,x2,y2);
	return l;
}
コード例 #12
0
OptionsWidget_privmsg::OptionsWidget_privmsg(QWidget * parent)
: KviOptionsWidget(parent)
{
	setObjectName("privmsg_options_widget");
	createLayout();

	KviTalGroupBox * g = addGroupBox(0,0,0,0,Qt::Horizontal,__tr2qs_ctx("General","options"));

	addBoolSelector(g,__tr2qs_ctx("Show message icons","options"),KviOption_boolIrcViewShowImages);
	addBoolSelector(g,__tr2qs_ctx("Draw some emoticons (smileys) as pictures","options"),KviOption_boolDrawEmoticons);
	addBoolSelector(g,__tr2qs_ctx("Don't show colors in user messages","options"),KviOption_boolStripMircColorsInUserMessages);

	g = addGroupBox(0,1,0,1,Qt::Horizontal,__tr2qs_ctx("Nicknames","options"));

	m_pUseSmartColorSelector = addBoolSelector(g,__tr2qs_ctx("\"Smart\" nickname colors","options"),KviOption_boolColorNicks);

	KviTalHBox * hb = new KviTalHBox(g);
	hb->setSpacing(4);
	m_pSpecialSmartColorSelector = addBoolSelector(hb,__tr2qs_ctx("Use specified colors for own nick:","options"),KviOption_boolUseSpecifiedSmartColorForOwnNick,KVI_OPTION_BOOL(KviOption_boolColorNicks));

	m_pSmartColorSelector = addMircTextColorSelector(hb,"",KviOption_uintUserIrcViewOwnForeground,KviOption_uintUserIrcViewOwnBackground,KVI_OPTION_BOOL(KviOption_boolColorNicks) && KVI_OPTION_BOOL(KviOption_boolUseSpecifiedSmartColorForOwnNick));

	connect(m_pSpecialSmartColorSelector,SIGNAL(toggled(bool)),this,SLOT(enableDisableSmartColorSelector(bool)));
	connect(m_pUseSmartColorSelector,SIGNAL(toggled(bool)),m_pSpecialSmartColorSelector,SLOT(setEnabled(bool)));

	KviBoolSelector * b2 = addBoolSelector(g,__tr2qs_ctx("Use same colors as in the userlist","options"),KviOption_boolUseUserListColorsAsNickColors,!KVI_OPTION_BOOL(KviOption_boolColorNicks));
	connect(m_pUseSmartColorSelector,SIGNAL(toggled(bool)),b2,SLOT(setNotEnabled(bool)));

	addBoolSelector(g,__tr2qs_ctx("Show nicknames in bold","options"),KviOption_boolBoldedNicks);
	addBoolSelector(g,__tr2qs_ctx("Show user and host","options"),KviOption_boolShowUserAndHostInPrivmsgView);
	addBoolSelector(g,__tr2qs_ctx("Show channel mode prefix","options"),KviOption_boolShowChannelUserFlagInPrivmsgView);
	KviBoolSelector * b = addBoolSelector(g,__tr2qs_ctx("User-defined prefix and postfix","options"),KviOption_boolUseExtendedPrivmsgView);

	QLabel * l = addLabel(g,__tr2qs_ctx("[PREFIX]nickname[!user@host][POSTFIX] message","options"));

	l->setEnabled(KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView));
	connect(b,
		SIGNAL(toggled(bool)),
		l,
		SLOT(setEnabled(bool)));

	KviTalVBox * vb = new KviTalVBox(g);
	vb->setSpacing(5);

	connect(
		b,
		SIGNAL(toggled(bool)),
		addStringSelector(vb,__tr2qs_ctx("Prefix:","options"),KviOption_stringExtendedPrivmsgPrefix,KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView)),
		SLOT(setEnabled(bool)));
	connect(
		b,
		SIGNAL(toggled(bool)),
		addStringSelector(vb,__tr2qs_ctx("Postfix:","options"),KviOption_stringExtendedPrivmsgPostfix,KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView)),
		SLOT(setEnabled(bool)));
	addRowSpacer(0,3,0,3);
}
コード例 #13
0
void diaElemAspectRatio::enable(uint32_t onoff) 
{
	QSpinBox *numBox = (QSpinBox*)myWidget;
	QSpinBox *denBox = (QSpinBox*)denControl;
	QLabel *label = (QLabel*)this->label;

	numBox->setEnabled(onoff);
	denBox->setEnabled(onoff);
	label->setEnabled(onoff);
}
コード例 #14
0
void* QmitkExtWorkbenchWindowAdvisor::CreateEmptyWindowContents(void* parent)
{
 QWidget* parentWidget = static_cast<QWidget*>(parent);
 QLabel* label = new QLabel(parentWidget);
 label->setText("<b>No perspectives are open. Open a perspective in the <i>Window->Open Perspective</i> menu.</b>");
 label->setContentsMargins(10,10,10,10);
 label->setAlignment(Qt::AlignTop);
 label->setEnabled(false);
 parentWidget->layout()->addWidget(label);
 return label;
}
コード例 #15
0
ファイル: treegui_funcs.cpp プロジェクト: alinelena/aten
// Create new label widget
QtWidgetObject* AtenTreeGuiDialog::addLabel(TreeGuiWidget* widget, QString text)
{
	QtWidgetObject* qtwo = widgetObjects_.add();
	QLabel *label = new QLabel(this);
	qtwo->set(widget, label, text);
	label->setText(text);
	label->setEnabled(widget->enabled());
	label->setVisible(widget->visible());
	label->setMinimumHeight(WIDGETHEIGHT);
	label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	return qtwo;
}
コード例 #16
0
ファイル: iconpreviewarea.cpp プロジェクト: cedrus/qt4
//! [4]
QLabel *IconPreviewArea::createPixmapLabel()
{
    QLabel *label = new QLabel;
    label->setEnabled(false);
    label->setAlignment(Qt::AlignCenter);
    label->setFrameShape(QFrame::Box);
    label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    label->setBackgroundRole(QPalette::Base);
    label->setAutoFillBackground(true);
    label->setMinimumSize(132, 132);
    return label;
}
コード例 #17
0
ファイル: Label.cpp プロジェクト: fferri/v_repExtCustomUI
QWidget * Label::createQtWidget(Proxy *proxy, UIProxy *uiproxy, QWidget *parent)
{
    QLabel *label = new QLabel(QString::fromStdString(text), parent);
    label->setEnabled(enabled);
    label->setVisible(visible);
    label->setStyleSheet(QString::fromStdString(style));
    label->setWordWrap(wordWrap);
    label->setOpenExternalLinks(false);
    QObject::connect(label, &QLabel::linkActivated, uiproxy, &UIProxy::onLinkActivated);
    setQWidget(label);
    setProxy(proxy);
    return label;
}
コード例 #18
0
Kleo::CryptoConfigEntryLineEdit::CryptoConfigEntryLineEdit(
  CryptoConfigModule* module,
  Kleo::CryptoConfigEntry* entry, const QString& entryName,
  QGridLayout * glay, QWidget* widget )
  : CryptoConfigEntryGUI( module, entry, entryName )
{
  const int row = glay->rowCount();
  mLineEdit = new KLineEdit( widget );
  QLabel *label = new QLabel( description(), widget );
  label->setBuddy( mLineEdit );
  glay->addWidget( label, row, 1 );
  glay->addWidget( mLineEdit, row, 2 );
  if ( entry->isReadOnly() ) {
    label->setEnabled( false );
    mLineEdit->setEnabled( false );
  } else {
    connect( mLineEdit, SIGNAL( textChanged( const QString& ) ), SLOT( slotChanged() ) );
  }
}
コード例 #19
0
Kleo::CryptoConfigEntryDirPath::CryptoConfigEntryDirPath(
  CryptoConfigModule* module,
  Kleo::CryptoConfigEntry* entry, const QString& entryName,
  QGridLayout * glay, QWidget* widget )
    : CryptoConfigEntryGUI( module, entry, entryName ),
      mUrlRequester( 0 ),
      mFileNameRequester( 0 )
{
  const int row = glay->rowCount();
  QWidget * req;
#ifdef KDEPIM_ONLY_KLEO
  req = mFileNameRequester = new FileNameRequester( widget );
  mFileNameRequester->setExistingOnly( false );
  mFileNameRequester->setFilter( QDir::Dirs );
#else
  req = mUrlRequester = new KUrlRequester( widget );
  mUrlRequester->setMode( KFile::Directory | KFile::LocalOnly );
#endif
  QLabel *label = new QLabel( description(), widget );
  label->setBuddy( req );
  glay->addWidget( label, row, 1 );
  glay->addWidget( req, row, 2 );
  if ( entry->isReadOnly() ) {
    label->setEnabled( false );
#ifndef KDEPIM_ONLY_KLEO
    if ( mUrlRequester )
        mUrlRequester->setEnabled( false );
#endif
    if ( mFileNameRequester )
        mFileNameRequester->setEnabled( false );
  } else {
#ifndef KDEPIM_ONLY_KLEO
      if ( mUrlRequester )
          connect( mUrlRequester, SIGNAL(textChanged(QString)),
                   this, SLOT(slotChanged()) );
#endif
      if ( mFileNameRequester )
          connect( mFileNameRequester, SIGNAL(fileNameChanged(QString)),
                   this, SLOT(slotChanged()) );
  }
}
コード例 #20
0
void DefinitionBoxWidget::setupGui(){
    ui->labelDefinition->show();
    ui->lineEditDefinition->hide();
    ui->labelDefinition->setText((m_definitionMap["value"]).toString());
    ui->lineEditDefinition->setText((m_definitionMap["value"]).toString());
    ui->plainTextEditExampleUsage->setPlainText((m_definitionMap["usage"]).toString());
    ui->plainTextEditNotes->setPlainText((m_definitionMap["notes"]).toString());

    this->setToolTip( ( m_definitionMap["key"]).toString().prepend(trUtf8("Definition of ")) );

    //Type tag
    if((m_definitionMap["type"]).toString() != QString()){
        QLabel *pTypeLabel = new QLabel((m_definitionMap["type"]).toString());
        pTypeLabel->setFrameShape(QFrame::StyledPanel);
        pTypeLabel->setEnabled(false);
        pTypeLabel->setToolTip(trUtf8("Word Type"));
        ui->horizontalLayoutTag->addWidget(pTypeLabel, 0, Qt::AlignLeft);
    }
    //TODO: sex tag
    //TODO: antonym-synonym tag
}
コード例 #21
0
Kleo::CryptoConfigEntryDebugLevel::CryptoConfigEntryDebugLevel( CryptoConfigModule * module, Kleo::CryptoConfigEntry * entry,
                                                                const QString & entryName, QGridLayout * glay, QWidget * widget )
    : CryptoConfigEntryGUI( module, entry, entryName ),
      mComboBox( new QComboBox( widget ) )
{
    QLabel *label = new QLabel( i18n("Set the debugging level to"), widget );
    label->setBuddy( mComboBox );

    for ( unsigned int i = 0 ; i < numDebugLevels ; ++i )
        mComboBox->addItem( i18n( debugLevels[i].label ) );

    if ( entry->isReadOnly() ) {
        label->setEnabled( false );
        mComboBox->setEnabled( false );
    } else {
        connect( mComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotChanged()) );
    }

    const int row = glay->rowCount();
    glay->addWidget( label, row, 1 );
    glay->addWidget( mComboBox, row, 2 );
}
コード例 #22
0
ファイル: CRaspiGPIO.cpp プロジェクト: CRLG/LABOTBOX
// _____________________________________________________________________
void CRaspiGPIO::setPinModeInput(unsigned int gpio_num, unsigned int pullup_down)
{
    pinMode(gpio_num, INPUT);
    pullUpDnControl(gpio_num, pullup_down);
    QString txt;
    QString tooltip;
    if (pullup_down == PUD_UP) {
        txt+="Iu";
        tooltip = "Input with pull UP";
    }
    else if (pullup_down == PUD_DOWN) {
        txt+="Id";
        tooltip = "Input with pull DOWN";
    }
    else {
        txt+="I";
        tooltip = "Digital Input";
    }
    QLabel *lbl = m_ihm.findChild<QLabel*>(PREFIX_MODE_GPIO + QString::number(gpio_num));
    if (lbl) {
        lbl->setText(txt);
        lbl->setToolTip(tooltip);
        lbl->setEnabled(true);
    }
    QLabel *lbl_name = m_ihm.findChild<QLabel*>(PREFIX_GPIO_NAME + QString::number(gpio_num));
    if (lbl_name) {
        lbl_name->setEnabled(true);
    }

    // On ne peut pas forcer l'état sur une entrée
    QCheckBox *checkbox = m_ihm.findChild<QCheckBox*>(PREFIX_CHECKBOX_WRITE + QString::number(gpio_num));
    if (checkbox) {
        checkbox->setEnabled(false);
    }

    m_raspi_pins_config[gpio_num] = tRaspiPinConfig { INPUT, pullup_down, 0};
    readPin(gpio_num);
}
コード例 #23
0
ファイル: liveinfo.cpp プロジェクト: frankyue/phm
Liveinfo::Liveinfo(int getroom,QWidget *parent) : QDialog(parent), Leavebool(true),Liveinbool(true)
{
	RoomNum = getroom;
	QSqlQueryModel roomtable;// = new QSqlQueryModel;
    roomtable.setQuery("select * from Room;");
   	QSqlQueryModel recordtable;// = new QSqlQueryModel;
    recordtable.setQuery("select * from Record,Guest;");
    int Check_live = 0;
   
    QString Snum;
    QString Sname;
    QString SID;
    QString Scontact;
    QString Stime;
    QString Etime;

	for (int i = 0; i < roomtable.rowCount(); ++i) 
	{
    	QSqlRecord roomrecord = roomtable.record(i);
    	int Rnum = roomrecord.value("Num").toInt();
    		if( Rnum == getroom )
    		{	
    			Check_live = roomrecord.value("Live").toInt();
    			Snum = roomrecord.value("Num").toString();
    			Sprice = roomrecord.value("Price").toString();
				
				if(Check_live == 1)
				{
    				for (int j = 0; j < recordtable.rowCount(); ++j)
    				{
    					QSqlRecord Recordrecord = recordtable.record(j);
    					Rnum = Recordrecord.value("Num").toInt();
    					if( Rnum == getroom )
    					{
    						Sname = Recordrecord.value("Name").toString();
    						Sdays = Recordrecord.value("Days").toString();
    						Sdeposit = Recordrecord.value("Deposit").toString();
    						SID = Recordrecord.value("ID").toString();
    						Scontact = Recordrecord.value("Contact").toString();
    						Stime = Recordrecord.value("Stime").toString();
    						Etime = Recordrecord.value("Etime").toString();
    					}
   					}
  				}
    			break;
   			}
     }//Got the roon num and chek if the room have lived
    
    QGridLayout* mainlayout = new QGridLayout;
	QGridLayout* buttonlayout = new QGridLayout;

	QLabel* Name = new QLabel("Name");
    QLabel* Contact = new QLabel("Contact");
    QLabel* ID = new QLabel("ID");
    QLabel* Days = new QLabel("Days");
    QLabel* Despoit = new QLabel("Despoit");
    QLabel* RoomNum = new QLabel("Room Num");
    QLabel* Price = new QLabel("Price");
    QLabel* Livein = new QLabel("Live in day");
    QLabel* LeaveDay = new QLabel("Leave day");
        
    NameEdit = new QLineEdit;
    ContactEdit = new QLineEdit;
    IDEdit = new QLineEdit;
    DaysEdit = new QLineEdit;
    DespoitEdit = new QLineEdit;
    RoomNumEdit = new QLineEdit;
/*
    PriceEdit = new QLineEdit;
    LiveinEdit = new QLineEdit;
    LeaveEdit = new QLineEdit;
*/
    QLineEdit* PriceEdit = new QLineEdit;
    QLineEdit* LiveinEdit = new QLineEdit;
    QLineEdit* LeaveEdit = new QLineEdit;
    
    QPushButton* Modify = new QPushButton("Modify");
	QPushButton* Check_out = new QPushButton("Check Out");
	QPushButton* Submit = new QPushButton("Submit");
	QPushButton* Cancel = new QPushButton("Cancel");
		
	PriceEdit->setText(Sprice);
	RoomNumEdit->setText(Snum);
	QDate a = QDate::currentDate();
	Estime = a.toString("yyyy-MM-dd");
	
	
	if(Check_live == 1)    //show the Record infomation 
   	{
		leave();
		
		NameEdit->setText(Sname);
		ContactEdit->setText(Scontact);
    	IDEdit->setText(SID);
    	DaysEdit->setText(Sdays);
    	DespoitEdit->setText(Sdeposit);
    	LiveinEdit->setText(Stime);
    	LeaveEdit->setText(Etime);
    
	}
	else
	{
		livein();
		LiveinEdit->setText(Estime);
	}
	
	LeaveDay->setEnabled(Liveinbool);
	LeaveEdit->setEnabled(Liveinbool);
	Modify->setEnabled(false);
	Check_out->setEnabled(Liveinbool);
	Submit->setEnabled(Leavebool);
	
	connect(Submit, SIGNAL(clicked()), this, SLOT(SubmitButton()));
	connect(Modify, SIGNAL(clicked()), this, SLOT(ModifyButton()));
	connect(Check_out, SIGNAL(clicked()), this, SLOT(CheckoutButton()));
	connect(Cancel, SIGNAL(clicked()), this, SLOT(CancelButton()));	
	
	mainlayout->addWidget(Name,0,0,1,1);
    mainlayout->addWidget(Contact,0,2,1,1);
    mainlayout->addWidget(ID,1,0,1,1);
    mainlayout->addWidget(Days,2,0,1,1);
    mainlayout->addWidget(Despoit,2,2,1,1);
    mainlayout->addWidget(RoomNum,3,0,1,1);
    mainlayout->addWidget(Price,3,2,1,1);
    mainlayout->addWidget(Livein,4,0,1,1);
    
	mainlayout->addWidget(NameEdit,0,1,1,1);
	mainlayout->addWidget(ContactEdit,0,3,1,1);
	mainlayout->addWidget(IDEdit,1,1,1,3);
	mainlayout->addWidget(DaysEdit,2,1,1,1);
	mainlayout->addWidget(DespoitEdit,2,3,1,1);
	mainlayout->addWidget(RoomNumEdit,3,1,1,1);
	mainlayout->addWidget(PriceEdit,3,3,1,1);
	mainlayout->addWidget(LiveinEdit,4,1,1,1);
	mainlayout->addWidget(LeaveDay,4,2,1,1);	
	mainlayout->addWidget(LeaveEdit,4,3,1,1);
	
	buttonlayout->addWidget(Submit,0,0,1,1);
	buttonlayout->addWidget(Modify,0,1,1,1);
	buttonlayout->addWidget(Check_out,0,2,1,1);
	buttonlayout->addWidget(Cancel,0,3,1,1);

	QVBoxLayout *Layout = new QVBoxLayout;
	Layout->addLayout(mainlayout);
	Layout->addLayout(buttonlayout);
	setLayout(Layout);
//	setWindow(200,300,400,500);
	setWindowTitle("Record");
	
}
コード例 #24
0
void
QvisDatabaseCorrelationWindow::CreateWidgets(
    const DatabaseCorrelation &correlation)
{
    QWidget *central = new QWidget(this);
    setCentralWidget(central);

    QVBoxLayout *topLayout = new QVBoxLayout(central);
    topLayout->setMargin(10);
    topLayout->setSpacing(5);

    // Create the name line edit.
    QGridLayout *gLayout = new QGridLayout();
    topLayout->addLayout(gLayout);
    correlationNameLineEdit = new QLineEdit(central);
    correlationNameLineEdit->setText(correlation.GetName().c_str());
    correlationNameLineEdit->setEnabled(createMode);
    QLabel *nameLabel = new QLabel(tr("Name"), central);
    nameLabel->setEnabled(createMode);
    gLayout->addWidget(nameLabel, 0, 0);
    gLayout->addWidget(correlationNameLineEdit, 0, 1);

    // Create the correlation method combobox.
    correlationMethodComboBox = new QComboBox(central);
    correlationMethodComboBox->addItem(tr("Padded index"));
    correlationMethodComboBox->addItem(tr("Stretched index"));
    correlationMethodComboBox->addItem(tr("Time"));
    correlationMethodComboBox->addItem(tr("Cycle"));
    int method = (int)correlation.GetMethod();
    correlationMethodComboBox->setCurrentIndex(method);
    gLayout->addWidget(correlationMethodComboBox, 1, 1);
    gLayout->addWidget(new QLabel(tr("Correlation method"), central), 1, 0);
    topLayout->addSpacing(10);

    // Create the widgets that let us add sources to the database correlation.
    QGridLayout *srcLayout = new QGridLayout();
    topLayout->addLayout(srcLayout);
    srcLayout->setSpacing(5);
    const int S[] = {1, 5, 1, 1, 5};
    int i;
    for(i = 0; i < 5; ++i)
        srcLayout->setRowStretch(i, S[i]);
    srcLayout->addWidget(new QLabel(tr("Sources"), central), 0, 0);
    srcLayout->addWidget(new QLabel(tr("Correlated sources"), central), 0, 2);

    //
    // Simplify the source names.
    //
    NameSimplifier simplifier;
    const stringVector &sources = GetViewerState()->GetGlobalAttributes()->GetSources();
    for(i = 0; i < sources.size(); ++i)
        simplifier.AddName(sources[i]);
    stringVector shortSources;
    simplifier.GetSimplifiedNames(shortSources);
    std::map<std::string, std::string> shortToLong, longToShort;
    for(i = 0; i < sources.size(); ++i)
    {
        shortToLong[shortSources[i]] = sources[i];
        longToShort[sources[i]] = shortSources[i];
    }

    // Create and populate the list of sources.
    sourcesListBox = new QListWidget(central);
    sourcesListBox->setSelectionMode(QAbstractItemView::MultiSelection);
    for(i = 0; i < sources.size(); ++i)
    {
        if(!correlation.UsesDatabase(sources[i]))
            sourcesListBox->addItem(shortSources[i].c_str());
    }
    if(sources.size() > 0)
        sourcesListBox->setCurrentItem(0);
    connect(sourcesListBox, SIGNAL(currentRowChanged(int)),
            this, SLOT(setAddButtonEnabled(int)));
    srcLayout->addWidget(sourcesListBox, 1, 0, 5, 1);

    // Create and populate the list of correlated sources.
    correlatedSourcesListBox = new QListWidget(central);
    correlatedSourcesListBox->setSelectionMode(QAbstractItemView::MultiSelection);
    const stringVector &dbs = correlation.GetDatabaseNames();
    for(i = 0; i < correlation.GetNumDatabases(); ++i)
        correlatedSourcesListBox->addItem(longToShort[dbs[i]].c_str());
    if(dbs.size() > 0)
        correlatedSourcesListBox->setCurrentRow(0);
    connect(correlatedSourcesListBox, SIGNAL(currentRowChanged(int)),
            this, SLOT(setRemoveButtonEnabled(int)));
    srcLayout->addWidget(correlatedSourcesListBox, 1, 2, 5, 1);

    // Create the add and remove buttons.
    addButton = new QPushButton("-->", central);
    connect(addButton, SIGNAL(clicked()),
            this, SLOT(addSources()));
    srcLayout->addWidget(addButton, 2, 1);

    removeButton = new QPushButton("<--", central);
    connect(removeButton, SIGNAL(clicked()),
            this, SLOT(removeSources()));
    srcLayout->addWidget(removeButton, 3, 1);

    UpdateAddRemoveButtonsEnabledState();

    // Add the action and cancel buttons.
    //topLayout->addSpacing(10);
    QHBoxLayout *actionButtonLayout = new QHBoxLayout();
    topLayout->addLayout(actionButtonLayout);
    QPushButton *actionButton = new QPushButton(
        createMode?tr("Create database correlation") : tr("Alter database correlation"), central);
    connect(actionButton, SIGNAL(clicked()),
            this, SLOT(actionClicked()));
    actionButtonLayout->addWidget(actionButton);
    actionButtonLayout->addStretch(10);
    QPushButton *cancelButton = new QPushButton(tr("Cancel"), central);
    connect(cancelButton, SIGNAL(clicked()),
            this, SLOT(cancelClicked()));
    actionButtonLayout->addWidget(cancelButton);
}
コード例 #25
0
void KIGPDialog::setupDirectoryPage(const QString& path) {
    QFrame *page = new QFrame();
    KPageWidgetItem *pageItem = new KPageWidgetItem( page, i18n("Folders") );
    pageItem->setHeader(i18n("Folders"));
    pageItem->setIcon(KIcon(BarIcon("folder", KIconLoader::SizeMedium )) );
    addPage(pageItem);

    KConfigGroup group =  m_config->group("Directory");
    QVBoxLayout *dvlay = new QVBoxLayout( page );
    dvlay->setMargin( 0 );

    QLabel *label;
    label = new QLabel(i18n("&Save to HTML file:"), page);
    dvlay->addWidget( label );
    QString whatsThis;
    whatsThis = i18n("<p>The name of the HTML file this gallery will be saved to.</p>");
    label->setWhatsThis( whatsThis );

    m_imageNameReq = new KUrlRequester(QString(path + "images.html"), page);
    label->setBuddy( m_imageNameReq );
    dvlay->addWidget(m_imageNameReq);
    connect( m_imageNameReq, SIGNAL(textChanged(const QString&)),
             this, SLOT(imageUrlChanged(const QString&)) );
    m_imageNameReq->setWhatsThis( whatsThis );

    const bool recurseSubDir = group.readEntry("RecurseSubDirectories", false);
    m_recurseSubDir = new QCheckBox(i18n("&Recurse subfolders"), page);
    m_recurseSubDir->setChecked( recurseSubDir );
    whatsThis = i18n("<p>Whether subfolders should be included for the "
                     "image gallery creation or not.</p>");
    m_recurseSubDir->setWhatsThis( whatsThis );

    const int recursionLevel = group.readEntry("RecursionLevel", 0);
    m_recursionLevel = new KIntNumInput( recursionLevel, page );
    m_recursionLevel->setRange( 0, 99, 1);
    m_recursionLevel->setSliderEnabled(true);
    m_recursionLevel->setLabel( i18n("Rec&ursion depth:") );
    if ( recursionLevel == 0 )
      m_recursionLevel->setSpecialValueText( i18n("Endless"));
    m_recursionLevel->setEnabled(recurseSubDir);
    whatsThis = i18n("<p>You can limit the number of folders the "
                     "image gallery creator will traverse to by setting an "
                     "upper bound for the recursion depth.</p>");
    m_recursionLevel->setWhatsThis( whatsThis );


    connect(m_recurseSubDir, SIGNAL( toggled(bool) ),
            m_recursionLevel, SLOT( setEnabled(bool) ) );

    dvlay->addWidget(m_recurseSubDir);
    dvlay->addWidget(m_recursionLevel);

    m_copyOriginalFiles = new QCheckBox(i18n("Copy or&iginal files"), page);
    m_copyOriginalFiles->setChecked(group.readEntry("CopyOriginalFiles", false) );
    dvlay->addWidget(m_copyOriginalFiles);
    whatsThis = i18n("<p>This makes a copy of all images and the gallery will refer "
                     "to these copies instead of the original images.</p>");
    m_copyOriginalFiles->setWhatsThis( whatsThis );


    const bool useCommentFile = group.readEntry("UseCommentFile", false);
    m_useCommentFile = new QCheckBox(i18n("Use &comment file"), page);
    m_useCommentFile->setChecked(useCommentFile);
    dvlay->addWidget(m_useCommentFile);

    whatsThis = i18n("<p>If you enable this option you can specify "
                     "a comment file which will be used for generating "
                     "subtitles for the images.</p>"
                     "<p>For details about the file format please see "
                     "the \"What's This?\" help below.</p>");
    m_useCommentFile->setWhatsThis( whatsThis );

    label = new QLabel(i18n("Comments &file:"), page);
    label->setEnabled( useCommentFile );
    dvlay->addWidget( label );
    whatsThis = i18n("<p>You can specify the name of the comment file here. "
                     "The comment file contains the subtitles for the images. "
                     "The format of this file is:</p>"
                     "<p>FILENAME1:"
                     "<br />Description"
                     "<br />"
                     "<br />FILENAME2:"
                     "<br />Description"
                     "<br />"
                     "<br />and so on</p>");
    label->setWhatsThis( whatsThis );

    m_commentFileReq = new KUrlRequester(QString(path + "comments"), page);
    m_commentFileReq->setEnabled(useCommentFile);
    label->setBuddy( m_commentFileReq );
    dvlay->addWidget(m_commentFileReq);
    m_commentFileReq->setWhatsThis( whatsThis );

    connect(m_useCommentFile, SIGNAL(toggled(bool)),
            label, SLOT(setEnabled(bool)));
    connect(m_useCommentFile, SIGNAL(toggled(bool)),
            m_commentFileReq, SLOT(setEnabled(bool)));

    dvlay->addStretch(1);
}
コード例 #26
0
ファイル: edit_cast.cpp プロジェクト: WMTH/rivendell
EditCast::EditCast(unsigned cast_id,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  QString sql;
  RDSqlQuery *q;
  RDSqlQuery *q1;
  int ypos=0;

  cast_cast=new RDPodcast(cast_id);
  cast_feed=new RDFeed(cast_cast->feedId());
  cast_status=cast_cast->status();
  setCaption(tr("Editing PodCast"));

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);
  QFont select_font=QFont("Helvetica",12,QFont::Normal);
  select_font.setPixelSize(12);

  //
  // Item Media Link
  //
  cast_item_medialink_edit=new QLineEdit(this,"cast_item_medialink_edit");
  cast_item_medialink_edit->setGeometry(115,10,sizeHint().width()-125,20);
  cast_item_medialink_edit->setReadOnly(true);
  QLabel *cast_item_medialink_label=
    new QLabel(cast_item_medialink_edit,tr("Media Link:"),this,
	       "cast_item_medialink_label");
  cast_item_medialink_label->setGeometry(20,10,90,20);
  cast_item_medialink_label->setFont(font);
  cast_item_medialink_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  if(cast_feed->mediaLinkMode()==RDFeed::LinkNone) {
    cast_item_medialink_edit->hide();
    cast_item_medialink_label->hide();
    ypos=10;
  }
  else {
    ypos=42;
  }

  //
  // Item Title
  //
  cast_item_title_edit=new QLineEdit(this,"cast_item_title_edit");
  cast_item_title_edit->setGeometry(115,ypos,sizeHint().width()-125,20);
  cast_item_title_edit->setMaxLength(255);
  QLabel *cast_item_title_label=
    new QLabel(cast_item_title_edit,tr("Title:"),this,
	       "cast_item_title_label");
  cast_item_title_label->setGeometry(20,ypos,90,20);
  cast_item_title_label->setFont(font);
  cast_item_title_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Author
  //
  cast_item_author_edit=new QLineEdit(this,"cast_item_author_edit");
  cast_item_author_edit->setGeometry(115,ypos+22,sizeHint().width()-125,20);
  cast_item_author_edit->setMaxLength(255);
  QLabel *cast_item_author_label=
    new QLabel(cast_item_author_edit,tr("Author E-Mail:"),this,
	       "cast_item_author_label");
  cast_item_author_label->setGeometry(20,ypos+22,90,20);
  cast_item_author_label->setFont(font);
  cast_item_author_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Category
  //
  cast_item_category_edit=new QLineEdit(this,"cast_item_category_edit");
  cast_item_category_edit->setGeometry(115,ypos+44,sizeHint().width()-125,20);
  cast_item_category_edit->setMaxLength(64);
  QLabel *cast_item_category_label=
    new QLabel(cast_item_category_edit,tr("Category:"),this,
	       "cast_item_category_label");
  cast_item_category_label->setGeometry(20,ypos+44,90,20);
  cast_item_category_label->setFont(font);
  cast_item_category_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Link
  //
  cast_item_link_edit=new QLineEdit(this,"cast_item_link_edit");
  cast_item_link_edit->setGeometry(115,ypos+66,sizeHint().width()-125,20);
  cast_item_link_edit->setMaxLength(255);
  QLabel *cast_item_link_label=
    new QLabel(cast_item_link_edit,tr("Link URL:"),this,
	       "cast_item_link_label");
  cast_item_link_label->setGeometry(20,ypos+66,90,20);
  cast_item_link_label->setFont(font);
  cast_item_link_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Description
  //
  cast_item_description_edit=
    new QTextEdit(this,"cast_item_description_edit");
  cast_item_description_edit->
    setGeometry(115,ypos+88,sizeHint().width()-125,76);
  QLabel *cast_item_description_label=
    new QLabel(cast_item_description_edit,tr("Description:"),this,
	       "cast_item_description_label");
  cast_item_description_label->setGeometry(20,ypos+88,90,20);
  cast_item_description_label->setFont(font);
  cast_item_description_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Source Text
  //
  cast_item_sourcetext_edit=new QLineEdit(this,"cast_item_sourcetext_edit");
  cast_item_sourcetext_edit->setGeometry(115,ypos+169,sizeHint().width()-125,20);
  cast_item_sourcetext_edit->setMaxLength(64);
  QLabel *cast_item_sourcetext_label=
    new QLabel(cast_item_sourcetext_edit,tr("Source Text:"),this,
	       "cast_item_sourcetext_label");
  cast_item_sourcetext_label->setGeometry(20,ypos+169,90,20);
  cast_item_sourcetext_label->setFont(font);
  cast_item_sourcetext_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Source URL
  //
  cast_item_sourceurl_edit=new QLineEdit(this,"cast_item_sourceurl_edit");
  cast_item_sourceurl_edit->setGeometry(115,ypos+191,sizeHint().width()-125,20);
  cast_item_sourceurl_edit->setMaxLength(64);
  QLabel *cast_item_sourceurl_label=
    new QLabel(cast_item_sourceurl_edit,tr("Source URL:"),this,
	       "cast_item_sourceurl_label");
  cast_item_sourceurl_label->setGeometry(20,ypos+191,90,20);
  cast_item_sourceurl_label->setFont(font);
  cast_item_sourceurl_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Comments
  //
  cast_item_comments_edit=new QLineEdit(this,"cast_item_comments_edit");
  cast_item_comments_edit->setGeometry(115,ypos+213,sizeHint().width()-125,20);
  cast_item_comments_edit->setMaxLength(64);
  QLabel *cast_item_comments_label=
    new QLabel(cast_item_comments_edit,tr("Comments URL:"),this,
	       "cast_item_comments_label");
  cast_item_comments_label->setGeometry(10,ypos+213,100,20);
  cast_item_comments_label->setFont(font);
  cast_item_comments_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Auxiliary Fields
  //
  cast_ypos=233+ypos;
  QString keyname=cast_cast->keyName();
  keyname.replace(" ","_");
  QLabel *label;
  sql=QString().sprintf("select VAR_NAME,CAPTION from AUX_METADATA \
                         where FEED_ID=%u order by VAR_NAME",
			cast_cast->feedId());
  q=new RDSqlQuery(sql);
  while(q->next()) {
    cast_aux_varnames.push_back(q->value(0).toString().
				mid(1,q->value(0).toString().length()-2));
    cast_aux_edits.push_back(new QLineEdit(this));
    cast_aux_edits.back()->
      setGeometry(115,cast_ypos,sizeHint().width()-125,20);
    cast_aux_edits.back()->setMaxLength(255);
    sql=QString().sprintf("select %s from %s_FIELDS where CAST_ID=%u",
			  (const char *)cast_aux_varnames.back(),
			  (const char *)keyname,cast_cast->id());
    q1=new RDSqlQuery(sql);
    if(q1->first()) {
      cast_aux_edits.back()->setText(q1->value(0).toString());
    }
    delete q1;
    label=new QLabel(cast_aux_edits.back(),q->value(1).toString()+":",this);
    label->setGeometry(20,cast_ypos,90,20);
    label->setFont(font);
    label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
    cast_ypos+=22;
  }
  delete q;
  cast_ypos+=3;

  //
  // Effective DateTime
  //
  cast_item_effective_edit=new QDateTimeEdit(this);
  cast_item_effective_edit->
    setGeometry(115,cast_ypos,165,20);
  label=new QLabel(cast_item_effective_edit,tr("Air Date/Time:"),this,
		   "cast_item_effective_label");
  label->setGeometry(20,cast_ypos,90,20);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  QPushButton *button=new QPushButton(this,"cast_item_effective_button");
  button->setGeometry(290,cast_ypos-3,50,25);
  button->setFont(select_font);
  button->setText(tr("&Select"));
  connect(button,SIGNAL(clicked()),this,SLOT(effectiveSelectData()));
  cast_ypos+=22;

  //
  // Item Origin
  //
  cast_item_origin_edit=new QLineEdit(this,"cast_item_origin_edit");
  cast_item_origin_edit->setReadOnly(true);
  cast_item_origin_edit->setGeometry(115,cast_ypos,165,20);
  cast_item_origin_edit->setMaxLength(64);
  QLabel *cast_item_origin_label=
    new QLabel(cast_item_origin_edit,tr("Posted At:"),this,
	       "cast_item_origin_label");
  cast_item_origin_label->setGeometry(20,cast_ypos,90,20);
  cast_item_origin_label->setFont(font);
  cast_item_origin_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  cast_ypos+=22;

  //
  // Item Expiration
  //
  cast_item_expiration_box=new QComboBox(this,"cast_item_expiration_box");
  cast_item_expiration_box->setGeometry(115,cast_ypos,50,20);
  cast_item_expiration_box->insertItem(tr("No"));
  cast_item_expiration_box->insertItem(tr("Yes"));
  connect(cast_item_expiration_box,SIGNAL(activated(int)),
	  this,SLOT(expirationSelectedData(int)));
  label=new QLabel(cast_item_expiration_box,tr("Cast Expires:"),this,"label");
  label->setGeometry(20,cast_ypos,90,20);
  label->setFont(font);
  label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  cast_ypos+=22;
  cast_item_expiration_box->setEnabled(cast_status!=RDPodcast::StatusExpired);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);

  cast_item_expiration_edit=new QDateEdit(this);
  cast_item_expiration_edit->setGeometry(115,cast_ypos,95,20);
  cast_item_expiration_label=
    new QLabel(cast_item_expiration_edit,tr("Expires On:"),this,
	       "cast_item_expiration_label");
  cast_item_expiration_label->setGeometry(20,cast_ypos,90,20);
  cast_item_expiration_label->setFont(font);
  cast_item_expiration_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  cast_item_expiration_button=
    new QPushButton(this,"cast_item_expiration_button");
  cast_item_expiration_button->setGeometry(220,cast_ypos-3,50,25);
  cast_item_expiration_button->setFont(select_font);
  cast_item_expiration_button->setText(tr("&Select"));
  connect(cast_item_expiration_button,SIGNAL(clicked()),
	  this,SLOT(expirationSelectData()));
  cast_ypos+=27;
  cast_item_expiration_edit->setEnabled(cast_status!=RDPodcast::StatusExpired);
  cast_item_expiration_label->
    setEnabled(cast_status!=RDPodcast::StatusExpired);
  cast_item_expiration_button->
    setEnabled(cast_status!=RDPodcast::StatusExpired);

  //
  // Cast Status
  //
  cast_item_status_group=new QButtonGroup(this,"cast_item_status_group");
  cast_item_status_group->setExclusive(true);
  cast_item_status_group->hide();

  QRadioButton *rbutton=new QRadioButton(this,"hold_button");
  rbutton->setGeometry(120,cast_ypos,15,15);
  cast_item_status_group->insert(rbutton);
  label=new QLabel(rbutton,tr("Hold"),this,"hold_label");
  label->setFont(select_font);
  label->setGeometry(140,cast_ypos,30,15);
  label->setAlignment(AlignVCenter|AlignLeft);
  rbutton->setChecked(true);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);
  rbutton->setEnabled(cast_status!=RDPodcast::StatusExpired);

  rbutton=new QRadioButton(this,"active_button");
  rbutton->setGeometry(190,cast_ypos,15,15);
  cast_item_status_group->insert(rbutton);
  label=new QLabel(rbutton,tr("Active"),this,"hold_label");
  label->setFont(select_font);
  label->setGeometry(210,cast_ypos,80,15);
  label->setAlignment(AlignVCenter|AlignLeft);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);
  label=new QLabel(cast_item_status_group,tr("Posting Status:"),this,
		   "cast_item_status_label");
  label->setGeometry(20,cast_ypos-1,90,20);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);
  rbutton->setEnabled(cast_status!=RDPodcast::StatusExpired);

  //
  //  Report Button
  //
  button=new QPushButton(this,"button");
  button->setGeometry(10,sizeHint().height()-60,80,50);
  button->setFont(font);
  button->setText(tr("Episode\n&Report"));
  connect(button,SIGNAL(clicked()),this,SLOT(reportData()));

  //
  //  Ok Button
  //
  button=new QPushButton(this,"button");
  button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  button->setDefault(true);
  button->setFont(font);
  button->setText(tr("&OK"));
  connect(button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  button=new QPushButton(this,"button");
  button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  button->setFont(font);
  button->setText(tr("&Cancel"));
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Populate Values
  //
  cast_item_medialink_edit->
    setText(cast_feed->audioUrl(cast_feed->mediaLinkMode(),
				"[web-hostname]",cast_cast->id()));
  cast_item_title_edit->setText(cast_cast->itemTitle());
  cast_item_author_edit->setText(cast_cast->itemAuthor());
  cast_item_origin_edit->setText(RDUtcToLocal(cast_cast->originDateTime()).
				 toString("MM/dd/yyyy - hh:mm:ss"));
  cast_item_category_edit->setText(cast_cast->itemCategory());
  cast_item_link_edit->setText(cast_cast->itemLink());
  cast_item_sourcetext_edit->setText(cast_cast->itemSourceText());
  cast_item_sourceurl_edit->setText(cast_cast->itemSourceUrl());
  cast_item_description_edit->setText(cast_cast->itemDescription());
  cast_item_comments_edit->setText(cast_cast->itemComments());
  cast_item_effective_edit->
    setDateTime(RDUtcToLocal(cast_cast->effectiveDateTime()));
  if(cast_cast->shelfLife()>0) {
    cast_item_expiration_box->setCurrentItem(1);
  }
  cast_item_expiration_edit->
    setDate(RDUtcToLocal(cast_cast->originDateTime()).date().
	    addDays(cast_cast->shelfLife()));
  expirationSelectedData(cast_item_expiration_box->currentItem());
  switch(cast_status) {
      case RDPodcast::StatusActive:
	cast_item_status_group->setButton(1);
	break;

      case RDPodcast::StatusPending:
	cast_item_status_group->setButton(0);
	break;

    case RDPodcast::StatusExpired:
      cast_item_status_group->setDisabled(true);
      break;
  }

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());
}
コード例 #27
0
MailingListFolderPropertiesDialog::MailingListFolderPropertiesDialog(QWidget *parent, KMFolder *folder)
    : KDialogBase(parent, "mailinglist_properties", false, i18n("Mailinglist Folder Properties"),
                  KDialogBase::Ok | KDialogBase::Cancel,
                  KDialogBase::Ok, true),
      mFolder(folder)
{
    setWFlags(getWFlags() | WDestructiveClose);
    QLabel *label;
    mLastItem = 0;

    QVBoxLayout *topLayout = new QVBoxLayout(layout(), spacingHint(),
            "topLayout");

    QGroupBox *mlGroup = new QGroupBox(i18n("Associated Mailing List"), this);
    mlGroup->setColumnLayout(0,  Qt::Vertical);
    QGridLayout *groupLayout = new QGridLayout(mlGroup->layout(), 6, 3, spacingHint());
    topLayout->addWidget(mlGroup);
    setMainWidget(mlGroup);

    mHoldsMailingList = new QCheckBox(i18n("&Folder holds a mailing list"), mlGroup);
    QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)),
                     SLOT(slotHoldsML(bool)));
    groupLayout->addMultiCellWidget(mHoldsMailingList, 0, 0, 0, 2);

    groupLayout->addItem(new QSpacerItem(0, 10), 1, 0);

    mDetectButton = new QPushButton(i18n("Detect Automatically"), mlGroup);
    mDetectButton->setEnabled(false);
    QObject::connect(mDetectButton, SIGNAL(pressed()), SLOT(slotDetectMailingList()));
    groupLayout->addWidget(mDetectButton, 2, 1);

    groupLayout->addItem(new QSpacerItem(0, 10), 3, 0);

    label = new QLabel(i18n("Mailing list description:"), mlGroup);
    label->setEnabled(false);
    QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)),
                     label, SLOT(setEnabled(bool)));
    groupLayout->addWidget(label, 4, 0);
    mMLId = new QLabel(label, "", mlGroup);
    groupLayout->addMultiCellWidget(mMLId, 4, 4, 1, 2);
    mMLId->setEnabled(false);

    //FIXME: add QWhatsThis
    label = new QLabel(i18n("Preferred handler:"), mlGroup);
    label->setEnabled(false);
    QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)),
                     label, SLOT(setEnabled(bool)));
    groupLayout->addWidget(label, 5, 0);
    mMLHandlerCombo = new QComboBox(mlGroup);
    mMLHandlerCombo->insertItem(i18n("KMail"), MailingList::KMail);
    mMLHandlerCombo->insertItem(i18n("Browser"), MailingList::Browser);
    mMLHandlerCombo->setEnabled(false);
    groupLayout->addMultiCellWidget(mMLHandlerCombo, 5, 5, 1, 2);
    QObject::connect(mMLHandlerCombo, SIGNAL(activated(int)),
                     SLOT(slotMLHandling(int)));
    label->setBuddy(mMLHandlerCombo);

    label = new QLabel(i18n("&Address type:"), mlGroup);
    label->setEnabled(false);
    QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)),
                     label, SLOT(setEnabled(bool)));
    groupLayout->addWidget(label, 6, 0);
    mAddressCombo = new QComboBox(mlGroup);
    label->setBuddy(mAddressCombo);
    groupLayout->addWidget(mAddressCombo, 6, 1);
    mAddressCombo->setEnabled(false);

    //FIXME: if the mailing list actions have either KAction's or toolbar buttons
    //       associated with them - remove this button since it's really silly
    //       here
    QPushButton *handleButton = new QPushButton(i18n("Invoke Handler"), mlGroup);
    handleButton->setEnabled(false);
    if(mFolder)
    {
        QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)),
                         handleButton, SLOT(setEnabled(bool)));
        QObject::connect(handleButton, SIGNAL(clicked()),
                         SLOT(slotInvokeHandler()));
    }
    groupLayout->addWidget(handleButton, 6, 2);

    mEditList = new KEditListBox(mlGroup);
    mEditList->setEnabled(false);
    groupLayout->addMultiCellWidget(mEditList, 7, 7, 0, 3);

    QStringList el;

    //Order is important because the activate handler and fillMLFromWidgets
    //depend on it
    el << i18n("Post to List")
       << i18n("Subscribe to List")
       << i18n("Unsubscribe from List")
       << i18n("List Archives")
       << i18n("List Help");
    mAddressCombo->insertStringList(el);
    QObject::connect(mAddressCombo, SIGNAL(activated(int)),
                     SLOT(slotAddressChanged(int)));

    load();
    resize(QSize(295, 204).expandedTo(minimumSizeHint()));
    clearWState(WState_Polished);
}
コード例 #28
0
ファイル: OptionsView.cpp プロジェクト: wzssyqa/opticks-cmake
OptionsView::OptionsView() :
   QWidget(NULL)
{
   // Initial Size
   mpFixedSizeRadio = new QRadioButton("Fixed Size", this);
   mpMaximizedRadio = new QRadioButton("Maximized", this);
   mpPercentageRadio = new QRadioButton("Percentage:", this);
   QButtonGroup* pInitialSizeGroup = new QButtonGroup(this);
   pInitialSizeGroup->addButton(mpFixedSizeRadio);
   pInitialSizeGroup->addButton(mpMaximizedRadio);
   pInitialSizeGroup->addButton(mpPercentageRadio);

   QLabel* pWidthLabel = new QLabel("Width:", this);
   mpWidthSpin = new QSpinBox(this);
   mpWidthSpin->setRange(1, numeric_limits<int>::max());
   mpWidthSpin->setSuffix(" Pixel(s)");

   QLabel* pHeightLabel = new QLabel("Height:", this);
   mpHeightSpin = new QSpinBox(this);
   mpHeightSpin->setRange(1, numeric_limits<int>::max());
   mpHeightSpin->setSuffix(" Pixel(s)");

   mpPercentageSpin = new QSpinBox(this);
   mpPercentageSpin->setRange(0, 100);
   mpPercentageSpin->setSuffix("%");

   QHBoxLayout* pPercentageLayout = new QHBoxLayout();
   pPercentageLayout->addWidget(mpPercentageRadio);
   pPercentageLayout->addWidget(mpPercentageSpin);
   pPercentageLayout->addStretch(10);

   QWidget* pInitialSizeWidget = new QWidget(this);
   QGridLayout* pInitialSizeLayout = new QGridLayout(pInitialSizeWidget);
   pInitialSizeLayout->setMargin(0);
   pInitialSizeLayout->setSpacing(5);
   pInitialSizeLayout->addWidget(mpFixedSizeRadio, 0, 0, 1, 3);
   pInitialSizeLayout->addWidget(pWidthLabel, 1, 1);
   pInitialSizeLayout->addWidget(mpWidthSpin, 1, 2);
   pInitialSizeLayout->addWidget(pHeightLabel, 2, 1);
   pInitialSizeLayout->addWidget(mpHeightSpin, 2, 2);
   pInitialSizeLayout->addWidget(mpMaximizedRadio, 3, 0, 1, 3);
   pInitialSizeLayout->addLayout(pPercentageLayout, 4, 0, 1, 4);
   pInitialSizeLayout->setColumnStretch(3, 10);
   pInitialSizeLayout->setColumnMinimumWidth(0, 10);
   LabeledSection* pInitialSizeSection = new LabeledSection(pInitialSizeWidget, "Default Size", this);

   // Initial Zoom
   mpZoomToFitRadio = new QRadioButton("Zoom To Fit", this);
   mpZoomPercentRadio = new QRadioButton("Percentage:", this);
   mpZoomPercentSpin = new QSpinBox(this);
   mpZoomPercentSpin->setRange(0, numeric_limits<int>::max());
   mpZoomPercentSpin->setSuffix("%");
   QButtonGroup* pInitialZoomGroup = new QButtonGroup(this);
   pInitialZoomGroup->addButton(mpZoomToFitRadio);
   pInitialZoomGroup->addButton(mpZoomPercentRadio);

   QWidget* pInitialZoomWidget = new QWidget(this);
   QGridLayout* pInitialZoomLayout = new QGridLayout(pInitialZoomWidget);
   pInitialZoomLayout->setMargin(0);
   pInitialZoomLayout->setSpacing(5);
   pInitialZoomLayout->addWidget(mpZoomToFitRadio, 0, 0, 1, 3);
   pInitialZoomLayout->addWidget(mpZoomPercentRadio, 1, 0);
   pInitialZoomLayout->addWidget(mpZoomPercentSpin, 1, 1);
   pInitialZoomLayout->setColumnStretch(2, 10);
   LabeledSection* pInitialZoomSection = new LabeledSection(pInitialZoomWidget, "Default Zoom", this);

   // Copy Snapshot
   mpResolutionWidget = new ResolutionWidget();
   LabeledSection* pResolutionSection = new LabeledSection(mpResolutionWidget, "Copy Snapshot", this);
   mpResolutionWidget->setAspectRatioLock(View::getSettingAspectRatioLock());
   mpResolutionWidget->setResolution(View::getSettingOutputWidth(), View::getSettingOutputHeight());
   mpResolutionWidget->setUseViewResolution(View::getSettingUseViewResolution());

   // Other Initial Options
   QLabel* pBackgroundLabel = new QLabel("Background Color:", this);
   mpBackgroundColor = new CustomColorButton(this);
   mpBackgroundColor->usePopupGrid(true);

   QLabel* pOriginLabel = new QLabel("Origin Location:", this);
   mpOriginCombo = new QComboBox(this);
   mpOriginCombo->setEditable(false);
   mpOriginCombo->addItem("Lower Left");
   mpOriginCombo->addItem("Upper Left");

   mpConfirmClose = new QCheckBox("Confirm Close", this);

   QWidget* pOtherOptWidget = new QWidget(this);
   QGridLayout* pOtherOptLayout = new QGridLayout(pOtherOptWidget);
   pOtherOptLayout->setMargin(0);
   pOtherOptLayout->setSpacing(5);
   pOtherOptLayout->addWidget(pBackgroundLabel, 0, 0);
   pOtherOptLayout->addWidget(mpBackgroundColor, 0, 1, Qt::AlignLeft);
   pOtherOptLayout->addWidget(pOriginLabel, 1, 0);
   pOtherOptLayout->addWidget(mpOriginCombo, 1, 1, Qt::AlignLeft);
   pOtherOptLayout->addWidget(mpConfirmClose, 2, 0, 1, 2);
   pOtherOptLayout->setColumnStretch(1, 10);
   LabeledSection* pOtherOptSection = new LabeledSection(pOtherOptWidget, "Other Default Properties", this);
   
   // Dialog layout
   QVBoxLayout* pLayout = new QVBoxLayout(this);
   pLayout->setMargin(0);
   pLayout->setSpacing(10);
   pLayout->addWidget(pInitialSizeSection);
   pLayout->addWidget(pInitialZoomSection);
   pLayout->addWidget(pResolutionSection);
   pLayout->addWidget(pOtherOptSection);
   pLayout->addStretch(10);

   //Connections
   connect(mpZoomPercentRadio, SIGNAL(toggled(bool)), mpZoomPercentSpin, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), pHeightLabel, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), mpHeightSpin, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), pWidthLabel, SLOT(setEnabled(bool)));
   connect(mpFixedSizeRadio, SIGNAL(toggled(bool)), mpWidthSpin, SLOT(setEnabled(bool)));
   connect(mpPercentageRadio, SIGNAL(toggled(bool)), mpPercentageSpin, SLOT(setEnabled(bool)));

   // Initialize From Settings
   WindowSizeType sizeType = WorkspaceWindow::getSettingWindowSize();
   mpHeightSpin->setValue(WorkspaceWindow::getSettingWindowHeight());
   mpWidthSpin->setValue(WorkspaceWindow::getSettingWindowWidth());
   mpPercentageSpin->setValue(WorkspaceWindow::getSettingWindowPercentage());

   mpFixedSizeRadio->setChecked(sizeType == FIXED_SIZE);
   mpMaximizedRadio->setChecked(sizeType == MAXIMIZED);
   mpPercentageRadio->setChecked(sizeType == WORKSPACE_PERCENTAGE);
   pHeightLabel->setEnabled(sizeType == FIXED_SIZE);
   mpHeightSpin->setEnabled(sizeType == FIXED_SIZE);
   pWidthLabel->setEnabled(sizeType == FIXED_SIZE);
   mpWidthSpin->setEnabled(sizeType == FIXED_SIZE);
   mpPercentageSpin->setEnabled(sizeType == WORKSPACE_PERCENTAGE);

   unsigned int zoomPercentage = PerspectiveView::getSettingZoomPercentage();
   if (zoomPercentage == 0)
   {
      mpZoomToFitRadio->setChecked(true);
      mpZoomPercentSpin->setEnabled(false);
      mpZoomPercentSpin->setValue(100);
   }
   else
   {
      mpZoomPercentRadio->setChecked(true);
      mpZoomPercentSpin->setEnabled(true);
      mpZoomPercentSpin->setValue(zoomPercentage);
   }

   DataOrigin origin = View::getSettingDataOrigin();
   if (origin == LOWER_LEFT)
   {
      mpOriginCombo->setCurrentIndex(0);
   }
   else if (origin == UPPER_LEFT)
   {
      mpOriginCombo->setCurrentIndex(1);
   }

   mpBackgroundColor->setColor(View::getSettingBackgroundColor());
   mpConfirmClose->setChecked(WorkspaceWindow::getSettingConfirmClose());
}
コード例 #29
0
PropertyTimelineWidget::PropertyTimelineWidget(std::string name, PropertyTimeline* propertyTimeline, QWidget* parent)
        : QWidget(parent)
        , propertyTimeline_(propertyTimeline)
        , inInterpolationMenu_(0)
        , outInterpolationMenu_(0)
        {
    guiName_ = name;
    id_ = name;
    mainLayout_ = new QHBoxLayout(this);

    mainLayout_->setMargin(0);
    mainLayout_->setSpacing(0);
    currentFrameGraphicsItem_ = new CurrentFrameGraphicsItem(false, false);

    smoothItem_ = new QGraphicsEllipseItem(0, 0, 8, 8);
    smoothItem_->setBrush(QBrush(QColor(50,255,50)));
    smoothItem_->moveBy(10, -7);
    smoothItem_->setCursor(Qt::ArrowCursor);
    smoothTextItem_ = new QGraphicsSimpleTextItem("smoothness");
    smoothTextItem_->moveBy(22, -10);
    smoothGroup_ = new QGraphicsItemGroup();
    smoothGroup_->addToGroup(smoothItem_);
    smoothGroup_->addToGroup(smoothTextItem_);
    smoothGroup_->hide();
    smoothGroup_->setZValue(5);
    propertyTimelineScene_ = new QGraphicsScene(this);

    propertyTimelineView_ = new PropertyTimelineView(propertyTimelineScene_);
    propertyTimelineView_->setStyleSheet("background:transparent");
    propertyTimelineView_->setFixedHeight(40);
    connect(propertyTimelineView_, SIGNAL(mousePressedAt(QPointF, const QGraphicsItem*)), this, SLOT(interpolationSelectorPressed(QPointF, const QGraphicsItem*)));

    inInterpolationSelector_ = new QGraphicsPixmapItem(QPixmap(":/qt/icons/1leftarrow.png"));
    outInterpolationSelector_ = new QGraphicsPixmapItem(QPixmap(":/qt/icons/1rightarrow.png"));
    inInterpolationSelector_->setCursor(Qt::ArrowCursor);
    outInterpolationSelector_->setCursor(Qt::ArrowCursor);

    inInterpolationSelector_->setMatrix(QMatrix(0.5, 0, 0, 0.5, 1, 1), true);
    outInterpolationSelector_->setMatrix(QMatrix(0.5, 0, 0, 0.5, 1, 1), true);

    propertyTimelineScene_->addItem(smoothGroup_);

    propertyTimelineScene_->addItem(inInterpolationSelector_);
    propertyTimelineScene_->addItem(outInterpolationSelector_);
    currentFrameCounter_ = propertyTimelineScene_->addText("0");
    inInterpolationSelector_->setPos(20, 20);
    outInterpolationSelector_->setPos(40, 20);
    inInterpolationSelector_->setZValue(2);
    outInterpolationSelector_->setZValue(2);

    activateTimelineButton_ = new QPushButton(QIcon(":/qt/icons/apply.png"), "", this);
    showFrameHUD(false);

    activateTimelineButton_->setToolTip(tr("Activate or deactivate timeline"));
    activateTimelineButton_->setStyleSheet("QToolButton { border: none; padding: 1px; }");
    activateTimelineButton_->setFlat(true);
    activateTimelineButton_->setFocusPolicy(Qt::NoFocus);
    activateTimelineButton_->setCheckable(true);
    activateTimelineButton_->setMaximumWidth(16);
    activateTimelineButton_->setMaximumHeight(16);
    activateTimelineButton_->setChecked(propertyTimeline->getActiveOnRendering());

    // note: this is duplicated in activateTimeline() below
    if (!propertyTimeline->getActiveOnRendering())
        activateTimelineButton_->setIcon(QIcon(":/qt/icons/button_cancel.png"));
    else
        activateTimelineButton_->setIcon(QIcon(":/qt/icons/apply.png"));


    connect(activateTimelineButton_, SIGNAL(toggled(bool)), this, SLOT(activateTimeline(bool)));

    setFps(30.0f);

    mainLayout_->addWidget(propertyTimelineView_);
    mainLayout_->addWidget(activateTimelineButton_);
    QLabel* nameLabel = new QLabel(this);
    nameLabel->move(8, 18);
    nameLabel->lower();
    nameLabel->setText(QString::fromStdString(name));
    nameLabel->setMinimumWidth(300);
    nameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    nameLabel->setEnabled(false);
    setCurrentFrame(0);
    propertyTimelineScene_->addItem(currentFrameGraphicsItem_);

    inInterpolationSelector_->show();
    outInterpolationSelector_->show();
    showFrameHUD(false);
    currentFrameGraphicsItem_->setPos(0, 1);
    currentFrameGraphicsItem_->setZValue(0.5);
    fps_ = 30.0f;
    setDuration(AnimationEditor::getDuration());
}
コード例 #30
0
void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
{
    // draws:
    //                   AccountName
    // Checkbox | Icon |              | ConnectionIcon | ConnectionState
    //                   errorMessage

    if (!index.isValid()) {
        return;
    }

    Q_ASSERT(widgets.size() == 6);

    // Get the widgets
    QCheckBox* checkbox = qobject_cast<QCheckBox*>(widgets.at(0));
    ChangeIconButton* changeIconButton = qobject_cast<ChangeIconButton*>(widgets.at(1));
    QLabel *statusTextLabel = qobject_cast<QLabel*>(widgets.at(2));
    QLabel *statusIconLabel = qobject_cast<QLabel*>(widgets.at(3));
    EditDisplayNameButton *displayNameButton = qobject_cast<EditDisplayNameButton*>(widgets.at(4));
    QLabel *connectionErrorLabel = qobject_cast<QLabel*>(widgets.at(5));

    Q_ASSERT(checkbox);
    Q_ASSERT(changeIconButton);
    Q_ASSERT(statusTextLabel);
    Q_ASSERT(statusIconLabel);
    Q_ASSERT(displayNameButton);
    Q_ASSERT(connectionErrorLabel);


    bool isSelected(itemView()->selectionModel()->isSelected(index) && itemView()->hasFocus());
    bool isEnabled(index.data(KTp::AccountsListModel::EnabledRole).toBool());
    KIcon accountIcon(index.data(Qt::DecorationRole).value<QIcon>());
    KIcon statusIcon(index.data(KTp::AccountsListModel::ConnectionStateIconRole).value<QIcon>());
    QString statusText(index.data(KTp::AccountsListModel::ConnectionStateDisplayRole).toString());
    QString displayName(index.data(Qt::DisplayRole).toString());
    QString connectionError(index.data(KTp::AccountsListModel::ConnectionErrorMessageDisplayRole).toString());
    Tp::AccountPtr account(index.data(KTp::AccountsListModel::AccountRole).value<Tp::AccountPtr>());

    if (!account->isEnabled()) {
      connectionError = i18n("Click checkbox to enable");
    }

    QRect outerRect(0, 0, option.rect.width(), option.rect.height());
    QRect contentRect = outerRect.adjusted(m_hpadding,m_vpadding,-m_hpadding,-m_vpadding); //add some padding


    // checkbox
    if (isEnabled) {
        checkbox->setChecked(true);;
        checkbox->setToolTip(i18n("Disable account"));
    } else {
        checkbox->setChecked(false);
        checkbox->setToolTip(i18n("Enable account"));
    }

    int checkboxLeftMargin = contentRect.left();
    int checkboxTopMargin = (outerRect.height() - checkbox->height()) / 2;
    checkbox->move(checkboxLeftMargin, checkboxTopMargin);


    // changeIconButton
    changeIconButton->setIcon(accountIcon);
    changeIconButton->setAccount(account);
    // At the moment (KDE 4.8.1) decorationSize is not passed from KWidgetItemDelegate
    // through the QStyleOptionViewItem, therefore we leave default size unless
    // the user has a more recent version.
    if (option.decorationSize.width() > -1) {
        changeIconButton->setButtonIconSize(option.decorationSize.width());
    }

    int changeIconButtonLeftMargin = checkboxLeftMargin + checkbox->width();
    int changeIconButtonTopMargin = (outerRect.height() - changeIconButton->height()) / 2;
    changeIconButton->move(changeIconButtonLeftMargin, changeIconButtonTopMargin);


    // statusTextLabel
    QFont statusTextFont = option.font;
    QPalette statusTextLabelPalette = option.palette;
    if (isEnabled) {
        statusTextLabel->setEnabled(true);
        statusTextFont.setItalic(false);
    } else {
        statusTextLabel->setDisabled(true);
        statusTextFont.setItalic(true);
    }
    if (isSelected) {
        statusTextLabelPalette.setColor(QPalette::Text, statusTextLabelPalette.color(QPalette::Active, QPalette::HighlightedText));
    }
    statusTextLabel->setPalette(statusTextLabelPalette);
    statusTextLabel->setFont(statusTextFont);
    statusTextLabel->setText(statusText);
    statusTextLabel->setFixedSize(statusTextLabel->fontMetrics().boundingRect(statusText).width(),
                                  statusTextLabel->height());
    int statusTextLabelLeftMargin = contentRect.right() - statusTextLabel->width();
    int statusTextLabelTopMargin = (outerRect.height() - statusTextLabel->height()) / 2;
    statusTextLabel->move(statusTextLabelLeftMargin, statusTextLabelTopMargin);


    // statusIconLabel
    statusIconLabel->setPixmap(statusIcon.pixmap(KIconLoader::SizeSmall));
    statusIconLabel->setFixedSize(statusIconLabel->minimumSizeHint());
    int statusIconLabelLeftMargin = contentRect.right() - statusTextLabel->width() - statusIconLabel->width() - 6;
    int statusIconLabelTopMargin = (outerRect.height() - statusIconLabel->height()) / 2;
    statusIconLabel->move(statusIconLabelLeftMargin, statusIconLabelTopMargin);


    QRect innerRect = contentRect.adjusted(changeIconButton->geometry().right() - contentRect.left(),
                                           0,
                                           -statusTextLabel->width() - statusIconLabel->width() - 6,
                                           0); // rect containing account name and error message


    // displayNameButton
    QFont displayNameButtonFont = option.font;
    QPalette displayNameButtonPalette = option.palette;
    if (isEnabled) {
        displayNameButtonPalette.setColor(QPalette::WindowText, displayNameButtonPalette.color(QPalette::Active, QPalette::Text));
        displayNameButtonFont.setBold(true);
    } else {
        displayNameButtonFont.setItalic(true);
        // NOTE: Flat QPushButton use WindowText instead of ButtonText for button text color
        displayNameButtonPalette.setColor(QPalette::WindowText, displayNameButtonPalette.color(QPalette::Disabled, QPalette::Text));
    }
    if (isSelected) {
        // Account is selected
        displayNameButtonPalette.setColor(QPalette::WindowText, displayNameButtonPalette.color(QPalette::Active, QPalette::HighlightedText));
    }
    displayNameButton->setFont(displayNameButtonFont);
    displayNameButton->setPalette(displayNameButtonPalette);

    QString displayNameButtonText = displayNameButton->fontMetrics().elidedText(displayName,
                                                                                Qt::ElideRight,
                                                                                innerRect.width() - (m_hpadding*2));
    displayNameButton->setText(displayNameButtonText);
    displayNameButton->setFixedSize(displayNameButton->fontMetrics().boundingRect(displayNameButtonText).width() + (m_hpadding*2),
                                    displayNameButton->minimumSizeHint().height());
    displayNameButton->setAccount(account);

    int displayNameButtonLeftMargin = innerRect.left();
    int displayNameButtonTopMargin = innerRect.top();
    displayNameButton->move(displayNameButtonLeftMargin, displayNameButtonTopMargin);


    // connectionErrorLabel
    QFont connectionErrorLabelFont = option.font;
    QPalette connectionErrorLabelPalette = option.palette;
    if (isEnabled) {
        connectionErrorLabelPalette.setColor(QPalette::WindowText, connectionErrorLabelPalette.color(QPalette::Active, QPalette::Text));
    } else {
        connectionErrorLabelFont.setItalic(true);
        connectionErrorLabelPalette.setColor(QPalette::Text, connectionErrorLabelPalette.color(QPalette::Disabled, QPalette::Text));
    }
    if (isSelected) {
        // Account is selected
        connectionErrorLabelPalette.setColor(QPalette::Text, connectionErrorLabelPalette.color(QPalette::Active, QPalette::HighlightedText));
    }
    connectionErrorLabel->setFont(connectionErrorLabelFont);
    connectionErrorLabel->setPalette(connectionErrorLabelPalette);

    QString connectionErrorLabelText = connectionErrorLabel->fontMetrics().elidedText(connectionError,
                                                                                      Qt::ElideRight,
                                                                                      innerRect.width() - (m_hpadding*2));
    connectionErrorLabel->setText(connectionErrorLabelText);
    connectionErrorLabel->setFixedSize(connectionErrorLabel->fontMetrics().boundingRect(connectionErrorLabelText).width(),
                                       displayNameButton->height());

    int connectionErrorLabelLeftMargin = innerRect.left() + m_hpadding;
    int connectionErrorLabelTopMargin = contentRect.bottom() - displayNameButton->height();
    connectionErrorLabel->move(connectionErrorLabelLeftMargin, connectionErrorLabelTopMargin);
}