Exemplo n.º 1
0
task1::task1(QWidget *parent, Qt::WFlags flags)
    : QDialog(parent, flags)
{
  QLayout* mainLayout = new QVBoxLayout;
  QLayout* firstNameLayout = new QHBoxLayout;

  QLabel* nameLabel = new QLabel("Enter your name", this);
  QLineEdit* nameEdit = new QLineEdit("here", this);

  firstNameLayout->addWidget(nameLabel);
  firstNameLayout->addWidget(nameEdit);

  mainLayout->addItem(firstNameLayout);

  QLayout* lastNameLayout = new QHBoxLayout;

  QLabel* lastNameLabel = new QLabel("Enter your last name", this);
  QLineEdit* lastNameEdit = new QLineEdit("here", this);

  lastNameLayout->addWidget(lastNameLabel);
  lastNameLayout->addWidget(lastNameEdit);

  mainLayout->addItem(lastNameLayout);

  QPushButton* confirmButton = new QPushButton("Confirm", this);
  QObject::connect(confirmButton, SIGNAL(clicked()), this, SLOT(accept()));

  mainLayout->addWidget(confirmButton);

  setLayout(mainLayout);
  
}
Exemplo n.º 2
0
GTrans::GTrans() {
    QLayout *mainLayout = new QVBoxLayout;

    // The input section
    QLayout *top = new QHBoxLayout;
    QBoxLayout *tl = new QVBoxLayout;
    QLabel *inLabel = new QLabel(tr("Input:"));
    fromLang = new QComboBox;
    tl->addWidget(inLabel);
    tl->addSpacing(10);
    tl->addWidget(fromLang);
    tl->addStretch();
    top->addItem(tl);
    inputTxt = new QTextEdit;

    top->addWidget(inputTxt);

    // The output section
    QLayout *bottom = new QHBoxLayout;
    QBoxLayout *bl = new QVBoxLayout;
    QLabel *outLabel = new QLabel(tr("Output:"));
    toLang = new QComboBox;
    bl->addWidget(outLabel);
    bl->addSpacing(10);
    bl->addWidget(toLang);
    bl->addStretch();
    bottom->addItem(bl);
    outputTxt = new QTextEdit;
    outputTxt->setReadOnly(true);
    bottom->addWidget(outputTxt);

    mainLayout->addItem(top);
    mainLayout->addItem(bottom);

    // Translate button
    trans_b = new QPushButton(tr("Translate"));
    mainLayout->addWidget(trans_b);

    fillInLanguages();

    setLayout(mainLayout);
    setWindowTitle(tr("Translate"));
    
    trans_b->setDefault(true);
    connect(trans_b, SIGNAL(clicked()), this, SLOT(doTrans()));

    // Setup foxus and tab order.
    inputTxt->setTabChangesFocus(true);
    inputTxt->setFocus(Qt::ActiveWindowFocusReason);
    setTabOrder(inputTxt, toLang);
    setTabOrder(toLang, trans_b);
    setTabOrder(trans_b, fromLang);
    setTabOrder(fromLang, inputTxt);
    outputTxt->setFocusProxy(trans_b);
}
Exemplo n.º 3
0
void StartMenu::SortScrollArea(QScrollArea *area){
  //qDebug() << "Sorting Scroll Area:";
  //Sort all the items in the scroll area alphabetically
  QLayout *lay = area->widget()->layout();
  QStringList items;
  for(int i=0; i<lay->count(); i++){
    items << lay->itemAt(i)->widget()->whatsThis();
  }
  
  items.sort();
  //qDebug() << " - Sorted Items:" << items;
  for(int i=0; i<items.length(); i++){
    if(items[i].isEmpty()){ continue; }
    //QLayouts are weird in that they can only add items to the end - need to re-insert almost every item
    for(int j=0; j<lay->count(); j++){
      //Find this item
      if(lay->itemAt(j)->widget()->whatsThis()==items[i]){
	//Found it - now move it if necessary
	//qDebug() << "Found Item:" << items[i] << i << j;
	lay->addItem( lay->takeAt(j) );
	break;
      }
    }
  }
}
Exemplo n.º 4
0
void TestController::load() {
    unload();
    //Inputs
    QLayout* layout = getView().getUi().grx_test_inputs->layout();
    for (int i = 0; i < getModel().numberOfInputLVars(); ++i) {
        GuiGrapher* g = new GuiGrapher(*getModel().inputLVar(i));
        g->setup();
        //            layout->insertWidget(i, g);
        layout->addWidget(g);
        QObject::connect(g, SIGNAL(onChangeInputValue()), this,
                         SLOT(onInputValueChanged()));
    }
    layout->addItem(new QSpacerItem(20, 40, QSizePolicy::Ignored, QSizePolicy::Expanding));

    //Rules
    for (int i = 0; i < getModel().ruleBlock(0)->numberOfRules(); ++i) {
        QString rule = QString::fromStdString(getModel().ruleBlock(0)->rule(i)->toString());
        getView().getUi().lsw_test_rules->addItem(rule);
        QListWidgetItem* item = new QListWidgetItem;
        item->setText("-");
        item->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        getView().getUi().lsw_test_rules_activation->addItem(item);
    }
    for (int i = 0; i < getModel().ruleBlock(0)->numberOfRules(); ++i) {
        QListWidgetItem* rule = getView().getUi().lsw_test_rules->item(i);
        QListWidgetItem* act = getView().getUi().lsw_test_rules_activation->item(i);
        QRect rect = getView().getUi().lsw_test_rules->visualItemRect(rule);
        act->setSizeHint(rect.size());
    }

    layout = getView().getUi().grx_test_outputs->layout();
    //Outputs
    for (int i = 0; i < getModel().numberOfOutputLVars(); ++i) {
        GuiGrapher* g = new GuiGrapher(*getModel().outputLVar(i));
        g->setup();
        layout->addWidget(g);
        QObject::connect(this, SIGNAL(forceUpdate()), g, SLOT(updateUi()));
    }
    layout->addItem(new QSpacerItem(20, 40, QSizePolicy::Ignored, QSizePolicy::Expanding));

    getView().getUi().tab_container->setCurrentIndex(1);
}
Exemplo n.º 5
0
ActionOptionWidget::ActionOptionWidget(CellToolBase* cellTool, const QDomElement& e, QWidget *parent) :
    QWidget(parent)
{
    QString name = e.attribute("name");
    setObjectName(name);
    setWindowTitle(i18n(name.toLatin1()));

    QLayout* layout = new GroupFlowLayout(this);//QBoxLayout(QBoxLayout::TopToBottom, this);

    for (QDomElement group = e.firstChildElement("group"); !group.isNull(); group = group.nextSiblingElement("group")) {
        QHBoxLayout *groupLayout = new QHBoxLayout();
        layout->addItem(groupLayout);

        // In each group there are a number of actions that will be layouted together.
        for (QDomElement action = group.firstChildElement("action"); !action.isNull(); action = action.nextSiblingElement("action")) {
            QString actionName = action.attribute("name");
            QAction* a = cellTool->action(actionName);
            if (!a) {
                kWarning() << "unknown action" << actionName << "in CellToolOptionWidgets.xml";
                continue;
            }
            QWidget* w = qobject_cast<QWidgetAction*>(a) ? qobject_cast<QWidgetAction*>(a)->requestWidget(this) : 0;
            if (w && w->inherits("QFontComboBox")) {
                w->setMinimumWidth(w->minimumWidth() / 2);
            }
            if (!w) {
                QToolButton* b = new QToolButton(this);
                b->setFocusPolicy(Qt::NoFocus);
                b->setDefaultAction(a);
                w = b;
            }

            if (w) {
                groupLayout->addWidget(w);
            }
        }
    }

    // The following widget activates a special feature in the
    // ToolOptionsDocker that makes the components of the widget align
    // to the top if there is extra space.
    QWidget *specialSpacer = new QWidget(this);
    specialSpacer->setObjectName("SpecialSpacer");
    layout->addWidget(specialSpacer);
}
Exemplo n.º 6
0
void GuiWidget::createWidget()
{
    QLayout *layout = new QVBoxLayout();

    _screenWidget = new ScreenWidget(_size.width(), _size.height(), _colorMode);
    layout->addWidget(_screenWidget);

    QLayout *statusLayout = new QHBoxLayout();
    statusLayout->addWidget(new QLabel(QString("screen %1").arg(_idPeriph)));
    _statusEnabled = new QLabel(QString("%1*%2pix").arg(_size.width()).arg(_size.height()));
    statusLayout->addWidget(_statusEnabled);
    _params = new QLabel("");
    statusLayout->addWidget(_params);

    layout->addItem(statusLayout);

    setLayout(layout);
}
Exemplo n.º 7
0
int drv_layout(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QLayout *self = (QLayout*)head->native;
    switch (drvid) {
    case LAYOUT_ADDLAYOUT: {
        self->addItem(drvGetLayout(a1));
        break;
    }
    case LAYOUT_ADDWIDGET: {
        self->addWidget(drvGetWidget(a1));
        break;
    }
    case LAYOUT_SETSPACING: {
        self->setSpacing(drvGetInt(a1));
        break;
    }
    case LAYOUT_SPACING: {
        drvSetInt(a1,self->spacing());
        break;
    }
    case LAYOUT_SETMARGINS: {
        self->setContentsMargins(drvGetMargins(a1));
        break;
    }
    case LAYOUT_MARGINS: {
        drvSetMargins(a1,self->contentsMargins());
        break;
    }
    case LAYOUT_SETMENUBAR: {
        self->setMenuBar(drvGetWidget(a1));
        break;
    }
    case LAYOUT_MENUBAR: {
        drvSetHandle(a1,self->menuBar());
        break;
    }
    default:
        return 0;
    }
    return 1;
}
Exemplo n.º 8
0
QgsDialog::QgsDialog( QWidget *parent, Qt::WindowFlags fl,
                      QDialogButtonBox::StandardButtons buttons,
                      Qt::Orientation orientation )
    : QDialog( parent, fl )
{
  // create buttonbox
  mButtonBox = new QDialogButtonBox( buttons, orientation, this );
  connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
  connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );

  // layout
  QLayout *layout = nullptr;
  if ( orientation == Qt::Horizontal )
    layout = new QVBoxLayout();
  else
    layout = new QHBoxLayout();
  mLayout = new QVBoxLayout();
  layout->addItem( mLayout );
  layout->addWidget( mButtonBox );
  setLayout( layout );
}
Exemplo n.º 9
0
HelpView::HelpView(bool makeControls, QWidget *parent) :
    CMainWindow(parent)
{
    address_box = new QComboBox;
    address_box->setEditable(true);
    helpContent = new SHelpContentViewWidget;
    helpContent->setSource(QUrl("qthelp://Serpkov_Nikita.com.Depot.2.0/doc/index.html"));

    QLayout *main = new QVBoxLayout;
    QFormLayout *layout = new QFormLayout;
    layout->insertRow(0, "URL: ", address_box);

    main->addItem(layout);
    main->addWidget(helpContent);

    QWidget *central = new QWidget(this);
    central->setLayout(main);

    setCentralWidget(central);
    setWindowTitle(tr("Assistant"));

    connect(helpContent, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
}
Exemplo n.º 10
0
BasicHeader::BasicHeader( QWidget* parent )
    : QWidget( parent )
{
    QLayout* l = new QVBoxLayout;
    TomahawkUtils::unmarginLayout( l );
    setLayout( l );

    m_mainLayout = new QHBoxLayout;

    m_imageLabel = new QLabel( this );
    m_imageLabel->setFixedSize( 48, 48 );
    m_mainLayout->addWidget( m_imageLabel );
    m_mainLayout->addSpacing( 8 );

    m_verticalLayout = new QVBoxLayout;
    m_mainLayout->addLayout( m_verticalLayout );

    m_captionLabel = new ElidedLabel( this );
    m_descriptionLabel = new ElidedLabel( this );
    m_verticalLayout->addWidget( m_captionLabel );
    m_verticalLayout->addWidget( m_descriptionLabel );
    m_verticalLayout->addStretch();

    m_mainLayout->addSpacing( 8 );
    m_mainLayout->setStretchFactor( m_verticalLayout, 2 );

    QPalette pal = palette();
    pal.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
    pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );

    m_captionLabel->setPalette( pal );
    m_descriptionLabel->setPalette( pal );

    QFont font = m_captionLabel->font();
    font.setPointSize( TomahawkUtils::defaultFontSize() + 4 );
    font.setBold( true );
    m_captionLabel->setFont( font );
    m_captionLabel->setElideMode( Qt::ElideRight );
    m_captionLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft );

    font.setPointSize( TomahawkUtils::defaultFontSize() + 1 );
    font.setBold( false );
    m_descriptionLabel->setFont( font );
    m_descriptionLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft );

    m_captionLabel->setMargin( 2 );
    m_descriptionLabel->setMargin( 2 );

/*    QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
    effect->setBlurRadius( 4 );
    effect->setXOffset( 0 );
    effect->setYOffset( 0 );
    effect->setColor( Qt::white );
    m_captionLabel->setGraphicsEffect( effect );*/
//    m_descriptionLabel->setGraphicsEffect( effect );

    QFrame* lineAbove = new QFrame( this );
    lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
    lineAbove->setFrameShape( QFrame::HLine );
    lineAbove->setMaximumHeight( 1 );
    QFrame* lineBelow = new QFrame( this );
    lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
    lineBelow->setFrameShape( QFrame::HLine );
    lineBelow->setMaximumHeight( 1 );

    l->addItem( m_mainLayout );
    l->addWidget( lineAbove );
    l->addWidget( lineBelow );

    TomahawkUtils::unmarginLayout( m_mainLayout );
    m_mainLayout->setContentsMargins( 8, 4, 8, 4 );
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
    setFixedHeight( 58 );

    setAutoFillBackground( true );
    setPalette( pal );
}
Exemplo n.º 11
0
MainWindowMobile::MainWindowMobile(QWidget * parent)
    : PlugGui::Container(parent)
    , m_networkAccessManager(new QNetworkAccessManager)
    , m_pictureSearch(0)
    , m_sceneView(0)
    , m_topbarContainer(0)
{
    // setup widget
    applianceSetTitle(QString());

    // vertical layout
    QVBoxLayout * mainLayout = new QVBoxLayout(this);
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    // container for the navigation bar
    QWidget * nbContainer = new NavibarContainer(this);
    mainLayout->addWidget(nbContainer);
    QLayout * nbLayout = new QHBoxLayout(nbContainer);
    nbLayout->setMargin(0);

    // create the Workflow navigation bar
    BreadCrumbBar * workflowBar = new BreadCrumbBar(nbContainer);
    workflowBar->setObjectName(QString::fromUtf8("applianceNavBar"));
    workflowBar->setClickableLeaves(false);
    workflowBar->setBackgroundOffset(-1);
    nbLayout->addWidget(workflowBar);
    workflowBar->show();

    nbLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));

    // create the exit button on the right side
    BreadCrumbBar * exitBar = new BreadCrumbBar(nbContainer);
    connect(exitBar, SIGNAL(nodeClicked(quint32)), qApp, SLOT(quit()));
    exitBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
    exitBar->setBackgroundOffset(1);
    exitBar->addNode(1, tr("Exit"), 0);
    nbLayout->addWidget(exitBar);
    exitBar->show();

    // create the Help navigation bar
    /*BreadCrumbBar * helpBar = new BreadCrumbBar(m_sceneView);
    connect(helpBar, SIGNAL(nodeClicked(quint32)), this, SLOT(slotHelpBarClicked(quint32)));
    helpBar->setBackgroundOffset(1);
    helpBar->addNode(1, tr(" ? "), 0);
    helpBar->show();
    addNavigationWidget(helpBar, 0, Qt::AlignRight);*/

    // the scene view, where applicances will plug into!
    m_sceneView = new SceneView(this);
    mainLayout->addWidget(m_sceneView);
    m_sceneView->setFrameShape(QFrame::NoFrame);

    // the topbar container, populated by the framework
    m_topbarContainer = new TopbarContainer(m_sceneView);
    m_topbarContainer->setFixedHeight(App::TopBarHeight);
    m_topbarContainer->show();
    QHBoxLayout * topbarLayout = new QHBoxLayout(m_topbarContainer);
    topbarLayout->setMargin(0);
    topbarLayout->setSpacing(0);

    // show (with last geometry)
    showFullScreen();

    // start the workflow
    new Workflow((PlugGui::Container *)this, workflowBar);

    // create the online services
    new OnlineServices(m_networkAccessManager);

    // focus the scene
    applianceSetFocusToScene();

#if 0
    // start with the Help appliance the first time
    if (App::settings->firstTime())
        App::workflow->stackHelpAppliance();
#endif
}
Exemplo n.º 12
0
TransferDialog::TransferDialog( MediaDevice *mdev )
        : KDialogBase( Pana::mainWindow(), "transferdialog", true, QString::null, Ok|Cancel, Ok )
{
    m_dev = mdev;
    m_accepted = false;
    m_sort1LastIndex = m_sort2LastIndex = -1;

    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n( "Transfer Queue to Device" ) ) );

    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing( KDialog::spacingHint() );

    QString transferDir = mdev->getTransferDir();

    QGroupBox *location = new QGroupBox( 1, Qt::Vertical, i18n( "Music Location" ), vbox );

    new QLabel( i18n( "Your music will be transferred to:\n%1" )
                    .arg( transferDir ), location );

    QVBox *vbox2 = new QVBox( vbox );
    QSpacerItem *spacer = new QSpacerItem( 0, 25 );
    QLayout *vlayout = vbox2->layout();
    if( vlayout )
        vlayout->addItem( spacer );

    new QLabel( i18n( "You can have your music automatically grouped in\n"
                      "a variety of ways. Each grouping will create\n"
                      "directories based upon the specified criteria.\n"), vbox );

    QGroupBox *sorting = new QGroupBox( 6, Qt::Vertical, i18n( "Groupings" ), vbox );
    m_label1 = new QLabel( i18n( "Select first grouping:\n" ), sorting );
    m_sort1  = new KComboBox( sorting );
    m_label2 = new QLabel( i18n( "Select second grouping:\n" ), sorting );
    m_sort2  = new KComboBox( sorting );
    m_label3 = new QLabel( i18n( "Select third grouping:\n" ), sorting );
    m_sort3  = new KComboBox( sorting );

    m_combolist = new QPtrList<KComboBox>();
    m_combolist->append( m_sort1 );
    m_combolist->append( m_sort2 );
    m_combolist->append( m_sort3 );

    KComboBox * comboTemp;
    for( comboTemp = m_combolist->first(); comboTemp; comboTemp = m_combolist->next() )
    {
        comboTemp->insertItem( i18n("None") );
        comboTemp->insertItem( i18n("Artist") );
        comboTemp->insertItem( i18n("Album") );
        comboTemp->insertItem( i18n("Genre") );
        comboTemp->setCurrentItem( 0 );
    }

    m_sort1->setCurrentItem( mdev->m_firstSort );
    m_sort2->setCurrentItem( mdev->m_secondSort );
    m_sort3->setCurrentItem( mdev->m_thirdSort );

    m_label2->setDisabled( m_sort1->currentItem() == 0 );
    m_sort2->setDisabled( m_sort1->currentItem() == 0 );
    m_label3->setDisabled( m_sort2->currentItem() == 0 );
    m_sort3->setDisabled( m_sort2->currentItem() == 0 );

    connect( m_sort1, SIGNAL( activated(int) ), SLOT( sort1_activated(int)) );
    connect( m_sort2, SIGNAL( activated(int) ), SLOT( sort2_activated(int)) );

    QVBox *vbox3 = new QVBox( vbox );
    QSpacerItem *spacer2 = new QSpacerItem( 0, 25 );
    QLayout *vlayout2 = vbox3->layout();
    if( vlayout2 )
        vlayout2->addItem( spacer2 );

    QGroupBox *options = new QGroupBox( 6, Qt::Vertical, i18n( "Options" ), vbox );

    QCheckBox *convertSpaces = new QCheckBox( i18n( "Convert spaces to underscores" ), options );
    convertSpaces->setChecked( mdev->getSpacesToUnderscores() );

    connect( convertSpaces, SIGNAL( toggled(bool) ), this, SLOT( convertSpaces_toggled(bool) ) );
}
Exemplo n.º 13
0
EEPROMWindow::EEPROMWindow(QStringList eepromLines, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::EEPROMWindow)
{
    ui->setupUi(this);

    QSettings settings;
    firmware = settings.value("printer/firmware").toInt();

    QLayout *layout = new QVBoxLayout();

    if(firmware == Repetier)
    {
        int j = 0;
        foreach (QString str, eepromLines)
        {
            str.remove("EPR:"); // Clear the unneeded part

            repetierEEPROMline currentLine; //Storage for EEPROM values

            QStringList tmp = str.split(' ');

            currentLine.T = tmp.at(0).toInt();
            currentLine.P = tmp.at(1).toInt();
            currentLine.S = tmp.at(2);

            lines.append(currentLine);

            QString msg;
            for(int i = 3; i < tmp.size(); i++) msg+=(tmp.at(i) + " "); //Rejoin the rest

            QLayout *line = new QGridLayout();

            QLabel *label = new QLabel(msg, this);
            QLineEdit *edit = new QLineEdit(currentLine.S,this);

            QFrame* hline = new QFrame();
            hline->setFrameShape(QFrame::HLine);
            hline->setFrameShadow(QFrame::Sunken);
            line->addWidget(hline);

            edit->setObjectName("e"+QString::number(j)); //Name the LineEdit, so when it emits signal we know where it came from

            QRegExpValidator *doublevalidator = new QRegExpValidator(
                                                    QRegExp("^\\-?\\d+\\.?\\d+(e\\-?\\d+)?$",
                                                    Qt::CaseInsensitive), this);
            doublevalidator->setLocale(QLocale::English);

            switch(currentLine.T) // set right validator for the line
            {
            case 0:
                edit->setValidator(new QIntValidator(-128, 255, this));
            case 1:
            case 2:
                edit->setValidator(new QIntValidator(this));
                break;
            case 3:
                edit->setValidator(doublevalidator);
                break;
            default:
                break;
            }

            connect(edit, &QLineEdit::textChanged, this, &EEPROMWindow::lineChanged);

            line->addWidget(label);
            line->addWidget(edit);

            line->setMargin(2);

            layout->addItem(line);

            j++; // increase counter
        }
Exemplo n.º 14
0
void QERecipe::setOptionsLayout(int pValue)
{

    QLayout *qLayoutMain;
    QLayout *qLayoutChild;


    delete layout();


    //TODO: fix issue of buttons not being centered when using LEFT and RIGHT layout

    switch(pValue)
    {
        case TOP:
            optionsLayout = TOP;
            qLayoutMain = new QVBoxLayout(this);
            qLayoutChild = new QHBoxLayout();
            qLayoutChild->addWidget(qLabelRecipeDescription);
            qLayoutChild->addWidget(qComboBoxRecipeList);
            qLayoutChild->addWidget(qPushButtonNew);
            qLayoutChild->addWidget(qPushButtonSave);
            qLayoutChild->addWidget(qPushButtonDelete);
            qLayoutChild->addWidget(qPushButtonApply);
            qLayoutChild->addWidget(qPushButtonRead);
            qLayoutMain->addItem(qLayoutChild);
            qLayoutMain->addWidget(qEConfiguredLayoutRecipeFields);
            break;

        case BOTTOM:
            optionsLayout = BOTTOM;
            qLayoutMain = new QVBoxLayout(this);
            qLayoutMain->addWidget(qEConfiguredLayoutRecipeFields);
            qLayoutChild = new QHBoxLayout();
            qLayoutChild->addWidget(qLabelRecipeDescription);
            qLayoutChild->addWidget(qComboBoxRecipeList);
            qLayoutChild->addWidget(qPushButtonNew);
            qLayoutChild->addWidget(qPushButtonSave);
            qLayoutChild->addWidget(qPushButtonDelete);
            qLayoutChild->addWidget(qPushButtonApply);
            qLayoutChild->addWidget(qPushButtonRead);
            qLayoutMain->addItem(qLayoutChild);
            break;

        case LEFT:
            optionsLayout = LEFT;
            qLayoutMain = new QHBoxLayout(this);
            qLayoutChild = new QVBoxLayout();
            qLayoutChild->addWidget(qLabelRecipeDescription);
            qLayoutChild->addWidget(qComboBoxRecipeList);
            qLayoutChild->addWidget(qPushButtonNew);
            qLayoutChild->addWidget(qPushButtonSave);
            qLayoutChild->addWidget(qPushButtonDelete);
            qLayoutChild->addWidget(qPushButtonApply);
            qLayoutChild->addWidget(qPushButtonRead);
            qLayoutMain->addItem(qLayoutChild);
            qLayoutMain->addWidget(qEConfiguredLayoutRecipeFields);
            break;

        case RIGHT:
            optionsLayout = RIGHT;
            qLayoutMain = new QHBoxLayout(this);
            qLayoutChild = new QVBoxLayout();
            qLayoutChild->addWidget(qLabelRecipeDescription);
            qLayoutChild->addWidget(qComboBoxRecipeList);
            qLayoutChild->addWidget(qPushButtonNew);
            qLayoutChild->addWidget(qPushButtonSave);
            qLayoutChild->addWidget(qPushButtonDelete);
            qLayoutChild->addWidget(qPushButtonApply);
            qLayoutChild->addWidget(qPushButtonRead);
            qLayoutMain->addWidget(qEConfiguredLayoutRecipeFields);
            qLayoutMain->addItem(qLayoutChild);
    }

}
Exemplo n.º 15
0
void BookmarkWidget::setup(bool showButtons)
{
    regExp.setPatternSyntax(QRegExp::FixedString);
    regExp.setCaseSensitivity(Qt::CaseInsensitive);

    QLayout *vlayout = new QVBoxLayout(this);
    vlayout->setMargin(4);

    QLabel *label = new QLabel(tr("Filter:"), this);
    vlayout->addWidget(label);

    searchField = new QLineEdit(this);
    vlayout->addWidget(searchField);
    connect(searchField, SIGNAL(textChanged(QString)), this,
        SLOT(filterChanged()));

    treeView = new TreeView(this);
    vlayout->addWidget(treeView);

#ifdef Q_OS_MAC
#   define SYSTEM "mac"
#else
#   define SYSTEM "win"
#endif

    if (showButtons) {
        QLayout *hlayout = new QHBoxLayout();
        vlayout->addItem(hlayout);

        hlayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding));

        addButton = new QToolButton(this);
        addButton->setText(tr("Add"));
        addButton->setIcon(QIcon(QLatin1String(":/assistant-icons/addtab.png")));
        addButton->setAutoRaise(true);
        addButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        hlayout->addWidget(addButton);
        connect(addButton, SIGNAL(clicked()), this, SIGNAL(addBookmark()));

        removeButton = new QToolButton(this);
        removeButton->setText(tr("Remove"));
        removeButton->setIcon(QIcon(QLatin1String(":/assistant-icons/closetab.png")));
        removeButton->setAutoRaise(true);
        removeButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        hlayout->addWidget(removeButton);
        connect(removeButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
    }

    filterBookmarkModel = new QSortFilterProxyModel(this);
    treeView->setModel(filterBookmarkModel);

    treeView->setDragEnabled(true);
    treeView->setAcceptDrops(true);
    treeView->setAutoExpandDelay(1000);
    treeView->setDropIndicatorShown(true);
    treeView->header()->setVisible(false);
    treeView->viewport()->installEventFilter(this);
    treeView->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(treeView, SIGNAL(expanded(QModelIndex)), this,
        SLOT(expand(QModelIndex)));
    connect(treeView, SIGNAL(collapsed(QModelIndex)), this,
        SLOT(expand(QModelIndex)));
    connect(treeView, SIGNAL(activated(QModelIndex)), this,
        SLOT(activated(QModelIndex)));
    connect(treeView, SIGNAL(customContextMenuRequested(QPoint)),
        this, SLOT(customContextMenuRequested(QPoint)));

    filterBookmarkModel->setFilterKeyColumn(0);
    filterBookmarkModel->setDynamicSortFilter(true);
    filterBookmarkModel->setSourceModel(bookmarkManager->treeBookmarkModel());

    expandItems();
}
Exemplo n.º 16
0
TransferDialog::TransferDialog( MediaDevice *mdev )
        : KDialog( Amarok::mainWindow() )
{
    setModal( true );
    setButtons( Ok|Cancel );
    setDefaultButton( Ok );
    showButtonSeparator( true );

    m_dev = mdev;
    m_accepted = false;
    m_sort1LastIndex = m_sort2LastIndex = -1;

    kapp->setTopWidget( this );
    setCaption( KDialog::makeStandardCaption( i18n( "Transfer Queue to Device" ) ) );

    KVBox *vbox = new KVBox( this );
    setMainWidget( vbox );

    QString transferDir = mdev->getTransferDir();

    QGroupBox *location = new QGroupBox( i18n( "Music Location" ), vbox );
    location->setAlignment( Qt::Vertical );
    KVBox *locationLayout = new KVBox( location );

    new QLabel( i18n( "Your music will be transferred to:\n%1",
                    transferDir ),
                locationLayout );

    KVBox *vbox2 = new KVBox( vbox );
    QLayout *vlayout = vbox2->layout();
    if( vlayout )
        vlayout->addItem( new QSpacerItem( 0, 25 ) );

    new QLabel( i18n( "You can have your music automatically grouped in\n"
                      "a variety of ways. Each grouping will create\n"
                      "directories based upon the specified criteria.\n"), vbox );

    QGroupBox *sorting = new QGroupBox( i18n( "Groupings" ), vbox );
    sorting->setAlignment( Qt::Vertical );
    KVBox *sortingLayout = new KVBox( sorting );
    m_label1 = new QLabel( i18n( "Select first grouping:\n" ), sortingLayout );
    m_sort1  = new KComboBox( sortingLayout );
    m_label2 = new QLabel( i18n( "Select second grouping:\n" ), sortingLayout );
    m_sort2  = new KComboBox( sortingLayout );
    m_label3 = new QLabel( i18n( "Select third grouping:\n" ), sortingLayout );
    m_sort3  = new KComboBox( sortingLayout );

    m_combolist.append( m_sort1 );
    m_combolist.append( m_sort2 );
    m_combolist.append( m_sort3 );

    QListIterator<KComboBox *> it(m_combolist);
    while (it.hasNext()) {
        it.next()->addItem( i18n("None") );
        it.next()->addItem( i18n("Artist") );
        it.next()->addItem( i18n("Album") );
        it.next()->addItem( i18n("Genre") );
        it.next()->setCurrentItem( 0 );
    }

    m_sort1->setCurrentItem( mdev->m_firstSort );
    m_sort2->setCurrentItem( mdev->m_secondSort );
    m_sort3->setCurrentItem( mdev->m_thirdSort );

    m_label2->setDisabled( m_sort1->currentIndex() == 0 );
    m_sort2->setDisabled( m_sort1->currentIndex() == 0 );
    m_label3->setDisabled( m_sort2->currentIndex() == 0 );
    m_sort3->setDisabled( m_sort2->currentIndex() == 0 );

    connect( m_sort1, SIGNAL( activated(int) ), SLOT( sort1_activated(int)) );
    connect( m_sort2, SIGNAL( activated(int) ), SLOT( sort2_activated(int)) );

    KVBox *vbox3 = new KVBox( vbox );
    QLayout *vlayout2 = vbox3->layout();
    if( vlayout2 )
        vlayout2->addItem( new QSpacerItem( 0, 25 ) );

    QGroupBox *options = new QGroupBox( i18n( "Options" ), vbox );
    options->setAlignment( Qt::Vertical );
    KVBox *optionsLayout = new KVBox( options );

    QCheckBox *convertSpaces = new QCheckBox( i18n( "Convert spaces to underscores" ), optionsLayout );
    convertSpaces->setChecked( mdev->getSpacesToUnderscores() );

    connect( convertSpaces, SIGNAL( toggled(bool) ), this, SLOT( convertSpaces_toggled(bool) ) );
    connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
    connect(this,SIGNAL(cancelClicked()),this,SLOT(slotCancel()));
}