NovelsWindow::NovelsWindow(QWidget* parent, Database* data) : QWidget(parent, Qt::Dialog), m_data(data) { setWindowTitle(tr("Select Novel")); m_novels = new QListWidget(this); connect(m_novels, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(currentNovelChanged(QListWidgetItem*))); connect(m_novels, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(hide())); m_add_button = new QPushButton(tr("New"), this); connect(m_add_button, SIGNAL(clicked()), this, SLOT(addClicked())); m_rename_button = new QPushButton(tr("Rename"), this); connect(m_rename_button, SIGNAL(clicked()), this, SLOT(renameClicked())); m_remove_button = new QPushButton(tr("Delete"), this); connect(m_remove_button, SIGNAL(clicked()), this, SLOT(removeClicked())); QPushButton* close_button = new QPushButton(tr("Close"), this); connect(close_button, SIGNAL(clicked()), this, SLOT(hide())); QVBoxLayout* button_layout = new QVBoxLayout; button_layout->addWidget(m_add_button); button_layout->addWidget(m_rename_button); button_layout->addWidget(m_remove_button); button_layout->addStretch(); button_layout->addWidget(close_button); QHBoxLayout* layout = new QHBoxLayout(this); layout->addWidget(m_novels); layout->addLayout(button_layout); }
DccRenameDialog::DccRenameDialog(DccBroker * br, DccDescriptor * dcc, const QString & text, bool bDisableResume) : QWidget(nullptr), DccDialog(br, dcc) { setObjectName("dcc_rename_box"); //QVBoxLayout * vb = new QVBoxLayout(this,4,4); QVBoxLayout * vb = new QVBoxLayout(this); vb->setMargin(4); vb->setSpacing(4); QLabel * l = new QLabel(text, this); l->setWordWrap(true); vb->addWidget(l); //QHBoxLayout *hb = new QHBoxLayout(4); QHBoxLayout * hb = new QHBoxLayout(); hb->setSpacing(4); vb->addLayout(hb, Qt::AlignCenter); QPushButton * btn = new QPushButton(__tr2qs_ctx("&Rename", "dcc"), this); hb->addWidget(btn); connect(btn, SIGNAL(clicked()), this, SLOT(renameClicked())); btn = new QPushButton(__tr2qs_ctx("Over&write", "dcc"), this); hb->addWidget(btn); connect(btn, SIGNAL(clicked()), this, SLOT(overwriteClicked())); btn = new QPushButton(__tr2qs_ctx("Re&sume", "dcc"), this); hb->addWidget(btn); connect(btn, SIGNAL(clicked()), this, SLOT(resumeClicked())); if(bDisableResume) btn->setEnabled(false); btn = new QPushButton(__tr2qs_ctx("Cancel", "dcc"), this); hb->addWidget(btn); connect(btn, SIGNAL(clicked()), this, SLOT(cancelClicked())); btn->setDefault(true); //btn->setFocus(); setWindowIcon(QIcon(*(g_pIconManager->getSmallIcon(KviIconManager::DccMsg)))); setWindowTitle(__tr2qs_ctx("File Already Exists - KVIrc", "dcc")); }