RenameImagesDialog::RenameImagesDialog(const KUrl::List& images, KIPI::Interface* interface, QWidget* parent) : KDialog(parent) { setCaption(i18n("Rename Images")); setModal(true); setButtons(Help | User1 | Close); setButtonText(User1, i18n("&Start")); setDefaultButton(Close); // About data and help button. m_about = new KIPIPlugins::KPAboutData(ki18n("Batch-rename images"), QByteArray(), KAboutData::License_GPL, ki18n("A Kipi plugin to batch-rename images"), ki18n("(c) 2003-2007, Gilles Caulier")); m_about->addAuthor(ki18n("Gilles Caulier"), ki18n("Author and maintainer"), "caulier dot gilles at gmail dot com"); DialogUtils::setupHelpButton(this, m_about); // gui QWidget* box = new QWidget(this); setMainWidget(box); Q3VBoxLayout* lay = new Q3VBoxLayout(box); m_widget = new RenameImagesWidget(box, interface, images); lay->addWidget(m_widget); connect(this, SIGNAL(user1Clicked()), m_widget, SLOT(slotStart())); adjustSize(); }
Receiver::Receiver() { QVBoxLayout *lay = new QVBoxLayout(this); QPushButton *h = new QPushButton(QStringLiteral("Press here to terminate"), this); lay->addWidget(h); connect(h, SIGNAL(clicked()), qApp, SLOT(quit())); start = new QPushButton(QStringLiteral("Launch KRuns"), this); lay->addWidget(start); connect(start, SIGNAL(clicked()), this, SLOT(slotStart())); stop = new QPushButton(QStringLiteral("Stop those KRuns"), this); stop->setEnabled(false); lay->addWidget(stop); connect(stop, SIGNAL(clicked()), this, SLOT(slotStop())); QPushButton *launchOne = new QPushButton(QStringLiteral("Launch one http KRun"), this); lay->addWidget(launchOne); connect(launchOne, SIGNAL(clicked()), this, SLOT(slotLaunchOne())); for (uint i = 0; i < sizeof(s_tests) / sizeof(*s_tests); ++i) { QHBoxLayout *hbox = new QHBoxLayout; lay->addLayout(hbox); QPushButton *button = new QPushButton(s_tests[i].text, this); button->setProperty("testNumber", i); hbox->addWidget(button); QLabel *label = new QLabel(s_tests[i].expectedResult, this); hbox->addWidget(label); connect(button, SIGNAL(clicked()), this, SLOT(slotLaunchTest())); hbox->addStretch(); } adjustSize(); show(); }
MultiSegmentCopyJob::MultiSegmentCopyJob( const QList<KUrl> Urls, const KUrl& dest, int permissions, qulonglong ProcessedSize, KIO::filesize_t totalSize, QList<SegData> SegmentsData, uint segments) :KJob(0), d(new MultiSegmentCopyJobPrivate), m_dest(dest), m_permissions(permissions), m_writeBlocked(false), m_segSplited(false) { kDebug(5001); SegFactory = new SegmentFactory( segments, Urls ); connect(SegFactory, SIGNAL(createdSegment(Segment *)), SLOT(slotConnectSegment( Segment *))); if ( !SegmentsData.isEmpty() ) { QList<SegData>::const_iterator it = SegmentsData.constBegin(); QList<SegData>::const_iterator itEnd = SegmentsData.constEnd(); for ( ; it!=itEnd ; ++it ) { SegFactory->createSegment( (*it), SegFactory->nextUrl() ); } } m_putJob = 0; connect(&d->speed_timer, SIGNAL(timeout()), SLOT(calcSpeed())); setProcessedAmount(Bytes, ProcessedSize); setTotalAmount(Bytes, totalSize); QTimer::singleShot(0, this, SLOT(slotStart())); }
KonqMultiRestoreJob::KonqMultiRestoreJob(const QList<QUrl>& urls) : KIO::Job(), m_urls(urls), m_urlsIterator(m_urls.begin()), m_progress(0) { QTimer::singleShot(0, this, SLOT(slotStart())); setUiDelegate(new KIO::JobUiDelegate); }
KRun::KRun( const KURL &url, int, bool, bool ) { m_fault = false; m_showingError = false; m_strURL = url; QTimer::singleShot( 0, this, SLOT( slotStart() ) ); m_job = 0; m_fhandle = -1; }
FFMpegDemo::FFMpegDemo(QWidget *parent) : QWidget(parent) { ui.setupUi(this); m_pScreenRecord = NULL; connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(slotStart())); connect(ui.pushButtonEnd, SIGNAL(clicked()), this, SLOT(slotEnd())); }
int StringCodec::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: slotStart(); break; default: ; } _id -= 1; } return _id; }
void KonqMultiRestoreJob::slotResult(KJob *job) { if (job->error()) { KIO::Job::slotResult(job); // will set the error and emit result(this) return; } removeSubjob(job); // Move on to next one ++m_urlsIterator; ++m_progress; //emit processedSize( this, m_progress ); emitPercent(m_progress, m_urls.count()); slotStart(); }
int main( int argc, char** argv ) { KAboutData aboutData( "test_keylister", "KeyLister Test", "0.1" ); KCmdLineArgs::init( argc, argv, &aboutData ); KApplication app; CertListView * clv = new CertListView( 0, "CertListView top-level" ); app.setMainWidget( clv ); clv->show(); QTimer::singleShot( 5000, clv, SLOT(slotStart()) ); return app.exec(); }
Receiver::Receiver() { QVBoxLayout *lay = new QVBoxLayout(this); lay->setAutoAdd(true); QPushButton *h = new QPushButton("Press here to terminate", this); start = new QPushButton("Launch KRuns", this); stop = new QPushButton("Stop those KRuns", this); stop->setEnabled(false); QObject::connect(h, SIGNAL(clicked()), kapp, SLOT(quit())); QObject::connect(start, SIGNAL(clicked()), this, SLOT(slotStart())); QObject::connect(stop, SIGNAL(clicked()), this, SLOT(slotStop())); adjustSize(); show(); }
ProgressBar::ProgressBar( QWidget *parent, const char *name ) : QButtonGroup( 0, Horizontal, "Progress Bar", parent, name ), timer() { setMargin( 10 ); QGridLayout* toplayout = new QGridLayout( layout(), 2, 2, 5); setRadioButtonExclusive( TRUE ); // insert three radiobuttons which the user can use // to set the speed of the progress and two pushbuttons // to start/pause/continue and reset the progress slow = new QRadioButton( "&Slow", this ); normal = new QRadioButton( "&Normal", this ); fast = new QRadioButton( "&Fast", this ); QVBoxLayout* vb1 = new QVBoxLayout; toplayout->addLayout( vb1, 0, 0 ); vb1->addWidget( slow ); vb1->addWidget( normal ); vb1->addWidget( fast ); // two push buttons, one for start, for for reset. start = new QPushButton( "&Start", this ); reset = new QPushButton( "&Reset", this ); QVBoxLayout* vb2 = new QVBoxLayout; toplayout->addLayout( vb2, 0, 1 ); vb2->addWidget( start ); vb2->addWidget( reset ); // Create the progressbar progress = new QProgressBar( 100, this ); toplayout->addMultiCellWidget( progress, 1, 1, 0, 1 ); // connect the clicked() SIGNALs of the pushbuttons to SLOTs connect( start, SIGNAL( clicked() ), this, SLOT( slotStart() ) ); connect( reset, SIGNAL( clicked() ), this, SLOT( slotReset() ) ); // connect the timeout() SIGNAL of the progress-timer to a SLOT connect( &timer, SIGNAL( timeout() ), this, SLOT( slotTimeout() ) ); // Let's start with normal speed... normal->setChecked( TRUE ); // some contraints start->setFixedWidth( 80 ); setMinimumWidth( 300 ); }
/** * class MultiSegmentCopyJob */ MultiSegmentCopyJob::MultiSegmentCopyJob( const QList<KUrl> Urls, const KUrl& dest, int permissions, uint segments) :KJob(0), d(new MultiSegmentCopyJobPrivate), m_dest(dest), m_permissions(permissions), m_writeBlocked(false), m_segSplited(false), m_chunkSize(0) { kDebug(5001); SegFactory = new SegmentFactory( segments, Urls ); connect(SegFactory, SIGNAL(createdSegment(Segment *)), SLOT(slotConnectSegment( Segment *))); m_putJob = 0; connect(&d->speed_timer, SIGNAL(timeout()), SLOT(calcSpeed())); QTimer::singleShot(0, this, SLOT(slotStart())); }
ThreadDlg::ThreadDlg(QWidget *parent) : QDialog(parent) { setWindowTitle(tr("线程")); startBtn = new QPushButton(tr("开始")); stopBtn = new QPushButton(tr("停止")); quitBtn = new QPushButton(tr("退出")); QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->addWidget(startBtn); mainLayout->addWidget(stopBtn); mainLayout->addWidget(quitBtn); connect(startBtn,SIGNAL(clicked()),this,SLOT(slotStart())); connect(stopBtn,SIGNAL(clicked()),this,SLOT(slotStop())); connect(quitBtn,SIGNAL(clicked()),this,SLOT(close())); }
MainWindow::MainWindow(QWidget *parent) : QDialog(parent), isStart_(false) { this->setWindowFlags(Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); QLabel *fromLabel = new QLabel(tr("From:"), this); QLabel *toLabel = new QLabel(tr("To :"), this); leFrom_ = new QLineEdit(this); leTo_ = new QLineEdit(this); pbFromBrowser_ = new QPushButton(tr("Browser"), this); pbToBrowser_ = new QPushButton(tr("Browser"), this); pbStart_ = new QPushButton(tr("Start"), this); tray_ = new SystemTrayIcon(this); leFrom_->setReadOnly(true); leTo_->setReadOnly(true); connect(pbFromBrowser_, SIGNAL(clicked()), this, SLOT(slotFromBrowser())); connect(pbToBrowser_, SIGNAL(clicked()), this, SLOT(slotToBrowser())); connect(pbStart_, SIGNAL(clicked()), this, SLOT(slotStart())); connect(tray_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason))); tray_->show(); QHBoxLayout *fromLayout = new QHBoxLayout; fromLayout->addWidget(fromLabel); fromLayout->addWidget(leFrom_); fromLayout->addWidget(pbFromBrowser_); QHBoxLayout *toLayout = new QHBoxLayout; toLayout->addWidget(toLabel); toLayout->addWidget(leTo_); toLayout->addWidget(pbToBrowser_); QHBoxLayout *startLayout = new QHBoxLayout; startLayout->addWidget(pbStart_); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(fromLayout); mainLayout->addLayout(toLayout); mainLayout->addLayout(startLayout); this->setLayout(mainLayout); watcher_ = new QFileSystemWatcher(this); }
WebImportWizardPage::WebImportWizardPage(KIconLoader *iconLoader, QWidget *parent) : QWidget(parent) { setupUi(this); button->setEnabled(false); siteUrl->setFocus(); imagelabel->setPixmap(iconLoader->loadIcon("thirdwizardpage", KIconLoader::User)); connect( commandLine, SIGNAL(textChanged(const QString&)), this, SLOT (enableStart(const QString&))); connect( siteUrl, SIGNAL(textChanged(const QString&)), this, SLOT (setCommandL(const QString&))); connect( button, SIGNAL(clicked()), this, SLOT (slotStart())); connect( protocolCombo,SIGNAL(highlighted(const QString&)), this, SLOT (setProtocol(const QString&))); start = false; progress->setRange(0, 0); progress->setTextVisible(false); }
void CDeviceDetailView::constructLayout() { // Create the buttons // ... edit pqPushButtonEdit = new QPushButton( QIcon( ":icons/32x32/edit.png" ), "" ); pqPushButtonEdit->setMaximumSize( 36, 34 ); pqPushButtonEdit->setToolTip( tr("Edit this device's configuration") ); pqPushButtonEdit->setEnabled( false ); QWidget::connect( pqPushButtonEdit, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); // ... delete pqPushButtonDelete = new QPushButton( QIcon( ":icons/32x32/delete.png" ), "" ); pqPushButtonDelete->setMaximumSize( 36, 34 ); pqPushButtonDelete->setToolTip( tr("Delete this device") ); pqPushButtonDelete->setEnabled( false ); QWidget::connect( pqPushButtonDelete, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); // ... stop pqPushButtonStop = new QPushButton( QIcon( ":icons/32x32/stop.png" ), "" ); pqPushButtonStop->setMaximumSize( 36, 34 ); pqPushButtonStop->setToolTip( tr("Stop this device") ); pqPushButtonStop->setCheckable( true ); pqPushButtonStop->setEnabled( false ); QWidget::connect( pqPushButtonStop, SIGNAL( clicked() ), this, SLOT( slotStop() ) ); // ... pause pqPushButtonPause = new QPushButton( QIcon( ":icons/32x32/pause.png" ), "" ); pqPushButtonPause->setMaximumSize( 36, 34 ); pqPushButtonPause->setToolTip( tr("Pause this device") ); pqPushButtonPause->setCheckable( true ); pqPushButtonPause->setEnabled( false ); QWidget::connect( pqPushButtonPause, SIGNAL( clicked() ), this, SLOT( slotPause() ) ); // ... start pqPushButtonStart = new QPushButton( QIcon( ":icons/32x32/start.png" ), "" ); pqPushButtonStart->setMaximumSize( 36, 34 ); pqPushButtonStart->setToolTip( tr("Start this device") ); pqPushButtonStart->setCheckable( true ); pqPushButtonStart->setEnabled( false ); QWidget::connect( pqPushButtonStart, SIGNAL( clicked() ), this, SLOT( slotStart() ) ); // Create layout QVBoxLayout* __pqVBoxLayout = new QVBoxLayout(); // Add header QFont __qFontHeader; __qFontHeader.setPixelSize( 16 ); __qFontHeader.setBold( true ); QHBoxLayout* __pqHBoxLayoutHeader = new QHBoxLayout(); QLabel* __pqLabelIcon = new QLabel(); __pqLabelIcon->setPixmap( QPixmap( ":icons/32x32/device.png" ) ); __pqLabelIcon->setToolTip( tr("Device") ); __pqHBoxLayoutHeader->addWidget( __pqLabelIcon, 0, Qt::AlignTop ); poTextName = new COverlayText(); poTextName->setToolTip( tr("Name") ); poTextName->setFont( __qFontHeader ); poTextName->setWordWrap( true ); __pqHBoxLayoutHeader->addWidget( poTextName, 1 ); __pqVBoxLayout->addLayout( __pqHBoxLayoutHeader ); // Add data QFont __qFontData; QTabWidget* __poTabWidget = new QTabWidget(); __poTabWidget->setTabPosition( QTabWidget::South ); __poTabWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); // ... summary QWidget* __poWidgetSummary = new QWidget(); QVBoxLayout* __pqVBoxLayoutSummary = new QVBoxLayout(); __qFontData.setPixelSize( 20 ); poTextDriver = new COverlayText(); poTextDriver->setToolTip( tr("Driver") ); poTextDriver->setFont( __qFontData ); poTextDriver->setIndent( 10 ); poTextDriver->setAlignment( Qt::AlignHCenter ); poTextDriver->resetText(); __pqVBoxLayoutSummary->addWidget( poTextDriver, 0 ); pqLabelActivity = new COverlayText(); pqLabelActivity->setToolTip( tr("Activity") ); pqLabelActivity->setFont( __qFontData ); pqLabelActivity->setIndent( 10 ); pqLabelActivity->setAlignment( Qt::AlignHCenter ); __pqVBoxLayoutSummary->addWidget( pqLabelActivity, 1 ); __poWidgetSummary->setLayout( __pqVBoxLayoutSummary ); __poTabWidget->addTab( __poWidgetSummary, tr("Summary") ); // ... [end] __pqVBoxLayout->addWidget( __poTabWidget, 1 ); // Add separator QFrame* __pqFrameSeparator = new QFrame(); __pqFrameSeparator->setFrameStyle( QFrame::HLine | QFrame::Sunken ); __pqVBoxLayout->addWidget( __pqFrameSeparator ); // Add buttons QHBoxLayout* __pqHBoxLayoutButtons = new QHBoxLayout(); __pqHBoxLayoutButtons->addWidget( pqPushButtonEdit, 0, Qt::AlignLeft ); __pqHBoxLayoutButtons->addWidget( pqPushButtonDelete, 1, Qt::AlignLeft ); __pqHBoxLayoutButtons->addWidget( pqPushButtonStop, 1, Qt::AlignRight ); __pqHBoxLayoutButtons->addWidget( pqPushButtonPause, 0, Qt::AlignRight ); __pqHBoxLayoutButtons->addWidget( pqPushButtonStart, 0, Qt::AlignRight ); __pqVBoxLayout->addLayout( __pqHBoxLayoutButtons ); // Set the layout COverlayObjectDetailView::setLayout( __pqVBoxLayout ); }
ProcessorDlg::ProcessorDlg(const QList<QUrl>& list) : QDialog(0), d(new Private) { setModal(false); setWindowTitle(QString::fromUtf8("Convert RAW files To PNG")); d->buttons = new QDialogButtonBox(QDialogButtonBox::Apply | QDialogButtonBox::Close, this); d->thread = new MyActionThread(this); d->list = list; d->count = d->list.count(); qDebug() << d->list; d->page = new QWidget(this); QVBoxLayout* const vbx = new QVBoxLayout(this); vbx->addWidget(d->page); vbx->addWidget(d->buttons); setLayout(vbx); int cpu = d->thread->maximumNumberOfThreads(); QGridLayout* const grid = new QGridLayout(d->page); QLabel* const pid = new QLabel(QString::fromUtf8("Main PID: %1").arg(QCoreApplication::applicationPid()), this); QLabel* const core = new QLabel(QString::fromUtf8("CPU cores available: %1").arg(cpu), this); QWidget* const hbox = new QWidget(this); d->items = new QLabel(this); QHBoxLayout* const hlay = new QHBoxLayout(hbox); QLabel* const coresLabel = new QLabel(QString::fromUtf8("Cores to use: "), this); d->usedCore = new QSpinBox(this); d->usedCore->setRange(1, cpu); d->usedCore->setSingleStep(1); d->usedCore->setValue(cpu); hlay->addWidget(coresLabel); hlay->addWidget(d->usedCore); hlay->setContentsMargins(QMargins()); d->progressView = new QScrollArea(this); QWidget* const progressbox = new QWidget(d->progressView->viewport()); QVBoxLayout* const progressLay = new QVBoxLayout(progressbox); d->progressView->setWidget(progressbox); d->progressView->setWidgetResizable(true); grid->addWidget(pid, 0, 0, 1, 1); grid->addWidget(core, 1, 0, 1, 1); grid->addWidget(hbox, 2, 0, 1, 1); grid->addWidget(d->items, 3, 0, 1, 1); grid->addWidget(d->progressView, 4, 0, 1, 1); foreach (const QUrl& url, d->list) { QProgressBar* const bar = new QProgressBar(progressbox); QString file = url.toLocalFile(); QFileInfo fi(file); bar->setMaximum(100); bar->setMinimum(0); bar->setValue(100); bar->setObjectName(file); bar->setFormat(fi.fileName()); progressLay->addWidget(bar); } progressLay->addStretch(); QPushButton* const applyBtn = d->buttons->button(QDialogButtonBox::Apply); QPushButton* const cancelBtn = d->buttons->button(QDialogButtonBox::Close); connect(applyBtn, SIGNAL(clicked()), this, SLOT(slotStart())); connect(cancelBtn, SIGNAL(clicked()), this, SLOT(slotStop())); connect(d->thread, SIGNAL(starting(QUrl)), this, SLOT(slotStarting(QUrl))); connect(d->thread, SIGNAL(finished(QUrl)), this, SLOT(slotFinished(QUrl))); connect(d->thread, SIGNAL(failed(QUrl,QString)), this, SLOT(slotFailed(QUrl,QString))); connect(d->thread, SIGNAL(progress(QUrl,int)), this, SLOT(slotProgress(QUrl,int))); updateCount(); resize(500, 400); }
void MaintenanceTool::start() { // We delay start to be sure that eventloop connect signals and slots in top level. QTimer::singleShot(0, this, SLOT(slotStart())); }
void StandGrapher::createGui() { //-------------------------------------------------- // Universal button creator for the navigation bars //-------------------------------------------------- class ButtonCreator { public: static QPushButton * create(QWidget * parent, const QString & objName, const QIcon & icon, const QKeySequence & key, QString toolTip, QWidget * target, const char * slot) { QPushButton * button = new QPushButton(parent); button->setObjectName(objName); button->setFocusPolicy(Qt::NoFocus); connect(button, SIGNAL(pressed()), target, slot); button->setIconSize(QSize(32, 32)); button->setIcon(QIcon(icon)); if (!key.isEmpty()) toolTip += " " + tr("(Shortcut: <b>%1</b>)").arg(key.toString()); button->setToolTip(toolTip); QShortcut * shortcut = new QShortcut(key, target); connect(shortcut, SIGNAL(activated()), target, slot); return button; } }; QList<QPushButton *> buttons; //------------------------------------------- // Horizontal tool box //------------------------------------------- hToolBox = new QFrame(this); hToolBox->setFrameStyle(QFrame::StyledPanel | QFrame::Plain); hToolBox->setAutoFillBackground(true); hToolBox->setCursor(Qt::ArrowCursor); hToolBox->installEventFilter(this); // Create buttons buttons << ButtonCreator::create(hToolBox, "Start_button", QIcon(":/start.png"), Qt::Key_Home, tr("Start"), this, SLOT(slotStart())); buttons << ButtonCreator::create(hToolBox, "Prev_button", QIcon(":/previous.png"), Qt::Key_Left, tr("Previous"), this, SLOT(slotPrevious())); buttons << ButtonCreator::create(hToolBox, "HFit_button", QIcon(":/fit.png"), QKeySequence(), tr("Fit horizontally"), this, SLOT(slotFit())); buttons << ButtonCreator::create(hToolBox, "Next_button", QIcon(":/next.png"), Qt::Key_Right, tr("Next"), this, SLOT(slotNext())); buttons << ButtonCreator::create(hToolBox, "Finish_button", QIcon(":/finish.png"), Qt::Key_End, tr("End"), this, SLOT(slotEnd())); buttons << ButtonCreator::create(hToolBox, "HZoomIn_button", QIcon(":/plus.png"), Qt::Key_Plus, tr("Wider"), this, SLOT(slotZoomIn())); buttons << ButtonCreator::create(hToolBox, "HZoomOut_button", QIcon(":/minus.png"), Qt::Key_Minus, tr("Narrower"), this, SLOT(slotZoomOut())); // Layout buttons QHBoxLayout * hLayout = new QHBoxLayout(hToolBox); foreach(QPushButton * button, buttons) hLayout->addWidget(button); hToolBox->setLayout(hLayout); //------------------------------------------- // Vertical tool box //------------------------------------------- vToolBox = new QFrame(this); vToolBox->setFrameStyle(QFrame::StyledPanel | QFrame::Plain); vToolBox->setAutoFillBackground(true); vToolBox->setCursor(Qt::ArrowCursor); vToolBox->installEventFilter(this); buttons.clear(); buttons << ButtonCreator::create(vToolBox, "Up_button", QIcon(":/up.png"), Qt::Key_Up, tr("Up"), this, SLOT(slotUp())); buttons << ButtonCreator::create(vToolBox, "VFit_button", QIcon(":/fit_vert.png"), QKeySequence(), tr("Fit vertically"), this, SLOT(slotVFit())); buttons << ButtonCreator::create(vToolBox, "Down_button", QIcon(":/down.png"), Qt::Key_Down, tr("Down"), this, SLOT(slotDown())); buttons << ButtonCreator::create(vToolBox, "VZoomIn_button", QIcon(":/plus.png"), Qt::SHIFT+Qt::Key_Plus, tr("Wider"), this, SLOT(slotVZoomIn())); buttons << ButtonCreator::create(vToolBox, "VZoomOut_button", QIcon(":/minus.png"), Qt::SHIFT+Qt::Key_Minus, tr("Narrower"), this, SLOT(slotVZoomOut())); // Layout buttons QVBoxLayout * vLayout = new QVBoxLayout(vToolBox); foreach(QPushButton * button, buttons) vLayout->addWidget(button); vToolBox->setLayout(vLayout); //------------------------------------------- // Tool Box //------------------------------------------- toolBox = new QFrame(this); toolBox->setFrameStyle(QFrame::StyledPanel | QFrame::Plain); toolBox->setAutoFillBackground(true); toolBox->setCursor(Qt::ArrowCursor); toolBox->installEventFilter(this); buttons.clear(); // Filter button filterButton = new QPushButton(toolBox); filterButton->setIcon(QIcon(":/filter.png")); filterButton->setCheckable(true); filterButton->setShortcut(Qt::Key_F); filterButton->setToolTip(tr("Filter window")); connect(filterButton, SIGNAL(released()), this, SLOT(slotFilterWindow())); buttons << filterButton; filterWindow = new ParamsFilterWidget(this); connect(filterWindow, SIGNAL( modelChanged(Stand_trace_model::Ptr) ), this, SLOT( setModel(Stand_trace_model::Ptr) )); connect(filterWindow, SIGNAL(windowClosed()), filterButton, SLOT(toggle())); // Drawing lines option drawLinesButton = new QPushButton(toolBox); drawLinesButton->setIcon(QIcon(":/draw_lines.png")); drawLinesButton->setCheckable(true); drawLinesButton->setChecked(true); drawLinesButton->setShortcut(Qt::Key_L); drawLinesButton->setToolTip(tr("Draw lines")); connect(drawLinesButton, SIGNAL(released()), this, SLOT(slotDrawLineSwither())); buttons << drawLinesButton; // Antialiasing option antialiasingButton = new QPushButton(toolBox); antialiasingButton->setIcon(QIcon(":/antialiasing.png")); antialiasingButton->setCheckable(true); antialiasingButton->setChecked(antialiasing); antialiasingButton->setShortcut(Qt::Key_A); antialiasingButton->setToolTip(tr("Antialiasing")); connect(antialiasingButton, SIGNAL(clicked(bool)), this, SLOT(slotAntialiasingSwither(bool))); buttons << antialiasingButton; // Print button printButton = new QPushButton(toolBox); printButton->setIcon(QIcon(":/printer.png")); printButton->setShortcut(Qt::Key_P); printButton->setToolTip(tr("Print")); connect(printButton, SIGNAL(released()), this, SLOT(slotPrintGraph())); buttons << printButton; // Setup buttons foreach (QPushButton * button, buttons) { button->setIconSize(QSize(16, 16)); button->setFocusPolicy(Qt::NoFocus); button->setToolTip(button->toolTip() + " " + tr("(Shortcut: <b>%1</b>)").arg(button->shortcut().toString())); }
ServerNForm::ServerNForm( Q_UINT16 port ) { ///// ** KeyPad Define for Authorization ** /////////////////// keypad = new KeyPad(); keypad->show(); ///// ** Initializing ETC ** ////////////////////////////////// simServer = new QTcpServer(this); if(!simServer->listen(QHostAddress::Any, port)) { qDebug("****** Unable to start the server ******"); simServer->close(); } else { qDebug("SimpleServer is initialized "); } newClientFlag = -1; infoText->append( tr("I made the Server. \nAnd Wait the Client Connection \n")); qDebug("I made the Server. \nAnd Wait the Client Connection "); RB_View_Endoscope->setChecked(1);//select endoscopic view as a default slotSelectView(); cB_LeftTool->insertItem("Dissector"); cB_LeftTool->insertItem("Cautery"); cB_LeftTool->insertItem("Grasper"); cB_LeftTool->insertItem("Clip Applier"); cB_LeftTool->insertItem("Scissors"); cB_RightTool->insertItem("Dissector"); cB_RightTool->insertItem("Cautery"); cB_RightTool->insertItem("Grasper"); cB_RightTool->insertItem("Clip Applier"); cB_RightTool->insertItem("Scissors"); UI2Madata.flag01 &= (ALL_ONES - BASIC_LOGIN) ; //m_logined = FALSE; m_surgeon_name = ""; ///// ** Initializing IP Address ** ////////////////////////////////// if(QFile::exists("./Configuration/IPSetting.inf") ) m_curr_directory = "./"; else if(QFile::exists("./GUI_Server/Configuration/IPSetting.inf") ) m_curr_directory = "./GUI_Server/"; else if(QFile::exists("../Configuration/IPSetting.inf") ) m_curr_directory = "../"; else m_curr_directory = ""; if(m_curr_directory != "" ) { FILE *fp = fopen(m_curr_directory+"Configuration/IPSetting.inf","r"); //Later, modify using new.. ^^ QString temp; char tmp[100]; if(fp != NULL) { fscanf(fp,"%d\n", &m_ip_max_no); ipname = new QString[m_ip_max_no]; ip = new unsigned char[m_ip_max_no][4]; for(int i=0;i<m_ip_max_no;i++) { fscanf(fp,"%s %d %d %d %d",tmp,&(ip[i][0]),&(ip[i][1]),&(ip[i][2]),&(ip[i][3])); ipname[i]=tmp; temp = ipname[i]+" : "+QString("%1.%2.%3.%4").arg(ip[i][0]).arg(ip[i][1]).arg(ip[i][2]).arg(ip[i][3]); cB_IP->insertItem(temp); } } QPixmap pm_logo; pm_logo.load(m_curr_directory+"Configuration/BioRobotics.bmp"); logoButton->setPixmap(pm_logo); // choose the default ip address fscanf(fp,"%s",tmp); temp = tmp; for (int j=0;j<m_ip_max_no;j++) { if(QString::compare(ipname[j],temp)==0) { cB_IP->setCurrentItem(j); UI2Madata.UDPaddr = (ip[j][0]<<24) + (ip[j][1]<<16) + (ip[j][2]<<8) + ip[j][3]; break; } } fclose(fp); } else { cB_IP->insertItem("There is no file"); UI2Madata.UDPaddr = (192<<24) + (168<<16) + (0<<8) + 100 ; // Buttercup } // ** Upload the images of the Stop/Start Buttons ** // pm_stop03.load(m_curr_directory+"Pixmaps/Paused.bmp"); pm_stop02.load(m_curr_directory+"Pixmaps/Operating.bmp"); pm_stop01.load(m_curr_directory+"Pixmaps/Initializing.bmp"); pm_stop00.load(m_curr_directory+"Pixmaps/EStop.bmp"); pm_start.load(m_curr_directory+"Pixmaps/Start.bmp"); ///// ** Connecting signals to slots** ////////////////////// // button-related slot(function)s connect( startButton, SIGNAL(clicked()), this, SLOT(slotStart()) ); connect( okButton, SIGNAL(clicked()), this, SLOT(slotClose()) ); connect( A_startButton, SIGNAL(clicked()), this, SLOT(slotStart()) ); connect( A_okButton, SIGNAL(clicked()), this, SLOT(slotClose()) ); connect( this, SIGNAL(closeEvent()), this, SLOT(slotClose()) ); connect( scaleDecreaseButton, SIGNAL(clicked()), this, SLOT(slotScaleDecrease()) ); connect( scaleIncreaseButton, SIGNAL(clicked()), this, SLOT(slotScaleIncrease()) ); connect( &m_timer, SIGNAL(timeout()), this, SLOT(slotUpdateTimer()) ); connect( tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(slotTabChange()) ); connect(loginButton, SIGNAL(clicked()), this, SLOT(slotCheckLogin())); connect(DC_dictateButton,SIGNAL(toggled(bool)),this, SLOT(slotDCDictate(bool))); connect(DC_newButton, SIGNAL( clicked() ), this, SLOT(slotDCNew())); connect(DC_saveButton, SIGNAL(toggled(bool)),this, SLOT(slotDCStart(bool))); connect(RB_View_Endoscope, SIGNAL(clicked()), this, SLOT(slotSelectView())); connect( RB_View_OR, SIGNAL(clicked()), this, SLOT(slotSelectView())); connect( RB_View_OR2, SIGNAL(clicked()), this, SLOT(slotSelectView())); connect( cB_IP, SIGNAL(activated(int)), this, SLOT(slotIPChanged(int)) ); connect( cB_RightTool, SIGNAL(activated(int)), this, SLOT(slotRightToolChanged(int)) ); connect( cB_LeftTool, SIGNAL(activated(int)), this, SLOT(slotLeftToolChanged(int)) ); connect( camAngle1, SIGNAL(valueChanged(double)), this, SLOT(slotCamAngleChanged()) ); connect( camAngle2, SIGNAL(valueChanged(double)), this, SLOT(slotCamAngleChanged()) ); connect( camAngle3, SIGNAL(valueChanged(double)), this, SLOT(slotCamAngleChanged()) ); connect( ITPCheck, SIGNAL(stateChanged(int)), this, SLOT(slotITPCheckBox(int)) ); // communication-realted slots connect(simServer, SIGNAL(newConnection()), SLOT(slotGUInewConnect()) ); connect(keypad, SIGNAL(signalAuthorized()), SLOT(slotKeyPadAuthorized()) ); // initialize HTTP connection to log server connect(&http,SIGNAL(done(bool)), this, SLOT(slotHttpRead(bool))); http.setHost("brl.ee.washington.edu"); }
MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this) ; device = new epocDevice() ; th = new epocThread(device) ; timerDraw = new QTimer() ; timerDraw->setInterval(100) ; ui->graphSignal->setScene(&sceneSignal) ; QPixmap pix ; pix.fromImage(QImage("../epocWatch/images/head.jpg")) ; QGraphicsScene scenePosition ; ui->graphPosition->setScene(&scenePosition) ; scenePosition.addPixmap(pix) ; vecDataAF3.fill(0, 1024) ; vecDataAF4.fill(0, 1024) ; vecDataF3.fill(0, 1024) ; vecDataF4.fill(0, 1024) ; vecDataF7.fill(0, 1024) ; vecDataF8.fill(0, 1024) ; vecDataFC5.fill(0, 1024) ; vecDataFC6.fill(0, 1024) ; vecDataT7.fill(0, 1024) ; vecDataT8.fill(0, 1024) ; vecDataP7.fill(0, 1024) ; vecDataP8.fill(0, 1024) ; vecDataO1.fill(0, 1024) ; vecDataO2.fill(0, 1024) ; vecFoufou.fill(0, 1024) ; isCheckedAF34 = false ; isCheckedF34 = false ; isCheckedF78 = false ; isCheckedFC56 = false ; isCheckedO12 = false ; isCheckedP78 = false ; isCheckedT78 = false ; ui->progressDelta->setStyleSheet(ui->progressDelta->property("defaultStyleSheet").toString() + " QProgressBar::chunk { background: yellow; }") ; ui->progressTheta->setStyleSheet(ui->progressTheta->property("defaultStyleSheet").toString() + " QProgressBar::chunk { background: orange; }") ; ui->progressAlpha->setStyleSheet(ui->progressAlpha->property("defaultStyleSheet").toString() + " QProgressBar::chunk { background: blue; }") ; ui->progressBeta->setStyleSheet(ui->progressBeta->property("defaultStyleSheet").toString() + " QProgressBar::chunk { background: green; }") ; ui->progressGamma->setStyleSheet(ui->progressGamma->property("defaultStyleSheet").toString() + " QProgressBar::chunk { background: red; }") ; connect(ui->cbAF34, SIGNAL(clicked()), this, SLOT(slotChecked())) ; connect(ui->cbF34, SIGNAL(clicked()), this, SLOT(slotChecked())) ; connect(ui->cbF78, SIGNAL(clicked()), this, SLOT(slotChecked())) ; connect(ui->cbFC56, SIGNAL(clicked()), this, SLOT(slotChecked())) ; connect(ui->cbO12, SIGNAL(clicked()), this, SLOT(slotChecked())) ; connect(ui->cbP78, SIGNAL(clicked()), this, SLOT(slotChecked())) ; connect(ui->cbT78, SIGNAL(clicked()), this, SLOT(slotChecked())) ; connect(ui->cbAll, SIGNAL(clicked()), this, SLOT(slotCheckedAll())) ; connect(timerDraw, SIGNAL(timeout()), this, SLOT(slotDraw())) ; connect(ui->pbConnect, SIGNAL(clicked()), this, SLOT(slotConnect())) ; connect(ui->pbStart, SIGNAL(clicked()), this, SLOT(slotStart())) ; connect(ui->pbQuit, SIGNAL(clicked()), this, SLOT(close())) ; }
void WidgetMain::slotClickUpload() { { //如果存在串口监视的则暂停 if(NULL != pSerialPortTool_) { pSerialPortTool_->closePort(); pSerialPortTool_->close(); } } //加入是否已经设置好串口的判断 if(pSerialSetting_->getBoardType() == tr("Plase Set Arduino Type") || pSerialSetting_->getSerialPort() == tr("Serial Port")) { //在此调出串口设置界面让其设置 createUploadSetting(); } else { UploadWaitForm *p = new UploadWaitForm(this->rect(), this); p->setAttribute(Qt::WA_DeleteOnClose); QSettings settingTmp("./resource/setting.ini", QSettings::IniFormat); QString value = settingTmp.value(tr("Normal/uploader")).toString(); QString filePath; if(value == "ArduinoUploader") { #ifdef Q_OS_MAC QDir dir("./resource/tools/ArduinoUploader/ArduinoUploader.app/Contents/MacOS"); if(!dir.exists("Temp")) { dir.mkdir("Temp"); } filePath = "./resource/tools/ArduinoUploader/ArduinoUploader.app/Contents/MacOS/Temp/code.cpp"; #else QDir dir("./resource/tools/ArduinoUploader"); if(!dir.exists("Temp")) { dir.mkdir("Temp"); } filePath = "./resource/tools/ArduinoUploader/Temp/code.cpp"; #endif } else if(value == "DFRobotUploader") { #ifdef Q_OS_MAC QDir dir("./resource/tools/ArduinoUploader/ArduinoUploader.app/Contents/MacOS"); if(!dir.exists("Temp")) { dir.mkdir("Temp"); } filePath = "./resource/tools/ArduinoUploader/ArduinoUploader.app/Contents/MacOS/Temp/code.cpp"; #else QDir dir("./resource/tools/ArduinoUploader"); if(!dir.exists("Temp")) { dir.mkdir("Temp"); } filePath = "./resource/tools/ArduinoUploader/Temp/code.cpp"; #endif } Uploader *pUpload = new Uploader(filePath, boardIndex_, pSerialSetting_->getSerialPort()); QThread *pThread = new QThread; pUpload->moveToThread(pThread); connect(pThread, SIGNAL(started()), pUpload, SLOT(slotStart())); connect(pUpload, SIGNAL(signalCurrentProgress(float, int)), p, SLOT(slotAdvanceProgress(float,int)), Qt::QueuedConnection); connect(pUpload, SIGNAL(signalBoardError(QString)), p, SLOT(SlotBoardError(QString)), Qt::QueuedConnection); connect(pUpload, SIGNAL(signalTypeConversionError(QString)), p, SLOT(SlotTypeConversionError(QString)), Qt::QueuedConnection); connect(pUpload, SIGNAL(signalPortError(QString)), p, SLOT(SlotPortError(QString)), Qt::QueuedConnection); connect(pUpload, SIGNAL(signalCompileEnd()), p, SLOT(SlotCompileEnd())); connect(p, SIGNAL(signalCancel()), pThread, SLOT(terminate())); p->show(); pThread->start(); } }
// -------------------------------------------------------------------------------------------- CMapQMAPExport::CMapQMAPExport(const CMapSelectionRaster& mapsel, QWidget * parent) : QDialog(parent) , mapsel(mapsel) , tainted(false) , has_map2jnx(false) , totalNumberOfStates(0) { setupUi(this); connect(toolPath, SIGNAL(clicked()), this, SLOT(slotOutputPath())); connect(pushExport, SIGNAL(clicked()), this, SLOT(slotStart())); connect(pushCancel, SIGNAL(clicked()), this, SLOT(slotCancel())); connect(pushDetails, SIGNAL(clicked()), this, SLOT(slotDetails())); connect(radioQLM, SIGNAL(toggled(bool)), this, SLOT(slotQLMToggled(bool))); connect(radioJNX, SIGNAL(toggled(bool)), this, SLOT(slotBirdsEyeToggled(bool))); connect(radioGCM, SIGNAL(toggled(bool)), this, SLOT(slotGCMToggled(bool))); connect(radioRMAP, SIGNAL(toggled(bool)), this, SLOT(slotRMAPToggled(bool))); connect(radioRMP, SIGNAL(toggled(bool)), this, SLOT(slotRMPToggled(bool))); connect(&cmd, SIGNAL(readyReadStandardError()), this, SLOT(slotStderr())); connect(&cmd, SIGNAL(readyReadStandardOutput()), this, SLOT(slotStdout())); connect(&cmd, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotFinished(int,QProcess::ExitStatus))); connect(toolGeoTiffProjWizard, SIGNAL(clicked()), this, SLOT(slotSetupProj())); connect(toolGeoTiffFromMap, SIGNAL(clicked()), this, SLOT(slotSetupProjFromMap())); connect(toolMagellanCopyright, SIGNAL(clicked()), this, SLOT(slotSelectCopyright())); SETTINGS; labelPath->setText(cfg.value("path/export","./").toString()); CMapDB::map_t mapData = CMapDB::self().getMapData(mapsel.mapkey); linePrefix->setText(QString("%1_%2_%3").arg(mapData.description).arg(mapsel.lon1 * RAD_TO_DEG).arg(mapsel.lat1 * RAD_TO_DEG)); linePrefix->setCursorPosition(0); lineDescription->setText(mapData.description); lineDescription->setCursorPosition(0); radioRMAP->show(); radioRMAP->setEnabled(true); comboRmapProjection->addItem("Mercator(WGS 84)", "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"); comboRmapProjection->addItem("EPSG:4326, LongLat(WGS 84)", "+init=epsg:4326"); comboRmapProjection->addItem("EPSG:31467, GK3 (DHDN)", "+init=epsg:31467"); comboRmapProjection->addItem("EPSG:31468, GK4 (DHDN)", "+init=epsg:31468"); #ifdef WIN32 path_map2jnx = QCoreApplication::applicationDirPath()+QDir::separator()+"map2jnx.exe"; QFile file_map2jnx(path_map2jnx); has_map2jnx = file_map2jnx.exists(); path_map2gcm = QCoreApplication::applicationDirPath()+QDir::separator()+"map2gcm.exe"; path_cache2gtiff = QCoreApplication::applicationDirPath()+QDir::separator()+"cache2gtiff.exe"; path_map2rmap = QCoreApplication::applicationDirPath()+QDir::separator()+"map2rmap.exe"; path_map2rmp = QCoreApplication::applicationDirPath()+QDir::separator()+"map2rmp.exe"; #else #if defined(Q_OS_MAC) // MacOS X: applications are stored in the bundle folder path_map2gcm = QString("%1/Resources/map2gcm").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "")); path_map2jnx = QString("%1/Resources/map2jnx").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "")); path_cache2gtiff = QString("%1/Resources/cache2gtiff").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "")); path_map2rmap = QString("%1/Resources/map2rmap").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "")); path_map2rmp = QString("%1/Resources/map2rmp").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "")); #else path_map2gcm = "map2gcm"; path_map2jnx = MAP2JNX; path_cache2gtiff = "cache2gtiff"; path_map2rmap = "map2rmap"; path_map2rmp = "map2rmp"; #endif QProcess proc1; proc1.start(path_map2jnx, QStringList()); proc1.waitForFinished(); has_map2jnx = proc1.error() == QProcess::UnknownError; #endif groupBirdsEye->hide(); groupJPEG->hide(); groupDevice->hide(); groupRMAP->hide(); groupMagellanRmp->hide(); spinJpegQuality->setValue(cfg.value("map/export/jnx/quality",75).toInt()); comboJpegSubsampling->setCurrentIndex(comboJpegSubsampling->findText(cfg.value("map/export/jnx/subsampling","411").toString())); spinProductId->setValue(cfg.value("map/export/jnx/productid",0).toInt()); lineProductName->setText(cfg.value("map/export/jnx/productname","BirdsEye").toString()); lineCopyright->setText(cfg.value("map/export/jnx/copyright","None").toString()); lineMagellanProvider->setText(cfg.value("map/export/rmp/provider", tr("Please enter a string")).toString()); lineMagellanProduct->setText(cfg.value("map/export/rmp/product", tr("Please enter a string")).toString()); copyright = cfg.value("map/export/rmp/copyright", tr("")).toString(); labelMagellanCopyright->setText(QFileInfo(copyright).fileName()); radioQLM->setChecked(cfg.value("map/export/qlm", true).toBool()); radioGCM->setChecked(cfg.value("map/export/gcm", false).toBool()); radioRMAP->setChecked(cfg.value("map/export/rmap", false).toBool()); radioRMP->setChecked(cfg.value("map/export/rmp", false).toBool()); if (has_map2jnx) { radioJNX->setChecked(cfg.value("map/export/jnx", false).toBool()); } else { radioJNX->hide(); } checkOverview2x->setChecked(cfg.value("map/export/over2x", true).toBool()); checkOverview4x->setChecked(cfg.value("map/export/over4x", true).toBool()); checkOverview8x->setChecked(cfg.value("map/export/over8x", true).toBool()); checkOverview16x->setChecked(cfg.value("map/export/over16x", true).toBool()); lineStreamingLevels->setText(cfg.value("map/export/stream/levels", "1 ").toString()); if(lineStreamingLevels->text().isEmpty()) { lineStreamingLevels->setText("1 "); } lineGeoTiffProjection->setText(cfg.value("map/export/qlm/proj","+proj=longlat +a=6378137.0000 +b=6356752.3142 +towgs84=0,0,0,0,0,0,0,0 +units=m +no_defs").toString()); lineGeoTiffProjection->setCursorPosition(0); checkProjection->setChecked(cfg.value("map/export/qlm/proj_enable").toBool()); progressBar->setMinimum(0); progressBar->setMaximum(100); progressBar->setValue(0); progressBar->resize(300, progressBar->height()); if(cfg.value("map/export/hidedetails", true).toBool()) { textBrowser->hide(); } else { textBrowser->show(); } if(mapsel.subtype == IMapSelection::eGDAL) { labelWarnStream->hide(); groupStreaming->hide(); } else { labelWarnStream->show(); groupStreaming->show(); } QFont f = font(); f.setFamily("Mono"); textBrowser->setFont(f); adjustSize(); }