void TableEditorDialog::setProxyModel(ChartProxyModel* proxyModel)
{
    if (m_proxyModel == proxyModel)
        return;

    // Disconnect the old proxy model.
    m_proxyModel->disconnect(this);

    m_proxyModel = proxyModel;

    // Connect the new proxy model.
    if (m_proxyModel) {
        connect(m_proxyModel,       SIGNAL(modelReset()),
                 this,               SLOT(slotUpdateDialog()));
    }

    slotUpdateDialog();
}
Exemplo n.º 2
0
HgUpdateDialog::HgUpdateDialog(QWidget *parent):
    KDialog(parent, Qt::Dialog)
{
    // dialog properties
    this->setCaption(i18nc("@title:window", 
                "<application>Hg</application> Update"));
    this->setButtons(KDialog::None);
    this->setButtons(KDialog::Ok | KDialog::Cancel);
    this->setDefaultButton(KDialog::Ok);
    this->setButtonText(KDialog::Ok, i18nc("@action:button", "Update"));

    // UI 
    QGroupBox *selectGroup = new QGroupBox(i18n("New working directory"));
    QVBoxLayout *selectLayout = new QVBoxLayout;
    m_selectType = new KComboBox;
    m_selectFinal = new KComboBox;
    m_selectType->addItem(i18n("Branch"));
    m_selectType->addItem(i18n("Tag"));
    m_selectType->addItem(i18n("Changeset/Revision"));
    selectLayout->addWidget(m_selectType);
    selectLayout->addWidget(m_selectFinal);
    selectGroup->setLayout(selectLayout);

    QGroupBox *infoGroup = new QGroupBox(i18n("Current Parent"));
    QVBoxLayout *infoLayout = new QVBoxLayout;
    m_currentInfo = new QLabel;
    infoLayout->addWidget(m_currentInfo);
    infoGroup->setLayout(infoLayout);

    QGroupBox *optionGroup = new QGroupBox(i18n("Options"));
    QVBoxLayout *optionLayout = new QVBoxLayout;
    m_discardChanges = new QCheckBox("Discard uncommitted changes");
    m_discardChanges->setCheckState(Qt::Unchecked);
    optionLayout->addWidget(m_discardChanges);
    optionGroup->setLayout(optionLayout);

    QFrame *frame = new QFrame;
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(infoGroup);
    mainLayout->addWidget(selectGroup);
    mainLayout->addWidget(optionGroup);
    frame->setLayout(mainLayout);

    slotUpdateDialog(0);
    setMainWidget(frame);

    // connections
    connect(m_selectType, SIGNAL(currentIndexChanged(int)), this,
            SLOT(slotUpdateDialog(int)));
}
Exemplo n.º 3
0
HgUpdateDialog::HgUpdateDialog(QWidget *parent):
    DialogBase(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, parent)
{
    // dialog properties
    this->setWindowTitle(xi18nc("@title:window",
                "<application>Hg</application> Update"));

    this->okButton()->setText(xi18nc("@action:button", "Update"));

    // UI 
    QGroupBox *selectGroup = new QGroupBox(i18n("New working directory"));
    QVBoxLayout *selectLayout = new QVBoxLayout;
    m_selectType = new KComboBox;
    m_selectFinal = new KComboBox;
    m_selectType->addItem(i18n("Branch"));
    m_selectType->addItem(i18n("Tag"));
    m_selectType->addItem(i18n("Changeset/Revision"));
    selectLayout->addWidget(m_selectType);
    selectLayout->addWidget(m_selectFinal);
    selectGroup->setLayout(selectLayout);

    QGroupBox *infoGroup = new QGroupBox(i18n("Current Parent"));
    QVBoxLayout *infoLayout = new QVBoxLayout;
    m_currentInfo = new QLabel;
    infoLayout->addWidget(m_currentInfo);
    infoGroup->setLayout(infoLayout);

    QGroupBox *optionGroup = new QGroupBox(i18n("Options"));
    QVBoxLayout *optionLayout = new QVBoxLayout;
    m_discardChanges = new QCheckBox(i18n("Discard uncommitted changes"));
    m_discardChanges->setCheckState(Qt::Unchecked);
    optionLayout->addWidget(m_discardChanges);
    optionGroup->setLayout(optionLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(infoGroup);
    mainLayout->addWidget(selectGroup);
    mainLayout->addWidget(optionGroup);

    slotUpdateDialog(0);
    layout()->insertLayout(0, mainLayout);

    // connections
    connect(m_selectType, SIGNAL(currentIndexChanged(int)), this,
            SLOT(slotUpdateDialog(int)));
}
void TableEditorDialog::init()
{
    tableViewContainer->addWidget(m_tableView);

    KIcon insertRowIcon = KIcon("insert_table_row");
    KIcon deleteRowIcon = KIcon("delete_table_row");
    KIcon insertColIcon = KIcon("insert_table_col");
    KIcon deleteColIcon = KIcon("delete_table_col");

    // Create actions.
    m_insertRowsAction    = new QAction(insertRowIcon, i18n("Insert Rows"), m_tableView);
    m_deleteRowsAction    = new QAction(deleteRowIcon, i18n("Delete Rows"), m_tableView);
    m_insertColumnsAction = new QAction(insertColIcon, i18n("Insert Columns"), m_tableView);
    m_deleteColumnsAction = new QAction(deleteColIcon, i18n("Delete Columns"), m_tableView);

    // Set icons on buttons(?).
    insertRow->setIcon(insertRowIcon);
    deleteRow->setIcon(deleteRowIcon);
    insertColumn->setIcon(insertColIcon);
    deleteColumn->setIcon(deleteColIcon);

    // Initially, no index is selected. Deletion only works with legal
    // selections.  They will automatically be enabled when an index
    // is selected.
    deleteRow->setEnabled(false);
    deleteColumn->setEnabled(false);

    // Buttons
    connect(insertRow,    SIGNAL(pressed()), this, SLOT(slotInsertRowPressed()));
    connect(insertColumn, SIGNAL(pressed()), this, SLOT(slotInsertColumnPressed()));
    connect(deleteRow,    SIGNAL(pressed()), this, SLOT(slotDeleteRowPressed()));
    connect(deleteColumn, SIGNAL(pressed()), this, SLOT(slotDeleteColumnPressed()));

    // Context Menu Actions
    connect(m_insertRowsAction,    SIGNAL(triggered()), this, SLOT(slotInsertRowPressed()));
    connect(m_insertColumnsAction, SIGNAL(triggered()), this, SLOT(slotInsertColumnPressed()));
    connect(m_deleteRowsAction,    SIGNAL(triggered()), this, SLOT(slotDeleteRowPressed()));
    connect(m_deleteColumnsAction, SIGNAL(triggered()), this, SLOT(slotDeleteColumnPressed()));
    connect(m_tableView,  SIGNAL(currentIndexChanged(const QModelIndex&)),
             this,         SLOT(slotCurrentIndexChanged(const QModelIndex&)));
    // We only need to connect one of the data direction buttons, since
    // they are mutually exclusive.
    connect(dataSetsInRows, SIGNAL(toggled(bool)),
             this,           SLOT(slotDataSetsInRowsToggled(bool)));

    // FIXME: QAction to create a separator??
    QAction *separator = new QAction(m_tableView);
    separator->setSeparator(true);

    // Add all the actions to the view.
    m_tableView->addAction(m_deleteRowsAction);
    m_tableView->addAction(m_insertRowsAction);
    m_tableView->addAction(separator);
    m_tableView->addAction(m_deleteColumnsAction);
    m_tableView->addAction(m_insertColumnsAction);

    m_tableView->setContextMenuPolicy(Qt::ActionsContextMenu);

    // Initialize the contents of the controls
    slotUpdateDialog();
}