OpenGLDebugMessageWindow::OpenGLDebugMessageWindow(QWidget *parent) :
    QDialog(parent)
{
    m_view = new QTreeView;
    m_view->setRootIsDecorated(false);

    QDialogButtonBox *buttonBox = new QDialogButtonBox;
    QPushButton *closeButton = buttonBox->addButton(QDialogButtonBox::Close);
    connect(closeButton, &QPushButton::clicked, this, &QWidget::close);

    m_clearButton = buttonBox->addButton(QDialogButtonBox::Reset);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(m_view);
    layout->addWidget(buttonBox);
    setLayout(layout);

    resize(600, 300);
}
EditPageSetDialog::EditPageSetDialog(QWidget * parent) : QDialog(parent) {
  QLOG_DEBUG() << Q_FUNC_INFO;
  QStringList cols;
  cols << tr("Id") << tr("Title") << tr("Tab count") << tr("Created") << tr("Delete") << tr("Select tabs") << tr("Tabs to delete");

  m_setlist = new ColumnarTableWidget(cols);
  m_setlist->setKey(ColumnarTableWidget::STATE,SID_PAGESET_EDIT_TAB_LIST_STATE);

  readSettings();

  setWindowTitle(tr("Edit Tab Set"));

  QVBoxLayout * layout = new QVBoxLayout;


  layout->addWidget(m_setlist);


  int rows = this->loadTitles();


  QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel);
  m_loadButton  = new QPushButton(tr("Apply"));


  buttonBox->addButton(m_loadButton,QDialogButtonBox::ActionRole);
  m_loadButton->setVisible(rows > 0);
  m_loadButton->setEnabled(false);


  connect(m_loadButton,SIGNAL(clicked()),this,SLOT(onApply()));
  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
  layout->addWidget(buttonBox);

  setLayout(layout);

  connect(m_setlist,SIGNAL(itemDoubleClicked(QTableWidgetItem *)),this,SLOT(onItemDoubleClicked(QTableWidgetItem *)));
  m_dirty = false;

  SETTINGS
  settings.beginGroup("PageSets");
  m_setlist->readConfiguration(settings);
}
Exemple #3
0
SelectExpiryDate::SelectExpiryDate(QWidget* parent, QDateTime date)
	: QDialog(parent)
{
	setWindowTitle(i18n("Choose New Expiration"));
	QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
	QWidget *mainWidget = new QWidget(this);
	QVBoxLayout *mainLayout = new QVBoxLayout(this);
	setLayout(mainLayout);
	mainLayout->addWidget(mainWidget);
	okButton = buttonBox->button(QDialogButtonBox::Ok);
	okButton->setDefault(true);
	okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
	connect(buttonBox, &QDialogButtonBox::accepted, this, &SelectExpiryDate::accept);
	connect(buttonBox, &QDialogButtonBox::rejected, this, &SelectExpiryDate::reject);
	okButton->setDefault(true);

	QWidget *page = new QWidget(this);
	m_unlimited = new QCheckBox(i18nc("Key has unlimited lifetime", "Unlimited"), page);
	m_unlimited->setChecked(date.isNull());

	if (date.isNull())
		date = QDateTime::currentDateTime();

	m_datepicker = new KDatePicker(date.date(), page);
	if (date.isNull()) {
		m_datepicker->setEnabled(false);
		m_unlimited->setChecked(true);
	}

	QVBoxLayout *layout = new QVBoxLayout(page);
	layout->setSpacing(3);
	layout->addWidget(m_datepicker);
	layout->addWidget(m_unlimited);

	connect(m_unlimited, &QCheckBox::toggled, this, &SelectExpiryDate::slotEnableDate);
	connect(m_datepicker, &KDatePicker::dateChanged, this, &SelectExpiryDate::slotCheckDate);
	connect(m_datepicker, &KDatePicker::dateEntered, this, &SelectExpiryDate::slotCheckDate);

	mainLayout->addWidget(page);
	mainLayout->addWidget(buttonBox);
	show();

	slotEnableDate(m_unlimited->isChecked());
}
Exemple #4
0
void TestGui::testAddEntry()
{
    EntryView* entryView = m_dbWidget->findChild<EntryView*>("entryView");
    QAction* entryNewAction = m_mainWindow->findChild<QAction*>("actionEntryNew");
    QVERIFY(entryNewAction->isEnabled());
    QToolBar* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar");
    QWidget* entryNewWidget = toolBar->widgetForAction(entryNewAction);
    QVERIFY(entryNewWidget->isVisible());
    QVERIFY(entryNewWidget->isEnabled());

    QTest::mouseClick(entryNewWidget, Qt::LeftButton);

    QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::EditMode);

    EditEntryWidget* editEntryWidget = m_dbWidget->findChild<EditEntryWidget*>("editEntryWidget");
    QLineEdit* titleEdit = editEntryWidget->findChild<QLineEdit*>("titleEdit");
    QTest::keyClicks(titleEdit, "test");

    QDialogButtonBox* editEntryWidgetButtonBox = editEntryWidget->findChild<QDialogButtonBox*>("buttonBox");
    QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);

    QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::ViewMode);
    QModelIndex item = entryView->model()->index(1, 1);
    Entry* entry = entryView->entryFromIndex(item);

    QCOMPARE(entry->title(), QString("test"));
    QCOMPARE(entry->historyItems().size(), 0);
    // wait for modified timer
    QTRY_COMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("NewDatabase.kdbx*"));

    QAction* entryEditAction = m_mainWindow->findChild<QAction*>("actionEntryEdit");
    QVERIFY(entryEditAction->isEnabled());
    QWidget* entryEditWidget = toolBar->widgetForAction(entryEditAction);
    QVERIFY(entryEditWidget->isVisible());
    QVERIFY(entryEditWidget->isEnabled());
    QTest::mouseClick(entryEditWidget, Qt::LeftButton);

    QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::EditMode);
    QTest::keyClicks(titleEdit, "something");
    QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);

    QCOMPARE(entry->title(), QString("testsomething"));
    QCOMPARE(entry->historyItems().size(), 1);
}
ChooseFileDlg::ChooseFileDlg(QWidget *parent)
	: QDialog(parent)
{
	new QVBoxLayout(this);

	QPushButton *upload = new QPushButton(tr("Choose file to upload..."), this);
	connect(upload, SIGNAL(clicked(bool)), this, SLOT(onFileSelect(bool)));
	layout()->addWidget(upload);

	QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
	buttons->setCenterButtons(true);
	connect(buttons, &QDialogButtonBox::accepted, this, [this]() {
		done(QDialog::Accepted);
	});
	connect(buttons, &QDialogButtonBox::rejected, this, [this]() {
		done(QDialog::Rejected);
	});
	layout()->addWidget(buttons);
}
DeleteThemeDialog::DeleteThemeDialog(QWidget * parent) : QDialog(parent) {
  QVBoxLayout * layout = new QVBoxLayout;

  setWindowTitle(tr("Delete Theme"));
  m_themes = new QComboBox;
  QStringList themes = getLexicon()->getThemes();
  themes.sort();

  m_themes->addItems(themes);
  m_currentTheme = getLexicon()->currentTheme();
  m_themes->setCurrentText(m_currentTheme);


  m_switch = new QComboBox;
  m_switch->addItems(themes);
  m_currentTheme = getLexicon()->currentTheme();


  connect(m_themes,SIGNAL(currentIndexChanged(int)),this,SLOT(onChangeTheme(int)));
  m_themes->setCurrentText(m_currentTheme);

  m_themes->removeItem(m_themes->findText(m_currentTheme));
  //  m_switch->removeItem(m_themes->findText(m_currentTheme));
  QFormLayout * form = new QFormLayout;
  form->addRow(tr("Delete theme"),m_themes);
  form->addRow(tr("New theme"),m_switch);

  m_deleteButton = new QPushButton(tr("Delete"));
  QDialogButtonBox * btns = new QDialogButtonBox(QDialogButtonBox::Cancel);
  btns->addButton(m_deleteButton,QDialogButtonBox::AcceptRole);
  connect(btns,SIGNAL(accepted()),this,SLOT(accept()));
  connect(btns,SIGNAL(rejected()),this,SLOT(reject()));

  layout->addWidget(new QLabel(QString(tr("The current theme is \"%1\" and cannot be deleted.")).arg(m_currentTheme)));
  layout->addLayout(form);
  layout->addWidget(btns);
  //  layout->addStretch();
  setLayout(layout);

  if (themes.size() == 1) {
    m_deleteButton->setEnabled(false);
  }
};
DialogResourceText::DialogResourceText(QString text, QWidget *parent): QDialog(parent)
{
	setWindowTitle(tr("Resource Dialog"));
	
	QDialogButtonBox *dialogbuttonbox = new QDialogButtonBox(this);
	dialogbuttonbox->setOrientation(Qt::Horizontal);
	dialogbuttonbox->setStandardButtons(QDialogButtonBox::Ok);

	QTextEdit *textedit = new QTextEdit(this);
	textedit->setAcceptRichText(true);
	textedit->setText(text);
	textedit->setReadOnly(true);

	QGridLayout *layout = new QGridLayout(this);
	layout->addWidget(textedit);
	layout->addWidget(dialogbuttonbox);

	connect(dialogbuttonbox, SIGNAL(accepted()), this, SLOT(accept()));
}
SlideFrictionControlSetupDialog::SlideFrictionControlSetupDialog()
    : ParamSetupDialog()
{
    setWindowTitle("Slide Friction Control Setup");

    QVBoxLayout* vbox = new QVBoxLayout();

    layout_ = (ParamSetupLayout*) new SlideFrictionControlSetupLayout();
    vbox->addLayout(layout_);

    QPushButton* okButton = new QPushButton("&Ok");
    okButton->setDefault(true);
    QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
    buttonBox->addButton(okButton, QDialogButtonBox::AcceptRole);
    connect(buttonBox,SIGNAL(accepted()), this, SLOT(accept()));
    vbox->addWidget(buttonBox);

    setLayout(vbox);
}
SendLaterConfigureDialog::SendLaterConfigureDialog(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(i18n("Configure"));
    setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    setLayout(mainLayout);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &SendLaterConfigureDialog::reject);

    mWidget = new SendLaterWidget(this);
    mWidget->setObjectName(QStringLiteral("sendlaterwidget"));
    connect(mWidget, &SendLaterWidget::sendNow, this, &SendLaterConfigureDialog::sendNow);
    mainLayout->addWidget(mWidget);
    mainLayout->addWidget(buttonBox);
    connect(okButton, &QPushButton::clicked, this, &SendLaterConfigureDialog::slotSave);

    readConfig();

    KAboutData aboutData = KAboutData(
                               QStringLiteral("sendlateragent"),
                               i18n("Send Later Agent"),
                               QStringLiteral(KDEPIM_VERSION),
                               i18n("Send emails later agent."),
                               KAboutLicense::GPL_V2,
                               i18n("Copyright (C) 2013-2016 Laurent Montel"));

    aboutData.addAuthor(i18n("Laurent Montel"),
                        i18n("Maintainer"), QStringLiteral("*****@*****.**"));

    QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
    aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"),
                            i18nc("EMAIL OF TRANSLATORS", "Your emails"));

    KHelpMenu *helpMenu = new KHelpMenu(this, aboutData, true);
    //Initialize menu
    QMenu *menu = helpMenu->menu();
    helpMenu->action(KHelpMenu::menuAboutApp)->setIcon(QIcon::fromTheme(QStringLiteral("kmail")));
    buttonBox->button(QDialogButtonBox::Help)->setMenu(menu);
}
DialogDeleteEntry::DialogDeleteEntry(QWidget* parent)
                 : QDialog(parent)
{
    setWindowIcon(QIcon(":/images/remove_entry.png"));
    setWindowTitle("Remove entry");

    QVBoxLayout* mainLayout = new QVBoxLayout();

    modelEntry = new QSqlQueryModel();
    modelEntry->setQuery("SELECT group_name, real_name, id_entry, category.name, active_entries.entry_id FROM mod_entry_summary, category, active_entries WHERE category.category_id = mod_entry_summary.category_id AND id_entry = active_entries.entry_id");
    //summaryModelUnassigned->setHeaderData(0, Qt::Horizontal, tr("Order"));
    modelEntry->setHeaderData(0, Qt::Horizontal, tr("Group"));
    modelEntry->setHeaderData(1, Qt::Horizontal, tr("Real name 1"));
    modelEntry->setHeaderData(3, Qt::Horizontal, tr("Category"));

    viewEntry = new QTableView();
    //connect(summaryViewUnassigned,SIGNAL(clicked(const QModelIndex&)),this,SLOT(entrySelected(const QModelIndex&)));
    viewEntry->setModel(modelEntry);
    //summaryViewUnassigned->setColumnHidden(0,true);
    viewEntry->setColumnHidden(2,true);
    //summaryViewUnassigned->setColumnHidden(4,true);
    viewEntry->show();
    //summaryViewUnassigned->setMaximumWidth(400);
    mainLayout->addWidget(viewEntry);
    permaDelete = new QCheckBox("Delete permanently?");
    mainLayout->addWidget(permaDelete);
    QPushButton* delButton = new QPushButton(QIcon(":/images/graveyard2.png"),"Delete entry");
    delButton->setIconSize(QSize(48,48));
    delButton->setToolTip("Delete the entry.");
    connect(delButton,SIGNAL(clicked()),this,SLOT(deleteEntry()));
    QHBoxLayout* btnLayout = new QHBoxLayout();
    btnLayout->addWidget(delButton);
    btnLayout->addStretch();
    mainLayout->addLayout(btnLayout);

    QDialogButtonBox* buttonBox = new QDialogButtonBox();
    buttonBox->addButton(QDialogButtonBox::Close);
    connect(buttonBox,SIGNAL(accepted()),this,SLOT(accept()));
    connect(buttonBox,SIGNAL(rejected()),this,SLOT(reject()));
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);
    loadSettings();
}
Exemple #11
0
int main(int argc, char ** argv) {
   QApplication app{argc, argv};
   QWidget w;
   QVBoxLayout layout{&w};
   // Individual Buttons
   QPushButton p1{"button1"}, p2{"button2"};
   for (auto p : {&p1, &p2}) {
      layout.addWidget(p);
      p->setFocusPolicy(Qt::StrongFocus);
   }
   // A button box
   QDialogButtonBox box;
   for (auto text : {"button3", "button4"})
      box.addButton(text, QDialogButtonBox::NoRole)->setFocusPolicy(Qt::StrongFocus);
   layout.addWidget(&box);

   w.show();
   return app.exec();
}
Exemple #12
0
KNotesKeyDialog::KNotesKeyDialog(KActionCollection *globals, QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(i18n("Configure Shortcuts"));
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::accepted, this, &KNotesKeyDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &KNotesKeyDialog::reject);

    m_keyChooser = new KShortcutsEditor(globals, this);
    mainLayout->addWidget(m_keyChooser);
    mainLayout->addWidget(buttonBox);
    connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, m_keyChooser, &KShortcutsEditor::allDefault);
    readConfig();
}
Exemple #13
0
QDialogButtonBox *Dialog::createButtons()
{
    QPushButton *closeButton = new QPushButton(tr("&Close"));
    QPushButton *revertButton = new QPushButton(tr("&Revert"));
    QPushButton *submitButton = new QPushButton(tr("&Submit"));

    closeButton->setDefault(true);

    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(revertButton, SIGNAL(clicked()), this, SLOT(revert()));
    connect(submitButton, SIGNAL(clicked()), this, SLOT(submit()));

    QDialogButtonBox *buttonBox = new QDialogButtonBox;
    buttonBox->addButton(submitButton, QDialogButtonBox::ResetRole);
    buttonBox->addButton(revertButton, QDialogButtonBox::ResetRole);
    buttonBox->addButton(closeButton, QDialogButtonBox::RejectRole);

    return buttonBox;
}
void tst_AddBookmarkDialog::addbookmarkdialog()
{
    QFETCH(QString, url);
    QFETCH(QString, title);
    QFETCH(QDialogButtonBox::StandardButton, button);
    QFETCH(int, menuCount);
    QFETCH(int, toolbarCount);
    QFETCH(int, select);

    BookmarksManager *manager = BrowserApplication::bookmarksManager();
    qRegisterMetaType<BookmarkNode *>("BookmarkNode *");
    QSignalSpy spy(manager, SIGNAL(entryAdded(BookmarkNode *)));
    BookmarkNode *menu = manager->menu();
    BookmarkNode *toolbar = manager->toolbar();
    QCOMPARE(menu->children().count(), 0);
    QCOMPARE(toolbar->children().count(), 0);

    SubAddBookmarkDialog dialog(0, manager);
    dialog.setUrl(url);
    dialog.setTitle(title);
    QComboBox *combobox = dialog.findChild<QComboBox*>();
    QVERIFY(combobox);
    if (select != -1) {
        combobox->setCurrentIndex(select);
        combobox->view()->setCurrentIndex(combobox->model()->index(select, 0));
    }
    QDialogButtonBox *buttonBox = dialog.findChild<QDialogButtonBox*>();
    QVERIFY(buttonBox);
    QPushButton *pushButton = buttonBox->button(button);
    pushButton->click();

    QCOMPARE(spy.count(), menuCount + toolbarCount);

    QCOMPARE(menu->children().count(), menuCount);
    QCOMPARE(toolbar->children().count(), toolbarCount);
    BookmarkNode *node = 0;
    if (menuCount == 1) node = menu->children()[0];
    if (toolbarCount == 1) node = toolbar->children()[0];
    if (node) {
        QCOMPARE(node->title, title);
        QCOMPARE(node->url, url);
    }
}
Exemple #15
0
void SettingsDialog::createGui()
{
    // Header label with large font and a bit of spacing (align with group boxes)
    QFont headerLabelFont = m_headerLabel->font();
    headerLabelFont.setBold(true);
    // Paranoia: Should a font be set in pixels...
    const int pointSize = headerLabelFont.pointSize();
    if (pointSize > 0)
        headerLabelFont.setPointSize(pointSize + 2);
    m_headerLabel->setFont(headerLabelFont);

    QHBoxLayout *headerHLayout = new QHBoxLayout;
    const int leftMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
    headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
    headerHLayout->addWidget(m_headerLabel);

    m_stackedLayout->setMargin(0);
    m_stackedLayout->addWidget(new QWidget(this)); // no category selected, for example when filtering

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
                                                       QDialogButtonBox::Apply |
                                                       QDialogButtonBox::Cancel);
    connect(buttonBox->button(QDialogButtonBox::Apply), &QAbstractButton::clicked,
            this, &SettingsDialog::apply);

    connect(buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);

    QGridLayout *mainGridLayout = new QGridLayout;
    mainGridLayout->addWidget(m_filterLineEdit, 0, 0, 1, 1);
    mainGridLayout->addLayout(headerHLayout,    0, 1, 1, 1);
    mainGridLayout->addWidget(m_categoryList,   1, 0, 1, 1);
    mainGridLayout->addLayout(m_stackedLayout,  1, 1, 1, 1);
    mainGridLayout->addWidget(buttonBox,        2, 0, 1, 2);
    mainGridLayout->setColumnStretch(1, 4);
    setLayout(mainGridLayout);

    buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);

    setMinimumSize(1000, 550);
    if (Utils::HostOsInfo::isMacHost())
        setMinimumHeight(minimumHeight() * 1.1);
}
Exemple #16
0
CopyInputDialog::CopyInputDialog(QWidget* parent)
    : QDialog(parent)
{
    setWindowTitle(i18n("Copy Input"));
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    QWidget *mainWidget = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    mainLayout->addWidget(mainWidget);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, &QDialogButtonBox::accepted, this, &CopyInputDialog::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &CopyInputDialog::reject);
    mainLayout->addWidget(buttonBox);

    setWindowModality(Qt::WindowModal);

    _ui = new Ui::CopyInputDialog();
    _ui->setupUi(mainWidget);

    connect(_ui->selectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::selectAll);
    connect(_ui->deselectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::deselectAll);

    _ui->filterEdit->setClearButtonEnabled(true);
    _ui->filterEdit->setFocus();

    _model = new CheckableSessionModel(parent);
    _model->setCheckColumn(1);
    _model->setSessions(SessionManager::instance()->sessions());

    QSortFilterProxyModel* filterProxyModel = new QSortFilterProxyModel(this);
    filterProxyModel->setDynamicSortFilter(true);
    filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    filterProxyModel->setSourceModel(_model);
    filterProxyModel->setFilterKeyColumn(-1);

    connect(_ui->filterEdit, &QLineEdit::textChanged, filterProxyModel, &QSortFilterProxyModel::setFilterFixedString);

    _ui->sessionList->setModel(filterProxyModel);
    _ui->sessionList->setColumnHidden(0, true); // Hide number column
    _ui->sessionList->header()->hide();
}
Exemple #17
0
void HistoryWindow::createGui()
{
	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(0);
	layout->setSpacing(0);

	TabWidget = new QTabWidget(this);
	TabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	TabWidget->setDocumentMode(true);

	connect(TabWidget, SIGNAL(currentChanged(int)),
			this, SLOT(currentTabChanged(int)));

	ChatTab = m_pluginInjectedFactory->makeInjected<ChatHistoryTab>(TabWidget);

	StatusTab = m_pluginInjectedFactory->makeInjected<HistoryMessagesTab>(TabWidget);
	StatusTab->timelineView()->setTalkableVisible(false);
	StatusTab->setClearHistoryMenuItemTitle(tr("&Clear Status History"));

	SmsTab = m_pluginInjectedFactory->makeInjected<HistoryMessagesTab>(TabWidget);
	SmsTab->timelineView()->setTalkableVisible(false);
	SmsTab->setClearHistoryMenuItemTitle(tr("&Clear SMS History"));

	MySearchTab = m_pluginInjectedFactory->makeInjected<SearchTab>(TabWidget);

	TabWidget->addTab(ChatTab, tr("Chats"));
	TabWidget->addTab(StatusTab, tr("Statuses"));
	TabWidget->addTab(SmsTab, tr("SMS"));
	TabWidget->addTab(MySearchTab, tr("Search"));

	CurrentTab = 0;

	QDialogButtonBox *buttons = new QDialogButtonBox(this);
	QPushButton *closeButton = buttons->addButton(QDialogButtonBox::Close);
	connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

	buttons->layout()->setMargin(5);

	layout->addWidget(TabWidget);
	layout->addWidget(buttons);

	ChatTab->setFocus();
}
ShortcutGetter::ShortcutGetter(QWidget *parent) : QDialog(parent)
{
	setWindowTitle(tr("Modify shortcut"));

			
	QVBoxLayout *vbox = new QVBoxLayout(this);
	vbox->setMargin(2);
	vbox->setSpacing(4);
			
	QLabel *l = new QLabel(this);
	l->setText(tr("Press the key combination you want to assign"));
	vbox->addWidget(l);
			
	leKey = new QLineEdit(this);

	leKey->installEventFilter(this);
	vbox->addWidget(leKey);

	// Change by rvm: use a QDialogButtonBox instead of QPushButtons
	// and add a clear button
	setCaptureKeyboard(true);
	QDialogButtonBox * buttonbox = new QDialogButtonBox(QDialogButtonBox::Ok |
                                                     QDialogButtonBox::Cancel | 
                                                     QDialogButtonBox::Reset );
	QPushButton * clearbutton = buttonbox->button(QDialogButtonBox::Reset);
	clearbutton->setText( tr("Clear") );

	QPushButton * captureButton = new QPushButton(tr("Capture"), this);
	captureButton->setToolTip( tr("Capture keystrokes") );
	captureButton->setCheckable( captureKeyboard() );
	captureButton->setChecked( captureKeyboard() );
	connect(captureButton, SIGNAL(toggled(bool)), 
            this, SLOT(setCaptureKeyboard(bool)));


	buttonbox->addButton(captureButton, QDialogButtonBox::ActionRole);

	connect( buttonbox, SIGNAL(accepted()), this, SLOT(accept()) );
	connect( buttonbox, SIGNAL(rejected()), this, SLOT(reject()) );
	connect( clearbutton, SIGNAL(clicked()), leKey, SLOT(clear()) );
	vbox->addWidget(buttonbox);
}
Exemple #19
0
void ProgressWindow::createGui()
{
	QVBoxLayout *mainLayout = new QVBoxLayout(this);
	mainLayout->setMargin(12);
	mainLayout->setSpacing(16);

	QLabel *label = new QLabel(this);
	label->setText(QString("<b>%1</b>").arg(Label));
	label->setWordWrap(true);

	QWidget *progressWidget = new QWidget(this);
	QHBoxLayout *progressLayout = new QHBoxLayout(progressWidget);
	progressLayout->setMargin(0);

	ProgressBar = new QProgressBar(this);
	ProgressBar->setMinimum(0);
	ProgressBar->setMaximum(0);

	progressLayout->addWidget(new QLabel(tr("Progress:"), progressWidget));
	progressLayout->addWidget(ProgressBar);

	TextListWidget = new QListWidget(this);
	TextListWidget->setMinimumHeight(200);
	TextListWidget->hide();

	QDialogButtonBox *buttons = new QDialogButtonBox(this);
	CloseButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCloseButton), tr("Close"));
	CloseButton->setEnabled(false);
	connect(CloseButton, SIGNAL(clicked(bool)), this, SLOT(close()));

	ShowDetailsButton = new QPushButton(tr("Show details >>>"));
	connect(ShowDetailsButton, SIGNAL(clicked(bool)), this, SLOT(showDetailsClicked()));

	buttons->addButton(CloseButton, QDialogButtonBox::DestructiveRole);
	buttons->addButton(ShowDetailsButton, QDialogButtonBox::ActionRole);

	mainLayout->addWidget(label);
	mainLayout->addWidget(progressWidget);
	mainLayout->addWidget(TextListWidget);
	mainLayout->addStretch(1);
	mainLayout->addWidget(buttons);
}
Exemple #20
0
GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf)
               : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
{
    setWindowFlags( Qt::Tool );
    setWindowTitle( qtr( "Go to Time" ) );
    setWindowRole( "vlc-goto-time" );

    QGridLayout *mainLayout = new QGridLayout( this );
    mainLayout->setSizeConstraint( QLayout::SetFixedSize );

    QPushButton *gotoButton = new QPushButton( qtr( "&Go" ) );
    QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) );
    QDialogButtonBox *buttonBox = new QDialogButtonBox;

    gotoButton->setDefault( true );
    buttonBox->addButton( gotoButton, QDialogButtonBox::AcceptRole );
    buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );

    QLabel *timeIntro = new QLabel( qtr( "Go to time" ) + ":" );
    timeIntro->setWordWrap( true );
    timeIntro->setAlignment( Qt::AlignCenter );

    timeEdit = new QTimeEdit();
    timeEdit->setDisplayFormat( "HH'H':mm'm':ss's'" );
    timeEdit->setAlignment( Qt::AlignRight );
    timeEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );

    QPushButton *resetButton = new QPushButton( QIcon(":/update.svg"), "" );
    resetButton->setToolTip( qtr("Reset") );

    mainLayout->addWidget( timeIntro, 0, 0, 1, 1 );
    mainLayout->addWidget( timeEdit, 0, 1, 1, 1 );
    mainLayout->addWidget( resetButton, 0, 2, 1, 1 );

    mainLayout->addWidget( buttonBox, 1, 0, 1, 3 );

    BUTTONACT( gotoButton, close() );
    BUTTONACT( cancelButton, cancel() );
    BUTTONACT( resetButton, reset() );

    QVLCTools::restoreWidgetPosition( p_intf, "gototimedialog", this );
}
SetReferenceDialog::SetReferenceDialog(QWidget * parent) :
    QDialog(parent)
{
    QVBoxLayout * layout = new QVBoxLayout();

    QGridLayout * grid = new QGridLayout();

    {
        QGroupBox * group = new QGroupBox("New object reference");
        QVBoxLayout * groupLayout = new QVBoxLayout();
        groupLayout->setMargin(0);

        m_reference = new ObjrefWidget();
        m_reference->setObjectName("reference");
        groupLayout->addWidget(m_reference);
        group->setLayout(groupLayout);
        
        grid->addWidget(group, 1, 0, 1, 2);
    }

    layout->addLayout(grid);

    // Buttons
    QDialogButtonBox * btns = new QDialogButtonBox();
    QPushButton * pasteButton = 
        btns->addButton("&Paste IOR from clipboard", QDialogButtonBox::ActionRole);
    QPushButton * createButton = 
        btns->addButton("&Apply", QDialogButtonBox::AcceptRole);
    QPushButton * cancelButton = 
        btns->addButton("C&ancel", QDialogButtonBox::RejectRole);
    layout->addWidget(btns);

    connect(pasteButton, SIGNAL(clicked()),
            m_reference, SLOT(pasteIOR()));
    connect(createButton, SIGNAL(clicked()),
            this, SLOT(update()));
    connect(cancelButton, SIGNAL(clicked()),
            window(), SLOT(hide()));
    // End buttons

    setLayout(layout);
}
TargetCommandList::TargetCommandList(void): NPPDialog()
{
    central = new QWidget;
    QPointer<QVBoxLayout> main_layout = new QVBoxLayout;
    central->setLayout(main_layout);
    main_layout->setSpacing(10);
    this->setClient(central);  // IMPORTANT: it must be called AFTER setting the layout

    QPointer<QLabel> targeting_prompt = new QLabel(color_string(QString("<h2>Targeting Commands</h2>"), TERM_BLUE));
    main_layout->addWidget(targeting_prompt, Qt::AlignCenter);

    QPointer<QHBoxLayout> top_across = new QHBoxLayout;
    main_layout->addLayout(top_across);

    QPointer<QVBoxLayout> vlay_key_dirs = new QVBoxLayout;
    add_dir_targeting(vlay_key_dirs, TRUE);
    top_across->addLayout(vlay_key_dirs);

    top_across->addStretch(1);
    QPointer<QVBoxLayout> vlay_pad_dirs = new QVBoxLayout;
    add_dir_targeting(vlay_pad_dirs, FALSE);
    top_across->addLayout(vlay_pad_dirs);

    top_across->addStretch(1);

    QPointer<QGridLayout> glay_target_commands = new QGridLayout;
    add_targeting_commands(glay_target_commands);
    main_layout->addLayout(glay_target_commands);

    QDialogButtonBox buttons;
    buttons.setStandardButtons(QDialogButtonBox::Ok);
    connect(&buttons, SIGNAL(accepted()), this, SLOT(close()));
    main_layout->addWidget(&buttons);

    main_layout->addStretch(1);

    setWindowTitle(tr("Targeting Command List"));

    this->clientSizeUpdated();

    this->exec();
}
Exemple #23
0
void ChatDataWindow::createButtons(QVBoxLayout *layout)
{
	QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this);

	OkButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("OK"), this);
	OkButton->setDefault(true);
	buttons->addButton(OkButton, QDialogButtonBox::AcceptRole);
	ApplyButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Apply"), this);
	buttons->addButton(ApplyButton, QDialogButtonBox::ApplyRole);

	QPushButton *cancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
	buttons->addButton(cancelButton, QDialogButtonBox::RejectRole);

	connect(OkButton, SIGNAL(clicked(bool)), this, SLOT(updateChatAndClose()));
	connect(ApplyButton, SIGNAL(clicked(bool)), this, SLOT(updateChat()));
	connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(close()));

	layout->addSpacing(16);
	layout->addWidget(buttons);
}
Exemple #24
0
/**
  * @brief the current tab changed
  */
void OpenNIC::tabChanged(int tab)
{
	QDialogButtonBox* buttonBox = ui->buttonBox;
	QList<QAbstractButton *> buttons = buttonBox->buttons();
	for(int n=0; n < buttons.count(); n++)
	{
		QAbstractButton* button = buttons.at(n);
		if (buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole || buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
		{
			if ( tab == 1 || tab == 5 )
			{
				button->setEnabled(true);
			}
			else
			{
				button->setEnabled(false);
			}
		}
	}
}
KisColorSelectorSettingsDialog::KisColorSelectorSettingsDialog(QWidget *parent) :
    QDialog(parent),
    m_widget(new KisColorSelectorSettings(this))
{
    QLayout* l = new QVBoxLayout(this);
    l->addWidget(m_widget);

    m_widget->loadPreferences();

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults,
                                                       Qt::Horizontal,
                                                       this);
    l->addWidget(buttonBox);

    connect(buttonBox, SIGNAL(accepted()), m_widget, SLOT(savePreferences()));
    connect(buttonBox, SIGNAL(accepted()), this,     SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this,     SLOT(reject()));
    connect(buttonBox->button(QDialogButtonBox::RestoreDefaults),
            SIGNAL(clicked()),  m_widget, SLOT(loadDefaultPreferences()));
}
Exemple #26
0
bool DialogyWidget::clickButton(QDialogButtonBox::StandardButton standardButton)
{
    QPushButton* pb = qobject_cast<QPushButton*>(focusWidget());
    if (pb && pb->isVisible() && pb->isEnabled() && pb->hasFocus()) {
        pb->click();
        return true;
    }

    QList<QDialogButtonBox*> buttonBoxes = findChildren<QDialogButtonBox*>();
    for (int i = 0; i < buttonBoxes.size(); ++i) {
        QDialogButtonBox* buttonBox = buttonBoxes.at(i);
        pb = buttonBox->button(standardButton);
        if (pb && pb->isVisible() && pb->isEnabled()) {
            pb->click();
            return true;
        }
    }

    return false;
}
	NewSoundDialog::NewSoundDialog(QWidget *parent, const SoundController *soundController) :
		QDialog(parent),
		soundController(soundController),
		sceneSound(nullptr)
	{
		this->setWindowTitle("New Sound");
		this->resize(530, 160);

		setupNameFields();
		setupSoundFilenameFields();
		setupSoundTypeFields();

		QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
		buttonBox->setGeometry(QRect(30, 120, 475, 22));
		buttonBox->setOrientation(Qt::Horizontal);
		buttonBox->setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);

		QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
		QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
	}
void DeleteGapsDialogFiller::commonScenario() {

    QWidget* dialog = QApplication::activeModalWidget();
    GT_CHECK(dialog, "activeModalWidget is NULL");

    if (radioButNum==1){
        QRadioButton* allColumnsOfGaps = dialog->findChild<QRadioButton*>("allRadioButton");
        GTRadioButton::click(os, allColumnsOfGaps);
    }
    else{
        QRadioButton* withNumberOfGaps = dialog->findChild<QRadioButton*>("absoluteRadioButton");
        GTRadioButton::click(os, withNumberOfGaps);
    }

    QDialogButtonBox* box = qobject_cast<QDialogButtonBox*>(GTWidget::findWidget(os, "buttonBox", dialog));
    GT_CHECK(box != NULL, "buttonBox is NULL");
    QPushButton* button = box->button(QDialogButtonBox::Ok);
    GT_CHECK(button !=NULL, "cancel button is NULL");
    GTWidget::click(os, button);
}
void
DelegateConfigWrapper::closed( QAbstractButton* b )
{
    // let the config widget live to see another day
    layout()->removeWidget( m_widget );
    m_widget->setParent( 0 );
    m_widget->setVisible( false );

    QDialogButtonBox* buttons = qobject_cast< QDialogButtonBox* >( sender() );
    if ( buttons->standardButton( b ) == QDialogButtonBox::Ok )
        done( QDialog::Accepted );
    else if ( b == m_deleteButton )
    {
        m_deleted = true;
        emit closedWithDelete();
        reject();
    }
    else
        done( QDialog::Rejected );
}
Exemple #30
0
ListTaskWindow::ListTaskWindow(std::auto_ptr<ListPage> listPage)
  : TaskWindow()      
{
  setWindowIcon(listPage->windowIcon());
  setWindowTitle(listPage->windowTitle());

  QWidget* contents = this->contents();
  QVBoxLayout* contentsLayout = new QVBoxLayout(contents);
  contentsLayout->setContentsMargins(0, 0, 0, 0);
  contentsLayout->setSpacing(0);

  CommandBar* commandBar = this->commandBar();
  commandBar->addCommands(listPage->primaryActions());
  commandBar->addCommand(listPage->helpAction().get(), CommandBar::tray, false);      
  if (QAction* customizeAction = listPage->customizeAction())
  {
    commandBar->addCommand(customizeAction, CommandBar::tray, false);
  }

  listPage->setParent(contents);      
  contentsLayout->addWidget(listPage.get());
  listPage_ = listPage.release();            
      
  QWidget* footer = new QWidget(contents);
  footer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
  contentsLayout->addWidget(footer);
  QVBoxLayout* footerLayout = new QVBoxLayout(footer);
  QDialogButtonBox* buttonBox = new QDialogButtonBox(footer);
  footerLayout->addWidget(buttonBox);
  buttonBox->setStandardButtons(QDialogButtonBox::Close);
  //buttonBox->button(QDialogButtonBox::Close)->setDefault(false);

  QObject::connect(listPage_, 
      SIGNAL(doubleClicked(const QModelIndex&)), 
      SLOT(on_listPage_doubleClicked(const QModelIndex&)));
  QObject::connect(listPage_, 
      SIGNAL(windowTitleUpdated()), 
      SLOT(on_listPage_windowTitleUpdated()));
  QObject::connect(listPage_, SIGNAL(needToClose()), SLOT(close()));
  QObject::connect(buttonBox, SIGNAL(rejected()), SLOT(close()));
}