示例#1
0
void RightWidget::constructInfoGroup()
{
    QGroupBox *infoGroupBox = new QGroupBox("Information :");
    infoGroupBox->setLayout(new QVBoxLayout());
    QComboBox *nodeComboBox = new QComboBox();
    for(int id:mcTalker->getNodeIDList())
    {
        nodeComboBox->addItem(
                             QString::number(id).append(" | ").append(
                             QString::fromStdString(
                             mcTalker->getNodeNameFromId(
                             id
                             ))));
    }
    nodeComboBox->setCurrentIndex(-1);
    labelName = new QLabel("Name : ");
    labelAltitude = new QLabel("Elevation : ");
    connect(nodeComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(setInfoName(int)));
    connect(nodeComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(setInfoAltitude(int)));

    infoGroupBox->layout()->addWidget(nodeComboBox);
    infoGroupBox->layout()->addWidget(labelName);
    infoGroupBox->layout()->addWidget(labelAltitude);

    layout->addWidget(infoGroupBox);
}
示例#2
0
void npc_text_view::setView(int id)
{
    setLayout(new QVBoxLayout{});
    std::multimap<int,std::tuple<float,QString,QString>> * l_map = m_dbcache->get_npc_text_resource();
    // loop through all the texts and present with probability
    for(auto it = l_map->lower_bound(id); it != l_map->upper_bound(id); ++it)
    {
        float   p = std::get<0>((*it).second);
        QString t0 = std::get<1>((*it).second);
        QString t1 = std::get<2>((*it).second);
        int a = (t0.length()!=0) + (t1.length()!=0)*2;
        int c = (t0.length()!=0) + (t1.length()!=0);
        QGroupBox * box = new QGroupBox(QString::number(p*100) + QString("%"));
        box->setLayout(new QHBoxLayout{});
        layout()->addWidget(box);
        switch(c)
        {
        case 1: // Present only one of the texts
        {
            QLabel * label = new QLabel{};
            label->setMaximumWidth(400);
            label->setWordWrap(true);
            label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
            box->layout()->addWidget(label);
            if(a==1) // t0 isnt empty
            {
                label->setText(t0);
            }
            if(a==2) // t1 isnt empty
            {
                label->setText(t1);
            }
            label->setAlignment(Qt::AlignCenter);
            break;
        }
        case 2: // Present both of the texts
        {
            QLabel * label0 = new QLabel{t0};
            label0->setMaximumWidth(400);
            label0->setWordWrap(true);
            QLabel * labelOR = new QLabel{" or "};
            labelOR->setMaximumWidth(20);
            QLabel * label1 = new QLabel{t1};
            label1->setMaximumWidth(400);
            label1->setWordWrap(true);
            label0->setFrameStyle(QFrame::Panel | QFrame::Sunken);
            label1->setFrameStyle(QFrame::Panel | QFrame::Sunken);
            box->layout()->addWidget(label0);
            box->layout()->addWidget(labelOR);
            box->layout()->addWidget(label1);
            break;
        }
        default:
            break;
        }
    }
}
示例#3
0
InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl )
        : QDialog( parent, name, modal, fl )
{
    setCaption( tr( "Options" ) );

    QVBoxLayout *layout = new QVBoxLayout( this );
    layout->setMargin( 2 );
    layout->setSpacing( 4 );

    QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Options" ), this );
    grpbox->layout()->setSpacing( 2 );
    grpbox->layout()->setMargin( 4 );
    layout->addWidget( grpbox );

    QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );

    forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox );
    grplayout->addWidget( forceDepends );

    forceReinstall = new QCheckBox( tr( "Force Reinstall" ), grpbox );
    grplayout->addWidget( forceReinstall );

    forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox );
    grplayout->addWidget( forceRemove );

    forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox );
    grplayout->addWidget( forceOverwrite );

    QLabel *l = new QLabel( tr( "Information Level" ), grpbox );
    grplayout->addWidget( l );

    verboseIpkg = new QComboBox( grpbox );
    verboseIpkg->insertItem( tr( "Errors only" ) );
    verboseIpkg->insertItem( tr( "Normal messages" ) );
    verboseIpkg->insertItem( tr( "Informative messages" ) );
    verboseIpkg->insertItem( tr( "Troubleshooting output" ) );
    verboseIpkg->setCurrentItem( verb );
    grplayout->addWidget( verboseIpkg );

    grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );

    if ( flags & FORCE_DEPENDS )
        forceDepends->setChecked( true );
    if ( flags & FORCE_REINSTALL )
        forceReinstall->setChecked( true );
    if ( flags & FORCE_REMOVE )
        forceRemove->setChecked( true );
    if ( flags & FORCE_OVERWRITE )
        forceOverwrite->setChecked( true );
    //    if ( flags & VERBOSE_WGET )
    //    	verboseWget->setChecked( true );
    //    if ( flags & MAKE_LINKS )
    //    	makeLinks->setChecked( true );

    QPEApplication::showDialog( this );

}
示例#4
0
void QgsDualView::modifySort()
{
  if ( !mLayer )
    return;

  QgsAttributeTableConfig config = mConfig;

  QDialog orderByDlg;
  orderByDlg.setWindowTitle( tr( "Configure Attribute Table Sort Order" ) );
  QDialogButtonBox *dialogButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
  QGridLayout *layout = new QGridLayout();
  connect( dialogButtonBox, &QDialogButtonBox::accepted, &orderByDlg, &QDialog::accept );
  connect( dialogButtonBox, &QDialogButtonBox::rejected, &orderByDlg, &QDialog::reject );
  orderByDlg.setLayout( layout );

  QGroupBox *sortingGroupBox = new QGroupBox();
  sortingGroupBox->setTitle( tr( "Defined sort order in attribute table" ) );
  sortingGroupBox->setCheckable( true );
  sortingGroupBox->setChecked( !sortExpression().isEmpty() );
  layout->addWidget( sortingGroupBox );
  sortingGroupBox->setLayout( new QGridLayout() );

  QgsExpressionBuilderWidget *expressionBuilder = new QgsExpressionBuilderWidget();
  QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) );
  expressionBuilder->setExpressionContext( context );
  expressionBuilder->setLayer( mLayer );
  expressionBuilder->loadFieldNames();
  expressionBuilder->loadRecent( QStringLiteral( "generic" ) );
  expressionBuilder->setExpressionText( sortExpression().isEmpty() ? mLayer->displayExpression() : sortExpression() );

  sortingGroupBox->layout()->addWidget( expressionBuilder );

  QCheckBox *cbxSortAscending = new QCheckBox( tr( "Sort ascending" ) );
  cbxSortAscending->setChecked( config.sortOrder() == Qt::AscendingOrder );
  sortingGroupBox->layout()->addWidget( cbxSortAscending );

  layout->addWidget( dialogButtonBox );
  if ( orderByDlg.exec() )
  {
    Qt::SortOrder sortOrder = cbxSortAscending->isChecked() ? Qt::AscendingOrder : Qt::DescendingOrder;
    if ( sortingGroupBox->isChecked() )
    {
      setSortExpression( expressionBuilder->expressionText(), sortOrder );
      config.setSortExpression( expressionBuilder->expressionText() );
      config.setSortOrder( sortOrder );
    }
    else
    {
      setSortExpression( QString(), sortOrder );
      config.setSortExpression( QString() );
    }

    setAttributeTableConfig( config );
  }
}
示例#5
0
LifeFormWidget::LifeFormWidget(QWidget *parent) :
    QWidget(parent)
{
    QVBoxLayout * layout = new QVBoxLayout;
    QGroupBox * groupBox = new QGroupBox;
    mAgeSpinBox = new QSpinBox;
    mNameEdit = new QLineEdit;
    mXSpinBox = new QSpinBox;
    mYSpinBox = new QSpinBox;

    setWindowIcon(QIcon(":rabbit"));
    groupBox->setTitle("Properties");

    mNameEdit->setPlaceholderText("Name");
    mAgeSpinBox->setPrefix("age: ");
    mXSpinBox->setPrefix("x: ");
    mYSpinBox->setPrefix("y: ");

    mGenomView = new GenomView;
    QWidget * coordWidget = new QWidget;
    coordWidget->setLayout(new QHBoxLayout);
    coordWidget->layout()->setMargin(0);
    coordWidget->layout()->addWidget(mXSpinBox);
    coordWidget->layout()->addWidget(mYSpinBox);

    layout->addWidget( mNameEdit);
    layout->addWidget( mAgeSpinBox);
    layout->addWidget( coordWidget);

    groupBox->setLayout(layout);
    groupBox->layout()->setContentsMargins(0,10,0,0);

    QGroupBox * genomGroupBox = new QGroupBox;
    genomGroupBox->setTitle("Genom");
    genomGroupBox->setLayout(new QVBoxLayout);
    genomGroupBox->layout()->addWidget(mGenomView);
    genomGroupBox->layout()->setMargin(0);


    QVBoxLayout * mainLayout = new QVBoxLayout;
    mainLayout->setSpacing(10);
    mainLayout->addWidget(groupBox);
    mainLayout->addWidget(genomGroupBox);
    mainLayout->setContentsMargins(0,0,0,0);

    setLayout(mainLayout);


}
示例#6
0
NamePartWidget::NamePartWidget( const QString &title, const QString &label,
                                QWidget *parent, const char *name )
  : QWidget( parent, name ), mTitle( title ), mLabel( label )
{
  QHBoxLayout *layout = new QHBoxLayout( this );

  QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this );
  QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2,
                                              KDialog::spacingHint() );

  mBox = new QListBox( group );
  connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ),
           SLOT( selectionChanged( QListBoxItem* ) ) );
  groupLayout->addWidget( mBox, 0, 0 );

  KButtonBox *bbox = new KButtonBox( group, Qt::Vertical );
  mAddButton = bbox->addButton( i18n( "Add..." ), this,  SLOT( add() ) );
  mEditButton = bbox->addButton( i18n( "Edit..." ), this,  SLOT( edit() ) );
  mEditButton->setEnabled( false );
  mRemoveButton = bbox->addButton( i18n( "Remove" ), this,  SLOT( remove() ) );
  mRemoveButton->setEnabled( false );
  bbox->layout();
  groupLayout->addWidget( bbox, 0, 1 );

  layout->addWidget( group );
}
/*protected*/ void ReporterItemPanel::makeDndIconPanel(QHash<QString, NamedIcon*>* /*iconMap*/, QString /*displayKey*/)
{
 if (_update)
 {
  return;
 }
 _reporter = new ReporterIcon(_editor);
 QGroupBox*  panel = new QGroupBox();
 QString borderName = tr("Drag to Panel");
 QString     gbStyleSheet = "QGroupBox { border: 2px solid gray; border-radius: 3px;} QGroupBox::title { /*background-color: transparent;*/  subcontrol-position: top left; /* position at the top left*/  padding:0 0px;} ";
 panel->setLayout(new QHBoxLayout);
 panel->setTitle(borderName);
 panel->setStyleSheet(gbStyleSheet);
 QWidget*  comp;
 DataFlavor* flavor;
 try {
     //comp = getDragger(flavor = new DataFlavor(Editor::POSITIONABLE_FLAVOR));
     comp = getDragger(flavor = new DataFlavor(_reporter,"ReporterIcon"));
     flavor->setMimeTypeParameter("reporter", _reporter->getName());
     comp->setToolTip(tr("Drag an icon from this panel to add it to the control panel"));
 } catch (ClassNotFoundException cnfe) {
     //cnfe.printStackTrace();
     comp = new QWidget();
 }
 comp->setLayout(new FlowLayout);
 comp->layout()->addWidget(_reporter);
 panel->layout()->addWidget(comp);
 //panel.validate();
 int width = qMax(100, panel->sizeHint().width());
 panel->setMinimumSize( QSize(width, panel->minimumSize().height()));
 panel->setToolTip(tr("Drag an icon from this panel to add it to the control panel"));
 _dragIconPanel->layout()->addWidget( panel);
 _dragIconPanel->setToolTip(tr("Drag an icon from this panel to add it to the control panel"));
}
示例#8
0
void RightWidget::constructOptionGroup()
{
    QGroupBox *optionGroupBox = new QGroupBox("Graph Visualiser Option :");
    optionGroupBox->setLayout(new QVBoxLayout());
    QCheckBox *checkShowName = new QCheckBox("Show the name of the path");
    connect(checkShowName,SIGNAL(stateChanged(int)),mcTalker->graphWidget,SLOT(setStateOfShowableNameForEdges(int)));
    optionGroupBox->layout()->addWidget(checkShowName);
    QCheckBox *checkShowDist =new QCheckBox("Show the distance of the path");
    connect(checkShowDist,SIGNAL(stateChanged(int)),mcTalker->graphWidget,SLOT(setStateOfShowableDistanceForEdges(int)));
    optionGroupBox->layout()->addWidget(checkShowDist);
    QCheckBox *checkShowTime =new QCheckBox("Show the time of the path");
    connect(checkShowTime,SIGNAL(stateChanged(int)),mcTalker->graphWidget,SLOT(setStateOfShowableTimeForEdges(int)));
    optionGroupBox->layout()->addWidget(checkShowTime);

    layout->addWidget(optionGroupBox);
}
示例#9
0
AdvancedWidget::AdvancedWidget( QWidget *parent )
    : QWidget(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    QGroupBox *groupBox = new QGroupBox(i18n("D&isable Actions for Windows of Type WM_CLASS"), this);
    groupBox->setLayout(new QVBoxLayout(groupBox));

    editListBox = new KEditListWidget(groupBox);

    editListBox->setButtons(KEditListWidget::Add | KEditListWidget::Remove);
    editListBox->setCheckAtEntering(true);

    editListBox->setWhatsThis(i18n("<qt>This lets you specify windows in which Klipper should "
                                   "not invoke \"actions\". Use<br /><br />"
                                   "<center><b>xprop | grep WM_CLASS</b></center><br />"
                                   "in a terminal to find out the WM_CLASS of a window. "
                                   "Next, click on the window you want to examine. The "
                                   "first string it outputs after the equal sign is the one "
                                   "you need to enter here.</qt>"));
    groupBox->layout()->addWidget(editListBox);

    mainLayout->addWidget(groupBox);

    editListBox->setFocus();
}
KCMKTECollaborative::KCMKTECollaborative(QWidget* parent, const QVariantList& args)
    : KCModule(KteCollaborativePluginFactory::componentData(), parent, args)
{
    kDebug() << "creating kte_collaborative kcmodule";
    // Set up config groups
    KConfig* config = new KConfig("ktecollaborative");
    m_colorsGroup = config->group("colors");
    m_notifyGroup = config->group("notifications");
    m_applicationsGroup = config->group("applications");

    // Create notifications group box
    QGroupBox* notificationsGroupBox = new QGroupBox();
    notificationsGroupBox->setTitle(i18n("Highlights and Notifications"));
    QVBoxLayout* notificationsLayout = new QVBoxLayout();
    notificationsGroupBox->setLayout(notificationsLayout);
    m_highlightBackground = new QCheckBox(i18n("Display popup widgets"));
    m_displayWidgets = new QCheckBox(i18n("Colorize text background"));
    m_displayTextHints = new QCheckBox(i18n("Display text tooltips"));
    notificationsLayout->addWidget(m_displayWidgets);
    notificationsLayout->addWidget(m_highlightBackground);
    notificationsLayout->addWidget(m_displayTextHints);

    // Create colors group box
    QGroupBox* colorsGroupBox = new QGroupBox();
    colorsGroupBox->setTitle(i18n("Colors"));
    QFormLayout* colorsLayout = new QFormLayout();
    colorsGroupBox->setLayout(colorsLayout);
    m_saturationSilder = new QSlider(Qt::Horizontal);
    m_saturationSilder->setRange(30, 255);
    colorsLayout->addRow(i18n("Highlight saturation"), m_saturationSilder);

    // Create default application group box
    QGroupBox* defaultApplicationBox = new QGroupBox();
    defaultApplicationBox->setTitle(i18n("Default application"));
    defaultApplicationBox->setLayout(new QHBoxLayout);
    m_selectEditorWidget = new SelectEditorWidget(m_applicationsGroup.readEntry("editor"));
    defaultApplicationBox->layout()->addWidget(m_selectEditorWidget);

    // Assemble the UI
    setLayout(new QVBoxLayout());
    KMessageWidget* message = new KMessageWidget(i18n("Some changes might only be applied for newly opened documents."));
    message->setMessageType(KMessageWidget::Information);
    message->setCloseButtonVisible(false);
    layout()->addWidget(message);
    layout()->addWidget(notificationsGroupBox);
    layout()->addWidget(colorsGroupBox);
    layout()->addWidget(defaultApplicationBox);
    // Add a spacer to top-align the widgets
    layout()->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding));

    // Set up connections for changed signals
    connect(m_saturationSilder, SIGNAL(sliderMoved(int)), SLOT(changed()));
    connect(m_highlightBackground, SIGNAL(toggled(bool)), SLOT(changed()));
    connect(m_displayWidgets, SIGNAL(toggled(bool)), SLOT(changed()));
    connect(m_displayTextHints, SIGNAL(toggled(bool)), SLOT(changed()));
    connect(m_selectEditorWidget, SIGNAL(selectionChanged()), SLOT(changed()));
}
示例#11
0
void MainForm::initPresets()
{
    for (int i = 0; i < ViewerCore::get()->getPresetList()->length(); i++)
    {
        PresetButton* newPresetButton = new PresetButton(ViewerCore::get()->getPresetList()->at(i));
        QGroupBox* tmpGrpBox = this->findChild<QGroupBox*>(ViewerCore::get()->getPresetList()->at(i)->getGroupBoxName());
        if (!tmpGrpBox)
        {
            ERROR_MSG("Cannot find groupbox \"" + ViewerCore::get()->getPresetList()->at(i)->getGroupBoxName() + "\"");
            continue;
        }
        if (!tmpGrpBox->layout())
        {
            ERROR_MSG("Groupbox \"" + ViewerCore::get()->getPresetList()->at(i)->getGroupBoxName() + "\" has no layout");
            continue;
        }
        tmpGrpBox->layout()->addWidget(newPresetButton);
    }
}
示例#12
0
    void TerrainWeightEditor::InitializeCanvases()
    {
        QGroupBox* group = editor_widget_->findChild<QGroupBox*>("weight_group");
        if(!group)
            return;

        QGridLayout* layout = dynamic_cast<QGridLayout*>(group->layout());
        if(!layout)
            return;

        TerrainLabel* label1 = new TerrainLabel(this);
        label1->setObjectName("canvas_1");
        label1->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
        label1->setScaledContents(true);
        layout->addWidget(label1,0,0);

        TerrainLabel* label2 = new TerrainLabel(this);
        label2->setObjectName("canvas_2");
        label2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
        label2->setScaledContents(true);
        layout->addWidget(label2,0,1);

        TerrainLabel* label3 = new TerrainLabel(this);
        label3->setObjectName("canvas_3");
        label3->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
        label3->setScaledContents(true);
        layout->addWidget(label3,2,0);

        TerrainLabel* label4 = new TerrainLabel(this);
        label4->setObjectName("canvas_4");
        label4->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
        label4->setScaledContents(true);
        layout->addWidget(label4,2,1);

        QLabel *canvas1 = editor_widget_->findChild<QLabel *>("canvas_1");
        QLabel *canvas2 = editor_widget_->findChild<QLabel *>("canvas_2");
        QLabel *canvas3 = editor_widget_->findChild<QLabel *>("canvas_3");
        QLabel *canvas4 = editor_widget_->findChild<QLabel *>("canvas_4");

        QLabel *brush_canvas = editor_widget_->findChild<QLabel *>("brush_label");
        
        assert(canvas1 && canvas2 && canvas3 && canvas4 && brush_canvas);
        QPixmap basic(1024,1024);
        basic.fill(Qt::black);

        canvas1->setPixmap(basic);
        canvas2->setPixmap(basic);
        canvas3->setPixmap(basic);
        canvas4->setPixmap(basic);

        QPixmap brush(256, 256);
        brush.fill(QColor(neutral_color_,neutral_color_,neutral_color_));
        brush_canvas->setPixmap(brush);
    }
示例#13
0
KMConfigFilter::KMConfigFilter(QWidget *parent, const char *name) : KMConfigPage(parent, name)
{
    setPageName(i18n("Filter"));
    setPageHeader(i18n("Printer Filtering Settings"));
    setPagePixmap("filter");

    QGroupBox *box = new QGroupBox(0, Qt::Vertical, i18n("Printer Filter"), this);

    m_list1 = new KListBox(box);
    m_list1->setSelectionMode(KListBox::Extended);
    m_list2 = new KListBox(box);
    m_list2->setSelectionMode(KListBox::Extended);
    m_add = new QToolButton(box);
    m_add->setIconSet(QApplication::reverseLayout() ? SmallIconSet("back") : SmallIconSet("forward"));
    m_remove = new QToolButton(box);
    m_remove->setIconSet(QApplication::reverseLayout() ? SmallIconSet("forward") : SmallIconSet("back"));
    m_locationre = new QLineEdit(box);
    QLabel *lab = new QLabel(box);
    lab->setText(
        i18n("The printer filtering allows you to view only a specific set of "
             "printers instead of all of them. This may be useful when there are a "
             "lot of printers available but you only use a few ones. Select the "
             "printers you want to see from the list on the left or enter a <b>Location</b> "
             "filter (ex: Group_1*). Both are cumulative and ignored if empty."));
    lab->setTextFormat(Qt::RichText);
    QLabel *lab1 = new QLabel(i18n("Location filter:"), box);

    QVBoxLayout *l0 = new QVBoxLayout(this, 0, KDialog::spacingHint());
    l0->addWidget(box, 1);
    QVBoxLayout *l1 = new QVBoxLayout(box->layout(), KDialog::spacingHint());
    l1->addWidget(lab);
    QGridLayout *l2 = new QGridLayout(0, 4, 3, 0, KDialog::spacingHint());
    l1->addLayout(l2);
    l2->setRowStretch(0, 1);
    l2->setRowStretch(3, 1);
    l2->setColStretch(0, 1);
    l2->setColStretch(2, 1);
    l2->addMultiCellWidget(m_list1, 0, 3, 0, 0);
    l2->addMultiCellWidget(m_list2, 0, 3, 2, 2);
    l2->addWidget(m_add, 1, 1);
    l2->addWidget(m_remove, 2, 1);
    QHBoxLayout *l3 = new QHBoxLayout(0, 0, KDialog::spacingHint());
    l1->addLayout(l3, 0);
    l3->addWidget(lab1, 0);
    l3->addWidget(m_locationre, 1);

    connect(m_add, SIGNAL(clicked()), SLOT(slotAddClicked()));
    connect(m_remove, SIGNAL(clicked()), SLOT(slotRemoveClicked()));
    connect(m_list1, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
    connect(m_list2, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
    m_add->setEnabled(false);
    m_remove->setEnabled(false);
}
示例#14
0
/**
*  Note caller must create _iconPanel before calling
*/
/*protected*/ void IconItemPanel::addIconsToPanel(QMap<QString, NamedIcon*>* iconMap)
{
 _iconPanel = new ImagePanel();
 _iconPanel->setLayout(new QHBoxLayout());
 //Iterator<Entry<QString, NamedIcon*>*> it = iconMap.entrySet().iterator();
 QMapIterator<QString, NamedIcon*> it(*iconMap);
 while (it.hasNext())
 {
  //Entry<String, NamedIcon> entry = it.next();
  it.next();
  NamedIcon* icon = new NamedIcon(it.value());    // make copy for possible reduction
  QGroupBox* panel = new QGroupBox();
  panel->setLayout(new QVBoxLayout());
  QString borderName = ItemPalette::convertText(it.key());
  //panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
  //                                                 borderName));
  QString     gbStyleSheet = "QGroupBox { border: 2px solid gray; border-radius: 3px;} QGroupBox::title { /*background-color: transparent;*/  subcontrol-position: top left; /* position at the top left*/  padding:0 0px;} ";

  panel->setTitle(borderName);
  panel->setStyleSheet(gbStyleSheet);
  try
  {
   IconDragJLabel* label = new IconDragJLabel(new DataFlavor(Editor::POSITIONABLE_FLAVOR), _level, this);
   label->setName(borderName);
   //panel->layout()->addWidget(label);
   if (icon->getIconWidth()<1 || icon->getIconHeight()<1)
   {
    label->setText(tr("invisibleIcon"));
//               label->setForeground(QColor(Qt::lightGray);
   }
   else
   {
    icon->reduceTo(50, 80, 0.2);
   }
   label->setIcon(icon);
   label->setAlignment(Qt::AlignCenter);
   label->setMargin(6);

   int width = qMax(100, panel->minimumSize().width());
   panel->setMinimumSize(QSize(width, panel->minimumSize().height()));
   ((QBoxLayout*)panel->layout())->addWidget(label,0, Qt::AlignCenter);

  } catch (ClassNotFoundException cnfe) {
           //cnfe.printStackTrace();
  }
  _iconPanel->layout()->addWidget(panel);
 }
 thisLayout->addWidget(_iconPanel/*, 1*/);
 //_iconPanel->addMouseListener(this);
}
示例#15
0
DateTimeDialog::DateTimeDialog(QWidget *parent) :
        QDialog(parent)
{
    QPalette pal = this->palette();
    pal.setColor(QPalette::Window, "#D0D0E7");

    setPalette(pal);

    setWindowTitle(QString::fromLocal8Bit("Změna času fotografií"));
    setLayout(new QVBoxLayout);

    QGroupBox *gBox = new QGroupBox;
    gBox->setLayout(new QVBoxLayout);
    rAll = new QRadioButton(tr("All pictures"));
    rAll->setChecked(true);
    rSelected = new QRadioButton(tr("Selected pictures"));
    gBox->setContentsMargins(QMargins(0,0,0,0));
    gBox->layout()->addWidget(rAll);
    gBox->layout()->addWidget(rSelected);

    QLabel *l = new QLabel;
    l->setAutoFillBackground(true);
    l->setBackgroundRole(QPalette::Light);
    l->setMaximumHeight(1);

    QDialogButtonBox *buttonBox = new QDialogButtonBox;//(QDialogButtonBox::Apply & QDialogButtonBox::Cancel);
    buttonBox->addButton(QDialogButtonBox::Cancel);
    buttonBox->addButton(QDialogButtonBox::Ok); //Apply

    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));


    this->layout()->addWidget(gBox);
    this->layout()->addWidget(l);
    this->layout()->addWidget(buttonBox);
}
示例#16
0
 //============================================================
void CAlgorithmSelector::setWorkflow(AWorkflow& workflow) {
    uint32_t steps = workflow.getStepCount();
    QPushButton* start = new QPushButton("Start", this);
    mStatus = new QStatusBar(start);
    mStatus->showMessage("Choose Images");
    mStartButton = start;
    start->setDisabled(true);
    connect(start, &QPushButton::clicked, this, &CAlgorithmSelector::startButtonPushed);

    if(mpWorkflow != nullptr)
    {
      disconnect(mpWorkflow, &AWorkflow::sigDataStoreFinished, this, &CAlgorithmSelector::onDataStoreFinished);
    }

    mpWorkflow = &workflow;

    connect(mpWorkflow, &AWorkflow::sigDataStoreFinished, this, &CAlgorithmSelector::onDataStoreFinished);

    QLayoutItem *child;
    while ((child = layout()->takeAt(0)) != 0) {
      if(child->widget())
      {
        delete child->widget();
      }
        delete child;
    }

    for (uint i = 0; i < steps; i++) {
        const QVector<IPlugin*> plugins = CPluginManager::Instance()->getPlugins(workflow.getAlgorithmType(i));

        QGroupBox* groupBox = new QGroupBox(workflow.getAlgorithmType(i), this);
        CStepComboBox* comboBox = new CStepComboBox(i, groupBox);
        for (IPlugin* p : plugins) {
            comboBox->addItem(p->Name(), QVariant::fromValue((void*)p));
        }
        groupBox->setLayout(new QVBoxLayout);
        groupBox->layout()->addWidget(comboBox);
        layout()->addWidget(groupBox);
        connect(comboBox,
                static_cast<void(CStepComboBox::*)(int)>(&CStepComboBox::currentIndexChanged), this,
                &CAlgorithmSelector::onCurrentIndexChanged);
        if (plugins.size() > 0) {
            workflow.trySetStep(i, plugins.at(0));
        }
    }

    layout()->addWidget(start);
    layout()->addWidget(mStatus);
}
示例#17
0
USBViewer::USBViewer(QWidget *parent, const char *name, const QStringList &) : KCModule(USBFactory::instance(), parent, name)
{
    setButtons(Help);

    setQuickHelp(
        i18n("<h1>USB Devices</h1> This module allows you to see"
             " the devices attached to your USB bus(es)."));

    QVBoxLayout *vbox = new QVBoxLayout(this, 0, KDialog::spacingHint());
    QGroupBox *gbox = new QGroupBox(i18n("USB Devices"), this);
    gbox->setColumnLayout(0, Qt::Horizontal);
    vbox->addWidget(gbox);

    QVBoxLayout *vvbox = new QVBoxLayout(gbox->layout(), KDialog::spacingHint());

    QSplitter *splitter = new QSplitter(gbox);
    vvbox->addWidget(splitter);

    _devices = new QListView(splitter);
    _devices->addColumn(i18n("Device"));
    _devices->setRootIsDecorated(true);
    _devices->header()->hide();
    _devices->setMinimumWidth(200);
    _devices->setColumnWidthMode(0, QListView::Maximum);

    QValueList< int > sizes;
    sizes.append(200);
    splitter->setSizes(sizes);

    _details = new QTextView(splitter);

    splitter->setResizeMode(_devices, QSplitter::KeepSize);

    QTimer *refreshTimer = new QTimer(this);
    // 1 sec seems to be a good compromise between latency and polling load.
    refreshTimer->start(1000);

    connect(refreshTimer, SIGNAL(timeout()), SLOT(refresh()));
    connect(_devices, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(selectionChanged(QListViewItem *)));

    KAboutData *about = new KAboutData(I18N_NOOP("kcmusb"), I18N_NOOP("KDE USB Viewer"), 0, 0, KAboutData::License_GPL,
                                       I18N_NOOP("(c) 2001 Matthias Hoelzer-Kluepfel"));

    about->addAuthor("Matthias Hoelzer-Kluepfel", 0, "*****@*****.**");
    about->addCredit("Leo Savernik", "Live Monitoring of USB Bus", "*****@*****.**");
    setAboutData(about);

    load();
}
XDSettingsWidget::XDSettingsWidget(XDSettings* settings, QWidget *parent, const char *name)
    : DebuggerTab(parent, name), m_settings(settings)
{

  QVBoxLayout *mainLayout = new QVBoxLayout(this, 16, 5);

  QHBoxLayout* jitbox = new QHBoxLayout(0, 1, 10);

  m_ckEnableJIT = new QCheckBox(this);
  m_ckEnableJIT->setText(i18n("Enable JIT"));
  jitbox->addWidget(m_ckEnableJIT);

  mainLayout->addLayout(jitbox);
  QHBoxLayout* portbox = new QHBoxLayout(0, 1, 10);

  QLabel* lblistenPort = new QLabel(this);
  lblistenPort->setText(i18n("Listen on port:"));
  portbox->addWidget(lblistenPort);

  m_spListenPort = new QSpinBox(this);
  m_spListenPort->setMaxValue(99999);
  portbox->addWidget(m_spListenPort);
  portbox->addItem(new QSpacerItem( 40, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ));

  mainLayout->addLayout(portbox);

  QGroupBox* groupbox = new QGroupBox(this);
  groupbox->setTitle(i18n("Options"));
  groupbox->setColumnLayout(0, Qt::Vertical );
  QVBoxLayout* groupboxLayout = new QVBoxLayout(groupbox->layout());
  groupboxLayout->setAlignment(Qt::AlignTop);

  QVBoxLayout* vbox = new QVBoxLayout(0, 3, 6);
  m_ckBreakOnLoad = new QCheckBox(groupbox);
  m_ckBreakOnLoad->setText(i18n("Break on load"));
  vbox->addWidget(m_ckBreakOnLoad);
  
    
  m_ckSendSuperGlobals = new QCheckBox(groupbox);
  m_ckSendSuperGlobals->setText(i18n("Send super global variables"));
  vbox->addWidget(m_ckSendSuperGlobals);

  groupboxLayout->addLayout(vbox);

  mainLayout->addWidget(groupbox);

  mainLayout->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
示例#19
0
void DeviceWizardOptions::protocolBox()
{
    QGroupBox *protoBox = new QGroupBox();
    protoBox->setTitle("Protocol");
    protoBox->setLayout(new QVBoxLayout());
    this->layout()->addWidget(protoBox);

    this->protoCombo = new QComboBox;
    this->protoCombo->addItem("Korad SCPI V2",
                              static_cast<int>(globcon::LPQ_PROTOCOL::KORADV2));
    this->protoCombo->setCurrentIndex(0);

    protoBox->layout()->addWidget(this->protoCombo);

    registerField("protocol", this->protoCombo);
    registerField("protocolText", this, "protocolName");
}
示例#20
0
文件: formbar.cpp 项目: mtao/DEC
FormBar::FormBar(QWidget * parent): QWidget(parent) {
    setLayout(new QVBoxLayout);
    QGroupBox * groupbox = new QGroupBox(tr("Form Selector"));
    layout()->addWidget(groupbox);

    groupbox->setLayout(new QVBoxLayout);
    m_treewidget = new QTreeWidget(this);
    groupbox->layout()->addWidget(m_treewidget);

    m_treewidget->setColumnCount(3);
    QStringList headers;
    headers << "Title" << "Dimension" << "Primality";
    m_treewidget->setHeaderLabels(headers);
    connect(m_treewidget, SIGNAL(itemSelectionChanged(void)),
            this, SLOT(itemSelectionChanged(void)));
    

}
示例#21
0
ImageBaseWidget::ImageBaseWidget(const QString &title,
                                 QWidget *parent, const char *name)
    : QWidget(parent, name), mReadOnly(false)
{
    mImageLoader = new ImageLoader(this);

    QVBoxLayout *topLayout = new QVBoxLayout(this, KDialog::marginHint(),
            KDialog::spacingHint());
    QGroupBox *box = new QGroupBox(0, Qt::Vertical, title, this);
    QVBoxLayout *layout = new QVBoxLayout(box->layout(), KDialog::spacingHint());

    mImageButton = new ImageButton(i18n("Picture"), box);
    mImageButton->setFixedSize(100, 140);
    mImageButton->setImageLoader(mImageLoader);
    layout->addWidget(mImageButton);

    topLayout->addWidget(box);

    connect(mImageButton, SIGNAL(changed()), SIGNAL(changed()));
}
示例#22
0
KWatchGnuPGConfig::KWatchGnuPGConfig(QWidget *parent, const char *name)
    : KDialogBase(Plain, i18n("Configure KWatchGnuPG"),
                  Ok | Cancel, Ok, parent, name)
{
    // tmp vars:
    QWidget *w;
    QGridLayout *glay;
    QGroupBox *group;

    QWidget *top = plainPage();

    QVBoxLayout *vlay = new QVBoxLayout(top, 0, spacingHint());

    group = new QVGroupBox(i18n("WatchGnuPG"), top);
    group->layout()->setSpacing(spacingHint());

    w = new QWidget(group);

    glay = new QGridLayout(w, 3, 2, 0, spacingHint());
    glay->setColStretch(1, 1);

    int row = -1;

    ++row;
    mExeED = new KURLRequester(w);
    glay->addWidget(new QLabel(mExeED, i18n("&Executable:"), w), row, 0);
    glay->addWidget(mExeED, row, 1);
    connect(mExeED, SIGNAL(textChanged(const QString &)), SLOT(slotChanged()));

    ++row;
    mSocketED = new KURLRequester(w);
    glay->addWidget(new QLabel(mSocketED, i18n("&Socket:"), w), row, 0);
    glay->addWidget(mSocketED, row, 1);
    connect(mSocketED, SIGNAL(textChanged(const QString &)), SLOT(slotChanged()));

    ++row;
    mLogLevelCB = new QComboBox(false, w);
    mLogLevelCB->insertItem(i18n("None"));
    mLogLevelCB->insertItem(i18n("Basic"));
    mLogLevelCB->insertItem(i18n("Advanced"));
    mLogLevelCB->insertItem(i18n("Expert"));
    mLogLevelCB->insertItem(i18n("Guru"));
    glay->addWidget(new QLabel(mLogLevelCB, i18n("Default &log level:"), w), row, 0);
    glay->addWidget(mLogLevelCB, row, 1);
    connect(mLogLevelCB, SIGNAL(activated(int)), SLOT(slotChanged()));

    vlay->addWidget(group);

    /******************* Log Window group *******************/
    group = new QVGroupBox(i18n("Log Window"), top);
    group->layout()->setSpacing(spacingHint());

    w = new QWidget(group);

    glay = new QGridLayout(w, 2, 3, 0, spacingHint());
    glay->setColStretch(1, 1);

    row = -1;

    ++row;
    mLoglenSB = new QSpinBox(0, 1000000, 100, w);
    mLoglenSB->setSuffix(i18n("history size spinbox suffix", " lines"));
    mLoglenSB->setSpecialValueText(i18n("unlimited"));
    glay->addWidget(new QLabel(mLoglenSB, i18n("&History size:"), w), row, 0);
    glay->addWidget(mLoglenSB, row, 1);
    QPushButton *button = new QPushButton(i18n("Set &Unlimited"), w);
    glay->addWidget(button, row, 2);

    connect(mLoglenSB, SIGNAL(valueChanged(int)), SLOT(slotChanged()));
    connect(button, SIGNAL(clicked()), SLOT(slotSetHistorySizeUnlimited()));

    ++row;
    mWordWrapCB = new QCheckBox(i18n("Enable &word wrapping"), w);
    mWordWrapCB->hide(); // QTextEdit doesn't support word wrapping in LogText mode
    glay->addMultiCellWidget(mWordWrapCB, row, row, 0, 2);

    connect(mWordWrapCB, SIGNAL(clicked()), SLOT(slotChanged()));

    vlay->addWidget(group);
    vlay->addStretch(1);

    connect(this, SIGNAL(applyClicked()), SLOT(slotSave()));
    connect(this, SIGNAL(okClicked()), SLOT(slotSave()));
}
示例#23
0
void gossip_menu_dialog::refreshScrollArea()
{
    QTreeWidgetItem * newitem = list->selectedItems().at(0);
    bool isMenu = newitem->data(1,Qt::UserRole).toBool();
    if(!isMenu)
    {
        return;
    }
    // First of all handle the button group that will be removed
    for(int i = 0; i < optionButtonGroup->buttons().length(); ++i)
    {
        // Note that the button itself is child of the widget that is replaced, it will get deleted that way
        optionButtonGroup->removeButton(optionButtonGroup->button(i));
    }

    QWidget * newwidget = new QWidget{};
    QVBoxLayout * newlayout = new QVBoxLayout{};
    newwidget->setLayout(newlayout);
    int menuid = newitem->data(2,Qt::UserRole).toInt();
    for(auto it = m_dbcache->get_gossip_menu_resource()->lower_bound(menuid); it != m_dbcache->get_gossip_menu_resource()->upper_bound(menuid); ++it)
    {
        // For every menu text, show the text and its condition
        int textid = std::get<0>((*it).second);
        int conditionid = std::get<2>((*it).second);
        conditionid = dbcache::find_ref(m_dbcache->get_condition_references(),conditionid);
        QString conditiontext;
        if(conditionid != -1)
        {
            conditiontext = m_dbcache->get_condition_resource()->at(conditionid);
        }
        else
        {
            conditiontext = "Always true";
        }
        QGroupBox * newgroupbox = new QGroupBox{conditiontext};
        newlayout->addWidget(newgroupbox);
        newgroupbox->setLayout(new QHBoxLayout());
        newgroupbox->layout()->addWidget(new npc_text_view{m_dbcache,textid});
    }

    for(int i = 0; i < newitem->childCount(); ++i)
    {
        QTreeWidgetItem * optionitem = newitem->child(i);
        QString text = optionitem->text(0);
        int conditionid = optionitem->data(4,Qt::UserRole).toInt();
        conditionid = dbcache::find_ref(m_dbcache->get_condition_references(),conditionid);
        QString conditiontext;
        if(conditionid != -1)
        {
            conditiontext = m_dbcache->get_condition_resource()->at(conditionid);
        }
        else
        {
            conditiontext = "None";
        }
        int action = optionitem->data(5,Qt::UserRole).toInt();
        QString actiontext;
        if(action==-1){actiontext = "Close";}
        else if(action==0){actiontext = "";}
        else if(action==1){actiontext = "Open submenu"; }
        int treedataindex = optionitem->data(6,Qt::UserRole).toInt();
        if(action==1)
        {
            optionTriggerData[i] = treedataindex;
        }
        else
        {
            optionTriggerData[i] = -1;
        }
        QPushButton * optionButton = new QPushButton{text};
        optionButtonGroup->addButton(optionButton,i);
        QFormLayout * buttonDisplayLayout = new QFormLayout{};
        buttonDisplayLayout->addRow(QString("Condition:"),new QLabel{conditiontext});
        buttonDisplayLayout->addRow(QString("Action:"),new QLabel{actiontext});
        buttonDisplayLayout->addRow(optionButton);
        newlayout->addLayout(buttonDisplayLayout);
    }

    rscroll->setWidget(newwidget);
}
void KIconDialog::KIconDialogPrivate::init()
{
    mGroupOrSize = KIconLoader::Desktop;
    mContext = KIconLoader::Any;
    mFileList = KGlobal::dirs()->findAllResources("appicon", QLatin1String("*.png"));

    QWidget *main = new QWidget(q);
    q->setMainWidget(main);

    QVBoxLayout *top = new QVBoxLayout(main);
    top->setMargin(0);

    QGroupBox *bgroup = new QGroupBox(main);
    bgroup->setTitle(i18n("Icon Source"));

    QVBoxLayout *vbox = new QVBoxLayout;
    bgroup->setLayout( vbox );
    top->addWidget(bgroup);

    QGridLayout *grid = new QGridLayout();
    grid->setSpacing(KDialog::spacingHint());
    bgroup->layout()->addItem(grid);

    mpSystemIcons = new QRadioButton(i18n("S&ystem icons:"), bgroup);
    connect(mpSystemIcons, SIGNAL(clicked()), q, SLOT(_k_slotSystemIconClicked()));
    grid->addWidget(mpSystemIcons, 1, 0);
    mpCombo = new QComboBox(bgroup);
    connect(mpCombo, SIGNAL(activated(int)), q, SLOT(_k_slotContext(int)));
    grid->addWidget(mpCombo, 1, 1);
    mpOtherIcons = new QRadioButton(i18n("O&ther icons:"), bgroup);
    connect(mpOtherIcons, SIGNAL(clicked()), q, SLOT(_k_slotOtherIconClicked()));
    grid->addWidget(mpOtherIcons, 2, 0);
    mpBrowseBut = new QPushButton(i18n("&Browse..."), bgroup);
    connect(mpBrowseBut, SIGNAL(clicked()), q, SLOT(_k_slotBrowse()));
    grid->addWidget(mpBrowseBut, 2, 1);

    //
    // ADD SEARCHLINE
    //
    QHBoxLayout *searchLayout = new QHBoxLayout();
    searchLayout->setMargin(0);
    searchLayout->setSpacing(KDialog::spacingHint());
    top->addLayout(searchLayout);

    QLabel *searchLabel = new QLabel(i18n("&Search:"), main);
    searchLayout->addWidget(searchLabel);

    searchLine = new KListWidgetSearchLine(main);
    searchLayout->addWidget(searchLine);
    searchLabel->setBuddy(searchLine);

    QString wtstr = i18n("Search interactively for icon names (e.g. folder).");
    searchLabel->setWhatsThis(wtstr);
    searchLine->setWhatsThis(wtstr);


    mpCanvas = new KIconCanvas(main);
    connect(mpCanvas, SIGNAL(itemActivated(QListWidgetItem *)), q, SLOT(_k_slotAcceptIcons()));
    mpCanvas->setMinimumSize(400, 125);
    top->addWidget(mpCanvas);
    searchLine->setListWidget(mpCanvas);

    mpProgress = new QProgressBar(main);
    top->addWidget(mpProgress);
    connect(mpCanvas, SIGNAL(startLoading(int)), q, SLOT(_k_slotStartLoading(int)));
    connect(mpCanvas, SIGNAL(progress(int)), q, SLOT(_k_slotProgress(int)));
    connect(mpCanvas, SIGNAL(finished()), q, SLOT(_k_slotFinished()));

    // When pressing Ok or Cancel, stop loading icons
    connect(q, SIGNAL(hidden()), mpCanvas, SLOT(stopLoading()));

    static const char* const context_text[] = {
        I18N_NOOP( "Actions" ),
        I18N_NOOP( "Animations" ),
        I18N_NOOP( "Applications" ),
        I18N_NOOP( "Categories" ),
        I18N_NOOP( "Devices" ),
        I18N_NOOP( "Emblems" ),
        I18N_NOOP( "Emotes" ),
        I18N_NOOP( "Filesystems" ),
        I18N_NOOP( "International" ),
        I18N_NOOP( "Mimetypes" ),
        I18N_NOOP( "Places" ),
        I18N_NOOP( "Status" ) };
    static const KIconLoader::Context context_id[] = {
        KIconLoader::Action,
        KIconLoader::Animation,
        KIconLoader::Application,
        KIconLoader::Category,
        KIconLoader::Device,
        KIconLoader::Emblem,
        KIconLoader::Emote,
        KIconLoader::FileSystem,
        KIconLoader::International,
        KIconLoader::MimeType,
        KIconLoader::Place,
        KIconLoader::StatusIcon };
    mNumContext = 0;
    int cnt = sizeof( context_text ) / sizeof( context_text[ 0 ] );
    // check all 3 arrays have same sizes
    Q_ASSERT( cnt == sizeof( context_id ) / sizeof( context_id[ 0 ] )
            && cnt == sizeof( mContextMap ) / sizeof( mContextMap[ 0 ] ));
    for( int i = 0;
         i < cnt;
         ++i )
    {
        if( mpLoader->hasContext( context_id[ i ] ))
        {
            mpCombo->addItem(i18n( context_text[ i ] ));
            mContextMap[ mNumContext++ ] = context_id[ i ];
        }
    }
    mpCombo->setFixedSize(mpCombo->sizeHint());

    mpBrowseBut->setFixedWidth(mpCombo->width());

    // Make the dialog a little taller
    q->incrementInitialSize(QSize(0,100));
    connect(q, SIGNAL(okClicked()), q, SLOT(slotOk()));
}
示例#25
0
void KPrPgConfDia::setupPageGeneral()
{
    QFrame* generalPage = addPage( i18n("&General") );
    QWhatsThis::add( generalPage, i18n("<p>This dialog allows you to configure how the slideshow "
				       "will be displayed, including whether the slides are "
				       "automatically sequenced or manually controlled, and also "
				       "allows you to configure a <em>drawing pen</em> that can "
				       "be used during the display of the presentation to add "
				       "additional information or to emphasise particular points.</p>") );
    QVBoxLayout *generalLayout = new QVBoxLayout( generalPage, 0, KDialog::spacingHint() );

    QVButtonGroup *switchGroup = new QVButtonGroup( i18n("&Transition Type"), generalPage );
    generalLayout->addWidget( switchGroup );
    QWhatsThis::add( switchGroup, i18n("<li><p>If you select <b>Manual transition to next step or slide</b> "
					  "then each transition and effect on a slide, or transition from "
					  "one slide to the next, will require an action. Typically this "
					  "action will be a mouse click, or the space bar.</p></li>"
					  "<li><p>If you select <b>Automatic transition to next step or slide</b> "
					  "then the presentation will automatically sequence each transition "
					  "and effect on a slide, and will automatically transition to the "
					  "next slide when the current slide is fully displayed. The speed "
					  "of sequencing is controlled using the slider below. This also "
					  "enables the option to automatically loop back to the first "
					  "slide after the last slide has been shown.</p></li>") );
    m_manualButton = new QRadioButton( i18n("&Manual transition to next step or slide"), switchGroup );
    m_manualButton->setChecked( m_doc->spManualSwitch() );
    m_autoButton = new QRadioButton( i18n("&Automatic transition to next step or slide"), switchGroup );
    m_autoButton->setChecked( !m_doc->spManualSwitch() );

    infiniteLoop = new QCheckBox( i18n( "&Infinite loop" ), generalPage );
    generalLayout->addWidget( infiniteLoop );
    QWhatsThis::add( infiniteLoop, i18n("<p>If this checkbox is selected, then the slideshow "
					"will restart at the first slide after the last slide "
					"has been displayed. It is only available if the "
					"<b>Automatic transition to next step or slide</b> "
					"button is selected above.</p> <p>This option may be "
					"useful if you are running a promotional display.</p>") );

    infiniteLoop->setEnabled( !m_doc->spManualSwitch() );
    connect( m_autoButton, SIGNAL( toggled(bool) ), infiniteLoop, SLOT( setEnabled(bool) ) );
    connect( m_autoButton, SIGNAL( toggled(bool) ), infiniteLoop, SLOT( setChecked(bool) ) );

    endOfPresentationSlide = new QCheckBox( i18n( "&Show 'End of presentation' slide" ), generalPage );
    generalLayout->addWidget( endOfPresentationSlide );
    QWhatsThis::add( endOfPresentationSlide, i18n("<p>If this checkbox is selected, when the slideshow "
					"has finished a black slideshow containing the "
					"message 'End of presentation. Click to exit' will "
					"be shown.") );
    endOfPresentationSlide->setChecked( m_doc->spShowEndOfPresentationSlide() );
    endOfPresentationSlide->setDisabled( infiniteLoop->isEnabled() && getInfiniteLoop() );
    connect( infiniteLoop, SIGNAL( toggled(bool) ), endOfPresentationSlide, SLOT( setDisabled(bool) ) );

    presentationDuration = new QCheckBox( i18n( "Measure presentation &duration" ), generalPage );
    generalLayout->addWidget( presentationDuration );
    QWhatsThis::add( presentationDuration, i18n("<p>If this checkbox is selected, the time that "
						"each slide was displayed for, and the total time "
						"for the presentation will be measured.</p> "
						"<p>The times will be displayed at the end of the "
						"presentation.</p> "
						"<p>This can be used during rehearsal to check "
						"coverage for each issue in the presentation, "
						"and to verify that the presentation duration "
						"is correct.</p>" ) );
    presentationDuration->setChecked( m_doc->presentationDuration() );

    // presentation pen (color and width)

    QGroupBox* penGroup = new QGroupBox( 2, Qt::Horizontal, i18n("Presentation Pen") , generalPage );
    generalLayout->addWidget( penGroup );
    QWhatsThis::add( penGroup, i18n("<p>This part of the dialog allows you to configure the "
				    "<em>drawing mode</em>, which allows you to add additional "
				    "information, emphasise particular content, or to correct "
				    "errors during the presentation by drawing on the slides "
				    "using the mouse.</p>"
				    "<p>You can configure the color of the drawing pen and the "
				    "width of the pen.</p>" ) );
    penGroup->layout()->setSpacing(KDialog::marginHint());
    penGroup->layout()->setMargin(KDialog::spacingHint());
    //QGridLayout *grid = new QGridLayout(penGroup->layout(), 3, 2 );

    QLabel* label = new QLabel( i18n( "Color:" ), penGroup );
    //grid->addWidget( label, 0, 0 );
    penColor = new KColorButton( m_doc->presPen().color(), m_doc->presPen().color(), penGroup );
    //grid->addWidget( penColor, 0, 1 );

    label = new QLabel( i18n( "Width:" ), penGroup );
    // grid->addWidget( label, 1, 0 );
    penWidth = new QSpinBox( 1, 10, 1, penGroup );
    penWidth->setSuffix( i18n(" pt") );
    penWidth->setValue( m_doc->presPen().width() );
    //grid->addWidget( penWidth, 1, 1 );

    generalLayout->addStretch();
}
示例#26
0
void QtCalculator::configclicked(){


  QTabDialog * tabdialog;
  tabdialog = new QTabDialog(0,"tabdialog",TRUE);

  tabdialog->setCaption( i18n("KCalc Configuration") );
  tabdialog->resize( 360, 390 );
  tabdialog->setCancelButton( i18n("&Cancel") );
  tabdialog->setOKButton(i18n("&OK"));

  QWidget *about = new QWidget(tabdialog,"about");
  QVBoxLayout *lay1 = new QVBoxLayout( about );
  lay1->setMargin( KDialog::marginHint() );
  lay1->setSpacing( KDialog::spacingHint() );

  QGroupBox *box = new QGroupBox(0,Qt::Vertical,about,"box");
  box->layout()->setSpacing(KDialog::spacingHint());
  box->layout()->setMargin(KDialog::marginHint());
  QGridLayout *grid1 = new QGridLayout(box->layout(),2,2);
  QLabel  *label = new QLabel(box,"label");
  QLabel  *label2 = new QLabel(box,"label2");

  box->setTitle(i18n("About"));
  grid1->addWidget(label,0,1);
  grid1->addMultiCellWidget(label2,2,2,0,1);

  QString labelstring = "KCalc "KCALCVERSION"\n"\
    "Bernd Johannes Wuebben\n"\
    "[email protected]\n"\
    "[email protected]\n"\
    "Copyright (C) 1996-98\n"\
    "\n\n";

  QString labelstring2 =
#ifdef HAVE_LONG_DOUBLE
                i18n( "Base type: long double\n");
#else
                i18n( "Due to broken glibc's everywhere, "\
                      "I had to reduce KCalc's precision from 'long double' "\
                      "to 'double'. "\
                      "Owners of systems with a working libc "\
                      "should recompile KCalc with 'long double' precision "\
                      "enabled. See the README for details.");
#endif

  label->setAlignment(AlignLeft|WordBreak|ExpandTabs);
  label->setText(labelstring);

  label2->setAlignment(AlignLeft|WordBreak|ExpandTabs);
  label2->setText(labelstring2);

  // HACK
  // QPixmap pm( BarIcon( "kcalclogo" ) );
  QPixmap pm;
  QLabel *logo = new QLabel(box);
  logo->setPixmap(pm);
  grid1->addWidget(logo,0,0);
  lay1->addWidget(box);


  DefStruct newdefstruct;
  newdefstruct.forecolor  = kcalcdefaults.forecolor;
  newdefstruct.backcolor  = kcalcdefaults.backcolor;
  newdefstruct.precision  = kcalcdefaults.precision;
  newdefstruct.fixedprecision  = kcalcdefaults.fixedprecision;
  newdefstruct.fixed  = kcalcdefaults.fixed;
  newdefstruct.style  = kcalcdefaults.style;
  newdefstruct.beep  = kcalcdefaults.beep;

  ConfigDlg *configdlg;
  configdlg = new ConfigDlg(tabdialog,"configdlg",&newdefstruct);

  tabdialog->addTab(configdlg,i18n("Defaults"));
  tabdialog->addTab(about,i18n("About"));


  if(tabdialog->exec() == QDialog::Accepted){


    kcalcdefaults.forecolor  = newdefstruct.forecolor;
    kcalcdefaults.backcolor  = newdefstruct.backcolor;
    kcalcdefaults.precision  = newdefstruct.precision;
    kcalcdefaults.fixedprecision  = newdefstruct.fixedprecision;
    kcalcdefaults.fixed  = newdefstruct.fixed;
    kcalcdefaults.style  = newdefstruct.style;
    kcalcdefaults.beep  = newdefstruct.beep;

    set_colors();
    set_precision();
    set_style();
    updateGeometry();
    resize(minimumSize());
  }
  delete configdlg;
}
示例#27
0
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent, const char *)
    : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone)
{
    QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3, strAllW;
    QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
    QGrid *grid;
    QGroupBox *box;
    QLabel *label;
    QString strMouseButton1, strMouseButton3;
    QString txtButton1, txtButton3;
    QStringList items;
    bool leftHandedMouse = (KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded);

    /**  Inactive inner window ******************/

    box = new QVGroupBox(i18n("Inactive Inner Window"), this, "Inactive Inner Window");
    box->layout()->setMargin(KDialog::marginHint());
    box->layout()->setSpacing(KDialog::spacingHint());
    layout->addWidget(box);
    QWhatsThis::add(box, i18n("Here you can customize mouse click behavior when clicking on an inactive"
                              " inner window ('inner' means: not titlebar, not frame)."));

    grid = new QGrid(3, Qt::Vertical, box);

    strMouseButton1 = i18n("Left button:");
    txtButton1 = i18n(
        "In this row you can customize left click behavior when clicking into"
        " the titlebar or the frame.");

    strMouseButton3 = i18n("Right button:");
    txtButton3 = i18n(
        "In this row you can customize right click behavior when clicking into"
        " the titlebar or the frame.");

    if(leftHandedMouse)
    {
        qSwap(strMouseButton1, strMouseButton3);
        qSwap(txtButton1, txtButton3);
    }

    strWin1 = i18n(
        "In this row you can customize left click behavior when clicking into"
        " an inactive inner window ('inner' means: not titlebar, not frame).");

    strWin3 = i18n(
        "In this row you can customize right click behavior when clicking into"
        " an inactive inner window ('inner' means: not titlebar, not frame).");

    // Be nice to lefties
    if(leftHandedMouse)
        qSwap(strWin1, strWin3);

    label = new QLabel(strMouseButton1, grid);
    QWhatsThis::add(label, strWin1);

    label = new QLabel(i18n("Middle button:"), grid);
    strWin2 = i18n(
        "In this row you can customize middle click behavior when clicking into"
        " an inactive inner window ('inner' means: not titlebar, not frame).");
    QWhatsThis::add(label, strWin2);

    label = new QLabel(strMouseButton3, grid);
    QWhatsThis::add(label, strWin3);

    items.clear();
    items << i18n("Activate, Raise & Pass Click") << i18n("Activate & Pass Click") << i18n("Activate") << i18n("Activate & Raise");

    QComboBox *combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coWin1 = combo;
    QWhatsThis::add(combo, strWin1);

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coWin2 = combo;
    QWhatsThis::add(combo, strWin2);

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coWin3 = combo;
    QWhatsThis::add(combo, strWin3);


    /** Inner window, titlebar and frame **************/

    box = new QVGroupBox(i18n("Inner Window, Titlebar && Frame"), this, "Inner Window, Titlebar and Frame");
    box->layout()->setMargin(KDialog::marginHint());
    box->layout()->setSpacing(KDialog::spacingHint());
    layout->addWidget(box);
    QWhatsThis::add(box, i18n("Here you can customize KDE's behavior when clicking somewhere into"
                              " a window while pressing a modifier key."));

    grid = new QGrid(5, Qt::Vertical, box);

    // Labels
    label = new QLabel(i18n("Modifier key:"), grid);

    strAllKey = i18n(
        "Here you select whether holding the Meta key or Alt key "
        "will allow you to perform the following actions.");
    QWhatsThis::add(label, strAllKey);


    strMouseButton1 = i18n("Modifier key + left button:");
    strAll1 = i18n(
        "In this row you can customize left click behavior when clicking into"
        " the titlebar or the frame.");

    strMouseButton3 = i18n("Modifier key + right button:");
    strAll3 = i18n(
        "In this row you can customize right click behavior when clicking into"
        " the titlebar or the frame.");

    if(leftHandedMouse)
    {
        qSwap(strMouseButton1, strMouseButton3);
        qSwap(strAll1, strAll3);
    }

    label = new QLabel(strMouseButton1, grid);
    QWhatsThis::add(label, strAll1);

    label = new QLabel(i18n("Modifier key + middle button:"), grid);
    strAll2 = i18n(
        "Here you can customize KDE's behavior when middle clicking into a window"
        " while pressing the modifier key.");
    QWhatsThis::add(label, strAll2);

    label = new QLabel(strMouseButton3, grid);
    QWhatsThis::add(label, strAll3);

    label = new QLabel(i18n("Modifier key + mouse wheel:"), grid);
    strAllW = i18n(
        "Here you can customize KDE's behavior when scrolling with the mouse wheel"
        "  in a window while pressing the modifier key.");
    QWhatsThis::add(label, strAllW);

    // Combo's
    combo = new QComboBox(grid);
    combo->insertItem(i18n("Meta"));
    combo->insertItem(i18n("Alt"));
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coAllKey = combo;
    QWhatsThis::add(combo, strAllKey);

    items.clear();
    items << i18n("Move") << i18n("Activate, Raise and Move") << i18n("Toggle Raise & Lower") << i18n("Resize") << i18n("Raise") << i18n("Lower")
          << i18n("Minimize") << i18n("Nothing");

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coAll1 = combo;
    QWhatsThis::add(combo, strAll1);

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coAll2 = combo;
    QWhatsThis::add(combo, strAll2);

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coAll3 = combo;
    QWhatsThis::add(combo, strAll3);

    combo = new QComboBox(grid);
    combo->insertItem(i18n("Raise/Lower"));
    combo->insertItem(i18n("Shade/Unshade"));
    combo->insertItem(i18n("Maximize/Restore"));
    combo->insertItem(i18n("Keep Above/Below"));
    combo->insertItem(i18n("Move to Previous/Next Desktop"));
    combo->insertItem(i18n("Change Opacity"));
    combo->insertItem(i18n("Nothing"));
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coAllW = combo;
    QWhatsThis::add(combo, strAllW);

    layout->addStretch();

    load();
}
示例#28
0
KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent, const char *)
    : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone)
{
    QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3;
    QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
    QGrid *grid;
    QGroupBox *box;
    QLabel *label;
    QString strMouseButton1, strMouseButton3, strMouseWheel;
    QString txtButton1, txtButton3, txtButton4;
    QStringList items;
    bool leftHandedMouse = (KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded);

    /** Titlebar doubleclick ************/

    QHBoxLayout *hlayout = new QHBoxLayout(layout);

    label = new QLabel(i18n("&Titlebar double-click:"), this);
    hlayout->addWidget(label);
    QWhatsThis::add(label, i18n("Here you can customize mouse click behavior when double clicking on the"
                                " titlebar of a window."));

    QComboBox *combo = new QComboBox(this);
    combo->insertItem(i18n("Maximize"));
    combo->insertItem(i18n("Maximize (vertical only)"));
    combo->insertItem(i18n("Maximize (horizontal only)"));
    combo->insertItem(i18n("Minimize"));
    combo->insertItem(i18n("Shade"));
    combo->insertItem(i18n("Lower"));
    combo->insertItem(i18n("On All Desktops"));
    combo->insertItem(i18n("Nothing"));
    combo->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    hlayout->addWidget(combo);
    coTiDbl = combo;
    QWhatsThis::add(combo, i18n("Behavior on <em>double</em> click into the titlebar."));

    label->setBuddy(combo);

    /** Mouse Wheel Events  **************/
    QHBoxLayout *hlayoutW = new QHBoxLayout(layout);
    strMouseWheel = i18n("Titlebar wheel event:");
    label = new QLabel(strMouseWheel, this);
    hlayoutW->addWidget(label);
    txtButton4 = i18n("Handle mouse wheel events");
    QWhatsThis::add(label, txtButton4);

    // Titlebar and frame mouse Wheel
    QComboBox *comboW = new QComboBox(this);
    comboW->insertItem(i18n("Raise/Lower"));
    comboW->insertItem(i18n("Shade/Unshade"));
    comboW->insertItem(i18n("Maximize/Restore"));
    comboW->insertItem(i18n("Keep Above/Below"));
    comboW->insertItem(i18n("Move to Previous/Next Desktop"));
    comboW->insertItem(i18n("Change Opacity"));
    comboW->insertItem(i18n("Nothing"));
    comboW->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
    connect(comboW, SIGNAL(activated(int)), SLOT(changed()));
    hlayoutW->addWidget(comboW);
    coTiAct4 = comboW;
    QWhatsThis::add(comboW, txtButton4);
    label->setBuddy(comboW);

    /** Titlebar and frame  **************/

    box = new QVGroupBox(i18n("Titlebar && Frame"), this, "Titlebar and Frame");
    box->layout()->setMargin(KDialog::marginHint());
    box->layout()->setSpacing(KDialog::spacingHint());
    layout->addWidget(box);
    QWhatsThis::add(box, i18n("Here you can customize mouse click behavior when clicking on the"
                              " titlebar or the frame of a window."));

    grid = new QGrid(4, Qt::Vertical, box);


    new QLabel(grid); // dummy

    strMouseButton1 = i18n("Left button:");
    txtButton1 = i18n(
        "In this row you can customize left click behavior when clicking into"
        " the titlebar or the frame.");

    strMouseButton3 = i18n("Right button:");
    txtButton3 = i18n(
        "In this row you can customize right click behavior when clicking into"
        " the titlebar or the frame.");

    if(leftHandedMouse)
    {
        qSwap(strMouseButton1, strMouseButton3);
        qSwap(txtButton1, txtButton3);
    }

    label = new QLabel(strMouseButton1, grid);
    QWhatsThis::add(label, txtButton1);

    label = new QLabel(i18n("Middle button:"), grid);
    QWhatsThis::add(label, i18n("In this row you can customize middle click behavior when clicking into"
                                " the titlebar or the frame."));

    label = new QLabel(strMouseButton3, grid);
    QWhatsThis::add(label, txtButton3);


    label = new QLabel(i18n("Active"), grid);
    label->setAlignment(AlignCenter);
    QWhatsThis::add(label, i18n("In this column you can customize mouse clicks into the titlebar"
                                " or the frame of an active window."));

    // Titlebar and frame, active, mouse button 1
    combo = new QComboBox(grid);
    combo->insertItem(i18n("Raise"));
    combo->insertItem(i18n("Lower"));
    combo->insertItem(i18n("Operations Menu"));
    combo->insertItem(i18n("Toggle Raise & Lower"));
    combo->insertItem(i18n("Nothing"));
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coTiAct1 = combo;

    txtButton1 = i18n(
        "Behavior on <em>left</em> click into the titlebar or frame of an "
        "<em>active</em> window.");

    txtButton3 = i18n(
        "Behavior on <em>right</em> click into the titlebar or frame of an "
        "<em>active</em> window.");

    // Be nice to left handed users
    if(leftHandedMouse)
        qSwap(txtButton1, txtButton3);

    QWhatsThis::add(combo, txtButton1);

    // Titlebar and frame, active, mouse button 2

    items << i18n("Raise") << i18n("Lower") << i18n("Operations Menu") << i18n("Toggle Raise & Lower") << i18n("Nothing") << i18n("Shade");

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coTiAct2 = combo;
    QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>active</em> window."));

    // Titlebar and frame, active, mouse button 3
    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coTiAct3 = combo;
    QWhatsThis::add(combo, txtButton3);

    txtButton1 = i18n(
        "Behavior on <em>left</em> click into the titlebar or frame of an "
        "<em>inactive</em> window.");

    txtButton3 = i18n(
        "Behavior on <em>right</em> click into the titlebar or frame of an "
        "<em>inactive</em> window.");

    // Be nice to left handed users
    if(leftHandedMouse)
        qSwap(txtButton1, txtButton3);

    label = new QLabel(i18n("Inactive"), grid);
    label->setAlignment(AlignCenter);
    QWhatsThis::add(label, i18n("In this column you can customize mouse clicks into the titlebar"
                                " or the frame of an inactive window."));

    items.clear();
    items << i18n("Activate & Raise") << i18n("Activate & Lower") << i18n("Activate") << i18n("Shade") << i18n("Operations Menu") << i18n("Raise")
          << i18n("Lower") << i18n("Nothing");

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coTiInAct1 = combo;
    QWhatsThis::add(combo, txtButton1);

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coTiInAct2 = combo;
    QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>inactive</em> window."));

    combo = new QComboBox(grid);
    combo->insertStringList(items);
    connect(combo, SIGNAL(activated(int)), SLOT(changed()));
    coTiInAct3 = combo;
    QWhatsThis::add(combo, txtButton3);

    /**  Maximize Button ******************/

    box = new QHGroupBox(i18n("Maximize Button"), this, "Maximize Button");
    box->layout()->setMargin(KDialog::marginHint());
    box->layout()->setSpacing(KDialog::spacingHint());
    layout->addWidget(box);
    QWhatsThis::add(box, i18n("Here you can customize behavior when clicking on the maximize button."));

    QString strMouseButton[] = {i18n("Left button:"), i18n("Middle button:"), i18n("Right button:")};

    QString txtButton[] = {i18n("Behavior on <em>left</em> click onto the maximize button."),
                           i18n("Behavior on <em>middle</em> click onto the maximize button."),
                           i18n("Behavior on <em>right</em> click onto the maximize button.")};

    if(leftHandedMouse) // Be nice to lefties
    {
        qSwap(strMouseButton[0], strMouseButton[2]);
        qSwap(txtButton[0], txtButton[2]);
    }

    createMaxButtonPixmaps();
    for(int b = 0; b < 3; ++b)
    {
        if(b != 0)
            new QWidget(box); // Spacer

        QLabel *label = new QLabel(strMouseButton[b], box);
        QWhatsThis::add(label, txtButton[b]);
        label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum));

        coMax[b] = new ToolTipComboBox(box, tbl_Max);
        for(int t = 0; t < 3; ++t)
            coMax[b]->insertItem(maxButtonPixmaps[t]);
        connect(coMax[b], SIGNAL(activated(int)), SLOT(changed()));
        connect(coMax[b], SIGNAL(activated(int)), coMax[b], SLOT(changed()));
        QWhatsThis::add(coMax[b], txtButton[b]);
        coMax[b]->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum));
    }

    connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(paletteChanged()));

    layout->addStretch();

    load();
}
示例#29
0
文件: toolbar.cpp 项目: videolan/vlc
ToolbarEditDialog::ToolbarEditDialog( QWidget *_w, intf_thread_t *_p_intf)
                  : QVLCDialog( _w,  _p_intf )
{
    setWindowTitle( qtr( "Toolbars Editor" ) );
    setWindowRole( "vlc-toolbars-editor" );
    QGridLayout *mainLayout = new QGridLayout( this );
    setMinimumWidth( 600 );
    setAttribute( Qt::WA_DeleteOnClose );

    /* main GroupBox */
    QGroupBox *widgetBox = new QGroupBox( qtr( "Toolbar Elements") , this );
    widgetBox->setSizePolicy( QSizePolicy::Preferred,
                              QSizePolicy::MinimumExpanding );
    QGridLayout *boxLayout = new QGridLayout( widgetBox );

    flatBox = new QCheckBox( qtr( "Flat Button" ) );
    flatBox->setToolTip( qtr( "Next widget style" ) );
    bigBox = new QCheckBox( qtr( "Big Button" ) );
    bigBox->setToolTip( flatBox->toolTip() );
    shinyBox = new QCheckBox( qtr( "Native Slider" ) );
    shinyBox->setToolTip( flatBox->toolTip() );

    boxLayout->addWidget( new WidgetListing( p_intf, this ), 1, 0, 1, -1 );
    boxLayout->addWidget( flatBox, 0, 0 );
    boxLayout->addWidget( bigBox, 0, 1 );
    boxLayout->addWidget( shinyBox, 0, 2 );
    mainLayout->addWidget( widgetBox, 5, 0, 3, 6 );

    QTabWidget *tabWidget = new QTabWidget();
    mainLayout->addWidget( tabWidget, 1, 0, 4, 9 );

    /* Main ToolBar */
    QWidget *mainToolbarBox = new QWidget();
    tabWidget->addTab( mainToolbarBox, qtr( "Main Toolbar" ) );
    QFormLayout *mainTboxLayout = new QFormLayout( mainToolbarBox );

    positionCheckbox = new QCheckBox( qtr( "Above the Video" ) );
    positionCheckbox->setChecked(
                getSettings()->value( "MainWindow/ToolbarPos", false ).toBool() );
    mainTboxLayout->addRow( new QLabel( qtr( "Toolbar position:" ) ),
                            positionCheckbox );

    QString line1 = getSettings()->value( "MainWindow/MainToolbar1",
                                          MAIN_TB1_DEFAULT ).toString();
    controller1 = new DroppingController( p_intf, line1, this );
    mainTboxLayout->addRow( new QLabel( qtr("Line 1:") ), controller1 );

    QString line2 = getSettings()->value( "MainWindow/MainToolbar2",
                                          MAIN_TB2_DEFAULT ).toString();
    controller2 = new DroppingController( p_intf, line2, this );
    mainTboxLayout->addRow( new QLabel( qtr("Line 2:") ), controller2 );

    /* TimeToolBar */
    QString line = getSettings()->value( "MainWindow/InputToolbar",
                                         INPT_TB_DEFAULT ).toString();
    controller = new DroppingController( p_intf, line, this );
    QWidget *timeToolbarBox = new QWidget();
    timeToolbarBox->setLayout( new QVBoxLayout() );
    timeToolbarBox->layout()->addWidget( controller );
    tabWidget->addTab( timeToolbarBox, qtr( "Time Toolbar" ) );

    /* Advanced ToolBar */
    QString lineA = getSettings()->value( "MainWindow/AdvToolbar",
                                          ADV_TB_DEFAULT ).toString();
    controllerA = new DroppingController( p_intf, lineA, this );
    QWidget *advToolbarBox = new QWidget();
    advToolbarBox->setLayout( new QVBoxLayout() );
    advToolbarBox->layout()->addWidget( controllerA );
    tabWidget->addTab( advToolbarBox, qtr( "Advanced Widget" ) );

    /* FSCToolBar */
    QString lineFSC = getSettings()->value( "MainWindow/FSCtoolbar",
                                            FSC_TB_DEFAULT ).toString();
    controllerFSC = new DroppingController( p_intf, lineFSC, this );
    QWidget *FSCToolbarBox = new QWidget();
    FSCToolbarBox->setLayout( new QVBoxLayout() );
    FSCToolbarBox->layout()->addWidget( controllerFSC );
    tabWidget->addTab( FSCToolbarBox, qtr( "Fullscreen Controller" ) );

    /* Profile */
    QGridLayout *profileBoxLayout = new QGridLayout();

    profileCombo = new QComboBox;

    QToolButton *newButton = new QToolButton;
    newButton->setIcon( QIcon( ":/new.svg" ) );
    newButton->setToolTip( qtr("New profile") );
    QToolButton *deleteButton = new QToolButton;
    deleteButton->setIcon( QIcon( ":/toolbar/clear.svg" ) );
    deleteButton->setToolTip( qtr( "Delete the current profile" ) );

    profileBoxLayout->addWidget( new QLabel( qtr( "Select profile:" ) ), 0, 0 );
    profileBoxLayout->addWidget( profileCombo, 0, 1 );
    profileBoxLayout->addWidget( newButton, 0, 2 );
    profileBoxLayout->addWidget( deleteButton, 0, 3 );

    mainLayout->addLayout( profileBoxLayout, 0, 0, 1, 9 );

    /* Fill combos */
    int i_size = getSettings()->beginReadArray( "ToolbarProfiles" );
    for( int i = 0; i < i_size; i++ )
    {
        getSettings()->setArrayIndex(i);
        profileCombo->addItem( getSettings()->value( "ProfileName" ).toString(),
                               getSettings()->value( "Value" ).toString() );
    }
    getSettings()->endArray();

    /* Load defaults ones if we have no combos */
    /* We could decide that we load defaults on first launch of the dialog
       or when the combo is back to 0. I choose the second solution, because some clueless
       user might hit on delete a bit too much, but discussion is opened. -- jb */
    if( i_size == 0 )
    {
        profileCombo->addItem( PROFILE_NAME_6, QString( VALUE_6 ) );
        profileCombo->addItem( PROFILE_NAME_1, QString( VALUE_1 ) );
        profileCombo->addItem( PROFILE_NAME_2, QString( VALUE_2 ) );
        profileCombo->addItem( PROFILE_NAME_3, QString( VALUE_3 ) );
        profileCombo->addItem( PROFILE_NAME_4, QString( VALUE_4 ) );
        profileCombo->addItem( PROFILE_NAME_5, QString( VALUE_5 ) );
    }
    profileCombo->setCurrentIndex( -1 );

    /* Build and prepare our preview */
    PreviewWidget *previewWidget = new PreviewWidget( controller, controller1, controller2,
                                                      positionCheckbox->isChecked() );
    QGroupBox *previewBox = new QGroupBox( qtr("Preview"), this );
    previewBox->setLayout( new QVBoxLayout() );
    previewBox->layout()->addWidget( previewWidget );
    mainLayout->addWidget( previewBox, 5, 6, 3, 3 );
    CONNECT( positionCheckbox, stateChanged(int),
             previewWidget, setBarsTopPosition(int) );

    /* Buttons */
    QDialogButtonBox *okCancel = new QDialogButtonBox;
    QPushButton *okButton = new QPushButton( qtr( "Cl&ose" ), this );
    okButton->setDefault( true );
    QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ), this );
    okCancel->addButton( okButton, QDialogButtonBox::AcceptRole );
    okCancel->addButton( cancelButton, QDialogButtonBox::RejectRole );

    BUTTONACT( deleteButton, deleteProfile() );
    BUTTONACT( newButton, newProfile() );
    CONNECT( profileCombo, currentIndexChanged( int ), this, changeProfile( int ) );
    BUTTONACT( okButton, close() );
    BUTTONACT( cancelButton, cancel() );
    mainLayout->addWidget( okCancel, 8, 0, 1, 9 );
}
示例#30
0
KDMAppearanceWidget::KDMAppearanceWidget(QWidget *parent, const char *name)
  : QWidget(parent, name)
{
  QString wtstr;

  QVBoxLayout *vbox = new QVBoxLayout(this, KDialog::marginHint(),
                      KDialog::spacingHint(), "vbox");
  QGroupBox *group = new QGroupBox(i18n("Appearance"), this);
  vbox->addWidget(group);

  QGridLayout *grid = new QGridLayout( group, 5, 2, KDialog::marginHint(),
                       KDialog::spacingHint(), "grid");
  grid->addRowSpacing(0, group->fontMetrics().height());
  grid->setColStretch(0, 1);
  grid->setColStretch(1, 1);

  QHBoxLayout *hlay = new QHBoxLayout( KDialog::spacingHint() );
  grid->addMultiCellLayout(hlay, 1,1, 0,1);
  greetstr_lined = new KLineEdit(group);
  QLabel *label = new QLabel(greetstr_lined, i18n("&Greeting:"), group);
  hlay->addWidget(label);
  connect(greetstr_lined, SIGNAL(textChanged(const QString&)),
      SLOT(changed()));
  hlay->addWidget(greetstr_lined);
  wtstr = i18n("This is the \"headline\" for KDM's login window. You may want to "
           "put some nice greeting or information about the operating system here.<p>"
           "KDM will substitute the following character pairs with the "
           "respective contents:<br><ul>"
           "<li>%d -> current display</li>"
           "<li>%h -> host name, possibly with domain name</li>"
           "<li>%n -> node name, most probably the host name without domain name</li>"
           "<li>%s -> the operating system</li>"
           "<li>%r -> the operating system's version</li>"
           "<li>%m -> the machine (hardware) type</li>"
           "<li>%% -> a single %</li>"
           "</ul>" );
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( greetstr_lined, wtstr );


  QGridLayout *hglay = new QGridLayout( 3, 4, KDialog::spacingHint() );
  grid->addMultiCellLayout(hglay, 2,4, 0,0);

  label = new QLabel(i18n("Logo area:"), group);
  hglay->addWidget(label, 0, 0);
  QVBoxLayout *vlay = new QVBoxLayout( KDialog::spacingHint() );
  hglay->addMultiCellLayout(vlay, 0,0, 1,2);
  noneRadio = new QRadioButton( i18n("logo area", "&None"), group );
  clockRadio = new QRadioButton( i18n("Show cloc&k"), group );
  logoRadio = new QRadioButton( i18n("Sho&w logo"), group );
  QButtonGroup *buttonGroup = new QButtonGroup( group );
  label->setBuddy( buttonGroup );
  connect( buttonGroup, SIGNAL(clicked(int)), SLOT(slotAreaRadioClicked(int)) );
  connect( buttonGroup, SIGNAL(clicked(int)), SLOT(changed()) );
  buttonGroup->hide();
  buttonGroup->insert(noneRadio, KdmNone);
  buttonGroup->insert(clockRadio, KdmClock);
  buttonGroup->insert(logoRadio, KdmLogo);
  vlay->addWidget(noneRadio);
  vlay->addWidget(clockRadio);
  vlay->addWidget(logoRadio);
  wtstr = i18n("You can choose to display a custom logo (see below), a clock or no logo at all.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( noneRadio, wtstr );
  QWhatsThis::add( logoRadio, wtstr );
  QWhatsThis::add( clockRadio, wtstr );

  logoLabel = new QLabel(i18n("&Logo:"), group);
  logobutton = new QPushButton(group);
  logoLabel->setBuddy( logobutton );
  logobutton->setAutoDefault(false);
  logobutton->setAcceptDrops(true);
  logobutton->installEventFilter(this); // for drag and drop
  connect(logobutton, SIGNAL(clicked()), SLOT(slotLogoButtonClicked()));
  hglay->addWidget(logoLabel, 1, 0);
  hglay->addWidget(logobutton, 1, 1, AlignCenter);
  hglay->addRowSpacing(1, 110);
  wtstr = i18n("Click here to choose an image that KDM will display. "
	       "You can also drag and drop an image onto this button "
	       "(e.g. from Konqueror).");
  QWhatsThis::add( logoLabel, wtstr );
  QWhatsThis::add( logobutton, wtstr );
  hglay->addRowSpacing( 2, KDialog::spacingHint());
  hglay->setColStretch( 3, 1);


  hglay = new QGridLayout( 2, 3, KDialog::spacingHint() );
  grid->addLayout(hglay, 2, 1);

  label = new QLabel(i18n("Position:"), group);
  hglay->addMultiCellWidget(label, 0,1, 0,0, AlignVCenter);
  QValidator *posValidator = new QIntValidator(0, 100, group);
  QLabel *xLineLabel = new QLabel(i18n("&X:"), group);
  hglay->addWidget(xLineLabel, 0, 1);
  xLineEdit = new QLineEdit (group);
  connect( xLineEdit, SIGNAL( textChanged(const QString&) ), SLOT( changed() ));
  hglay->addWidget(xLineEdit, 0, 2);
  xLineLabel->setBuddy(xLineEdit);
  xLineEdit->setValidator(posValidator);
  QLabel *yLineLabel = new QLabel(i18n("&Y:"), group);
  hglay->addWidget(yLineLabel, 1, 1);
  yLineEdit = new QLineEdit (group);
  connect( yLineEdit, SIGNAL( textChanged(const QString&) ), SLOT( changed() ));
  hglay->addWidget(yLineEdit, 1, 2);
  yLineLabel->setBuddy(yLineEdit);
  yLineEdit->setValidator(posValidator);
  wtstr = i18n("Here you specify the relative coordinates (in percent) of the login dialog's <em>center</em>.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( xLineLabel, wtstr );
  QWhatsThis::add( xLineEdit, wtstr );
  QWhatsThis::add( yLineLabel, wtstr );
  QWhatsThis::add( yLineEdit, wtstr );
  hglay->setColStretch( 3, 1);
  hglay->setRowStretch( 2, 1);


  hglay = new QGridLayout( 2, 3, KDialog::spacingHint() );
  grid->addLayout(hglay, 3, 1);
  hglay->setColStretch(3, 1);

  guicombo = new KBackedComboBox(group);
  guicombo->insertItem( "", i18n("<default>") );
  loadGuiStyles(guicombo);
  guicombo->listBox()->sort();
  label = new QLabel(guicombo, i18n("GUI s&tyle:"), group);
  connect(guicombo, SIGNAL(activated(int)), SLOT(changed()));
  hglay->addWidget(label, 0, 0);
  hglay->addWidget(guicombo, 0, 1);
  wtstr = i18n("You can choose a basic GUI style here that will be "
        "used by KDM only.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( guicombo, wtstr );

  colcombo = new KBackedComboBox(group);
  colcombo->insertItem( "", i18n("<default>") );
  loadColorSchemes(colcombo);
  colcombo->listBox()->sort();
  label = new QLabel(colcombo, i18n("&Color scheme:"), group);
  connect(colcombo, SIGNAL(activated(int)), SLOT(changed()));
  hglay->addWidget(label, 1, 0);
  hglay->addWidget(colcombo, 1, 1);
  wtstr = i18n("You can choose a basic Color Scheme here that will be "
        "used by KDM only.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( colcombo, wtstr );

  echocombo = new KBackedComboBox(group);
  echocombo->insertItem("NoEcho", i18n("No Echo"));
  echocombo->insertItem("OneStar", i18n("One Star"));
  echocombo->insertItem("ThreeStars", i18n("Three Stars"));
  label = new QLabel(echocombo, i18n("Echo &mode:"), group);
  connect(echocombo, SIGNAL(activated(int)), SLOT(changed()));
  hglay->addWidget(label, 2, 0);
  hglay->addWidget(echocombo, 2, 1);
  wtstr = i18n("You can choose whether and how KDM shows your password when you type it.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( echocombo, wtstr );


  // The Language group box
  group = new QGroupBox(0, Vertical, i18n("Locale"), this);
  vbox->addWidget(group);

  langcombo = new KLanguageButton(group);
  loadLanguageList(langcombo);
  connect(langcombo, SIGNAL(activated(const QString &)), SLOT(changed()));
  label = new QLabel(langcombo, i18n("Languag&e:"), group);
  QGridLayout *hbox = new QGridLayout( group->layout(), 2, 2, KDialog::spacingHint() );
  hbox->setColStretch(1, 1);
  hbox->addWidget(label, 1, 0);
  hbox->addWidget(langcombo, 1, 1);
  wtstr = i18n("Here you can choose the language used by KDM. This setting does not affect"
    " a user's personal settings; that will take effect after login.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( langcombo, wtstr );


  vbox->addStretch(1);

}