コード例 #1
0
void MacroCart::doubleClickedData(QListViewItem *,const QPoint &,int)
{
    if(rdcart_allow_modification) {
        QListViewItem *item=rdcart_macro_list->selectedItem();

        if((item==NULL)||(item->text(0).isEmpty())) {
            addMacroData();
        }
        else {
            editMacroData();
        }
    }
}
コード例 #2
0
ファイル: macro_cart.cpp プロジェクト: stgabmp/Rivendell
MacroCart::MacroCart(RDCart *cart,QWidget *parent,const char *name)
    : QWidget(parent,name)
{
    rdcart_length=0;
    rdcart_cart=cart;
    setCaption(QString().sprintf("%u",rdcart_cart->number())+" - "+
               rdcart_cart->title());
    rdcart_allow_modification=lib_user->modifyCarts();

    //
    // Generate Fonts
    //
    QFont button_font=QFont("Helvetica",12,QFont::Bold);
    button_font.setPixelSize(12);
    QFont line_edit_font=QFont("Helvetica",12,QFont::Normal);
    line_edit_font.setPixelSize(12);

    //
    // Add Macro Button
    //
    rdcart_add_button=new QPushButton(this,"add_macro_button");
    rdcart_add_button->setGeometry(10,0,80,50);
    rdcart_add_button->setFont(button_font);
    rdcart_add_button->setText(tr("Add"));
    connect(rdcart_add_button,SIGNAL(clicked()),this,SLOT(addMacroData()));

    //
    // Delete Macro Button
    //
    rdcart_delete_button=new QPushButton(this,"delete_macro_button");
    rdcart_delete_button->setGeometry(10,60,80,50);
    rdcart_delete_button->setFont(button_font);
    rdcart_delete_button->setText(tr("Delete"));
    connect(rdcart_delete_button,SIGNAL(clicked()),this,SLOT(deleteMacroData()));

    //
    // Copy Macro Button
    //
    rdcart_copy_button=new QPushButton(this,"copy_macro_button");
    rdcart_copy_button->setGeometry(10,120,80,50);
    rdcart_copy_button->setFont(button_font);
    rdcart_copy_button->setText(tr("Copy"));
    connect(rdcart_copy_button,SIGNAL(clicked()),this,SLOT(copyMacroData()));

    //
    // Paste Macro Button
    //
    paste_macro_button=new QPushButton(this,"paste_macro_button");
    paste_macro_button->setGeometry(10,180,80,50);
    paste_macro_button->setFont(button_font);
    paste_macro_button->setText(tr("Paste"));
    paste_macro_button->setDisabled(true);
    connect(paste_macro_button,SIGNAL(clicked()),this,SLOT(pasteMacroData()));

    //
    // Cart Macro List
    //
    rdcart_events=new RDMacroEvent(rdstation_conf->address(),rdripc,
                                   this,"rdcart_events");
    rdcart_events->load(rdcart_cart->macros());

    rdcart_macro_list=new QListView(this,"rdcart_macro_list");
    rdcart_macro_list->setGeometry(100,0,430,230);
    rdcart_macro_list->setAllColumnsShowFocus(true);
    rdcart_macro_list->setItemMargin(5);
    rdcart_macro_list->setSorting(0);
    connect(rdcart_macro_list,
            SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
            this,
            SLOT(doubleClickedData(QListViewItem *,const QPoint &,int)));

    rdcart_macro_list->addColumn(tr("LINE"));
    rdcart_macro_list->setColumnAlignment(0,Qt::AlignHCenter);

    rdcart_macro_list->addColumn(tr("COMMAND"));
    rdcart_macro_list->setColumnAlignment(1,Qt::AlignLeft);

    rdcart_macro_list_label=new QLabel(rdcart_macro_list,tr("Macros"),
                                       this,"rdcartmacro_list_label");
    rdcart_macro_list_label->setGeometry(105,345,430,22);
    rdcart_macro_list_label->setFont(QFont("Helvetica",16,QFont::Bold));

    RefreshList();

    //
    // Edit Macro Button
    //
    rdcart_edit_button=new QPushButton(this,"edit_edit_button");
    rdcart_edit_button->setGeometry(550,0,80,50);
    rdcart_edit_button->setFont(button_font);
    rdcart_edit_button->setText(tr("Edit"));
    connect(rdcart_edit_button,SIGNAL(clicked()),this,SLOT(editMacroData()));

    //
    // Run Line Button
    //
    rdcart_runline_button=new QPushButton(this,"run_macro_button");
    rdcart_runline_button->setGeometry(550,120,80,50);
    rdcart_runline_button->setFont(button_font);
    rdcart_runline_button->setText(tr("Run\nLine"));
    connect(rdcart_runline_button,SIGNAL(clicked()),
            this,SLOT(runLineMacroData()));

    //
    // Run Cart Button
    //
    rdcart_runcart_button=new QPushButton(this,"run_macro_button");
    rdcart_runcart_button->setGeometry(550,180,80,50);
    rdcart_runcart_button->setFont(button_font);
    rdcart_runcart_button->setText(tr("Run\nCart"));
    connect(rdcart_runcart_button,SIGNAL(clicked()),
            this,SLOT(runCartMacroData()));

    //
    // Set Control Permissions
    //
    rdcart_add_button->setEnabled(rdcart_allow_modification);
    rdcart_delete_button->setEnabled(rdcart_allow_modification);
    rdcart_copy_button->setEnabled(rdcart_allow_modification);
    rdcart_edit_button->setEnabled(rdcart_allow_modification);
}
コード例 #3
0
ファイル: macro_cart.cpp プロジェクト: stgabmp/Rivendell
void MacroCart::doubleClickedData(QListViewItem *,const QPoint &,int)
{
    if(rdcart_allow_modification) {
        editMacroData();
    }
}