Пример #1
0
void UserMenuDialog::slotSaveAsClicked()
{
	QString filename = saveAsClicked();
	if ( !filename.isEmpty() ) {
		// set new state: current file is not installed anymore
		m_modified = false;
		setXmlFile(filename,false);
		updateDialogButtons();
	}
}
Пример #2
0
RegionListFrame::RegionListFrame(QWidget *parent, AnnotatorWnd *annWnd) :
    QFrame(parent),
    ui(new Ui::RegionListFrame),
    mAnnotatorWnd(annWnd)
{
    ui->setupUi(this);

    connect( ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
             this, SLOT(listCurrentItemChanged(QListWidgetItem*,QListWidgetItem*)));

    connect( ui->butSave, SIGNAL(clicked()), this, SLOT(saveAsClicked()) );
    connect( ui->listWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(listClickedSignal(QModelIndex)) );
    connect( ui->butLabelRegion, SIGNAL(clicked()), this, SLOT(butLabelRegionClicked()) );
}
Пример #3
0
bool UserMenuDialog::okClicked()
{
	if ( m_currentXmlFile.isEmpty() ) {
		return !saveAsClicked().isEmpty();
	}

	if ( ! saveClicked() ) {
		return false;
	}

	if ( m_currentXmlInstalled ) {
		m_modified = false;
		slotInstallClicked();
	}
	return true;
}
int MainWindowImpl::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: openClicked(); break;
        case 1: saveAsClicked(); break;
        case 2: closeClicked(); break;
        case 3: aboutClicked(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Пример #5
0
DiffDialog::DiffDialog(KConfig& cfg, QWidget *parent, bool modal)
    : QDialog(parent)
    , partConfig(cfg)
{
    markeditem = -1;
    setModal(modal);

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

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Close);
    connect(buttonBox, &QDialogButtonBox::helpRequested, this, &DiffDialog::slotHelp);

    QPushButton *user1Button = new QPushButton;
    buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    KGuiItem::assign(user1Button, KStandardGuiItem::saveAs());

    QGridLayout *pairlayout = new QGridLayout();
    mainLayout->addLayout(pairlayout);
    pairlayout->setRowStretch(0, 0);
    pairlayout->setRowStretch(1, 1);
    pairlayout->setColumnStretch(1, 0);
    pairlayout->addItem(new QSpacerItem(16, 0), 0, 1);
    pairlayout->setColumnStretch(0, 10);
    pairlayout->setColumnStretch(2, 10);

    revlabel1 = new QLabel;
    pairlayout->addWidget(revlabel1, 0, 0);

    revlabel2 = new QLabel;
    pairlayout->addWidget(revlabel2, 0, 2);

    diff1 = new DiffView(cfg, true, false, this);
    diff2 = new DiffView(cfg, true, true, this);
    DiffZoomWidget *zoom = new DiffZoomWidget(this);
    zoom->setDiffView(diff2);

    pairlayout->addWidget(diff1, 1, 0);
    pairlayout->addWidget(zoom,  1, 1);
    pairlayout->addWidget(diff2, 1, 2);

    diff1->setPartner(diff2);
    diff2->setPartner(diff1);

    syncbox = new QCheckBox(i18n("Synchronize scroll bars"));
    syncbox->setChecked(true);
    connect(syncbox, SIGNAL(toggled(bool)), this, SLOT(toggleSynchronize(bool)));

    itemscombo = new KComboBox;
    itemscombo->addItem(QString());
    connect(itemscombo, SIGNAL(activated(int)), this, SLOT(comboActivated(int)));

    nofnlabel = new QLabel;
    // avoids auto resize when the text is changed
    nofnlabel->setMinimumWidth(fontMetrics().width(i18np("%1 difference", "%1 differences", 10000)));

    backbutton = new QPushButton(QLatin1String("&<<"));
    connect(backbutton, SIGNAL(clicked()), SLOT(backClicked()));

    forwbutton = new QPushButton(QLatin1String("&>>"));
    connect(forwbutton, SIGNAL(clicked()), SLOT(forwClicked()));

    connect(user1Button, SIGNAL(clicked()), SLOT(saveAsClicked()));

    QBoxLayout *buttonlayout = new QHBoxLayout();
    mainLayout->addLayout(buttonlayout);
    buttonlayout->addWidget(syncbox, 0);
    buttonlayout->addStretch(4);
    buttonlayout->addWidget(itemscombo);
    buttonlayout->addStretch(1);
    buttonlayout->addWidget(nofnlabel);
    buttonlayout->addStretch(1);
    buttonlayout->addWidget(backbutton);
    buttonlayout->addWidget(forwbutton);

    mainLayout->addWidget(buttonBox);
    buttonBox->button(QDialogButtonBox::Close)->setDefault(true);

    setAttribute(Qt::WA_DeleteOnClose, true);

    KConfigGroup cg(&partConfig, "DiffDialog");
    syncbox->setChecked(cg.readEntry("Sync",false));
    restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray()));
}