Пример #1
0
void LibraryUI::setupActions()
{
    burn_act = new QAction( QIcon(":/library/pics/Image-Burner.png") , tr("Burn Image") , this );
    mount_act = new QAction( SMasterIcons::icon( QSize(48,48) , "emblem-mounted.png" ) , tr("Mount") , this );
    delete_act = new QAction( SMasterIcons::icon( QSize(48,48) , "edit-delete.png" ) , tr("Delete From Library") , this );
    edit_tags_act = new QAction( tr("Edit Tags") , this );
    rename_act = new QAction( SMasterIcons::icon( QSize(48,48) , "edit-rename.png" ) , tr("Rename") , this );

    add_to_library_action = new QAction( SMasterIcons::icon( QSize(48,48) , "list-add.png" ) , tr("Add to Library") , this );
    reload_action = new QAction( SMasterIcons::icon( QSize(48,48) , "view-refresh.png" ) , tr("Reload") , this );

    toolbar->addAction( add_to_library_action );
    toolbar->addAction( reload_action );

    this->menuPanel()->addAction( add_to_library_action );
    this->menuPanel()->addAction( reload_action );

    menu = new QMenu( this );
        menu->addAction( burn_act );
        menu->addAction( mount_act );
        menu->addSeparator();
        menu->addAction( delete_act );
        menu->addAction( edit_tags_act );
        menu->addAction( rename_act );


    QObject::connect( item_list , SIGNAL(customContextMenuRequested(QPoint)) , this , SLOT(showMenu(QPoint)) );
    QObject::connect( burn_act , SIGNAL(triggered()) , this , SLOT(burnCurrentItem()) );
    QObject::connect( mount_act , SIGNAL(triggered()) , this , SLOT(mountCurrentItem()) );
    QObject::connect( delete_act , SIGNAL(triggered()) , this , SLOT(deleteCurrentItem()) );
    QObject::connect( edit_tags_act , SIGNAL(triggered()) , this , SLOT(editCurrentItemTags()) );
    QObject::connect( rename_act , SIGNAL(triggered()) , this , SLOT(renameCurrentItem()) );
    QObject::connect( reload_action , SIGNAL(triggered()) , this , SLOT(reload()) );
    QObject::connect( add_to_library_action , SIGNAL(triggered()) , this , SLOT(addToLibrary()) );
}
bool IconViewEditor::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: insertNewItem(); break;
    case 1: deleteCurrentItem(); break;
    case 2: currentItemChanged((QIconViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 3: currentTextChanged((const QString&)static_QUType_QString.get(_o+1)); break;
    case 4: okClicked(); break;
    case 5: cancelClicked(); break;
    case 6: applyClicked(); break;
    case 7: choosePixmap(); break;
    case 8: deletePixmap(); break;
    default:
	return IconViewEditorBase::qt_invoke( _id, _o );
    }
    return TRUE;
}
Пример #3
0
bool ListBoxEditorBase::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: init(); break;
    case 2: destroy(); break;
    case 3: insertNewItem(); break;
    case 4: deleteCurrentItem(); break;
    case 5: currentItemChanged((QListBoxItem*)static_QUType_ptr.get(_o+1)); break;
    case 6: currentTextChanged((const QString&)static_QUType_QString.get(_o+1)); break;
    case 7: okClicked(); break;
    case 8: cancelClicked(); break;
    case 9: applyClicked(); break;
    case 10: choosePixmap(); break;
    case 11: deletePixmap(); break;
    case 12: moveItemUp(); break;
    case 13: moveItemDown(); break;
    default:
	return QDialog::qt_invoke( _id, _o );
    }
    return TRUE;
}
/*
 *  Constructs a IconViewEditorBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
IconViewEditorBase::IconViewEditorBase( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "IconViewEditorBase" );
    setSizeGripEnabled( TRUE );
    IconViewEditorBaseLayout = new QVBoxLayout( this, 11, 6, "IconViewEditorBaseLayout"); 

    Layout6 = new QHBoxLayout( 0, 0, 6, "Layout6"); 

    preview = new QIconView( this, "preview" );
    Layout6->addWidget( preview );

    Layout5 = new QVBoxLayout( 0, 0, 6, "Layout5"); 

    itemNew = new QPushButton( this, "itemNew" );
    Layout5->addWidget( itemNew );

    itemDelete = new QPushButton( this, "itemDelete" );
    Layout5->addWidget( itemDelete );
    Vertical_Spacing1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
    Layout5->addItem( Vertical_Spacing1 );
    Layout6->addLayout( Layout5 );

    GroupBox1 = new QGroupBox( this, "GroupBox1" );
    GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) );
    GroupBox1->setColumnLayout(0, Qt::Vertical );
    GroupBox1->layout()->setSpacing( 6 );
    GroupBox1->layout()->setMargin( 11 );
    GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
    GroupBox1Layout->setAlignment( Qt::AlignTop );

    Label1 = new QLabel( GroupBox1, "Label1" );

    GroupBox1Layout->addWidget( Label1, 0, 0 );

    itemText = new QLineEdit( GroupBox1, "itemText" );
    itemText->setMinimumSize( QSize( 0, 0 ) );

    GroupBox1Layout->addWidget( itemText, 0, 1 );

    Label2 = new QLabel( GroupBox1, "Label2" );

    GroupBox1Layout->addWidget( Label2, 1, 0 );

    Layout4 = new QHBoxLayout( 0, 0, 6, "Layout4"); 

    itemPixmap = new QLabel( GroupBox1, "itemPixmap" );
    Layout4->addWidget( itemPixmap );

    itemDeletePixmap = new QPushButton( GroupBox1, "itemDeletePixmap" );
    itemDeletePixmap->setMaximumSize( QSize( 30, 22 ) );
    itemDeletePixmap->setPixmap( QPixmap::fromMimeSource( "designer_s_editcut.png" ) );
    Layout4->addWidget( itemDeletePixmap );

    itemChoosePixmap = new QPushButton( GroupBox1, "itemChoosePixmap" );
    itemChoosePixmap->setMaximumSize( QSize( 30, 22 ) );
    Layout4->addWidget( itemChoosePixmap );

    GroupBox1Layout->addLayout( Layout4, 1, 1 );
    Layout6->addWidget( GroupBox1 );
    IconViewEditorBaseLayout->addLayout( Layout6 );

    Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1"); 

    buttonHelp = new QPushButton( this, "buttonHelp" );
    buttonHelp->setAutoDefault( TRUE );
    Layout1->addWidget( buttonHelp );
    Horizontal_Spacing2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout1->addItem( Horizontal_Spacing2 );

    buttonApply = new QPushButton( this, "buttonApply" );
    buttonApply->setAutoDefault( TRUE );
    Layout1->addWidget( buttonApply );

    buttonOk = new QPushButton( this, "buttonOk" );
    buttonOk->setAutoDefault( TRUE );
    buttonOk->setDefault( TRUE );
    Layout1->addWidget( buttonOk );

    buttonCancel = new QPushButton( this, "buttonCancel" );
    buttonCancel->setAutoDefault( TRUE );
    Layout1->addWidget( buttonCancel );
    IconViewEditorBaseLayout->addLayout( Layout1 );
    languageChange();
    resize( QSize(567, 321).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( itemNew, SIGNAL( clicked() ), this, SLOT( insertNewItem() ) );
    connect( itemDelete, SIGNAL( clicked() ), this, SLOT( deleteCurrentItem() ) );
    connect( itemText, SIGNAL( textChanged( const QString & ) ), this, SLOT( currentTextChanged(const QString&) ) );
    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( okClicked() ) );
    connect( buttonApply, SIGNAL( clicked() ), this, SLOT( applyClicked() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) );
    connect( itemChoosePixmap, SIGNAL( clicked() ), this, SLOT( choosePixmap() ) );
    connect( preview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( currentItemChanged(QIconViewItem*) ) );
    connect( preview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentItemChanged(QIconViewItem*) ) );
    connect( itemDeletePixmap, SIGNAL( clicked() ), this, SLOT( deletePixmap() ) );

    // tab order
    setTabOrder( buttonOk, buttonCancel );
    setTabOrder( buttonCancel, preview );
    setTabOrder( preview, itemNew );
    setTabOrder( itemNew, itemDelete );
    setTabOrder( itemDelete, itemText );
    setTabOrder( itemText, itemDeletePixmap );
    setTabOrder( itemDeletePixmap, itemChoosePixmap );
    setTabOrder( itemChoosePixmap, buttonHelp );
    setTabOrder( buttonHelp, buttonApply );

    // buddies
    Label1->setBuddy( itemText );
    Label2->setBuddy( itemChoosePixmap );
    init();
}
Пример #5
0
/*
 *  Constructs a ListBoxEditorBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
ListBoxEditorBase::ListBoxEditorBase( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "ListBoxEditorBase" );
    setSizeGripEnabled( TRUE );
    ListBoxEditorBaseLayout = new QGridLayout( this, 1, 1, 11, 6, "ListBoxEditorBaseLayout"); 

    Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1"); 

    helpButton = new QPushButton( this, "helpButton" );
    helpButton->setAutoDefault( TRUE );
    Layout1->addWidget( helpButton );
    Horizontal_Spacing2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Layout1->addItem( Horizontal_Spacing2 );

    buttonApply = new QPushButton( this, "buttonApply" );
    buttonApply->setAutoDefault( TRUE );
    Layout1->addWidget( buttonApply );

    buttonOk = new QPushButton( this, "buttonOk" );
    buttonOk->setAutoDefault( TRUE );
    buttonOk->setDefault( TRUE );
    Layout1->addWidget( buttonOk );

    buttonCancel = new QPushButton( this, "buttonCancel" );
    buttonCancel->setAutoDefault( TRUE );
    Layout1->addWidget( buttonCancel );

    ListBoxEditorBaseLayout->addMultiCellLayout( Layout1, 5, 5, 0, 2 );

    preview = new QListBox( this, "preview" );

    ListBoxEditorBaseLayout->addMultiCellWidget( preview, 0, 4, 0, 0 );

    GroupBox1 = new QGroupBox( this, "GroupBox1" );
    GroupBox1->setColumnLayout(0, Qt::Vertical );
    GroupBox1->layout()->setSpacing( 6 );
    GroupBox1->layout()->setMargin( 11 );
    GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
    GroupBox1Layout->setAlignment( Qt::AlignTop );

    Label2 = new QLabel( GroupBox1, "Label2" );

    GroupBox1Layout->addWidget( Label2, 1, 0 );

    itemPixmap = new QLabel( GroupBox1, "itemPixmap" );

    GroupBox1Layout->addWidget( itemPixmap, 1, 1 );

    itemDeletePixmap = new QPushButton( GroupBox1, "itemDeletePixmap" );
    itemDeletePixmap->setMaximumSize( QSize( 30, 22 ) );
    itemDeletePixmap->setPixmap( QPixmap::fromMimeSource( "designer_s_editcut.png" ) );

    GroupBox1Layout->addWidget( itemDeletePixmap, 1, 2 );

    itemChoosePixmap = new QPushButton( GroupBox1, "itemChoosePixmap" );
    itemChoosePixmap->setMaximumSize( QSize( 30, 22 ) );

    GroupBox1Layout->addWidget( itemChoosePixmap, 1, 3 );

    Label1 = new QLabel( GroupBox1, "Label1" );

    GroupBox1Layout->addWidget( Label1, 0, 0 );

    itemText = new QLineEdit( GroupBox1, "itemText" );
    itemText->setMinimumSize( QSize( 0, 0 ) );

    GroupBox1Layout->addMultiCellWidget( itemText, 0, 0, 1, 3 );

    ListBoxEditorBaseLayout->addMultiCellWidget( GroupBox1, 0, 4, 2, 2 );

    itemNew = new QPushButton( this, "itemNew" );

    ListBoxEditorBaseLayout->addWidget( itemNew, 0, 1 );

    itemDelete = new QPushButton( this, "itemDelete" );

    ListBoxEditorBaseLayout->addWidget( itemDelete, 1, 1 );
    Vertical_Spacing1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
    ListBoxEditorBaseLayout->addItem( Vertical_Spacing1, 2, 1 );

    itemUp = new QPushButton( this, "itemUp" );
    itemUp->setPixmap( QPixmap::fromMimeSource( "designer_s_up.png" ) );

    ListBoxEditorBaseLayout->addWidget( itemUp, 3, 1 );

    itemDown = new QPushButton( this, "itemDown" );
    itemDown->setPixmap( QPixmap::fromMimeSource( "designer_s_down.png" ) );

    ListBoxEditorBaseLayout->addWidget( itemDown, 4, 1 );
    languageChange();
    resize( QSize(482, 229).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( itemNew, SIGNAL( clicked() ), this, SLOT( insertNewItem() ) );
    connect( itemDelete, SIGNAL( clicked() ), this, SLOT( deleteCurrentItem() ) );
    connect( itemText, SIGNAL( textChanged( const QString & ) ), this, SLOT( currentTextChanged(const QString&) ) );
    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( okClicked() ) );
    connect( buttonApply, SIGNAL( clicked() ), this, SLOT( applyClicked() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) );
    connect( itemChoosePixmap, SIGNAL( clicked() ), this, SLOT( choosePixmap() ) );
    connect( itemDeletePixmap, SIGNAL( clicked() ), this, SLOT( deletePixmap() ) );
    connect( itemUp, SIGNAL( clicked() ), this, SLOT( moveItemUp() ) );
    connect( itemDown, SIGNAL( clicked() ), this, SLOT( moveItemDown() ) );
    connect( preview, SIGNAL( selectionChanged(QListBoxItem*) ), this, SLOT( currentItemChanged(QListBoxItem*) ) );
    connect( preview, SIGNAL( currentChanged( QListBoxItem * ) ), this, SLOT( currentItemChanged(QListBoxItem*) ) );

    // tab order
    setTabOrder( buttonOk, buttonCancel );
    setTabOrder( buttonCancel, preview );
    setTabOrder( preview, itemNew );
    setTabOrder( itemNew, itemDelete );
    setTabOrder( itemDelete, itemUp );
    setTabOrder( itemUp, itemDown );
    setTabOrder( itemDown, itemText );
    setTabOrder( itemText, itemDeletePixmap );
    setTabOrder( itemDeletePixmap, itemChoosePixmap );
    setTabOrder( itemChoosePixmap, helpButton );
    setTabOrder( helpButton, buttonApply );

    // buddies
    Label2->setBuddy( itemChoosePixmap );
    Label1->setBuddy( itemText );
    init();
}