KSaneDeviceDialog::KSaneDeviceDialog(QWidget *parent) : KDialog(parent) { setButtons(KDialog::User1 | KDialog::Ok | KDialog::Cancel); setButtonText(User1, i18n("Reload devices list")); m_btnGroup = new QButtonGroup(this); m_btnBox = new QGroupBox; QVBoxLayout *layout = new QVBoxLayout; m_btnContainer = new QWidget; m_btnLayout = new QVBoxLayout(m_btnContainer); QScrollArea *area = new QScrollArea; m_btnBox->setLayout(layout); QLabel *explanation = new QLabel(i18n("<html>The SANE (Scanner Access Now Easy) system could not find any device.<br>" "Check that the scanner is plugged in and turned on<br>" "or check your systems scanner setup.<br>" "For details about SANE see the " "<a href='http://www.sane-project.org/'>SANE homepage</a>.</html>")); explanation->setOpenExternalLinks(true); int l,t,r,b; layout->getContentsMargins(&l, &t, &r, &b); explanation->setContentsMargins(l, t, r, b); layout->addWidget(explanation); m_btnBox->adjustSize(); // make sure to see the complete explanation text layout->addWidget(area); layout->setContentsMargins(0,0,0,0); area->setWidgetResizable(true); area->setFrameShape(QFrame::NoFrame); area->setWidget(m_btnContainer); setMainWidget(m_btnBox); setMinimumHeight(200); m_findDevThread = FindSaneDevicesThread::getInstance(); connect(m_findDevThread, SIGNAL(finished()), this, SLOT(updateDevicesList())); connect(this, SIGNAL(user1Clicked()), this, SLOT(reloadDevicesList())); reloadDevicesList(); }
void MainWindow::setupSignalsSlots() { //signal-slot: //connect(_thread,SIGNAL(updateUI(QStringList)),this,SLOT(updateClients(QStringList)),Qt::QueuedConnection); qRegisterMetaType<QVector<Device*> >("QVector<Device*>"); connect(m_restoreAction, &QAction::triggered, this, [this](){ setMainWindowVisibility(isHidden() || windowState() == Qt::WindowMinimized || (qApp->applicationState() == Qt::ApplicationInactive)); }); connect(m_quitAction, &QAction::triggered, this, &MainWindow::close); connect(m_controlWifi,&QAction::triggered,this,&MainWindow::on_pushButton_clicked); connect(m_restartWifi,&QAction::triggered,this,[this](){ ui->pushButton->setText("Restaring..."); m_wifi->restartWifi(); ui->pushButton->setText("STOP"); }); connect(m_wthread,SIGNAL(clientAdd(QVector<Device *>)),this,SLOT(updateNewClients(QVector<Device*>)),Qt::QueuedConnection); connect(m_wthread,SIGNAL(clientLeave(QVector<Device *>)),this,SLOT(updateLeaveClients(QVector<Device*>)),Qt::QueuedConnection); connect(m_wthread,SIGNAL(clientUpdate(QVector<Device*>)),this,SLOT(updateDevicesList(QVector<Device*>)),Qt::QueuedConnection); }