Beispiel #1
0
void UimImSwitcher::createGUI()
{
    /* im list view */
    listview = new QTableWidget( this );
    listview->setSelectionMode( QAbstractItemView::SingleSelection );
    listview->setSelectionBehavior( QAbstractItemView::SelectRows );
    listview->setColumnCount( 3 );
    listview->verticalHeader()->setVisible( false );
    listview->setHorizontalHeaderLabels( QStringList()
        << _( "InputMethodName" ) << _( "Language" ) << _( "Description" ) );
    listview->setShowGrid( false );
    listview->horizontalHeader()->setStretchLastSection( true );
    listview->setAttribute( Qt::WA_InputMethodEnabled, false );

    /* radio buttons for the switcher coverage */
    wholeButton = new QRadioButton( _( "whole desktop" ) );
    applicationButton = new QRadioButton( _( "current application only" ) );
    textButton = new QRadioButton( _( "current text area only" ) );
    wholeButton->setChecked( true ); // default is "whole desktop"

    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget( wholeButton );
    vbox->addWidget( applicationButton );
    vbox->addWidget( textButton );

    QGroupBox *groupBox = new QGroupBox(  _( "Effective coverage" ) );
    groupBox->setLayout( vbox );

    /* cancel, apply & ok button */
    QPushButton *okButton = new QPushButton( this );
    okButton->setText( _( "OK" ) );
    connect( okButton, SIGNAL( clicked() ),
                      this, SLOT( slotChangeInputMethodAndQuit() ) );

    QPushButton *applyButton = new QPushButton( this );
    applyButton->setText( _( "Apply" ) );
    connect( applyButton, SIGNAL( clicked() ),
                      this, SLOT( slotChangeInputMethod() ) );

    QPushButton *cancelButton = new QPushButton( this );
    cancelButton->setText( _( "Cancel" ) );
    connect( cancelButton, SIGNAL( clicked() ),
                      QApplication::instance(), SLOT( quit() ) );
    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch( 0 );
    buttonLayout->addWidget( okButton );
    buttonLayout->addWidget( applyButton );
    buttonLayout->addWidget( cancelButton );

    // main layout
    QVBoxLayout *mainLayout = new QVBoxLayout( this );
    mainLayout->setMargin( 6 );
    mainLayout->setSpacing( 6 );
    mainLayout->addWidget( listview );
    mainLayout->addWidget( groupBox );
    mainLayout->addLayout( buttonLayout );
}
Beispiel #2
0
void UimImSwitcher::createGUI()
{
    /* im list view */
    listview = new QListView( this );
    listview->setSelectionMode( QListView::Single );
    listview->setAllColumnsShowFocus( true );
    listview->addColumn( _( "InputMethodName" ) );
    listview->addColumn( _( "Language" ) );
    listview->addColumn( _( "Description" ) );

    /* radio buttons for the switcher coverage */
    QRadioButton *button;
    vbGroup = new QVButtonGroup( _( "Effective coverage" ), this );
    button = new QRadioButton( _( "whole desktop" ), vbGroup );
    vbGroup->insert( button, ID_CHANGE_WHOLE_DESKTOP );
    button->setChecked( TRUE ); // default is "whole desktop"
    button = new QRadioButton( _( "current application only" ), vbGroup );
    vbGroup->insert( button, ID_CHANGE_THIS_APPLICATION_ONLY );
    button = new QRadioButton( _( "current text area only" ), vbGroup );
    vbGroup->insert( button, ID_CHANGE_THIS_TEXT_AREA_ONLY );

    /* cancel & ok button */
    okButton = new QPushButton( this );
    okButton->setText( _( "OK" ) );
    okButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
    QObject::connect( okButton, SIGNAL( clicked() ),
                      this, SLOT( slotChangeInputMethod() ) );
    cancelButton = new QPushButton( this );
    cancelButton->setText( _( "Cancel" ) );
    cancelButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
    QObject::connect( cancelButton, SIGNAL( clicked() ),
                      qApp, SLOT( quit() ) );
    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch( 0 );
    buttonLayout->addWidget( okButton );
    buttonLayout->addWidget( cancelButton );

    // main layout
    QVBoxLayout *mainLayout = new QVBoxLayout( this );
    mainLayout->setMargin( 6 );
    mainLayout->setSpacing( 6 );
    mainLayout->addWidget( listview );
    mainLayout->addWidget( vbGroup );
    mainLayout->addLayout( buttonLayout );
}