Beispiel #1
0
KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
    : KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
    QString wtstr;
    QBoxLayout *lay = new QVBoxLayout (this);

    windowsBox = new KButtonGroup(this);
    windowsBox->setTitle(i18n("Windows"));

    QBoxLayout *wLay = new QVBoxLayout (windowsBox);

    QBoxLayout *bLay = new QVBoxLayout;
    wLay->addLayout(bLay);

    opaque = new QCheckBox(i18n("Di&splay content in moving windows"), windowsBox);
    bLay->addWidget(opaque);
    opaque->setWhatsThis( i18n("Enable this option if you want a window's content to be fully shown"
                                  " while moving it, instead of just showing a window 'skeleton'. The result may not be satisfying"
                                  " on slow machines without graphic acceleration.") );

    resizeOpaqueOn = new QCheckBox(i18n("Display content in &resizing windows"), windowsBox);
    bLay->addWidget(resizeOpaqueOn);
    resizeOpaqueOn->setWhatsThis( i18n("Enable this option if you want a window's content to be shown"
                                          " while resizing it, instead of just showing a window 'skeleton'. The result may not be satisfying"
                                          " on slow machines.") );

    geometryTipOn = new QCheckBox(i18n("Display window &geometry when moving or resizing"), windowsBox);
    bLay->addWidget(geometryTipOn);
    geometryTipOn->setWhatsThis( i18n("Enable this option if you want a window's geometry to be displayed"
                                        " while it is being moved or resized. The window position relative"
                                        " to the top-left corner of the screen is displayed together with"
                                        " its size."));

    QGridLayout *rLay = new QGridLayout();
    bLay->addLayout(rLay);
    rLay->setColumnStretch(0,0);
    rLay->setColumnStretch(1,1);

    moveResizeMaximized = new QCheckBox( i18n("Allow moving and resizing o&f maximized windows"), windowsBox);
    bLay->addWidget(moveResizeMaximized);
    moveResizeMaximized->setWhatsThis( i18n("When enabled, this feature activates the border of maximized windows"
                                              " and allows you to move or resize them,"
                                              " just like for normal windows"));


    bLay->addSpacing(10);

    lay->addWidget(windowsBox);

    //iTLabel = new QLabel(i18n("  Allowed overlap:\n"
    //                         "(% of desktop space)"),
    //             plcBox);
    //iTLabel->setAlignment(AlignTop|AlignHCenter);
    //pLay->addWidget(iTLabel,1,1);

    //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
    //pLay->addWidget(interactiveTrigger,1,2);

    //pLay->addRowSpacing(2,KDialog::spacingHint());

    //lay->addWidget(plcBox);





    //CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
    MagicBox = new KButtonGroup(this);
    MagicBox->setTitle(i18n("Snap Zones"));
    QGridLayout *kLay = new QGridLayout(MagicBox);

    BrdrSnap = new KIntNumInput(10, MagicBox);
    BrdrSnap->setSpecialValueText( i18n("none") );
    BrdrSnap->setRange( 0, MAX_BRDR_SNAP);
    BrdrSnap->setSteps(1,10);
    BrdrSnap->setWhatsThis( i18n("Here you can set the snap zone for screen borders, i.e."
                                    " the 'strength' of the magnetic field which will make windows snap to the border when"
                                    " moved near it.") );
    BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    BrdrSnapLabel = new QLabel(i18n("&Border snap zone:"), this);
    BrdrSnapLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    BrdrSnapLabel->setBuddy(BrdrSnap);
    kLay->addWidget(BrdrSnapLabel, 0, 0);
    kLay->addWidget(BrdrSnap, 0, 1);

    WndwSnap = new KIntNumInput(10, MagicBox);
    WndwSnap->setSpecialValueText( i18n("none") );
    WndwSnap->setRange( 0, MAX_WNDW_SNAP);
    WndwSnap->setSteps(1,10);
    WndwSnap->setWhatsThis( i18n("Here you can set the snap zone for windows, i.e."
                                    " the 'strength' of the magnetic field which will make windows snap to each other when"
                                    " they are moved near another window.") );
    BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    WndwSnapLabel = new QLabel(i18n("&Window snap zone:"), this);
    WndwSnapLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    WndwSnapLabel->setBuddy(WndwSnap);
    kLay->addWidget(WndwSnapLabel, 1, 0);
    kLay->addWidget(WndwSnap, 1, 1);

    CntrSnap = new KIntNumInput(10, MagicBox);
    CntrSnap->setSpecialValueText( i18n("none") );
    CntrSnap->setRange( 0, MAX_CNTR_SNAP);
    CntrSnap->setSteps(1,10);
    CntrSnap->setWhatsThis( i18n("Here you can set the snap zone for the screen center, i.e."
                                    " the 'strength' of the magnetic field which will make windows snap to the center of"
                                    " the screen when moved near it.") );
    BrdrSnap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    CntrSnapLabel = new QLabel(i18n("&Center snap zone:"), this);
    CntrSnapLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    CntrSnapLabel->setBuddy(CntrSnap);
    kLay->addWidget(CntrSnapLabel, 2, 0);
    kLay->addWidget(CntrSnap, 2, 1);

    OverlapSnap=new QCheckBox(i18n("Snap windows onl&y when overlapping"),MagicBox);
    OverlapSnap->setWhatsThis( i18n("Here you can set that windows will be only"
                                       " snapped if you try to overlap them, i.e. they will not be snapped if the windows"
                                       " comes only near another window or border.") );
    kLay->addWidget(OverlapSnap, 3, 0, 1, 2);

    lay->addWidget(MagicBox);
    lay->addStretch();

    load();

    // Any changes goes to slotChanged()
    connect( opaque, SIGNAL(clicked()), SLOT(changed()));
    connect( resizeOpaqueOn, SIGNAL(clicked()), SLOT(changed()));
    connect( geometryTipOn, SIGNAL(clicked()), SLOT(changed()));
    connect( moveResizeMaximized, SIGNAL(toggled(bool)), SLOT(changed()));
    connect( BrdrSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
    connect( BrdrSnap, SIGNAL(valueChanged(int)), SLOT(slotBrdrSnapChanged(int)));
    connect( WndwSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
    connect( WndwSnap, SIGNAL(valueChanged(int)), SLOT(slotWndwSnapChanged(int)));
    connect( CntrSnap, SIGNAL(valueChanged(int)), SLOT(changed()));
    connect( CntrSnap, SIGNAL(valueChanged(int)), SLOT(slotCntrSnapChanged(int)));
    connect( OverlapSnap, SIGNAL(clicked()), SLOT(changed()));

    // To get suffix to BrdrSnap, WndwSnap and CntrSnap inputs with default values.
    slotBrdrSnapChanged(BrdrSnap->value());
    slotWndwSnapChanged(WndwSnap->value());
    slotCntrSnapChanged(CntrSnap->value());
}
Beispiel #2
0
// removed the LCD display over the slider - this is not good GUI design :) RNolden 051701
KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
    : KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
    QString wtstr;
    QBoxLayout *lay = new QVBoxLayout(this);
    QLabel *label;

    //iTLabel = new QLabel(i18n("  Allowed overlap:\n"
    //                         "(% of desktop space)"),
    //             plcBox);
    //iTLabel->setAlignment(AlignTop|AlignHCenter);
    //pLay->addWidget(iTLabel,1,1);

    //interactiveTrigger = new QSpinBox(0, 500, 1, plcBox);
    //pLay->addWidget(interactiveTrigger,1,2);

    //pLay->addRowSpacing(2,KDialog::spacingHint());

    //lay->addWidget(plcBox);

    // focus policy
    //fcsBox = new QGroupBox(i18n("Focus"),this);
    fcsBox = new QWidget(this);

    QGridLayout *gLay = new QGridLayout();

    fcsBox->setLayout( gLay );

    focusStealing = new QComboBox( this );
    focusStealing->addItem( i18nc( "Focus Stealing Prevention Level", "None" ));
    focusStealing->addItem( i18nc( "Focus Stealing Prevention Level", "Low" ));
    focusStealing->addItem( i18nc( "Focus Stealing Prevention Level", "Normal" ));
    focusStealing->addItem( i18nc( "Focus Stealing Prevention Level", "High" ));
    focusStealing->addItem( i18nc( "Focus Stealing Prevention Level", "Extreme" ));
    wtstr = i18n( "<p>This option specifies how much KWin will try to prevent unwanted focus stealing "
                  "caused by unexpected activation of new windows. (Note: This feature does not "
                  "work with the Focus Under Mouse or Focus Strictly Under Mouse focus policies.)"
                  "<ul>"
                  "<li><em>None:</em> Prevention is turned off "
                  "and new windows always become activated.</li>"
                  "<li><em>Low:</em> Prevention is enabled; when some window does not have support "
                  "for the underlying mechanism and KWin cannot reliably decide whether to "
                  "activate the window or not, it will be activated. This setting may have both "
                  "worse and better results than normal level, depending on the applications.</li>"
                  "<li><em>Normal:</em> Prevention is enabled.</li>"
                  "<li><em>High:</em> New windows get activated only if no window is currently active "
                  "or if they belong to the currently active application. This setting is probably "
                  "not really usable when not using mouse focus policy.</li>"
                  "<li><em>Extreme:</em> All windows must be explicitly activated by the user.</li>"
                  "</ul></p>"
                  "<p>Windows that are prevented from stealing focus are marked as demanding attention, "
                  "which by default means their taskbar entry will be highlighted. This can be changed "
                  "in the Notifications control module.</p>" );
    focusStealing->setWhatsThis( wtstr );
    connect(focusStealing, SIGNAL(activated(int)), SLOT(changed()));
    focusStealing->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    label = new QLabel(i18n("Focus stealing prevention level:"), this);
    label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    label->setBuddy(focusStealing);
    gLay->addWidget(label, 0, 0, 1, 2);
    gLay->addWidget(focusStealing, 0, 2);

    focusCombo =  new QComboBox(fcsBox);
    focusCombo->setEditable( false );
    focusCombo->addItem(i18n("Click to Focus"), CLICK_TO_FOCUS);
    focusCombo->addItem(i18n("Focus Follows Mouse"), FOCUS_FOLLOWS_MOUSE);
    focusCombo->addItem(i18n("Focus Under Mouse"), FOCUS_UNDER_MOUSE);
    focusCombo->addItem(i18n("Focus Strictly Under Mouse"), FOCUS_STRICTLY_UNDER_MOUSE);
    focusCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    label = new QLabel(i18n("&Policy:"), this);
    label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    label->setBuddy(focusCombo);
    gLay->addWidget(label, 1, 0, 1, 2);
    gLay->addWidget(focusCombo, 1, 2);


    // FIXME, when more policies have been added to KWin
    wtstr = i18n("The focus policy is used to determine the active window, i.e."
                                      " the window you can work in. <ul>"
                                      " <li><em>Click to focus:</em> A window becomes active when you click into it."
                                      " This is the behavior you might know from other operating systems.</li>"
                                      " <li><em>Focus follows mouse:</em> Moving the mouse pointer actively on to a"
                                      " normal window activates it. New windows will receive the focus,"
                                      " without you having to point the mouse at them explicitly."
                                      " Very practical if you are using the mouse a lot.</li>"
                                      " <li><em>Focus under mouse:</em> The window that happens to be under the"
                                      " mouse pointer is active. If the mouse points nowhere, the last window"
                                      " that was under the mouse has focus."
                                      " New windows will not automatically receive the focus.</li>"
                                      " <li><em>Focus strictly under mouse:</em> Only the window under the mouse pointer is"
                                      " active. If the mouse points nowhere, nothing has focus.</li>"
                                      " </ul>"
                                      "Note that 'Focus under mouse' and 'Focus strictly under mouse' prevent certain"
                                      " features such as the Alt+Tab walk through windows dialog in the KDE mode"
                                      " from working properly."
                         );
    focusCombo->setWhatsThis( wtstr);

    connect(focusCombo, SIGNAL(activated(int)), this, SLOT(focusPolicyChanged()) );

    // autoraise delay
    autoRaiseOn = new QCheckBox(fcsBox);
    connect(autoRaiseOn,SIGNAL(toggled(bool)), this, SLOT(autoRaiseOnTog(bool)));
    autoRaise = new KIntNumInput(500, fcsBox);
    autoRaise->setRange(0, 3000, 100);
    autoRaise->setSteps(100,100);
    autoRaise->setSuffix(i18n(" ms"));
    autoRaise->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    autoRaiseOnLabel = new QLabel(i18n("&Raise, with the following delay:"), this);
    autoRaiseOnLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    autoRaiseOnLabel->setBuddy(autoRaise);
    gLay->addWidget(autoRaiseOn, 2, 0);
    gLay->addWidget(autoRaiseOnLabel, 2, 1);
    gLay->addWidget(autoRaise, 2, 2);

    connect(focusCombo, SIGNAL(activated(int)), this, SLOT(setDelayFocusEnabled()) );

    delayFocusOn = new QCheckBox(fcsBox);
    connect(delayFocusOn,SIGNAL(toggled(bool)), this, SLOT(delayFocusOnTog(bool)));
    delayFocus = new KIntNumInput(500, fcsBox);
    delayFocus->setRange(0, 3000, 100);
    delayFocus->setSteps(100,100);
    delayFocus->setSuffix(i18n(" ms"));
    delayFocus->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    delayFocusOnLabel = new QLabel(i18n("Delay focus by:"), this);
    delayFocusOnLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    delayFocusOnLabel->setBuddy(delayFocus);
    gLay->addWidget(delayFocusOn, 3, 0);
    gLay->addWidget(delayFocusOnLabel, 3, 1);
    gLay->addWidget(delayFocus, 3, 2);

    clickRaiseOn = new QCheckBox(i18n("C&lick raises active window"), fcsBox);
    connect(clickRaiseOn,SIGNAL(toggled(bool)), this, SLOT(clickRaiseOnTog(bool)));
    gLay->addWidget(clickRaiseOn, 4, 0, 1, 3);

    autoRaiseOn->setWhatsThis( i18n("When this option is enabled, a window in the background will automatically"
                                       " come to the front when the mouse pointer has been over it for some time.") );
    wtstr = i18n("This is the delay after which the window that the mouse pointer is over will automatically"
                 " come to the front.");
    autoRaise->setWhatsThis( wtstr );

    clickRaiseOn->setWhatsThis( i18n("When this option is enabled, the active window will be brought to the"
                                        " front when you click somewhere into the window contents. To change"
                                        " it for inactive windows, you need to change the settings"
                                        " in the Actions tab.") );

    delayFocusOn->setWhatsThis( i18n("When this option is enabled, there will be a delay after which the"
                                        " window the mouse pointer is over will become active (receive focus).") );
    delayFocus->setWhatsThis( i18n("This is the delay after which the window the mouse pointer is over"
                                       " will automatically receive focus.") );

    separateScreenFocus = new QCheckBox( i18n( "S&eparate screen focus" ), fcsBox );
    gLay->addWidget(separateScreenFocus, 5, 0, 1, 3);
    wtstr = i18n( "When this option is enabled, focus operations are limited only to the active Xinerama screen" );
    separateScreenFocus->setWhatsThis( wtstr );

    activeMouseScreen = new QCheckBox( i18n( "Active screen follows &mouse" ), fcsBox );
    gLay->addWidget(activeMouseScreen, 6, 0, 1, 3);
    wtstr = i18n( "When this option is enabled, the active Xinerama screen (where new windows appear, for example)"
                  " is the screen containing the mouse pointer. When disabled, the active Xinerama screen is the "
                  " screen containing the focused window. By default this option is disabled for Click to focus and"
                  " enabled for other focus policies." );
    activeMouseScreen->setWhatsThis( wtstr );
    connect(focusCombo, SIGNAL(activated(int)), this, SLOT(updateActiveMouseScreen()));

    if (Kephal::ScreenUtils::numScreens() == 1) // No Ximerama 
    {
        separateScreenFocus->hide();
        activeMouseScreen->hide();
    }

    lay->addWidget(fcsBox);





    kbdBox = new KButtonGroup(this);
    kbdBox->setTitle(i18nc("@title:group", "Window Switching"));
    QVBoxLayout *kLay = new QVBoxLayout(kbdBox);

    altTabPopup = new QCheckBox( i18n("Show window list while switching windows"), kbdBox );
    kLay->addWidget( altTabPopup );

    wtstr = i18n("Hold down the Alt key and press the Tab key repeatedly to walk"
                 " through the windows on the current desktop (the Alt+Tab"
                 " combination can be reconfigured).\n\n"
                 "If this checkbox is checked"
                 " a popup widget is shown, displaying the icons of all windows to"
                 " walk through and the title of the currently selected one.\n\n"
                 "Otherwise, the focus is passed to a new window each time Tab"
                 " is pressed, with no popup widget.  In addition, the previously"
                 " activated window will be sent to the back in this mode.");
    altTabPopup->setWhatsThis( wtstr );
    connect(focusCombo, SIGNAL(activated(int)), this, SLOT(updateAltTabMode()));
    kLay->addWidget(altTabPopup);

    traverseAll = new QCheckBox( i18n( "&Traverse windows on all desktops" ), kbdBox );
    kLay->addWidget( traverseAll );

    wtstr = i18n( "Leave this option disabled if you want to limit walking through"
                  " windows to the current desktop." );
    traverseAll->setWhatsThis( wtstr );
    kLay->addWidget(traverseAll);

    rollOverDesktops = new QCheckBox( i18n("Desktop navi&gation wraps around"), kbdBox );
    kLay->addWidget(rollOverDesktops);

    wtstr = i18n( "Enable this option if you want keyboard or active desktop border navigation beyond"
                  " the edge of a desktop to take you to the opposite edge of the new desktop." );
    rollOverDesktops->setWhatsThis( wtstr );
    kLay->addWidget(rollOverDesktops);

    showPopupinfo = new QCheckBox( i18n("Popup desktop name on desktop &switch"), kbdBox );
    kLay->addWidget(showPopupinfo);

    wtstr = i18n( "Enable this option if you wish to see the current desktop"
                  " name popup whenever the current desktop is changed." );
    showPopupinfo->setWhatsThis( wtstr );
    kLay->addWidget(showPopupinfo);

    lay->addWidget(kbdBox);

    lay->addStretch();

    // Any changes goes to slotChanged()
    connect(focusCombo, SIGNAL(activated(int)), SLOT(changed()));
    connect(autoRaiseOn,SIGNAL(clicked()), SLOT(changed()));
    connect(delayFocusOn, SIGNAL(clicked()), SLOT(changed()));
    connect(clickRaiseOn, SIGNAL(clicked()), SLOT(changed()));
    connect(autoRaise, SIGNAL(valueChanged(int)), SLOT(changed()));
    connect(delayFocus, SIGNAL(valueChanged(int)), SLOT(changed()));
    connect(separateScreenFocus, SIGNAL(clicked()), SLOT(changed()));
    connect(activeMouseScreen, SIGNAL(clicked()), SLOT(changed()));
    connect(altTabPopup, SIGNAL(clicked()), SLOT(changed()));
    connect(traverseAll, SIGNAL(clicked()), SLOT(changed()));
    connect(rollOverDesktops, SIGNAL(clicked()), SLOT(changed()));
    connect(showPopupinfo, SIGNAL(clicked()), SLOT(changed()));

    load();
}
Beispiel #3
0
/******************************************************************************
*  Display the Find dialog.
*/
void Find::display()
{
    if(!mOptions)
        // Set defaults the first time the Find dialog is activated
        mOptions = FIND_LIVE | FIND_EXPIRED | FIND_MESSAGE | FIND_FILE | FIND_COMMAND | FIND_EMAIL;
    bool noExpired = !Preferences::expiredKeepDays();
    bool showExpired = mListView->isA("AlarmListView") && ((AlarmListView *)mListView)->showingExpired();
    if(noExpired  ||  !showExpired)       // these settings could change between activations
        mOptions &= ~FIND_EXPIRED;

    if(mDialog)
    {
        KWin::activateWindow(mDialog->winId());
    }
    else
    {
#ifdef MODAL_FIND
        mDialog = new KFindDialog(mListView, "FindDlg", mOptions, mHistory, (mListView->selectedCount() > 1));
#else
        mDialog = new KFindDialog(false, mListView, "FindDlg", mOptions, mHistory, (mListView->selectedCount() > 1));
#endif
        mDialog->setHasSelection(false);
        QWidget *kalarmWidgets = mDialog->findExtension();

        // Alarm types
        QBoxLayout *layout = new QVBoxLayout(kalarmWidgets, 0, KDialog::spacingHint());
        QGroupBox *group = new QGroupBox(i18n("Alarm Type"), kalarmWidgets);
        layout->addWidget(group);
        QGridLayout *grid = new QGridLayout(group, 2, 2, KDialog::marginHint(), KDialog::spacingHint());
        grid->addRowSpacing(0, mDialog->fontMetrics().lineSpacing() / 2);
        grid->setColStretch(1, 1);

        // Live & expired alarm selection
        mLive = new QCheckBox(i18n("Acti&ve"), group);
        mLive->setFixedSize(mLive->sizeHint());
        QWhatsThis::add(mLive, i18n("Check to include active alarms in the search."));
        grid->addWidget(mLive, 1, 0, Qt::AlignAuto);

        mExpired = new QCheckBox(i18n("Ex&pired"), group);
        mExpired->setFixedSize(mExpired->sizeHint());
        QWhatsThis::add(mExpired,
                        i18n("Check to include expired alarms in the search. "
                             "This option is only available if expired alarms are currently being displayed."));
        grid->addWidget(mExpired, 1, 2, Qt::AlignAuto);

        mActiveExpiredSep = new KSeparator(Qt::Horizontal, kalarmWidgets);
        grid->addMultiCellWidget(mActiveExpiredSep, 2, 2, 0, 2);

        // Alarm actions
        mMessageType = new QCheckBox(i18n("Text"), group, "message");
        mMessageType->setFixedSize(mMessageType->sizeHint());
        QWhatsThis::add(mMessageType, i18n("Check to include text message alarms in the search."));
        grid->addWidget(mMessageType, 3, 0);

        mFileType = new QCheckBox(i18n("Fi&le"), group, "file");
        mFileType->setFixedSize(mFileType->sizeHint());
        QWhatsThis::add(mFileType, i18n("Check to include file alarms in the search."));
        grid->addWidget(mFileType, 3, 2);

        mCommandType = new QCheckBox(i18n("Co&mmand"), group, "command");
        mCommandType->setFixedSize(mCommandType->sizeHint());
        QWhatsThis::add(mCommandType, i18n("Check to include command alarms in the search."));
        grid->addWidget(mCommandType, 4, 0);

        mEmailType = new QCheckBox(i18n("&Email"), group, "email");
        mEmailType->setFixedSize(mEmailType->sizeHint());
        QWhatsThis::add(mEmailType, i18n("Check to include email alarms in the search."));
        grid->addWidget(mEmailType, 4, 2);

        // Set defaults
        mLive->setChecked(mOptions & FIND_LIVE);
        mExpired->setChecked(mOptions & FIND_EXPIRED);
        mMessageType->setChecked(mOptions & FIND_MESSAGE);
        mFileType->setChecked(mOptions & FIND_FILE);
        mCommandType->setChecked(mOptions & FIND_COMMAND);
        mEmailType->setChecked(mOptions & FIND_EMAIL);

#ifndef MODAL_FIND
        connect(mDialog, SIGNAL(okClicked()), this, SLOT(slotFind()));
#endif
    }

    // Only display active/expired options if expired alarms are being kept
    if(noExpired)
    {
        mLive->hide();
        mExpired->hide();
        mActiveExpiredSep->hide();
    }
    else
    {
        mLive->show();
        mExpired->show();
        mActiveExpiredSep->show();
    }

    // Disable options where no displayed alarms match them
    bool live    = false;
    bool expired = false;
    bool text    = false;
    bool file    = false;
    bool command = false;
    bool email   = false;
    for(EventListViewItemBase *item = mListView->firstChild();  item;  item = item->nextSibling())
    {
        const KAEvent &event = item->event();
        if(event.expired())
            expired = true;
        else
            live = true;
        switch(event.action())
        {
            case KAEvent::MESSAGE:
                text    = true;
                break;
            case KAEvent::FILE:
                file    = true;
                break;
            case KAEvent::COMMAND:
                command = true;
                break;
            case KAEvent::EMAIL:
                email   = true;
                break;
        }
    }
    mLive->setEnabled(live);
    mExpired->setEnabled(expired);
    mMessageType->setEnabled(text);
    mFileType->setEnabled(file);
    mCommandType->setEnabled(command);
    mEmailType->setEnabled(email);

    mDialog->setHasCursor(mListView->currentItem());
#ifdef MODAL_FIND
    if(mDialog->exec() == QDialog::Accepted)
        slotFind();
    else
        delete mDialog;
#else
    mDialog->show();
#endif
}
Beispiel #4
0
SidePanel::SidePanel(QWidget *parent_) : 
    QWidget(parent_),
	m_paused(true),
    m_gridWidth(defaultGridSize[0]),
    m_gridHeight(defaultGridSize[1]),
    m_gridLength(defaultGridSize[2]),
    m_argsMap(0),
    m_varsMap(0),
    m_initialCondsMap(0),
	m_defaultCondsMap(0),
    m_saveDirectory(""),
    initDialog(0),
    paramsDialog(0)
{

    // Get parent
    MainWindow *mainWin = qobject_cast<MainWindow *>(parent_);
    if (!mainWin)
        log4cpp::log_console->errorStream() << "SidePanel does not have a parent !";

    this->setStyleSheet("QWidget {background-color: white;}");
    this->setAutoFillBackground(true);

    // GroupBox
    QGroupBox *modelGroupBox = new QGroupBox("Model options");
    QGroupBox *runGroupBox = new QGroupBox("Runtime options");
    QGroupBox *renderOptionsGroupBox = new QGroupBox("Rendering options");

    modelGroupBox->setStyleSheet(
										"QGroupBox {"
										"    border: 1px solid gray;"
										"    border-radius: 9px;"
										"    margin-top: 0.5em;"
										"}"
										""
										"QGroupBox::title {"
										"    subcontrol-origin: margin;"
										"    left: 20px;"
										"    padding: 0 3px 0 3px;"
										"}");
    runGroupBox->setStyleSheet(
										"QGroupBox {"
										"    border: 1px solid gray;"
										"    border-radius: 9px;"
										"    margin-top: 0.5em;"
										"}"
										""
										"QGroupBox::title {"
										"    subcontrol-origin: margin;"
										"    left: 20px;"
										"    padding: 0 3px 0 3px;"
										"}");
    renderOptionsGroupBox->setStyleSheet(
										"QGroupBox {"
										"    border: 1px solid gray;"
										"    border-radius: 9px;"
										"    margin-top: 0.5em;"
										"}"
										""
										"QGroupBox::title {"
										"    subcontrol-origin: margin;"
										"    left: 20px;"
										"    padding: 0 3px 0 3px;"
										"}");
    
    // Layouts
    QBoxLayout *globalLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
    QGridLayout *modelLayout = new QGridLayout(modelGroupBox);
    QGridLayout *runLayout = new QGridLayout(runGroupBox);
    QGridLayout *renderOptionsLayout = new QGridLayout(renderOptionsGroupBox);

    this->setLayout(globalLayout);
    modelGroupBox->setLayout(modelLayout);
    runGroupBox->setLayout(runLayout);
    renderOptionsGroupBox->setLayout(renderOptionsLayout);

    //----//

    // Labels for model
    QLabel *modelLabel = new QLabel("Selected model :");
    QLabel *iterLabel = new QLabel("Iterations :");
    
    // Dropdown list
    modelComboBox = new QComboBox;
    modelComboBox->addItems(SidePanel::modelsList);
    connect(modelComboBox, SIGNAL(currentIndexChanged(int)), mainWin, SLOT(changeModel(int)));
    connect(modelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshParameters(int)));

    // Iterations spinBox
    iterSpinBox = new QSpinBox();
    iterSpinBox->setRange(1, 1000000);
    iterSpinBox->setSingleStep(defaultNumberOfSteps/10);
    iterSpinBox->setValue(defaultNumberOfSteps);
    connect(iterSpinBox, SIGNAL(valueChanged(int)), mainWin, SLOT(changeNbIter(int)));
    //connect(iterSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeNbIterSlider(int)));

    // Buttons for model parameters and model initialization with QDialog
    initButton = new QPushButton("Initialization");
    connect(initButton, SIGNAL(clicked()), this, SLOT(openInitDialog()));
    paramsButton = new QPushButton("Parameters");
    connect(paramsButton, SIGNAL(clicked()), this, SLOT(openParametersDialog()));
    
    //---

    // Buttons
    startButton = new QPushButton("Start");
    connect(startButton, SIGNAL(clicked()), this, SLOT(start_pause_resume()));
    connect(this, SIGNAL(startPushed()), mainWin, SLOT(startComputing()));
    connect(this, SIGNAL(pauseOrResumePushed(bool)), mainWin, SLOT(pauseComputing(bool)));
    stopButton = new QPushButton("Stop");
    stopButton->setEnabled(false);
    connect(stopButton, SIGNAL(clicked()), mainWin, SLOT(stopComputing()));
    connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));

    // Checkbox for saving option
    saveDirCheckBox = new QCheckBox("Save data");
    saveDirCheckBox->setChecked(false);

    // Button for QFileDialog
    saveDirButton = new QPushButton("Choose saving directory");
    connect(saveDirButton, SIGNAL(clicked()), this, SLOT(changeDirectory()));

    // Steps to skip Label
    QLabel *saveStepsLabel = new QLabel("Steps between saves :");

    // Steps to skip Spinbox
    saveStepsSpinBox = new QSpinBox();
    saveStepsSpinBox->setRange(1, 1000000);
    saveStepsSpinBox->setSingleStep(1);
    saveStepsSpinBox->setValue(defaultNbStepsToSave);
    connect(saveStepsSpinBox, SIGNAL(valueChanged(int)), mainWin, SLOT(changeNbStepsToSave(int)));

    //---

    // Labels and lists for variables to display
    QLabel *variablesRenderedLabel = new QLabel("Variables rendered :");
    variablesRenderedList = new QListWidget;
    variablesRenderedList->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
    variablesRenderedList->setMinimumSize(QSize(30,100)); //modify if needed (height = nItems * cst?)
    connect(variablesRenderedList, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(updateRenderedVars(QListWidgetItem *)));

    // Rendering colormap label & dropdown list
    QLabel *colorLabel = new QLabel("Colormap :");
    QComboBox *colorComboBox = new QComboBox;
    std::map<std::string, std::pair<unsigned int, float*>> colormap = ColorMap::multiHueColorMaps();
    for (auto it = colormap.begin(); it != colormap.end(); ++it) {
        colorComboBox->addItem(QString(it->first.c_str()));
    }
    connect(colorComboBox, SIGNAL(currentIndexChanged(const QString &)), mainWin, SLOT(changeColormap(const QString &)));

    // Auto rendering checkbox
    QCheckBox *autoRenderCheckBox = new QCheckBox("Automatic rendering");
    autoRenderCheckBox->setChecked(true);
    connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), mainWin, SLOT(changeAutoRendering(int)));
    connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showSlider(int)));
    autoRenderCheckBox->setVisible(false);
    
    // Iteration selection slider
    gridSlider = new QSlider(Qt::Horizontal);
    gridSlider->setRange(1, 100); // to be updated when iterSpinBox changes value
    gridSlider->setPageStep(5);
    gridSlider->setSingleStep(1);
    gridSlider->setTracking(false);
    gridSlider->setValue(1);
    gridSlider->hide();
    connect(gridSlider, SIGNAL(valueChanged(int)), mainWin, SLOT(changeDisplayedGrid(int)));
    
    //----//

    // Add Widgets
    globalLayout->setSpacing(30);
    globalLayout->addWidget(modelGroupBox);
    globalLayout->addWidget(runGroupBox);
    globalLayout->addWidget(renderOptionsGroupBox);

    modelLayout->setSpacing(10);
    modelLayout->addWidget(modelLabel, 0, 0);
    modelLayout->addWidget(modelComboBox, 0, 1);
    modelLayout->addWidget(iterLabel, 1, 0);
    modelLayout->addWidget(iterSpinBox, 1, 1);
    modelLayout->addWidget(initButton, 2, 0);
    modelLayout->addWidget(paramsButton, 2, 1);

    runLayout->setSpacing(10);
    runLayout->addWidget(startButton, 0, 0, 1, 2);
    runLayout->addWidget(stopButton, 1, 0, 1, 2);
    runLayout->addWidget(saveDirCheckBox, 2, 0);
    runLayout->addWidget(saveDirButton, 2, 1);
    runLayout->addWidget(saveStepsLabel, 3, 0);
    runLayout->addWidget(saveStepsSpinBox, 3, 1);

    renderOptionsLayout->setSpacing(10);
    renderOptionsLayout->addWidget(variablesRenderedLabel, 0, 0);
    renderOptionsLayout->addWidget(variablesRenderedList, 0, 1);
    renderOptionsLayout->addWidget(colorLabel, 1, 0);
    renderOptionsLayout->addWidget(colorComboBox,1 , 1);
    renderOptionsLayout->addWidget(autoRenderCheckBox, 2, 0);
    renderOptionsLayout->addWidget(gridSlider, 2, 1);
    
    // Init m_argsMap and m_varsMap
    refreshParameters(modelComboBox->currentIndex());
}
Beispiel #5
0
SeExprEdColorCurve::SeExprEdColorCurve(QWidget* parent, QString pLabel, QString vLabel, QString iLabel,
    bool expandable) :
    QWidget(parent),  _scene(0), _selPosEdit(0), _selValEdit(0), _interpComboBox(0)
{
    Q_UNUSED(iLabel);
    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->setSpacing(2);
    mainLayout->setMargin(5);

    QWidget *edits = new QWidget;
    QVBoxLayout *editsLayout = new QVBoxLayout;
    editsLayout->setAlignment(Qt::AlignTop);
    editsLayout->setSpacing(0);
    editsLayout->setMargin(0);
    edits->setLayout(editsLayout);

    QWidget *selPos = new QWidget;
    QHBoxLayout *selPosLayout = new QHBoxLayout;
    selPosLayout->setSpacing(1);
    selPosLayout->setMargin(1);
    selPos->setLayout(selPosLayout);
    _selPosEdit = new QLineEdit;
    QDoubleValidator *posValidator = new QDoubleValidator(0.0,1.0,6,_selPosEdit);
    _selPosEdit->setValidator(posValidator);
    _selPosEdit->setFixedWidth(38);
    _selPosEdit->setFixedHeight(20);
    selPosLayout->addStretch(50);
    QLabel *posLabel;
    if (pLabel.isEmpty()) {
        posLabel = new QLabel("Selected Position:  ");
    } else {
        posLabel = new QLabel(pLabel);
    }
    selPosLayout->addWidget(posLabel);
    selPosLayout->addWidget(_selPosEdit);

    QWidget *selVal = new QWidget;
    QBoxLayout *selValLayout = new QHBoxLayout;
    selValLayout->setSpacing(1);
    selValLayout->setMargin(1);
    selVal->setLayout(selValLayout);
    _selValEdit = new SeExprEdCSwatchFrame(SeVec3d(.5));
    _selValEdit->setFixedWidth(38);
    _selValEdit->setFixedHeight(20);
    selValLayout->addStretch(50);
    QLabel *valLabel;
    if (vLabel.isEmpty()) {
        valLabel = new QLabel("Selected Color:  ");
    } else {
        valLabel = new QLabel(vLabel);
    }
    selValLayout->addWidget(valLabel);
    selValLayout->addWidget(_selValEdit);

    _interpComboBox = new QComboBox;
    _interpComboBox->addItem("None");
    _interpComboBox->addItem("Linear");
    _interpComboBox->addItem("Smooth");
    _interpComboBox->addItem("Spline");
    _interpComboBox->addItem("MSpline");
    _interpComboBox->setCurrentIndex(4);
    _interpComboBox->setFixedWidth(70);
    _interpComboBox->setFixedHeight(20);

    editsLayout->addWidget(selPos);
    editsLayout->addWidget(selVal);
    editsLayout->addWidget(_interpComboBox);

    QFrame *curveFrame = new QFrame;
    curveFrame->setFrameShape(QFrame::Panel);
    curveFrame->setFrameShadow(QFrame::Sunken);
    curveFrame->setLineWidth(1);
    QHBoxLayout *curveFrameLayout = new QHBoxLayout;
    curveFrameLayout->setMargin(0);
    CurveGraphicsView *curveView = new CurveGraphicsView;
    curveView->setFrameShape(QFrame::Panel);
    curveView->setFrameShadow(QFrame::Sunken);
    curveView->setLineWidth(1);
    curveView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    curveView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    _scene = new CCurveScene;
    curveView->setScene(_scene);
    curveView->setTransform(QTransform().scale(1, -1));
    curveView->setRenderHints(QPainter::Antialiasing);
    curveFrameLayout->addWidget(curveView);
    curveFrame->setLayout(curveFrameLayout);

    mainLayout->addWidget(edits);
    mainLayout->addWidget(curveFrame);
    if(expandable){
        QPushButton* expandButton=new QPushButton(">");
        expandButton->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
        expandButton->setFixedWidth(15);
        mainLayout->addWidget(expandButton);
        // open a the detail widget when clicked
        connect(expandButton, SIGNAL(clicked()), this, SLOT(openDetail()));
    }
    mainLayout->setStretchFactor(curveFrame,100);
    setLayout(mainLayout);

    // SIGNALS

    // when a user selects a cv, update the fields on left
    connect(_scene, SIGNAL(cvSelected(double, SeVec3d, T_INTERP)), this, SLOT(cvSelectedSlot(double, SeVec3d, T_INTERP)));
    // when a user selects a different interp, the curve has to redraw
    connect(_interpComboBox, SIGNAL(activated(int)), _scene, SLOT(interpChanged(int)));
    // when a user types a different position, the curve has to redraw
    connect(_selPosEdit, SIGNAL(returnPressed()), this, SLOT(selPosChanged()));
    connect(this, SIGNAL(selPosChangedSignal(double)), _scene, SLOT(selPosChanged(double)));
    // when a user selects a different color, the ramp has to redraw
    connect(_selValEdit, SIGNAL(selValChangedSignal(SeVec3d)), _scene, SLOT(selValChanged(SeVec3d)));
    connect(_selValEdit, SIGNAL(swatchChanged(QColor)), this, SLOT(internalSwatchChanged(QColor)));
    // when the widget is resized, resize the curve widget
    connect(curveView, SIGNAL(resizeSignal(int, int)), _scene, SLOT(resize(int, int)));
}
Beispiel #6
0
TupCanvas::TupCanvas(QWidget *parent, Qt::WindowFlags flags, TupGraphicsScene *scene, 
                   const QPointF centerPoint, const QSize &screenSize, TupProject *project, double scaleFactor,
                   int angle, TupBrushManager *brushManager) : QFrame(parent, flags), k(new Private)
{
    setWindowTitle(tr("Tupi: Open 2D Magic"));
    setWindowIcon(QIcon(QPixmap(THEME_DIR + "icons/animation_mode.png")));

    k->scene = scene;
    k->size = project->dimension();
    k->currentColor = brushManager->penColor();
    k->brushManager = brushManager;
    k->project = project;

    graphicsView = new TupCanvasView(this, screenSize, k->size, project->bgColor());

    graphicsView->setScene(scene);
    graphicsView->centerOn(centerPoint);
    graphicsView->scale(scaleFactor, scaleFactor);
    graphicsView->rotate(angle);

    TImageButton *pencil = new TImageButton(QPixmap(THEME_DIR + "icons/pencil_big.png"), 40, this, true);
    pencil->setToolTip(tr("Pencil"));
    connect(pencil, SIGNAL(clicked()), this, SLOT(wakeUpPencil()));

    TImageButton *ink = new TImageButton(QPixmap(THEME_DIR + "icons/ink_big.png"), 40, this, true);
    ink->setToolTip(tr("Ink"));
    connect(ink, SIGNAL(clicked()), this, SLOT(wakeUpInk()));

    /*
    TImageButton *polyline = new TImageButton(QPixmap(THEME_DIR + "icons/polyline_big.png"), 40, this, true);
    polyline->setToolTip(tr("Polyline"));
    connect(polyline, SIGNAL(clicked()), this, SLOT(wakeUpPolyline()));
    */

    TImageButton *ellipse = new TImageButton(QPixmap(THEME_DIR + "icons/ellipse_big.png"), 40, this, true);
    ellipse->setToolTip(tr("Ellipse"));
    connect(ellipse, SIGNAL(clicked()), this, SLOT(wakeUpEllipse()));

    TImageButton *rectangle = new TImageButton(QPixmap(THEME_DIR + "icons/square_big.png"), 40, this, true);
    rectangle->setToolTip(tr("Rectangle"));
    connect(rectangle, SIGNAL(clicked()), this, SLOT(wakeUpRectangle()));

    TImageButton *images = new TImageButton(QPixmap(THEME_DIR + "icons/bitmap_big.png"), 40, this, true);
    images->setToolTip(tr("Images"));
    connect(images, SIGNAL(clicked()), this, SLOT(wakeUpLibrary()));

    TImageButton *objects = new TImageButton(QPixmap(THEME_DIR + "icons/selection_big.png"), 40, this, true);
    objects->setToolTip(tr("Object Selection"));
    connect(objects, SIGNAL(clicked()), this, SLOT(wakeUpObjectSelection()));

    TImageButton *nodes = new TImageButton(QPixmap(THEME_DIR + "icons/nodes_big.png"), 40, this, true);
    nodes->setToolTip(tr("Line Selection"));
    connect(nodes, SIGNAL(clicked()), this, SLOT(wakeUpNodeSelection()));

    TImageButton *trash = new TImageButton(QPixmap(THEME_DIR + "icons/delete_big.png"), 40, this, true);
    trash->setToolTip(tr("Delete Selection"));
    connect(trash, SIGNAL(clicked()), this, SLOT(wakeUpDeleteSelection()));

    TImageButton *zoomIn = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_in_big.png"), 40, this, true);
    zoomIn->setToolTip(tr("Zoom In"));
    connect(zoomIn, SIGNAL(clicked()), this, SLOT(wakeUpZoomIn()));

    TImageButton *zoomOut = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_out_big.png"), 40, this, true);
    zoomOut->setToolTip(tr("Zoom Out"));
    connect(zoomOut, SIGNAL(clicked()), this, SLOT(wakeUpZoomOut()));

    TImageButton *hand = new TImageButton(QPixmap(THEME_DIR + "icons/hand_big.png"), 40, this, true);
    hand->setToolTip(tr("Hand"));
    connect(hand, SIGNAL(clicked()), this, SLOT(wakeUpHand()));

    TImageButton *undo = new TImageButton(QPixmap(THEME_DIR + "icons/undo_big.png"), 40, this, true);
    undo->setToolTip(tr("Undo"));
    connect(undo, SIGNAL(clicked()), this, SLOT(undo()));

    TImageButton *redo = new TImageButton(QPixmap(THEME_DIR + "icons/redo_big.png"), 40, this, true);
    redo->setToolTip(tr("Redo"));
    connect(redo, SIGNAL(clicked()), this, SLOT(redo()));

    TImageButton *colors = new TImageButton(QPixmap(THEME_DIR + "icons/color_palette_big.png"), 40, this, true);
    colors->setToolTip(tr("Color Palette"));
    connect(colors, SIGNAL(clicked()), this, SLOT(colorDialog()));

    TImageButton *pen = new TImageButton(QPixmap(THEME_DIR + "icons/pen_properties.png"), 40, this, true);
    pen->setToolTip(tr("Pen Size"));
    connect(pen, SIGNAL(clicked()), this, SLOT(penDialog()));

    TImageButton *exposure = new TImageButton(QPixmap(THEME_DIR + "icons/exposure_sheet_big.png"), 40, this, true);
    exposure->setToolTip(tr("Exposure Sheet"));
    connect(exposure, SIGNAL(clicked()), this, SLOT(exposureDialog()));

    QBoxLayout *controls = new QBoxLayout(QBoxLayout::TopToBottom);
    controls->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    controls->setContentsMargins(3, 3, 3, 3);
    controls->setSpacing(7);

    controls->addWidget(pencil);
    controls->addWidget(ink);
    // controls->addWidget(polyline);
    controls->addWidget(ellipse);
    controls->addWidget(rectangle);
    controls->addWidget(images);
    controls->addWidget(objects);
    controls->addWidget(nodes);
    controls->addWidget(trash);
    controls->addWidget(zoomIn);
    controls->addWidget(zoomOut);
    controls->addWidget(hand);

    controls->addWidget(undo);
    controls->addWidget(redo);
    controls->addWidget(colors);
    controls->addWidget(pen);
    controls->addWidget(exposure);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(2);
    layout->addLayout(controls);
    layout->addWidget(graphicsView);

    setLayout(layout);
}
FinderHomeWidget::FinderHomeWidget(QWidget *parent) : QWidget(parent) {

    setWindowTitle(tr("Home"));

    // speedup painting since we'll paint the whole background
    // by ourselves anyway in paintEvent()
    setAttribute(Qt::WA_OpaquePaintEvent);

    // colors
    QPalette p = palette();
    p.setBrush(QPalette::Base, Qt::black);
    p.setColor(QPalette::Text, QColor(Qt::white));
    p.setBrush(QPalette::Window, Qt::black);
    p.setColor(QPalette::WindowText, QColor(Qt::white));
    this->setPalette(p);

    QBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->setAlignment(Qt::AlignLeft | Qt::AlignTop);

    QLabel *welcomeLabel =
            new QLabel("<h3>" +
                       tr("Welcome to <a href='%1'>%2</a>,")
                       .replace("<a ", "<a style='color:white'")
                       .arg(Constants::WEBSITE, Constants::APP_NAME)
                       + "</h3>" + tr("Use the icons below to explore your music collection."), this);
    welcomeLabel->setOpenExternalLinks(true);
    welcomeLabel->setMargin(15);
    layout->addWidget(welcomeLabel);
    // welcomeLabel->setStyleSheet("background: qlineargradient(x1:0, y1:0, x2:1, y2:1,stop:0 #1a1a1a, stop:1 #343434)");

    QListWidget *items = new QListWidget(this);
    connect(items, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(itemActivated(QListWidgetItem*)));
    items->setAutoFillBackground(false);
    items->setAttribute(Qt::WA_NoSystemBackground);
    items->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    items->setFrameShape(QFrame::NoFrame);
    items->setAttribute(Qt::WA_MacShowFocusRect, false);
    items->setSelectionMode(QAbstractItemView::NoSelection);

    items->addItem(tr("Artists"));
    items->addItem(tr("Albums"));
    items->addItem(tr("Tracks"));
    items->addItem(tr("Years"));
    items->addItem(tr("Languages"));

    layout->addWidget(items);

    /*
      Artists
      Albums
      Tracks
      Time machine
      By language
      Files
      ---
      Tagcloud
      */

}
Beispiel #8
0
MainWindow::MainWindow()
    : QWidget(nullptr)
    , _newsReply(nullptr)
    , _informationWidget(nullptr)
    , _scenes(nullptr)
    , _shortcutWidget(nullptr)
    , _syncWidget(nullptr)
{
    setObjectName("MainWindow");
    setFixedSize(WindowSize);
    //setContentsMargins(0, 0, 0, 0);
    
    QGridLayout* layout = new QGridLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    
    QLabel* image = new QLabel;
    //image->setContentsMargins(0, 0, 0, 0);
    image->setObjectName("Image");
    QPixmap p = QPixmap(":/images/header.png");
    image->setPixmap(p.scaledToWidth(WindowSize.width()));
    layout->addWidget(image, 0, 0, 1, 2);

    
    _informationWidget = new QTextEdit(this);
    _informationWidget->setReadOnly(true);
    _informationWidget->setEnabled(false);
    layout->addWidget(_informationWidget, 1, 0, 2, 1);
    layout->setRowStretch(1, 10);
    layout->setColumnStretch(0, 4);
    layout->setColumnStretch(1, 5);

    QWidget* container = new QWidget;
    {
        QGridLayout* innerLayout = new QGridLayout;
        
        QLabel* shortcutLabel = new QLabel("Keyboard Shortcuts:");
        innerLayout->addWidget(shortcutLabel, 0, 0);
        QPushButton* shortcutButton = new QPushButton("Open...");
        QObject::connect(shortcutButton, SIGNAL(clicked(bool)),
                         this, SLOT(shortcutButtonPressed())
                         );
        innerLayout->addWidget(shortcutButton, 0, 1);

        innerLayout->setRowStretch(1, 10);

        QLabel* configurationSelectionLabel = new QLabel("Configuration:");
        innerLayout->addWidget(configurationSelectionLabel, 2, 0);
        _configurations = new QComboBox;
        innerLayout->addWidget(_configurations, 2, 1);
        
        QLabel* sceneSelectionLabel = new QLabel("Scenes:");
        innerLayout->addWidget(sceneSelectionLabel, 3, 0);
        _scenes = new QComboBox;
        innerLayout->addWidget(_scenes, 3, 1);
        
        container->setLayout(innerLayout);
    }
    layout->addWidget(container, 1, 1);
    
    container = new QWidget;
    {
        QBoxLayout* innerLayout = new QHBoxLayout;
        
        QPushButton* cancelButton = new QPushButton("Cancel");
        QObject::connect(
            cancelButton, SIGNAL(clicked(bool)),
            QApplication::instance(), SLOT(quit())
        );
        innerLayout->addWidget(cancelButton);
        
        QPushButton* syncButton = new QPushButton("Sync");
        QObject::connect(
            syncButton, SIGNAL(clicked(bool)),
            this, SLOT(syncButtonPressed())
        );
        innerLayout->addWidget(syncButton);
        
        QPushButton* startButton = new QPushButton("Start");
        QObject::connect(
            startButton, SIGNAL(clicked(bool)),
            this, SLOT(startButtonPressed())
        );
        innerLayout->addWidget(startButton);
        
        container->setLayout(innerLayout);
    }
    layout->addWidget(container, 2, 1);
    
    setLayout(layout);
    
    initialize();
}
Beispiel #9
0
//
// Constructor
//                                                                  
MsgDialog::MsgDialog(QWidget *parent, const char *name, QStringList &list)
// : QDialog(parent, name)
 : QWidget(parent, name)
{
#ifdef DEBUGMSG
  qDebug("MsgDialog() '%s' List passed by ref with %d elements", 
       name, list.count());
#endif

   m_bScrollLock = FALSE;
   m_nButtons = 0;
   m_nIndent = 5;   // num of spaces to indent wrapped lines
   m_nLockIndex = 0;
   m_nIndex = 0;
   m_bUseIndexing = FALSE;
   m_bShowType = TRUE;
   m_nShown = 0;
   m_nEditItem = -1;
   m_bAdditiveFilter = FALSE;

#if 0
   m_pMsgTypeCheckBox = 0;
   m_pButtonsPanel = 0;
   m_pEdit = 0;
   m_pStatusBar = 0;
   m_pStatusBarLock = 0;
   m_pStatusBarMsgcount = 0;
   m_pStatusBarTotMsgcount = 0;
   m_pStatusBarFilter = 0;
   m_pButtonsLayout = 0;
   m_pMenu = 0;
   m_pStringList = 0;
#endif

//  Anyone want to explain to me why ShowEQ segfaults upon exit when I
//  uncomment out the following line.  This baffles me.... it acts like 
//  it causes something to get destroyed when it's not supposed to be
//     - Maerlyn
//   m_pButtonOver = 0;

   // use the shared list given to us
   m_pStringList = &list;

   // set Title
   setCaption(QString(name));

   // install event filter to catch right clicks to add buttons 
   installEventFilter(this);
   
   // top-level layout; a vertical box to contain all widgets and sublayouts
   QBoxLayout *topLayout = new QVBoxLayout(this);
  
   // Make an hbox that will hold the textbox and the row of filterbuttons
   QBoxLayout *middleLayout = new QHBoxLayout(topLayout);
  
   // add the edit
//   m_pEdit = new QMultiLineEdit(this, "edit"); 
   m_pEdit = new MyEdit(this, "edit"); 
   m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   m_pEdit->setReadOnly(TRUE);
   m_pEdit->setFont(QFont("Helvetica", 10));
   middleLayout->addWidget(m_pEdit);
  
   // add a vertical box to hold the button layout and the stretch 
   QBoxLayout *rightLayout = new QVBoxLayout(middleLayout);
  
   // add a vertical box to hold the filter buttons
   m_pButtonsPanel = new QWidget(this, "buttonPanel");
   rightLayout->addWidget(m_pButtonsPanel);
   m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel);
  
   // Make an hbox that will hold the tools 
   QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout);

   // Make an bbox that will hold the right tools 
   QBoxLayout *righttools = new QVBoxLayout(tools);

   // Add an 'additive' vs 'subtractive checkbox
   m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel);
   m_pAdditiveCheckBox->setChecked(isAdditive());
   connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), 
                this, SLOT (setAdditive(bool)));
   righttools->addWidget(m_pAdditiveCheckBox);
  
   // Add a 'scroll-lock' checkbox
   QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel);
   pScrollLockCheckBox->setChecked(FALSE);
   connect(pScrollLockCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (scrollLock(bool)));
   righttools->addWidget(pScrollLockCheckBox);

   // Add a 'msg type' checkbox
   m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel);
   m_pMsgTypeCheckBox->setChecked(m_bShowType);
   connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)),
                this, SLOT (showMsgType(bool)));
   righttools->addWidget(m_pMsgTypeCheckBox);

   // Add a decrorative frame seperator
   QFrame *frame = new QFrame(m_pButtonsPanel, "seperator");
   frame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   frame->setFixedHeight(2);
   m_pButtonsLayout->addWidget(frame);
   
   // 
   // Status Bar
   //
   // create a label to look like a status bar
   QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
   m_pStatusBarFilter = new QLabel(this);
   m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarFilter, 4);
   m_pStatusBarMsgcount = new QLabel(this);
   m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarMsgcount, 1);
   m_pStatusBarTotMsgcount = new QLabel(this);
   m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarTotMsgcount, 1);
   m_pStatusBarLock = new QLabel(this);
   m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken);
   statusLayout->addWidget(m_pStatusBarLock, 1);
  

#if 0
   // Add some default filter buttons
   MyButton *but;
 
   for (int i = 0; i < 5; i++)
   {
      char temp[15];
      sprintf(temp, "Empty%d", i);
      QString name(temp);
      QString filter(temp);
      QString color("Black");
      newButton(name, filter, color, FALSE);
   } 
#endif

   // Add an empty widget to fill the space and stretch when resized
   rightLayout->addStretch(10);
  
   // Add popup menu
   m_pMenu = new QPopupMenu(this, "popup");
   m_pMenu->insertItem("&Add Button", this, SLOT(addButton()));
   m_pMenu->insertSeparator();
   m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls()));
   connect(m_pMenu, SIGNAL (aboutToShow(void)), 
              this, SLOT (menuAboutToShow(void)));
  
   // refresh the messages 
   refresh();
  
} // end constructor
Beispiel #10
0
GDBOutputWidget::GDBOutputWidget(CppDebuggerPlugin* plugin, QWidget *parent) :
    QWidget(parent),
    m_userGDBCmdEditor(0),
    m_Interrupt(0),
    m_gdbView(0),
    showInternalCommands_(false),
    maxLines_(5000)
{
//     setWindowIcon(KIcon("inline_image"));
    setWindowIcon(KIcon("debugger"));
    setWindowTitle(i18n("GDB Output"));
    setWhatsThis(i18n("<b>GDB output</b><p>"
                    "Shows all gdb commands being executed. "
                    "You can also issue any other gdb command while debugging.</p>"));

    m_gdbView = new OutputTextEdit(this);
    m_gdbView->setReadOnly(true);

    m_userGDBCmdEditor = new KHistoryComboBox (this);

    QLabel *label = new QLabel(i18n("&GDB cmd:"), this);
    label->setBuddy(m_userGDBCmdEditor);

    m_Interrupt = new QToolButton( this );
    m_Interrupt->setIcon ( KIcon ( "media-playback-pause" ) );
    m_Interrupt->setToolTip( i18n ( "Pause execution of the app to enter gdb commands" ) );

    QVBoxLayout *topLayout = new QVBoxLayout(this);
    topLayout->addWidget(m_gdbView);
    topLayout->setStretchFactor(m_gdbView, 1);
    topLayout->setMargin(0);

    QBoxLayout *userGDBCmdEntry = new QHBoxLayout();
    userGDBCmdEntry->addWidget(label);
    userGDBCmdEntry->addWidget(m_userGDBCmdEditor);
    userGDBCmdEntry->setStretchFactor(m_userGDBCmdEditor, 1);
    userGDBCmdEntry->addWidget(m_Interrupt);
    topLayout->addLayout(userGDBCmdEntry);

    setLayout(topLayout);

    slotStateChanged(s_none, s_dbgNotStarted);

    connect( m_userGDBCmdEditor, SIGNAL(returnPressed()), SLOT(slotGDBCmd()) );
    connect( m_Interrupt,        SIGNAL(clicked()),       SIGNAL(breakInto()));

    updateTimer_.setSingleShot(true);
    connect( &updateTimer_, SIGNAL(timeout()),
             this,  SLOT(flushPending()));

    connect(KDevelop::ICore::self()->debugController(), 
            SIGNAL(currentSessionChanged(KDevelop::IDebugSession*)),
            SLOT(currentSessionChanged(KDevelop::IDebugSession*)));

    connect(plugin, SIGNAL(reset()), this, SLOT(clear()));
    connect(plugin, SIGNAL(raiseGdbConsoleViews()), SIGNAL(requestRaise()));

    currentSessionChanged(KDevelop::ICore::self()->debugController()->currentSession());

    connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
            this, SLOT(updateColors()));
    updateColors();

}
Beispiel #11
0
void KDMSessionsWidget::setupPage(QWidget *)
{
      QGroupBox *group0 = new QGroupBox( i18n("Allow to shutdown"), this );

      sdcombo = new QComboBox( FALSE, group0 );
      connect(sdcombo, SIGNAL(highlighted(int)), SLOT(slotSetAllowShutdown(int)));
      sdcombo->insertItem(klocale->translate("None"), 0);
      sdcombo->insertItem(klocale->translate("All"), 1);
      sdcombo->insertItem(klocale->translate("Root Only"), 2);
      sdcombo->insertItem(klocale->translate("Console Only"), 3);
      sdcombo->setCurrentItem(sdMode);
      sdcombo->setFixedSize(sdcombo->sizeHint());

      QGroupBox *group1 = new QGroupBox( klocale->translate("Commands"), this );
      QLabel *shutdown_label = new QLabel(klocale->translate("Shutdown"), group1);
      shutdown_label->setFixedSize(shutdown_label->sizeHint());
      shutdown_lined = new QLineEdit(group1);
      shutdown_lined->setFixedHeight(shutdown_lined->sizeHint().height());
      shutdown_lined->setText(shutdownstr);

      QLabel *restart_label = new QLabel(klocale->translate("Restart"), group1);
      restart_label->setFixedSize(restart_label->sizeHint());

      restart_lined = new QLineEdit(group1);
      restart_lined->setFixedHeight(shutdown_lined->height());
      restart_lined->setText(restartstr);

      QGroupBox *group2 = new QGroupBox( klocale->translate("Session types"), this );
      
      QLabel *type_label = new QLabel(klocale->translate("New type"), group2);
      type_label->setFixedSize(type_label->sizeHint());

      session_lined = new QLineEdit(group2);
      session_lined->setFixedHeight(session_lined->sizeHint().height());
      connect(session_lined, SIGNAL(textChanged(const char*)),
              SLOT(slotCheckNewSession(const char*)));
      connect(session_lined, SIGNAL(returnPressed()),
              SLOT(slotAddSessionType()));

      QLabel *types_label = new QLabel(klocale->translate("Available types"), group2);
      types_label->setFixedSize(types_label->sizeHint());

      sessionslb = new MyListBox(group2);
      connect(sessionslb, SIGNAL(highlighted(int)), SLOT(slotSessionHighlighted(int)));
      sessionslb->insertStrList(&sessions);

      btnrm = new QPushButton( klocale->translate("Remove"), group2 );
      btnrm->setFixedSize(btnrm->sizeHint());
      btnrm->setEnabled(false);
      connect( btnrm, SIGNAL( clicked() ), SLOT( slotRemoveSessionType() ) );

      btnadd = new QPushButton( klocale->translate("Add"), group2 );
      btnadd->setFixedSize(btnadd->sizeHint());
      btnadd->setEnabled(false);
      connect( btnadd, SIGNAL( clicked() ), SLOT( slotAddSessionType() ) );

      btnup = new KDirectionButton(UpArrow, group2);
      btnup->setFixedSize(20, 20);
      btnup->setEnabled(false);
      connect(btnup, SIGNAL( clicked() ), SLOT( slotSessionUp() ));
      btndown = new KDirectionButton(DownArrow, group2);
      btndown->setFixedSize(20, 20);
      btndown->setEnabled(false);
      connect(btndown,SIGNAL( clicked() ), SLOT( slotSessionDown() ));

      QBoxLayout *main = new QVBoxLayout( this, 10 );
      QBoxLayout *lgroup0 = new QVBoxLayout( group0, 10 );

      QBoxLayout *lgroup1 = new QVBoxLayout( group1, 10 );
      QBoxLayout *lgroup1a = new QHBoxLayout();
      QBoxLayout *lgroup1b = new QHBoxLayout();

      QBoxLayout *lgroup2 = new QVBoxLayout( group2, 10 );
      QBoxLayout *lgroup2sub = new QHBoxLayout();
      QBoxLayout *lgroup2a = new QVBoxLayout();
      QBoxLayout *lgroup2b = new QVBoxLayout();
      QBoxLayout *lgroup2c = new QVBoxLayout();

      main->addWidget(group0);
      main->addWidget(group1);
      main->addWidget(group2, 2);

      lgroup0->addSpacing(10);
      lgroup0->addWidget(sdcombo);

      lgroup1->addSpacing(group1->fontMetrics().height()/2);
      lgroup1->addLayout(lgroup1a);
      lgroup1->addLayout(lgroup1b);
      lgroup1a->addWidget(shutdown_label);
      lgroup1a->addWidget(shutdown_lined);

      lgroup1b->addWidget(restart_label);
      lgroup1b->addWidget(restart_lined);
      lgroup1->activate();

      lgroup2->addSpacing(group2->fontMetrics().height()/2);
      lgroup2->addLayout(lgroup2sub);
      lgroup2sub->addLayout(lgroup2a, 2);
      lgroup2sub->addLayout(lgroup2b, 2);
      lgroup2sub->addLayout(lgroup2c);
      lgroup2a->addWidget(type_label, 10, AlignLeft);
      lgroup2a->addWidget(session_lined);
      lgroup2a->addWidget(btnrm, 10, AlignRight);
      lgroup2a->addWidget(btnadd, 10, AlignRight);
      lgroup2b->addWidget(types_label, 10, AlignLeft);
      lgroup2b->addWidget(sessionslb);
      lgroup2c->addStretch(1);
      lgroup2c->addWidget(btnup);
      lgroup2c->addWidget(btndown);
      lgroup2c->addStretch(1);
      lgroup2->activate();

      main->activate();
}
Beispiel #12
0
ExampleWidget::ExampleWidget( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    // Make the top-level layout; a vertical box to contain all widgets
    // and sub-layouts.
    QBoxLayout *topLayout = new QVBoxLayout( this, 5 );

    // Create a menubar...
    QMenuBar *menubar = new QMenuBar( this );
    menubar->setSeparator( QMenuBar::InWindowsStyle );
    QPopupMenu* popup;
    popup = new QPopupMenu( this );
    popup->insertItem( "&Quit", qApp, SLOT(quit()) );
    menubar->insertItem( "&File", popup );

    // ...and tell the layout about it.
    topLayout->setMenuBar( menubar );

    // Make an hbox that will hold a row of buttons.
    QBoxLayout *buttons = new QHBoxLayout( topLayout );
    int i;
    for ( i = 1; i <= 4; i++ ) {
	QPushButton* but = new QPushButton( this );
	QString s;
	s.sprintf( "Button %d", i );
	but->setText( s );

	// Set horizontal stretch factor to 10 to let the buttons
	// stretch horizontally. The buttons will not stretch
	// vertically, since bigWidget below will take up vertical
	// stretch.
	buttons->addWidget( but, 10 );
	// (Actually, the result would have been the same with a
	// stretch factor of 0; if no items in a layout have non-zero
	// stretch, the space is divided equally between members.)
    }

    // Make another hbox that will hold a left-justified row of buttons.
    QBoxLayout *buttons2 = new QHBoxLayout( topLayout );

    QPushButton* but = new QPushButton( "Button five", this );
    buttons2->addWidget( but );

    but = new QPushButton( "Button 6", this );
    buttons2->addWidget( but );

    // Fill up the rest of the hbox with stretchable space, so that
    // the buttons get their minimum width and are pushed to the left.
    buttons2->addStretch( 10 );

    // Make  a big widget that will grab all space in the middle.
    QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
    bigWidget->setText( "This widget will get all the remaining space" );
    bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );

    // Set vertical stretch factor to 10 to let the bigWidget stretch
    // vertically. It will stretch horizontally because there are no
    // widgets beside it to take up horizontal stretch.
    //    topLayout->addWidget( bigWidget, 10 );
    topLayout->addWidget( bigWidget ); 

    // Make a grid that will hold a vertical table of QLabel/QLineEdit
    // pairs next to a large QMultiLineEdit.

    // Don't use hard-coded row/column numbers in QGridLayout, you'll
    // regret it when you have to change the layout.
    const int numRows = 3;
    const int labelCol = 0;
    const int linedCol = 1;
    const int multiCol = 2;

    // Let the grid-layout have a spacing of 10 pixels between
    // widgets, overriding the default from topLayout.
    QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
    int row;

    for ( row = 0; row < numRows; row++ ) {
	QLineEdit *ed = new QLineEdit( this );
	// The line edit goes in the second column
	grid->addWidget( ed, row, linedCol );	

	// Make a label that is a buddy of the line edit
	QString s;
	s.sprintf( "Line &%d", row+1 );
	QLabel *label = new QLabel( ed, s, this );
	// The label goes in the first column.
	grid->addWidget( label, row, labelCol );
    }

    // The multiline edit will cover the entire vertical range of the
    // grid (rows 0 to numRows) and stay in column 2.

    QMultiLineEdit *med = new QMultiLineEdit( this );
    grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );

    // The labels will take the space they need. Let the remaining
    // horizontal space be shared so that the multiline edit gets
    // twice as much as the line edit.
    grid->setColStretch( linedCol, 10 );
    grid->setColStretch( multiCol, 20 );

    // Add a widget at the bottom.
    QLabel* sb = new QLabel( this );
    sb->setText( "Let's pretend this is a status bar" );
    sb->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    // This widget will use all horizontal space, and have a fixed height.

    // we should have made a subclass and implemented sizePolicy there...
    sb->setFixedHeight( sb->sizeHint().height() );

    sb->setAlignment( AlignVCenter | AlignLeft );
    topLayout->addWidget( sb );

    topLayout->activate();
}
Beispiel #13
0
RepositoryDialog::RepositoryDialog(KConfig& cfg, OrgKdeCervisia5CvsserviceCvsserviceInterface* cvsService,
                                   const QString& cvsServiceInterfaceName, QWidget* parent)
    : QDialog(parent)
    , m_partConfig(cfg)
    , m_cvsService(cvsService)
    , m_cvsServiceInterfaceName(cvsServiceInterfaceName)
{
    setWindowTitle(i18n("Configure Access to Repositories"));
    setModal(true);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(okButton, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QBoxLayout* hbox = new QHBoxLayout;
    hbox->setMargin(0);
    mainLayout->addLayout(hbox);

    m_repoList = new QTreeWidget;
    hbox->addWidget(m_repoList, 10);
    m_repoList->setMinimumWidth(fontMetrics().width('0') * 60);
    m_repoList->setAllColumnsShowFocus(true);
    m_repoList->setRootIsDecorated(false);
    m_repoList->setHeaderLabels(QStringList() << i18n("Repository") << i18n("Method")
                                              << i18n("Compression") << i18n("Status"));
    m_repoList->setFocus();

    connect(m_repoList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
            this, SLOT(slotDoubleClicked(QTreeWidgetItem*, int)));
    connect(m_repoList, SIGNAL(itemSelectionChanged()),
            this,       SLOT(slotSelectionChanged()));

    QDialogButtonBox* actionbox = new QDialogButtonBox(Qt::Vertical);
    QPushButton* addbutton = actionbox->addButton(i18n("Add..."), QDialogButtonBox::ActionRole);
    m_modifyButton = actionbox->addButton(i18n("Modify..."), QDialogButtonBox::ActionRole);
    m_removeButton = actionbox->addButton(i18n("Remove"), QDialogButtonBox::ActionRole);
    m_loginButton  = actionbox->addButton(i18n("Login..."), QDialogButtonBox::ActionRole);
    m_logoutButton = actionbox->addButton(i18n("Logout"), QDialogButtonBox::ActionRole);
    hbox->addWidget(actionbox, 0);

    m_loginButton->setEnabled(false);
    m_logoutButton->setEnabled(false);

    connect( addbutton, SIGNAL(clicked()),
             this, SLOT(slotAddClicked()) );
    connect( m_modifyButton, SIGNAL(clicked()),
             this, SLOT(slotModifyClicked()) );
    connect( m_removeButton, SIGNAL(clicked()),
             this, SLOT(slotRemoveClicked()) );
    connect( m_loginButton, SIGNAL(clicked()),
             this, SLOT(slotLoginClicked()) );
    connect( m_logoutButton, SIGNAL(clicked()),
             this, SLOT(slotLogoutClicked()) );

    // open cvs DBUS service configuration file
    m_serviceConfig = new KConfig("cvsservicerc");

    readCvsPassFile();
    readConfigFile();

    if (QTreeWidgetItem *item = m_repoList->topLevelItem(0))
    {
        m_repoList->setCurrentItem(item);
        item->setSelected(true);
    }
    else
    {
        // we have no item so disable modify and remove button
        slotSelectionChanged();
    }

    connect(buttonBox, &QDialogButtonBox::helpRequested, this, &RepositoryDialog::slotHelp);

    setAttribute(Qt::WA_DeleteOnClose, true);

    KConfigGroup cg(&m_partConfig, "RepositoryDialog");
    restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray()));

    QByteArray state = cg.readEntry<QByteArray>("RepositoryListView", QByteArray());
    m_repoList->header()->restoreState(state);

    mainLayout->addWidget(buttonBox);
}
void MainWindow::addWidgets()
{
    Q_D(MainWindow);

    int i = 0;

    d->mainContainer = new QWidget(this);

    // Selectors and file chooser
    d->deviceSel = new QComboBox(d->mainContainer);
    d->instLocSel = new QComboBox(d->mainContainer);
    d->instLocDesc = new QLabel(d->mainContainer);

    // Labels
    d->deviceLbl = new QLabel(tr("Device:"), d->mainContainer);
    d->instLocLbl = new QLabel(tr("Install to:"), d->mainContainer);

    // Text boxes
    d->instLocLe = new QLineEdit(d->mainContainer);
    d->instLocLe->setPlaceholderText(tr("Enter an ID"));
    QRegExp re(QStringLiteral("[a-z0-9]+"));
    QValidator *validator = new QRegExpValidator(re, this);
    d->instLocLe->setValidator(validator);

    QGridLayout *layout = new QGridLayout(d->mainContainer);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(d->deviceLbl, i, 0);
    layout->addWidget(d->deviceSel, i, 1, 1, -1);
    layout->addWidget(d->instLocLbl, ++i, 0);
    layout->addWidget(d->instLocSel, i, 1, 1, -1);
    layout->addWidget(d->instLocLe, ++i, 1, 1, -1);
    layout->addWidget(d->instLocDesc, ++i, 1, 1, -1);

    d->messageLbl = new QLabel(d->mainContainer);
    // Don't allow the window to grow too big
    d->messageLbl->setWordWrap(true);
    d->messageLbl->setMaximumWidth(550);

    d->chooseFileBtn = new QPushButton(tr("Choose file"), d->mainContainer);
    d->chooseAnotherFileBtn = new QPushButton(tr("Choose another file"), d->mainContainer);
    d->startPatchingBtn = new QPushButton(tr("Start patching"), d->mainContainer);

    d->buttons = new QDialogButtonBox(d->mainContainer);
    d->buttons->addButton(d->chooseFileBtn, QDialogButtonBox::ActionRole);
    d->buttons->addButton(d->chooseAnotherFileBtn, QDialogButtonBox::ActionRole);
    d->buttons->addButton(d->startPatchingBtn, QDialogButtonBox::ActionRole);

    QWidget *horiz1 = newHorizLine(d->mainContainer);

    layout->setColumnStretch(0, 0);
    layout->setColumnStretch(1, 0);
    layout->setColumnStretch(2, 0);
    layout->setColumnStretch(3, 1);

    layout->addWidget(horiz1,             ++i, 0, 1, -1);
    layout->addWidget(d->messageLbl,      ++i, 0, 1, -1);

    layout->addWidget(newHorizLine(d->mainContainer), ++i, 0, 1, -1);

    layout->addWidget(d->buttons,         ++i, 0, 1, -1);


    d->mainContainer->setLayout(layout);

    // List of widgets related to the message label
    d->messageWidgets << horiz1;
    d->messageWidgets << d->messageLbl;

    // Buttons
    d->progressContainer = new QWidget(this);
    QBoxLayout *progressLayout = new QVBoxLayout(d->progressContainer);
    progressLayout->setContentsMargins(0, 0, 0, 0);

    QGroupBox *detailsBox = new QGroupBox(d->progressContainer);
    detailsBox->setTitle(tr("Details"));

    d->detailsLbl = new QLabel(detailsBox);
    d->detailsLbl->setWordWrap(true);
    // Make sure the window doesn't change size while patching
    d->detailsLbl->setFixedWidth(500);

    QVBoxLayout *detailsLayout = new QVBoxLayout(detailsBox);
    detailsLayout->addWidget(d->detailsLbl);
    detailsBox->setLayout(detailsLayout);

    d->progressBar = new QProgressBar(d->progressContainer);
    //d->progressBar->setFormat(tr("%p% - %v / %m files"));
    d->progressBar->setMaximum(0);
    d->progressBar->setMinimum(0);
    d->progressBar->setValue(0);

    progressLayout->addWidget(detailsBox);
    //progressLayout->addStretch(1);
    progressLayout->addWidget(newHorizLine(d->progressContainer));
    progressLayout->addWidget(d->progressBar);
    d->progressContainer->setLayout(progressLayout);


    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);
    mainLayout->addWidget(d->mainContainer);
    mainLayout->addWidget(d->progressContainer);
    setLayout(mainLayout);
}
Beispiel #15
0
KDMGeneralWidget::KDMGeneralWidget( QWidget *parent )
	: QWidget( parent )
{
	QString wtstr;

	QBoxLayout *ml = new QVBoxLayout( this );
	ml->setSpacing( KDialog::spacingHint() );
	ml->setMargin( KDialog::marginHint() );

	QGroupBox *box = new QGroupBox( "Appearance", this );
	ml->addWidget( box );
	QGridLayout *grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );
	grid->setColStretch( 2, 1 );

	useThemeCheck = new QCheckBox( i18n("&Use themed greeter"), box );
	connect( useThemeCheck, SIGNAL(toggled( bool )), SLOT(slotUseThemeChanged()) );
	useThemeCheck->setWhatsThis( i18n("Enable this if you would like to use a themed Login Manager.") );
	grid->addWidget( useThemeCheck, 0, 0, 1, 2 );

	guicombo = new KBackedComboBox( box );
	guicombo->insertItem( "", i18n("<placeholder>default</placeholder>") );
	loadGuiStyles( guicombo );
	QLabel *label = new QLabel( i18n("GUI s&tyle:"), box );
	label->setBuddy( guicombo );
	connect( guicombo, SIGNAL(activated( int )), SIGNAL(changed()) );
	grid->addWidget( label, 1, 0 );
	grid->addWidget( guicombo, 1, 1 );
	wtstr = i18n("You can choose a basic GUI style here that will be "
	             "used by KDM only.");
	label->setWhatsThis( wtstr );
	guicombo->setWhatsThis( wtstr );

	colcombo = new KBackedComboBox( box );
	colcombo->insertItem( "", i18n("<placeholder>default</placeholder>") );
	loadColorSchemes( colcombo );
	label = new QLabel( i18n("Color sche&me:"), box );
	label->setBuddy( colcombo );
	connect( colcombo, SIGNAL(activated( int )), SIGNAL(changed()) );
	grid->addWidget( label, 2, 0 );
	grid->addWidget( colcombo, 2, 1 );
	wtstr = i18n("You can choose a basic Color Scheme here that will be "
	             "used by KDM only.");
	label->setWhatsThis( wtstr );
	colcombo->setWhatsThis( wtstr );

	box = new QGroupBox( "Locale", this );
	ml->addWidget( box );
	grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );
	grid->setColStretch( 2, 1 );

	// The Language group box
	langcombo = new KLanguageButton( box );
	langcombo->showLanguageCodes(true);
	langcombo->loadAllLanguages();
	connect( langcombo, SIGNAL(activated( const QString & )), SIGNAL(changed()) );
	label = new QLabel( i18n("&Language:"), this );
	label->setBuddy( langcombo );
	grid->addWidget( label, 0, 0 );
	grid->addWidget( langcombo, 0, 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.");
	label->setWhatsThis( wtstr );
	langcombo->setWhatsThis( wtstr );

	box = new QGroupBox( "Fonts", this );
	ml->addWidget( box );
	grid = new QGridLayout( box );
	grid->setSpacing( KDialog::spacingHint() );
	grid->setMargin( KDialog::marginHint() );

	label = new QLabel( i18n("&General:"), box );
	stdFontChooser = new KFontRequester( box );
	label->setBuddy( stdFontChooser );
	stdFontChooser->setWhatsThis( i18n("This changes the font which is used for all the text in the login manager except for the greeting and failure messages.") );
	connect( stdFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 0, 0 );
	grid->addWidget( stdFontChooser, 0, 1 );

	label = new QLabel( i18n("&Failure font:"), box );
	failFontChooser = new KFontRequester( box );
	label->setBuddy( failFontChooser );
	failFontChooser->setWhatsThis( i18n("This changes the font which is used for failure messages in the login manager.") );
	connect( failFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 1, 0 );
	grid->addWidget( failFontChooser, 1, 1 );

	label = new QLabel( i18n("Gree&ting:"), box );
	greetingFontChooser = new KFontRequester( box );
	label->setBuddy( greetingFontChooser );
	greetingFontChooser->setWhatsThis( i18n("This changes the font which is used for the login manager's greeting.") );
	connect( greetingFontChooser, SIGNAL(fontSelected( const QFont& )), SIGNAL(changed()) );
	grid->addWidget( label, 2, 0 );
	grid->addWidget( greetingFontChooser, 2, 1 );

	aacb = new QCheckBox( i18n("Use anti-aliasing for fonts"), box );
	aacb->setWhatsThis( i18n("If you check this box and your X-Server has the Xft extension, "
	                         "fonts will be antialiased (smoothed) in the login dialog.") );
	connect( aacb, SIGNAL(toggled( bool )), SIGNAL(changed()) );
	grid->addWidget( aacb, 3, 0, 1, 2 );

	ml->addStretch( 1 );
}
DistributionListEditorWidget::DistributionListEditorWidget(AddressBook *addressBook, QWidget *parent) : QWidget(parent), mAddressBook(addressBook)
{
    kdDebug(5700) << "DistributionListEditor()" << endl;

    QBoxLayout *topLayout = new QVBoxLayout(this);
    topLayout->setSpacing(KDialog::spacingHint());

    QBoxLayout *nameLayout = new QHBoxLayout(topLayout);

    mNameCombo = new QComboBox(this);
    nameLayout->addWidget(mNameCombo);
    connect(mNameCombo, SIGNAL(activated(int)), SLOT(updateEntryView()));

    mNewButton = new QPushButton(i18n("New List..."), this);
    nameLayout->addWidget(mNewButton);
    connect(mNewButton, SIGNAL(clicked()), SLOT(newList()));

    mEditButton = new QPushButton(i18n("Rename List..."), this);
    nameLayout->addWidget(mEditButton);
    connect(mEditButton, SIGNAL(clicked()), SLOT(editList()));

    mRemoveButton = new QPushButton(i18n("Remove List"), this);
    nameLayout->addWidget(mRemoveButton);
    connect(mRemoveButton, SIGNAL(clicked()), SLOT(removeList()));

    QGridLayout *gridLayout = new QGridLayout(topLayout, 3, 3);
    gridLayout->setColStretch(1, 1);

    QLabel *listLabel = new QLabel(i18n("Available addresses:"), this);
    gridLayout->addWidget(listLabel, 0, 0);

    mListLabel = new QLabel(this);
    gridLayout->addMultiCellWidget(mListLabel, 0, 0, 1, 2);

    mAddresseeView = new QListView(this);
    mAddresseeView->addColumn(i18n("Name"));
    mAddresseeView->addColumn(i18n("Preferred Email"));
    mAddresseeView->setAllColumnsShowFocus(true);
    gridLayout->addWidget(mAddresseeView, 1, 0);
    connect(mAddresseeView, SIGNAL(selectionChanged()), SLOT(slotSelectionAddresseeViewChanged()));
    connect(mAddresseeView, SIGNAL(doubleClicked(QListViewItem *)), SLOT(addEntry()));

    mAddEntryButton = new QPushButton(i18n("Add Entry"), this);
    mAddEntryButton->setEnabled(false);
    gridLayout->addWidget(mAddEntryButton, 2, 0);
    connect(mAddEntryButton, SIGNAL(clicked()), SLOT(addEntry()));

    mEntryView = new QListView(this);
    mEntryView->addColumn(i18n("Name"));
    mEntryView->addColumn(i18n("Email"));
    mEntryView->addColumn(i18n("Use Preferred"));
    mEntryView->setEnabled(false);
    mEntryView->setAllColumnsShowFocus(true);
    gridLayout->addMultiCellWidget(mEntryView, 1, 1, 1, 2);
    connect(mEntryView, SIGNAL(selectionChanged()), SLOT(slotSelectionEntryViewChanged()));

    mChangeEmailButton = new QPushButton(i18n("Change Email..."), this);
    gridLayout->addWidget(mChangeEmailButton, 2, 1);
    connect(mChangeEmailButton, SIGNAL(clicked()), SLOT(changeEmail()));

    mRemoveEntryButton = new QPushButton(i18n("Remove Entry"), this);
    gridLayout->addWidget(mRemoveEntryButton, 2, 2);
    connect(mRemoveEntryButton, SIGNAL(clicked()), SLOT(removeEntry()));

    mManager = new DistributionListManager(mAddressBook);
    mManager->load();

    updateAddresseeView();
    updateNameCombo();
}
void AlarmTimeWidget::init(Mode mode, const QString& title)
{
	static const QString recurText = i18nc("@info/plain",
	                                       "If a recurrence is configured, the start date/time will be adjusted "
	                                       "to the first recurrence on or after the entered date/time."); 
	static const QString tzText = i18nc("@info/plain",
	                                    "This uses KAlarm's default time zone, set in the Configuration dialog.");

	QWidget* topWidget;
	if (title.isEmpty())
		topWidget = this;
	else
	{
		QBoxLayout* layout = new QVBoxLayout(this);
		layout->setMargin(0);
		layout->setSpacing(0);
		topWidget = new QGroupBox(title, this);
		layout->addWidget(topWidget);
	}
	mDeferring = mode & DEFER_TIME;
	mButtonGroup = new ButtonGroup(this);
	connect(mButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotButtonSet(QAbstractButton*)));
	QVBoxLayout* topLayout = new QVBoxLayout(topWidget);
	topLayout->setSpacing(KDialog::spacingHint());
	topLayout->setMargin(title.isEmpty() ? 0 : KDialog::marginHint());

	// At time radio button/label
	mAtTimeRadio = new RadioButton((mDeferring ? i18nc("@option:radio", "Defer to date/time:") : i18nc("@option:radio", "At date/time:")), topWidget);
	mAtTimeRadio->setFixedSize(mAtTimeRadio->sizeHint());
	mAtTimeRadio->setWhatsThis(mDeferring ? i18nc("@info:whatsthis", "Reschedule the alarm to the specified date and time.")
	                                      : i18nc("@info:whatsthis", "Specify the date, or date and time, to schedule the alarm."));
	mButtonGroup->addButton(mAtTimeRadio);

	// Date edit box
	mDateEdit = new DateEdit(topWidget);
	connect(mDateEdit, SIGNAL(dateEntered(const QDate&)), SLOT(dateTimeChanged()));
	mDateEdit->setWhatsThis(i18nc("@info:whatsthis",
	      "<para>Enter the date to schedule the alarm.</para>"
	      "<para>%1</para>", (mDeferring ? tzText : recurText)));
	mAtTimeRadio->setFocusWidget(mDateEdit);

	// Time edit box and Any time checkbox
	KHBox* timeBox = new KHBox(topWidget);
	timeBox->setSpacing(2*KDialog::spacingHint());
	mTimeEdit = new TimeEdit(timeBox);
	mTimeEdit->setFixedSize(mTimeEdit->sizeHint());
	connect(mTimeEdit, SIGNAL(valueChanged(int)), SLOT(dateTimeChanged()));
	mTimeEdit->setWhatsThis(i18nc("@info:whatsthis",
	      "<para>Enter the time to schedule the alarm.</para>"
	      "<para>%1</para>"
	      "<para>%2</para>", (mDeferring ? tzText : recurText), TimeSpinBox::shiftWhatsThis()));

	mAnyTime = -1;    // current status is uninitialised
	if (mode == DEFER_TIME)
	{
		mAnyTimeAllowed = false;
		mAnyTimeCheckBox = 0;
	}
	else
	{
		mAnyTimeAllowed = true;
		mAnyTimeCheckBox = new CheckBox(i18nc("@option:check", "Any time"), timeBox);
		mAnyTimeCheckBox->setFixedSize(mAnyTimeCheckBox->sizeHint());
		connect(mAnyTimeCheckBox, SIGNAL(toggled(bool)), SLOT(slotAnyTimeToggled(bool)));
		mAnyTimeCheckBox->setWhatsThis(i18nc("@info:whatsthis",
		      "Check to specify only a date (without a time) for the alarm. The alarm will trigger at the first opportunity on the selected date."));
	}

	// 'Time from now' radio button/label
	mAfterTimeRadio = new RadioButton((mDeferring ? i18nc("@option:radio", "Defer for time interval:") : i18nc("@option:radio", "Time from now:")), topWidget);
	mAfterTimeRadio->setFixedSize(mAfterTimeRadio->sizeHint());
	mAfterTimeRadio->setWhatsThis(mDeferring ? i18nc("@info:whatsthis", "Reschedule the alarm for the specified time interval after now.")
	                                         : i18nc("@info:whatsthis", "Schedule the alarm after the specified time interval from now."));
	mButtonGroup->addButton(mAfterTimeRadio);

	// Delay time spin box
	mDelayTimeEdit = new TimeSpinBox(1, maxDelayTime, topWidget);
	mDelayTimeEdit->setValue(1439);
	mDelayTimeEdit->setFixedSize(mDelayTimeEdit->sizeHint());
	connect(mDelayTimeEdit, SIGNAL(valueChanged(int)), SLOT(delayTimeChanged(int)));
	mDelayTimeEdit->setWhatsThis(mDeferring ? i18nc("@info:whatsthis", "<para>%1</para><para>%2</para>", i18n_TimeAfterPeriod(), TimeSpinBox::shiftWhatsThis())
	                                        : i18nc("@info:whatsthis", "<para>%1</para><para>%2</para><para>%3</para>", i18n_TimeAfterPeriod(), recurText, TimeSpinBox::shiftWhatsThis()));
	mAfterTimeRadio->setFocusWidget(mDelayTimeEdit);

	// Set up the layout, either narrow or wide
	QGridLayout* grid = new QGridLayout();
	grid->setMargin(0);
	topLayout->addLayout(grid);
	if (mDeferring)
	{
		grid->addWidget(mAtTimeRadio, 0, 0);
		grid->addWidget(mDateEdit, 0, 1, Qt::AlignLeft);
		grid->addWidget(timeBox, 1, 1, Qt::AlignLeft);
		grid->setColumnStretch(2, 1);
		topLayout->addStretch();
		QHBoxLayout* layout = new QHBoxLayout();
		topLayout->addLayout(layout);
		layout->addWidget(mAfterTimeRadio);
		layout->addWidget(mDelayTimeEdit);
		layout->addStretch();
	}
	else
	{
		grid->addWidget(mAtTimeRadio, 0, 0, Qt::AlignLeft);
		grid->addWidget(mDateEdit, 0, 1, Qt::AlignLeft);
		grid->addWidget(timeBox, 0, 2, Qt::AlignLeft);
		grid->setRowStretch(1, 1);
		grid->addWidget(mAfterTimeRadio, 2, 0, Qt::AlignLeft);
		grid->addWidget(mDelayTimeEdit, 2, 1, Qt::AlignLeft);

		// Time zone selection push button
		mTimeZoneButton = new PushButton(i18nc("@action:button", "Time Zone..."), topWidget);
		connect(mTimeZoneButton, SIGNAL(clicked()), SLOT(showTimeZoneSelector()));
		mTimeZoneButton->setWhatsThis(i18nc("@info:whatsthis",
		      "Choose a time zone for this alarm which is different from the default time zone set in KAlarm's configuration dialog."));
		grid->addWidget(mTimeZoneButton, 2, 2, 1, 2, Qt::AlignRight);

		grid->setColumnStretch(2, 1);
		topLayout->addStretch();

		QHBoxLayout* layout = new QHBoxLayout();
		topLayout->addLayout(layout);
		layout->setSpacing(2*KDialog::spacingHint());

		// Time zone selector
		mTimeZoneBox = new KHBox(topWidget);   // this is to control the QWhatsThis text display area
		mTimeZoneBox->setMargin(0);
		mTimeZoneBox->setSpacing(KDialog::spacingHint());
		QLabel* label = new QLabel(i18nc("@label:listbox", "Time zone:"), mTimeZoneBox);
		mTimeZone = new TimeZoneCombo(mTimeZoneBox);
		mTimeZone->setMaxVisibleItems(15);
		connect(mTimeZone, SIGNAL(activated(int)), SLOT(slotTimeZoneChanged()));
		mTimeZoneBox->setWhatsThis(i18nc("@info:whatsthis", "Select the time zone to use for this alarm."));
		label->setBuddy(mTimeZone);
		layout->addWidget(mTimeZoneBox);

		// Time zone checkbox
		mNoTimeZone = new CheckBox(i18nc("@option:check", "Ignore time zone"), topWidget);
		connect(mNoTimeZone, SIGNAL(toggled(bool)), SLOT(slotTimeZoneToggled(bool)));
		mNoTimeZone->setWhatsThis(i18nc("@info:whatsthis",
		                                "<para>Check to use the local computer time, ignoring time zones.</para>"
		                                "<para>You are recommended not to use this option if the alarm has a "
		                                "recurrence specified in hours/minutes. If you do, the alarm may "
		                                "occur at unexpected times after daylight saving time shifts.</para>"));
		layout->addWidget(mNoTimeZone);
		layout->addStretch();

		// Initially show only the time zone button, not time zone selector
		mTimeZoneBox->hide();
		mNoTimeZone->hide();
	}

	// Initialise the radio button statuses
	mAtTimeRadio->setChecked(true);
	slotButtonSet(mAtTimeRadio);

	// Timeout every minute to update alarm time fields.
	MinuteTimer::connect(this, SLOT(updateTimes()));
}