コード例 #1
0
FindDialog::FindDialog(QWidget *parent) :QDialog(parent)
{
	label = new QLabel(tr("find &what:"));
	lineEdit = new QLineEdit;
	label->setBuddy(lineEdit);
	caseCheckBox = new QCheckBox(tr("Match &case"));
	backwardCheckBox = new QCheckBox(tr("Search &backward"));
	findButton = new QPushButton(tr("&Find"));
	findButton->setDefault(true);
	findButton->setEnabled(false);
	closeButton = new QPushButton(tr("Close"));
	connect(lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(enableFindButton(const QString&)));
	connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
	connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
	QHBoxLayout *topLeftLayout = new QHBoxLayout;
	topLeftLayout->addWidget(label);
	topLeftLayout->addWidget(lineEdit);
	QVBoxLayout *leftLayout = new QVBoxLayout;
	leftLayout->addLayout(topLeftLayout);
	leftLayout->addWidget(caseCheckBox);
	leftLayout->addWidget(backwardCheckBox);
	QVBoxLayout *rightLayout = new QVBoxLayout;
	rightLayout->addWidget(findButton);
	rightLayout->addWidget(closeButton);
	rightLayout->addStretch();
	QHBoxLayout *mainLayout = new QHBoxLayout;
	mainLayout->addLayout(leftLayout);
	mainLayout->addLayout(rightLayout);
	setLayout(mainLayout);
	setWindowTitle(tr("Find"));
	setFixedHeight(sizeHint().height());
}
コード例 #2
0
ファイル: FindDialog.cpp プロジェクト: udara28/FindDialog
findDialog::findDialog(QWidget *parent) : QDialog(parent)
{	
	line = new QLineEdit();
	find = new QPushButton(tr("&Find"));
	close = new QPushButton(tr("&Close"));
	matchCase = new QCheckBox(tr("&Match Case"));
	findNext = new QCheckBox(tr("Find &Next"));
	lbl = new QLabel(tr("Find &what"));

	QHBoxLayout *box = new QHBoxLayout();
	box->addWidget(line);
	box->addWidget(lbl);
	box->addWidget(find);
	box->addWidget(close);
	box->addWidget(matchCase);
	setLayout(box);

	find->setDefault(true);
	find->setEnabled(false);	

	connect(line,SIGNAL(textChanged(const QString &)),this,
SLOT(findEnabled(const QString &)));

	connect(close,SIGNAL(clicked()),this,SLOT(close()));

	connect(find,SIGNAL(clicked()),this,SLOT(findClicked()));
}
コード例 #3
0
ファイル: input_dialog.cpp プロジェクト: HamiguaLu/phonelin
InputDialog::InputDialog(QWidget *parent)
    :QDialog(parent)
{
    label = new QLabel(tr("New Name"));
    lineEdit = new QLineEdit;
    label->setBuddy(lineEdit);

    findButton = new QPushButton(tr("OK"));
    findButton->setDefault(true);
    findButton->setEnabled(false);

    closeButton = new QPushButton(tr("Cancel"));

    connect(lineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(enableFindButton(const QString &)));
    connect(findButton,SIGNAL(clicked()),this,SLOT(findClicked()));
    connect(closeButton,SIGNAL(clicked()),this,SLOT(close()));


	QHBoxLayout *topLeftLayout = new QHBoxLayout;
    topLeftLayout->addWidget(label);
    topLeftLayout->addWidget(lineEdit);

    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout->addWidget(findButton);
    rightLayout->addWidget(closeButton);
    rightLayout->addStretch();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(topLeftLayout);
    mainLayout->addLayout(rightLayout);

    setLayout(mainLayout);
    setWindowTitle(tr("New"));
    setFixedHeight(sizeHint().height());
}
コード例 #4
0
ファイル: Window.cpp プロジェクト: swflb/qompose
void Window::initializeDialogs()
{
	// Create our dialog objects.

	preferencesDialog = new PreferencesDialog(this);

	findDialog = new FindDialog(this);

	replaceDialog = new ReplaceDialog(this);

	goToDialog = new GoToDialog(this);

	aboutDialog = new AboutDialog(this);

	// Connect our dialog actions.

	QObject::connect(findDialog, SIGNAL(accepted()), this,
	                 SLOT(doFindNext()));
	QObject::connect(replaceDialog, SIGNAL(replaceClicked()), this,
	                 SLOT(doReplace()));
	QObject::connect(replaceDialog, SIGNAL(findClicked()), this,
	                 SLOT(doReplaceFind()));
	QObject::connect(replaceDialog, SIGNAL(replaceSelectionClicked()), this,
	                 SLOT(doReplaceSelection()));
	QObject::connect(replaceDialog, SIGNAL(replaceAllClicked()), this,
	                 SLOT(doReplaceAll()));
	QObject::connect(goToDialog, SIGNAL(accepted()), this,
	                 SLOT(doGoToAccepted()));
}
コード例 #5
0
//! [constructor]
FindDialog::FindDialog(QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::FindDialog)
{
    m_ui->setupUi(this);

    connect(m_ui->findButton, SIGNAL(clicked()), this, SLOT(findClicked()));

    setWindowTitle(tr("Find a Contact"));
}
コード例 #6
0
ファイル: findroomsdlg.cpp プロジェクト: alex-games/a1
FindRoomsDlg::FindRoomsDlg(MapData* md, QWidget *parent)
  : QDialog(parent)
{
  setupUi(this);

  m_mapData = md;
  m_admin = NULL;
  adjustResultTable();

  connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableFindButton(const QString &)));
  connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
  connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
  connect(resultTable, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem *)));
}
コード例 #7
0
ファイル: moc_find_dialog.cpp プロジェクト: woongiap/mywork
int FindDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: findNext((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< Qt::CaseSensitivity(*)>(_a[2]))); break;
        case 1: findPrevious((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< Qt::CaseSensitivity(*)>(_a[2]))); break;
        case 2: findClicked(); break;
        case 3: enableFindButton((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        }
        _id -= 4;
    }
    return _id;
}
コード例 #8
0
ファイル: mainwindow.cpp プロジェクト: patricklyvo/Qt
// find dialog
void MainWindow::on_actionFind_triggered()
{
    // set find direction to down and match case to 0
    findDirectionDown = true;
    findMatchCaseState = 0;
    // show FindDialog
    findDialog = new FindDialog(this);
    findDialog->show();

    // connecting signal and slot to start finding the specified string
    connect(findDialog, SIGNAL(findClicked(QString)), this, SLOT(findString(QString)));
    // connecting signal and slot to change find direction
    connect(findDialog, SIGNAL(directionClicked(bool)), this, SLOT(changeFindDirection(bool)));
    // connecting signal and slot to change match case state
    connect(findDialog, SIGNAL(matchCaseClicked(int)), this, SLOT(changeMatchCase(int)));
}
コード例 #9
0
ファイル: findroomsdlg.cpp プロジェクト: GPUWorks/MMapper
FindRoomsDlg::FindRoomsDlg(MapData* md, QWidget *parent)
  : QDialog(parent)
{
  setupUi(this);

  m_mapData = md;
  m_admin = NULL;
  adjustResultTable();

  m_showSelectedRoom = new QShortcut( QKeySequence( tr( "Space", "Select result item" ) ), resultTable );
  m_showSelectedRoom->setContext( Qt::WidgetShortcut );

  connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableFindButton(const QString &)));
  connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
  connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
  connect(resultTable, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem *)));
  connect(m_showSelectedRoom, SIGNAL(activated()), this, SLOT(showSelectedRoom()));
}
コード例 #10
0
ファイル: finddialog.cpp プロジェクト: elProxy/qtbase
FindDialog::FindDialog(QWidget *parent)
    : QDialog(parent)
{
    QLabel *findLabel = new QLabel(tr("Enter the name of a contact:"));
    lineEdit = new QLineEdit;

    findButton = new QPushButton(tr("&Find"));
    findText = "";

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(findLabel);
    layout->addWidget(lineEdit);
    layout->addWidget(findButton);

    setLayout(layout);
    setWindowTitle(tr("Find a Contact"));
    connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
    connect(findButton, SIGNAL(clicked()), this, SLOT(accept()));
}
コード例 #11
0
ファイル: FindDialog.cpp プロジェクト: Incanus3/Ustredna
FindDialog::FindDialog(PhoneDatabase* db, QWidget* parent) : QDialog(parent)
{
	setWindowTitle(tr("Vyhledat"));

	findEdit = new QLineEdit;
	findButton = new QPushButton(tr("&Hledat"));
	findButton->setDefault(true);
	nameRadio = new QRadioButton(tr("podle jména"));
	nameRadio->setChecked(true);
	departmentRadio = new QRadioButton(tr("podle postu"));
	foundList = new QTableWidget;
	foundList->setMinimumWidth(750);
	foundList->setColumnCount(4);

	QStringList headers;
	headers << tr("Post")
			<< tr("Jméno")
			<< tr("Linka")
			<< tr("Ručka");

	foundList->setHorizontalHeaderLabels(headers);

	QHBoxLayout* upperLayout = new QHBoxLayout;
	upperLayout->addWidget(findEdit);
	upperLayout->addWidget(findButton);

	QHBoxLayout* middleLayout = new QHBoxLayout;
	middleLayout->addWidget(nameRadio);
	middleLayout->addStretch();
	middleLayout->addWidget(departmentRadio);

	QVBoxLayout* mainLayout = new QVBoxLayout;
	mainLayout->addLayout(upperLayout);
	mainLayout->addLayout(middleLayout);
	mainLayout->addWidget(foundList);

	setLayout(mainLayout);

	database = db;

	QObject::connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
}
コード例 #12
0
FindDialog::FindDialog(QWidget *parent)
    : QDialog(Parent)
{
    label    = new QLabel(tr("Find &what:"));
    lineEdit = new QLineEdit;
    label   -> setBuddy(lineEdit);

    caseCheckBox = new QCheckBox(tr("Match &case"));
    backwardCheckBox = new QCheckBox(tr("Search &backward"));

    findButton  = new QPushButton(tr("&Find"));
    findButton -> setDefault(true);
    findButton -> setEnabled(false);
    closeButton = new QPushButton(tr("Close"));

    //Signal and Slot Connections
    connect(lineEdit, SIGNAL(textChanged(const QString &)),
            this, SLOT(enableFindButton(const QString &)));
    connect(findButton, SIGNAL(clicked()),
            this, SLOT(findClicked()))
}
コード例 #13
0
FindDialog::FindDialog(QWidget *parent):QDialog(parent)
{
	label = new QLabel(tr("Find &what:"));
	lineEdit = new QLineEdit;
	label->setBuddy(lineEdit);
	caseCheckBox = new QCheckBox(tr("Match &case"));
	backwardCheckBox = new QCheckBox(tr("Search &backward"));
	findButton = new QPushButton(tr("&Find"));
	findButton->setDefault(true);
	findButton->setEnabled(false);
	closeButton = new QPushButton(tr("close"));
	connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableFindButton(const QString &)));
	connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
	connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
	
	QHBoxLayout *topLeftLayout = new QHBoxLayout;
	topLeftLayout->addWidget(label);
	topLeftLayout->addWidget(lineEdit);
	
	QVBoxLayout *leftLayout = new QVBoxLayout;
	leftLayout->addLayout(topLeftLayout);
	leftLayout->addWidget(caseCheckBox);
	leftLayout->addWidget(backwardCheckBox);

	QVBoxLayout *rightLayout = new QVBoxLayout;
	rightLayout->addWidget(findButton);
	rightLayout->addWidget(closeButton);
	
	QHBoxLayout *mainLayout = new QHBoxLayout;
	mainLayout->addLayout(leftLayout);
	mainLayout->addLayout(rightLayout);

	setLayout(mainLayout);
	setWindowTitle(tr("Find"));
	setFixedHeight(sizeHint().height());

	QSettings settings("find dialog settings");
	QString caseString = settings.value("case selected", QString("CaseSensitive")).toString();
	QMessageBox::about(this, tr("last case selected"), caseString);
}
コード例 #14
0
ファイル: finddialog.cpp プロジェクト: jaykrell/j
FindDialog::FindDialog(QWidget* parent)
:
	QDialog(parent),
	label(tr("Find &what:")),
	caseCheckBox(tr("Match &case")),
	backwardCheckBox(tr("Search &backward")),
	findButton(tr("&Find")),
	closeButton(tr("Close"))
{
	label.setBuddy(&lineEdit);
	findButton.setDefault(true);
	findButton.setEnabled(false);

	connect(&lineEdit, SIGNAL(textChanged(const QString&)),
		this, SLOT(enableFindButton(const QString&)));

	connect(&findButton, SIGNAL(clicked()),
		this, SLOT(findClicked()));

	connect(&closeButton, SIGNAL(clicked()),
		this, SLOT(close()));

	topLeftLayout.addWidget(&label);
	topLeftLayout.addWidget(&lineEdit);

	leftLayout.addLayout(&topLeftLayout);
	leftLayout.addWidget(&caseCheckBox);
	leftLayout.addWidget(&backwardCheckBox);

	rightLayout.addWidget(&findButton);
	rightLayout.addWidget(&closeButton);
	rightLayout.addStretch();

	mainLayout.addLayout(&leftLayout);
	mainLayout.addLayout(&rightLayout);
	setLayout(&mainLayout);

	setWindowTitle(tr("Find"));
	//setFixedHeight(sizeHint().height());
}
コード例 #15
0
ファイル: finddialog.cpp プロジェクト: lutinwood/edi
//constructeur
FindDialog::FindDialog(QWidget *parent) : QDialog(parent)
{
    m_label = new QLabel(tr("Rechercher :"));
    m_lineEdit = new QLineEdit;
    m_label->setBuddy(m_lineEdit);
    m_caseCheckBox = new QCheckBox(tr("Respecter la &casse"));
    m_backwardCheckBox = new QCheckBox(tr("Rechercher en &arrière"));
    m_findButton = new QPushButton(tr("&Rechercher"));
    m_findButton->setDefault(true);
    m_findButton->setEnabled(false);
    m_closeButton = new QPushButton(tr("Quitter"));
    connect(m_lineEdit, SIGNAL(textChanged(const QString &)),
        this, SLOT(enableFindButton(const QString &)));
    connect(m_findButton, SIGNAL(clicked()),
        this, SLOT(findClicked()));
    connect(m_closeButton, SIGNAL(clicked()),
        this, SLOT(close()));
    QHBoxLayout *topLeftLayout = new QHBoxLayout;
    topLeftLayout->addWidget(m_label);
    topLeftLayout->addWidget(m_lineEdit);
    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addLayout(topLeftLayout);
    leftLayout->addWidget(m_caseCheckBox);
    leftLayout->addWidget(m_backwardCheckBox);
    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout->addWidget(m_findButton);
    rightLayout->addWidget(m_closeButton);
    rightLayout->addStretch();
    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addLayout(leftLayout);
    mainLayout->addLayout(rightLayout);
    setLayout(mainLayout);
    setWindowTitle(tr("Rechercher"));
    setFixedHeight(sizeHint().height());
    m_findBefore = false;
    m_findAfter = false;
    connect(m_backwardCheckBox,SIGNAL(stateChanged(int)),this,SLOT(stateChanged(int)));
    connect(m_caseCheckBox,SIGNAL(stateChanged(int)),this,SLOT(stateChanged(int)));
}
コード例 #16
0
ファイル: GuiSearch.cpp プロジェクト: 315234/lyx-retina
GuiSearch::GuiSearch(GuiView & lv)
	: GuiDialog(lv, "findreplace", qt_("Find and Replace"))
{
	setupUi(this);

	connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
	connect(findPB, SIGNAL(clicked()), this, SLOT(findClicked()));
	connect(replacePB, SIGNAL(clicked()), this, SLOT(replaceClicked()));
	connect(replaceallPB, SIGNAL(clicked()), this, SLOT(replaceallClicked()));
	connect(findCO, SIGNAL(editTextChanged(QString)),
		this, SLOT(findChanged()));

	setFocusProxy(findCO);

	bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
	bc().setCancel(closePB);
	bc().addReadOnly(replaceCO);
	bc().addReadOnly(replacePB);
	bc().addReadOnly(replaceallPB);

	replacePB->setEnabled(false);
	replaceallPB->setEnabled(false);
}
コード例 #17
0
/**
 * Create the widgets and lay them out
 */
void FindReplaceDialog::initLayout() {
  QGroupBox *gb1 = new QGroupBox();
  m_topLayout = new QGridLayout(gb1);

  m_topLayout->addWidget(new QLabel(tr("Find")), 0, 0);
  boxFind = new QComboBox();
  boxFind->setEditable(true);
  boxFind->setDuplicatesEnabled(false);
  boxFind->setInsertPolicy(QComboBox::InsertAtTop);
  boxFind->setAutoCompletion(true);
  boxFind->setMaxCount(10);
  boxFind->setMaxVisibleItems(10);
  boxFind->setMinimumWidth(250);
  boxFind->setSizePolicy(
      QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
  connect(boxFind, SIGNAL(editTextChanged(const QString &)), this,
          SLOT(resetSearchFlags()));

  m_topLayout->addWidget(boxFind, 0, 1);

  addReplaceBox();

  QGroupBox *gb2 = new QGroupBox();
  QGridLayout *bottomLayout = new QGridLayout(gb2);
  QButtonGroup *find_options = new QButtonGroup(this);
  find_options->setExclusive(false);

  boxCaseSensitive = new QCheckBox(tr("&Match case"));
  boxCaseSensitive->setChecked(false);
  bottomLayout->addWidget(boxCaseSensitive, 0, 0);
  find_options->addButton(boxCaseSensitive);

  boxWholeWords = new QCheckBox(tr("&Whole word"));
  boxWholeWords->setChecked(false);
  bottomLayout->addWidget(boxWholeWords, 1, 0);
  find_options->addButton(boxWholeWords);

  boxRegex = new QCheckBox(tr("&Regular expression"));
  boxRegex->setChecked(false);
  bottomLayout->addWidget(boxRegex, 2, 0);
  find_options->addButton(boxRegex);

  boxSearchBackwards = new QCheckBox(tr("&Search backwards"));
  boxSearchBackwards->setChecked(false);
  bottomLayout->addWidget(boxSearchBackwards, 0, 1);
  find_options->addButton(boxSearchBackwards);

  boxWrapAround = new QCheckBox(tr("&Wrap around"));
  boxWrapAround->setChecked(true);
  bottomLayout->addWidget(boxWrapAround, 1, 1);
  find_options->addButton(boxWrapAround);
  connect(find_options, SIGNAL(buttonClicked(int)), this,
          SLOT(resetSearchFlags()));

  QVBoxLayout *vb1 = new QVBoxLayout();
  vb1->addWidget(gb1);
  vb1->addWidget(gb2);

  m_vb2 = new QVBoxLayout();

  buttonNext = new QPushButton(tr("&Next"));
  buttonNext->setShortcut(tr("Ctrl+F"));
  buttonNext->setDefault(true);
  m_vb2->addWidget(buttonNext);
  connect(buttonNext, SIGNAL(clicked()), this, SLOT(findClicked()));

  addReplaceButtons();

  buttonCancel = new QPushButton(tr("&Close"));
  m_vb2->addWidget(buttonCancel);
  m_vb2->addStretch();
  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));

  QHBoxLayout *hb = new QHBoxLayout(this);
  hb->addLayout(vb1);
  hb->addLayout(m_vb2);
}
コード例 #18
0
BestIntervalDialog::BestIntervalDialog(Context *context) :
    context(context)
{
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowTitle("Find Intervals");
    HelpWhatsThis *help = new HelpWhatsThis(this);
    this->setWhatsThis(help->getWhatsThisText(HelpWhatsThis::FindIntervals));

    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    QHBoxLayout *intervalLengthLayout = new QHBoxLayout;
    QLabel *intervalLengthLabel = new QLabel(tr("Interval length: "), this);
    intervalLengthLayout->addWidget(intervalLengthLabel);
    hrsSpinBox = new QDoubleSpinBox(this);
    hrsSpinBox->setDecimals(0);
    hrsSpinBox->setMinimum(0.0);
    hrsSpinBox->setSuffix(" hrs");
    hrsSpinBox->setSingleStep(1.0);
    hrsSpinBox->setAlignment(Qt::AlignRight);
    intervalLengthLayout->addWidget(hrsSpinBox);
    minsSpinBox = new QDoubleSpinBox(this);
    minsSpinBox->setDecimals(0);
    minsSpinBox->setRange(0.0, 59.0);
    minsSpinBox->setSuffix(" mins");
    minsSpinBox->setSingleStep(1.0);
    minsSpinBox->setWrapping(true);
    minsSpinBox->setAlignment(Qt::AlignRight);
    minsSpinBox->setValue(1.0);
    intervalLengthLayout->addWidget(minsSpinBox);
    secsSpinBox = new QDoubleSpinBox(this);
    secsSpinBox->setDecimals(0);
    secsSpinBox->setRange(0.0, 59.0);
    secsSpinBox->setSuffix(" secs");
    secsSpinBox->setSingleStep(1.0);
    secsSpinBox->setWrapping(true);
    secsSpinBox->setAlignment(Qt::AlignRight);
    intervalLengthLayout->addWidget(secsSpinBox);
    mainLayout->addLayout(intervalLengthLayout);

    QHBoxLayout *intervalCountLayout = new QHBoxLayout;
    QLabel *intervalCountLabel = new QLabel(tr("How many to find: "), this);
    intervalCountLayout->addWidget(intervalCountLabel);
    countSpinBox = new QDoubleSpinBox(this);
    countSpinBox->setDecimals(0);
    countSpinBox->setMinimum(1.0);
    countSpinBox->setValue(5.0); // lets default to the top 5 powers
    countSpinBox->setSingleStep(1.0);
    countSpinBox->setAlignment(Qt::AlignRight);
    intervalCountLayout->addWidget(countSpinBox);
    mainLayout->addLayout(intervalCountLayout);

    QLabel *resultsLabel = new QLabel(tr("Results:"), this);
    mainLayout->addWidget(resultsLabel);

    // user can select from the results to add
    // to the ride intervals
    resultsTable = new QTableWidget;
    mainLayout->addWidget(resultsTable);
    resultsTable->setColumnCount(5);
    resultsTable->setColumnHidden(3, true); // has start time in secs
    resultsTable->setColumnHidden(4, true); // has stop time in secs
    resultsTable->horizontalHeader()->hide();
//    resultsTable->verticalHeader()->hide();
    resultsTable->setShowGrid(false);

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    findButton = new QPushButton(tr("&Find Intervals"), this);
    buttonLayout->addWidget(findButton);
    doneButton = new QPushButton(tr("&Done"), this);
    buttonLayout->addWidget(doneButton);
    addButton = new QPushButton(tr("&Add to Intervals"));
    buttonLayout->addWidget(addButton);
    mainLayout->addLayout(buttonLayout);

    connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
    connect(doneButton, SIGNAL(clicked()), this, SLOT(doneClicked()));
    connect(addButton, SIGNAL(clicked()), this, SLOT(addClicked()));
}
コード例 #19
0
ファイル: desktopwidget.cpp プロジェクト: sglass68/paperman
QWidget *Desktopwidget::createToolbar(void)
   {
   QWidget *group = new QWidget (this);

   //TODO: Move this to use the designer
   /* create the desktop toolbar. We are doing this manually since we can't
      seem to get Qt to insert a QLineEdit into a toolbar */
   _toolbar = new QToolBar (group);
//   _toolbar = new QWidget (group);
//   _toolbar = group;
   addAction (_actionPprev, "Previous page", SLOT(pageLeft ()), "", _toolbar, "pprev.xpm");
   addAction (_actionPprev, "Next page", SLOT(pageRight ()), "", _toolbar, "pnext.xpm");
   addAction (_actionPprev, "Previous stack", SLOT(stackLeft ()), "", _toolbar, "prev.xpm");
   addAction (_actionPprev, "Next stack", SLOT(stackRight ()), "", _toolbar, "next.xpm");

   QWidget *findgroup = new QWidget (_toolbar);

   QHBoxLayout *hboxLayout2 = new QHBoxLayout();
   hboxLayout2->setSpacing(0);
   hboxLayout2->setContentsMargins (0, 0, 0, 0);
   hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2"));
   findgroup->setLayout (hboxLayout2);

   QLabel *label = new QLabel (findgroup);
   label->setText(QApplication::translate("Mainwindow", "Filter:", 0));
   label->setObjectName(QString::fromUtf8("label"));

   hboxLayout2->addWidget(label);

   _match = new QLineEdit (findgroup);
   _match->setObjectName ("match");
   QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Fixed);
   sizePolicy2.setHorizontalStretch(1);
   sizePolicy2.setVerticalStretch(0);
   sizePolicy2.setHeightForWidth(_match->sizePolicy().hasHeightForWidth());
   _match->setSizePolicy(sizePolicy2);
   _match->setMinimumSize(QSize(50, 0));
   //_match->setDragEnabled(true);

   connect (_match, SIGNAL (returnPressed()),
        this, SLOT (matchUpdate ()));
   connect (_match, SIGNAL (textChanged(const QString&)),
        this, SLOT (matchChange (const QString &)));
   //_reset_filter = new QAction (this);
   //_reset_filter->setShortcut (Qt::Key_Escape);
   //connect (_reset_filter, SIGNAL (triggered()), this, SLOT (resetFilter()));
   //_match->addAction (_reset_filter);
   //_match->installEventFilter (this);

   // When ESC is pressed, clear the field
   QStateMachine *machine = new QStateMachine (this);
   QState *s1 = new QState (machine);

//   QSignalTransition *pressed_esc = new QSignalTransition(_match,
//                                       SIGNAL(textChanged(const QString&)));
   QKeyEventTransition *pressed_esc = new QKeyEventTransition(_match,
                           QEvent::KeyPress, Qt::Key_Escape);
   s1->addTransition (pressed_esc);
   connect(pressed_esc, SIGNAL(triggered()), this, SLOT(resetFilter()));
   machine->setInitialState (s1);
   machine->start ();
#if 0
  QPushButton *test = new QPushButton (findgroup);
  test->setText ("hello");
  hboxLayout2->addWidget (test);

   QStateMachine *test_machine = new QStateMachine (this);
   QState *test_s1 = new QState (test_machine);

   QSignalTransition *trans = new QSignalTransition(test, SIGNAL(clicked()));
   test_s1->addTransition (trans);
   connect(trans, SIGNAL(triggered()), this, SLOT(resetFilter()));
   test_machine->setInitialState (test_s1);
   test_machine->start ();
#endif
    // and change the state
   hboxLayout2->addWidget(label);

   hboxLayout2->addWidget (_match);

   addAction (_find, "Filter stacks", SLOT(findClicked ()), "", findgroup, "find.xpm");
   QToolButton *find = new QToolButton (findgroup);
   find->setDefaultAction (_find);
   hboxLayout2->addWidget (find);
//    connect (_find, SIGNAL (activated ()), this, SLOT (findClicked ()));

   QSpacerItem *spacerItem = new QSpacerItem(16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

   hboxLayout2->addItem (spacerItem);

   _global = new QCheckBox("Subdirs", findgroup);
   _global->setObjectName(QString::fromUtf8("global"));

   hboxLayout2->addWidget(_global);

   addAction (_reset, "Reset", SLOT(resetFilter ()), "", findgroup);
   QToolButton *reset = new QToolButton (findgroup);
   reset->setDefaultAction (_reset);
   hboxLayout2->addWidget (reset);

   _toolbar->addWidget (findgroup);

#ifndef QT_NO_TOOLTIP
   _match->setToolTip(QApplication::translate("Mainwindow", "Enter part of the name of the stack to search for", 0));
   _find->setToolTip(QApplication::translate("Mainwindow", "Search for the name", 0));
   _global->setToolTip(QApplication::translate("Mainwindow", "Enable this to search all subdirectories also", 0));
   _reset->setToolTip(QApplication::translate("Mainwindow", "Reset the search string", 0));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
   _match->setWhatsThis(QApplication::translate("Mainwindow", "The filter feature can be used in two ways. To filter out unwanted stacks, type a few characters from the stack name that you are looking for. Everything that does not match will be removed from view. To go back, just delete characters from the filter.\n"
"\n"
"There is also a 'global' mode which allows searching of all subdirectories. To use this, select the 'global' button, then type your filter string. Press return or click 'find' to perform the search. This might take a while.\n"
"\n"
"To reset the filter, click the 'reset' button.", 0));
   _find->setWhatsThis(QApplication::translate("Mainwindow", "Click this button to perform a search when in global mode", 0));
   _global->setWhatsThis(QApplication::translate("Mainwindow", "The filter feature can be used in two ways. To filter out unwanted stacks, type a few characters from the stack name that you are looking for. Everything that does not match will be removed from view. To go back, just delete characters from the filter.\n"
"\n"
"There is also a 'global' mode which allows searching of all subdirectories. To use this, select the 'global' button, then type your filter string. Press return or click 'find' to perform the search. This might take a while.\n"
"\n"
"To reset the filter, click the 'reset' button.", 0));
   _reset->setWhatsThis(QApplication::translate("Mainwindow", "Press this button to reset the filter string and display stacks in the current directory", 0));
#endif // QT_NO_WHATSTHIS
   return group;
   }
コード例 #20
0
BestIntervalDialog::BestIntervalDialog(MainWindow *mainWindow) : 
    mainWindow(mainWindow)
{
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowTitle("Find Best Intervals");
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    QHBoxLayout *intervalLengthLayout = new QHBoxLayout;
    QLabel *intervalLengthLabel = new QLabel(tr("Interval length: "), this);
    intervalLengthLayout->addWidget(intervalLengthLabel);
    hrsSpinBox = new QDoubleSpinBox(this);
    hrsSpinBox->setDecimals(0);
    hrsSpinBox->setMinimum(0.0);
    hrsSpinBox->setSuffix(" hrs");
    hrsSpinBox->setSingleStep(1.0);
    hrsSpinBox->setAlignment(Qt::AlignRight);
    intervalLengthLayout->addWidget(hrsSpinBox);
    minsSpinBox = new QDoubleSpinBox(this);
    minsSpinBox->setDecimals(0);
    minsSpinBox->setRange(0.0, 59.0);
    minsSpinBox->setSuffix(" mins");
    minsSpinBox->setSingleStep(1.0);
    minsSpinBox->setWrapping(true);
    minsSpinBox->setAlignment(Qt::AlignRight);
    minsSpinBox->setValue(1.0);
    intervalLengthLayout->addWidget(minsSpinBox);
    secsSpinBox = new QDoubleSpinBox(this);
    secsSpinBox->setDecimals(0);
    secsSpinBox->setRange(0.0, 59.0);
    secsSpinBox->setSuffix(" secs");
    secsSpinBox->setSingleStep(1.0);
    secsSpinBox->setWrapping(true);
    secsSpinBox->setAlignment(Qt::AlignRight);
    intervalLengthLayout->addWidget(secsSpinBox);
    mainLayout->addLayout(intervalLengthLayout);

    QHBoxLayout *intervalCountLayout = new QHBoxLayout;
    QLabel *intervalCountLabel = new QLabel(tr("How many to find: "), this);
    intervalCountLayout->addWidget(intervalCountLabel);
    countSpinBox = new QDoubleSpinBox(this);
    countSpinBox->setDecimals(0);
    countSpinBox->setMinimum(1.0);
    countSpinBox->setSingleStep(1.0);
    countSpinBox->setAlignment(Qt::AlignRight);
    intervalCountLayout->addWidget(countSpinBox);
    mainLayout->addLayout(intervalCountLayout);

    QLabel *resultsLabel = new QLabel(tr("Results:"), this);
    mainLayout->addWidget(resultsLabel);

    resultsText = new QTextEdit(this);
    resultsText->setReadOnly(true);
    mainLayout->addWidget(resultsText);
 
    QHBoxLayout *buttonLayout = new QHBoxLayout; 
    findButton = new QPushButton(tr("&Find Intervals"), this);
    buttonLayout->addWidget(findButton);
    doneButton = new QPushButton(tr("&Done"), this);
    buttonLayout->addWidget(doneButton);
    mainLayout->addLayout(buttonLayout);

    connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
    connect(doneButton, SIGNAL(clicked()), this, SLOT(doneClicked()));
}
コード例 #21
0
ファイル: logdlg.cpp プロジェクト: serghei/kde-kdesdk
LogDialog::LogDialog(KConfig& cfg, QWidget *parent, const char *name)
    : KDialogBase(parent, name, false, QString::null,
                  Ok | Apply | Close | Help | User1 | User2 | User3, Close, true,
                  KGuiItem(i18n("&Annotate")),
                  KGuiItem(i18n("&Diff"), "vcs_diff"),
                  KGuiItem(i18n("&Find..."), "find"))
    , cvsService(0)
    , partConfig(cfg)
{
    QSplitter *splitter = new QSplitter(Qt::Vertical, this);
    setMainWidget(splitter);

    tree = new LogTreeView(this);
    connect( tree, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    QWidget* listWidget = new QWidget(this);
    QVBoxLayout* listLayout = new QVBoxLayout(listWidget);
    QHBoxLayout* searchLayout = new QHBoxLayout(listLayout);
    searchLayout->setMargin(KDialog::spacingHint());
    searchLayout->setSpacing(KDialog::spacingHint());

    list = new LogListView(partConfig, listWidget);
    listLayout->addWidget(list, 1);

    KListViewSearchLine* searchLine = new KListViewSearchLine(listWidget, list);
    QLabel* searchLabel = new QLabel(searchLine, i18n("S&earch:"), listWidget);
    searchLayout->addWidget(searchLabel);
    searchLayout->addWidget(searchLine, 1);

    connect( list, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    plain = new LogPlainView(this);
    connect( plain, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    tabWidget = new QTabWidget(splitter);
    tabWidget->addTab(tree, i18n("&Tree"));
    tabWidget->addTab(listWidget, i18n("&List"));
    tabWidget->addTab(plain, i18n("CVS &Output"));

    connect(tabWidget, SIGNAL(currentChanged(QWidget*)),
            this, SLOT(tabChanged(QWidget*)));

    QWhatsThis::add(tree, i18n("Choose revision A by clicking with the left "
                               "mouse button,\nrevision B by clicking with "
                               "the middle mouse button."));

    items.setAutoDelete(true);
    tags.setAutoDelete(true);

    QWidget *mainWidget = new QWidget(splitter);
    QBoxLayout *layout = new QVBoxLayout(mainWidget, 0, spacingHint());

    for (int i = 0; i < 2; ++i)
    {
        if ( i == 1 )
        {
            QFrame *frame = new QFrame(mainWidget);
            frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
            layout->addWidget(frame);
        }

        QGridLayout *grid = new QGridLayout(layout);
        grid->setRowStretch(0, 0);
        grid->setRowStretch(1, 0);
        grid->setRowStretch(2, 1);
        grid->setColStretch(0, 0);
        grid->setColStretch(1, 1);
        grid->setColStretch(2, 0);
        grid->setColStretch(3, 1);
        grid->setColStretch(4, 2);

        QString versionident = (i==0)? i18n("Revision A:") : i18n("Revision B:");
        QLabel *versionlabel = new QLabel(versionident, mainWidget);
        grid->addWidget(versionlabel, 0, 0);

        revbox[i] = new QLabel(mainWidget);
        revbox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        grid->addWidget(revbox[i], 0, 1, Qt::AlignVCenter);

        QLabel *selectlabel = new QLabel(i18n("Select by tag:"), mainWidget);
        grid->addWidget(selectlabel, 0, 2);

        tagcombo[i] = new QComboBox(mainWidget);
        QFontMetrics fm(tagcombo[i]->fontMetrics());
        tagcombo[i]->setMinimumWidth(fm.width("X")*20);
        grid->addWidget(tagcombo[i], 0, 3);

        QLabel *authorlabel = new QLabel(i18n("Author:"), mainWidget);
        grid->addWidget(authorlabel, 1, 0);

        authorbox[i] = new QLabel(mainWidget);
        authorbox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        grid->addWidget(authorbox[i], 1, 1);

        QLabel *datelabel = new QLabel(i18n("Date:"), mainWidget);
        grid->addWidget(datelabel, 1, 2);

        datebox[i] = new QLabel(mainWidget);
        datebox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        grid->addWidget(datebox[i], 1, 3);

        QLabel *commentlabel = new QLabel(i18n("Comment/Tags:"), mainWidget);
        grid->addWidget(commentlabel, 2, 0);

        commentbox[i] = new QTextEdit(mainWidget);
        commentbox[i]->setReadOnly(true);
        commentbox[i]->setTextFormat(Qt::PlainText);
        fm = commentbox[i]->fontMetrics();
        commentbox[i]->setMinimumHeight(2*fm.lineSpacing()+10);
        grid->addMultiCellWidget(commentbox[i], 2, 2, 1, 3);

        tagsbox[i] = new QTextEdit(mainWidget);
        tagsbox[i]->setReadOnly(true);
        tagsbox[i]->setMinimumHeight(2*fm.lineSpacing()+10);
        grid->addWidget(tagsbox[i], 2, 4);
    }

    QWhatsThis::add(revbox[0], i18n("This revision is used when you click "
                                    "Annotate.\nIt is also used as the first "
                                    "item of a Diff operation."));
    QWhatsThis::add(revbox[1], i18n("This revision is used as the second "
                                    "item of a Diff operation."));

    connect( tagcombo[0], SIGNAL(activated(int)),
             this, SLOT(tagASelected(int)) );
    connect( tagcombo[1], SIGNAL(activated(int)),
             this, SLOT(tagBSelected(int)) );

    connect( this, SIGNAL(user1Clicked()),
             this, SLOT(annotateClicked()) );
    connect( this, SIGNAL(user2Clicked()),
             this, SLOT(diffClicked()) );
    connect( this, SIGNAL(user3Clicked()),
             this, SLOT(findClicked()) );

    setButtonGuiItem(Ok, KGuiItem(i18n("to view something", "&View"),"fileopen"));
    setButtonGuiItem(Apply, KGuiItem(i18n("Create Patch...")));
    setHelp("browsinglogs");

    setWFlags(Qt::WDestructiveClose | getWFlags());

    QSize size = configDialogSize(partConfig, "LogDialog");
    resize(size);

    KConfigGroupSaver cs(&partConfig, "LogDialog");
    tabWidget->setCurrentPage(partConfig.readNumEntry("ShowTab", 0));

    updateButtons();
}
コード例 #22
0
ファイル: findReplaceDialog.cpp プロジェクト: Antropovi/qreal
	mUi->setupUi(this);

	mCheckBoxes.append(mUi->mByNameBox);
	mCheckBoxes.append(mUi->mByTypeBox);
	mCheckBoxes.append(mUi->mByPropertyBox);
	mCheckBoxes.append(mUi->mByContentBox);
	mCheckBoxes.append(mUi->mSensitivity);
	mCheckBoxes.append(mUi->mByRegExp);

	mCheckBoxes.first()->setChecked(true);

	foreach (QCheckBox *current, mCheckBoxes) {
		connect(current, SIGNAL(clicked()), this, SLOT(tryEnableReplaceButton()));
	}

	connect(mUi->mFindButton, SIGNAL(clicked()), this, SLOT(findClicked()));
	connect(mUi->mReplaceButton, SIGNAL(clicked()), this, SLOT(replaceHandler()));

	stateClear();

	setWindowTitle(tr("Search"));
}

void FindReplaceDialog::tryEnableReplaceButton()
{
	mUi->mReplaceButton->setEnabled((mUi->mByNameBox->isChecked() || mUi->mByContentBox->isChecked())
			&& (!mUi->mByPropertyBox->isChecked()) && (!mUi->mByTypeBox->isChecked()));
}

void FindReplaceDialog::stateClear()
{
コード例 #23
0
ファイル: logdialog.cpp プロジェクト: KDE/cervisia
LogDialog::LogDialog(KConfig& cfg, QWidget *parent)
    : QDialog(parent)
    , cvsService(0)
    , partConfig(cfg)
{
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    splitter = new QSplitter(Qt::Vertical, this);
    mainLayout->addWidget(splitter);

    tree = new LogTreeView(this);
    connect( tree, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    QWidget* listWidget = new QWidget(this);
    QVBoxLayout* listLayout = new QVBoxLayout(listWidget);
    QHBoxLayout* searchLayout = new QHBoxLayout();
    listLayout->addLayout(searchLayout);

    list = new LogListView(partConfig, listWidget);
    listLayout->addWidget(list, 1);

    KTreeWidgetSearchLine* searchLine = new KTreeWidgetSearchLine(listWidget, list);
    QLabel* searchLabel = new QLabel(i18n("Search:"),listWidget);
    searchLabel->setBuddy(searchLine);
    searchLayout->addWidget(searchLabel);
    searchLayout->addWidget(searchLine, 1);

    connect( list, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    plain = new LogPlainView(this);
    connect( plain, SIGNAL(revisionClicked(QString,bool)),
             this, SLOT(revisionSelected(QString,bool)) );

    tabWidget = new QTabWidget;
    tabWidget->addTab(tree, i18n("&Tree"));
    tabWidget->addTab(listWidget, i18n("&List"));
    tabWidget->addTab(plain, i18n("CVS &Output"));
    splitter->addWidget(tabWidget);
    splitter->setStretchFactor(0, 1);

    connect(tabWidget, &QTabWidget::currentChanged, this, &LogDialog::tabChanged);

    tree->setWhatsThis( i18n("Choose revision A by clicking with the left "
                               "mouse button,\nrevision B by clicking with "
                               "the middle mouse button."));

    QWidget *mainWidget = new QWidget;
    splitter->addWidget(mainWidget);
    QBoxLayout *layout = new QVBoxLayout(mainWidget);
    layout->setMargin(0);

    for (int i = 0; i < 2; ++i)
    {
        if ( i == 1 )
        {
            QFrame *frame = new QFrame(mainWidget);
            frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
            layout->addWidget(frame);
        }

        QGridLayout *grid = new QGridLayout();
        layout->addLayout( grid );
        grid->setRowStretch(0, 0);
        grid->setRowStretch(1, 0);
        grid->setRowStretch(2, 1);
        grid->setColumnStretch(0, 0);
        grid->setColumnStretch(1, 1);
        grid->setColumnStretch(2, 0);
        grid->setColumnStretch(3, 1);
        grid->setColumnStretch(4, 2);

        QString versionident = (i==0)? i18n("Revision A:") : i18n("Revision B:");
        QLabel *versionlabel = new QLabel(versionident, mainWidget);
        grid->addWidget(versionlabel, 0, 0);

        revbox[i] = new QLabel(mainWidget);
        revbox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        revbox[i]->setTextInteractionFlags(Qt::TextSelectableByMouse);
        grid->addWidget(revbox[i], 0, 1, Qt::AlignVCenter);

        QLabel *selectlabel = new QLabel(i18n("Select by tag:"), mainWidget);
        grid->addWidget(selectlabel, 0, 2);

        tagcombo[i] = new KComboBox(mainWidget);
        QFontMetrics fm(tagcombo[i]->fontMetrics());
        tagcombo[i]->setMinimumWidth(fm.width("X")*20);
        grid->addWidget(tagcombo[i], 0, 3);

        QLabel *authorlabel = new QLabel(i18n("Author:"), mainWidget);
        grid->addWidget(authorlabel, 1, 0);

        authorbox[i] = new QLabel(mainWidget);
        authorbox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        authorbox[i]->setTextInteractionFlags(Qt::TextSelectableByMouse);
        grid->addWidget(authorbox[i], 1, 1);

        QLabel *datelabel = new QLabel(i18n("Date:"), mainWidget);
        grid->addWidget(datelabel, 1, 2);

        datebox[i] = new QLabel(mainWidget);
        datebox[i]->setFrameStyle(QFrame::Panel | QFrame::Sunken);
        datebox[i]->setTextInteractionFlags(Qt::TextSelectableByMouse);
        grid->addWidget(datebox[i], 1, 3);

        QLabel *commentlabel = new QLabel(i18n("Comment/Tags:"), mainWidget);
        grid->addWidget(commentlabel, 2, 0);

        commentbox[i] = new KTextEdit(mainWidget);
        commentbox[i]->setReadOnly(true);
        fm = commentbox[i]->fontMetrics();
        commentbox[i]->setMinimumHeight(2*fm.lineSpacing()+10);
        grid->addWidget(commentbox[i], 2, 1, 1, 3);

        tagsbox[i] = new KTextEdit(mainWidget);
        tagsbox[i]->setReadOnly(true);
        tagsbox[i]->setMinimumHeight(2*fm.lineSpacing()+10);
        grid->addWidget(tagsbox[i], 0, 4, 3, 1);
    }

    buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Help | QDialogButtonBox::Close | QDialogButtonBox::Apply);

    okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(okButton, &QPushButton::clicked, this, &LogDialog::slotOk);

    user1Button = new QPushButton;
    buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);

    user2Button = new QPushButton;
    buttonBox->addButton(user2Button, QDialogButtonBox::ActionRole);

    user3Button = new QPushButton;
    buttonBox->addButton(user3Button, QDialogButtonBox::ActionRole);

    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    KGuiItem::assign(user1Button, KGuiItem(i18n("&Annotate A")));
    KGuiItem::assign(user2Button, KGuiItem(i18n("&Diff")));
    KGuiItem::assign(user3Button, KGuiItem(i18n("&Find")));
    user3Button->setVisible(false);

    // initially make the version info widget as small as possible
    splitter->setSizes(QList<int>() << height() << 10);

    revbox[0]->setWhatsThis(i18n("This revision is used when you click "
                                 "Annotate.\nIt is also used as the first "
                                 "item of a Diff operation."));

    revbox[1]->setWhatsThis(i18n("This revision is used as the second "
                                 "item of a Diff operation."));

    connect(tagcombo[0], SIGNAL(activated(int)), this, SLOT(tagASelected(int)));
    connect(tagcombo[1], SIGNAL(activated(int)), this, SLOT(tagBSelected(int)));

    connect(user1Button, SIGNAL(clicked()), this, SLOT(annotateClicked()));
    connect(user2Button, SIGNAL(clicked()), this, SLOT(diffClicked()));
    connect(user3Button, SIGNAL(clicked()), this, SLOT(findClicked()));

    connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(slotPatch()));
    connect(buttonBox, &QDialogButtonBox::helpRequested, this, &LogDialog::slotHelp);

    KGuiItem::assign(okButton, KGuiItem(i18n("&View A")));
    KGuiItem::assign(buttonBox->button(QDialogButtonBox::Apply), KGuiItem(i18n("Create Patch...")));

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

    setAttribute(Qt::WA_DeleteOnClose, true);

    KConfigGroup cg(&partConfig, "LogDialog");
    tabWidget->setCurrentIndex(cg.readEntry("ShowTab", 0));
    restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray()));

    splitter->restoreState(cg.readEntry<QByteArray>("Splitter", QByteArray()));

    updateButtons();
}