MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowClass) { QDir *directory = new QDir; appPath = QDir::homePath() + QString("/.wiitcpload/"); configPath = appPath + QString("config.ini"); if (directory->exists(appPath) != true) { if (directory->mkdir(appPath) != true) { QMessageBox::critical(this, tr("Critical"), QString("Can't create %1 directory").arg(appPath)); return; } } delete directory; ui->setupUi(this); if (QCoreApplication::arguments().count() > 1) ui->fileEdit->setText(QCoreApplication::arguments().at(1)); QSettings *configFile = new QSettings(configPath, QSettings::IniFormat); configFile->beginGroup("settings"); ui->hostEdit->setText(configFile->value("Hostname", "").toString()); if (ui->fileEdit->text().count() == 0) ui->fileEdit->setText(configFile->value("Filename", "").toString()); if (ui->argEdit->text().count() == 0) ui->argEdit->setText(configFile->value("Arguments", "").toString()); configFile->endGroup(); delete configFile; ui->actionQuit->setShortcut(QKeySequence::Close); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(actionQuit())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(actionAbout())); connect(ui->openFile, SIGNAL(clicked()), this, SLOT(openFile())); }
QEbuMainWindow::QEbuMainWindow(QWidget *parent) : QMainWindow(parent) { m_ebuCoreMain = 0; m_icon.addFile(":/images/qebu-icon_32.png"); m_icon.addFile(":/images/qebu-icon_64.png"); this->setWindowIcon(m_icon); qApp->setWindowIcon(m_icon); // Central Widget QWidget *cw = new QWidget; m_mainCentralLayout = new QVBoxLayout; m_labelNavigation = new QLabel; m_labelNavigation->setFrameStyle(QFrame::NoFrame); m_stackedWidget = new QStackedWidget; m_stackedWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); //m_stackedWidget->setMinimumSize(640,400); m_mainCentralLayout->addWidget(m_labelNavigation); m_mainCentralLayout->addWidget(m_stackedWidget); // Bottom label -> currentDocument m_currentDocument = new QLabel; m_mainCentralLayout->addWidget(m_currentDocument); cw->setLayout(m_mainCentralLayout); this->setCentralWidget(cw); // Create top menu bar QMenuBar *topMenuBar = new QMenuBar(this); QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = new QAction(tr("&Open..."), this); openAction->setShortcuts(QKeySequence::Open); QObject::connect(openAction, SIGNAL(triggered()), this, SLOT(actionOpen())); fileMenu->addAction(openAction); QAction *saveAction = new QAction(tr("&Save as..."), this); saveAction->setShortcut(QKeySequence::SaveAs); QObject::connect(saveAction, SIGNAL(triggered()), this, SLOT(actionSave())); fileMenu->addAction(saveAction); QAction *closeAction = new QAction(tr("&Close"), this); closeAction->setShortcut(QKeySequence::Close); QObject::connect(closeAction, SIGNAL(triggered()), this, SLOT(actionClose())); fileMenu->addAction(closeAction); fileMenu->addSeparator(); QAction *quitAction = new QAction(tr("&Quit"), this); quitAction->setShortcut(QKeySequence::Quit); quitAction->setMenuRole(QAction::QuitRole); QObject::connect(quitAction, SIGNAL(triggered()), this, SLOT(actionQuit())); fileMenu->addAction(quitAction); topMenuBar->addMenu(fileMenu); QMenu *helpMenu = new QMenu(tr("&Help"), this); QAction *wizardAction = new QAction(tr("&Getting started..."), this); QObject::connect(wizardAction, SIGNAL(triggered()), this, SLOT(actionWizard())); helpMenu->addAction(wizardAction); helpMenu->addSeparator(); QAction *aboutQtAction = new QAction(tr("About &Qt..."), this); aboutQtAction->setMenuRole(QAction::AboutQtRole); QObject::connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); helpMenu->addAction(aboutQtAction); QAction *aboutAction = new QAction(tr("&About QEbu..."), this); aboutQtAction->setMenuRole(QAction::AboutRole); QObject::connect(aboutAction, SIGNAL(triggered()), this, SLOT(actionAbout())); helpMenu->addAction(aboutAction); topMenuBar->addMenu(helpMenu); this->setMenuBar(topMenuBar); // Prepare main view resetView(); }
void MainWindow::createAboutDialog() { dialogAbout = new DialogAbout( this ); connect( ui.actionAbout, SIGNAL( triggered() ), this, SLOT( actionAbout() ) ); }
UI::UI() { widget.setupUi(this); widget.gridLayout->setContentsMargins(2,2,2,2); widget.gridLayout->setVerticalSpacing(0); // connect up all the menus connect(widget.actionAbout,SIGNAL(triggered()),this,SLOT(actionAbout())); connect(widget.actionConnectToServer,SIGNAL(triggered()),this,SLOT(actionConnect())); connect(widget.actionDisconnectFromServer,SIGNAL(triggered()),this,SLOT(actionDisconnect())); connect(widget.actionSubrx,SIGNAL(triggered()),this,SLOT(actionSubRx())); connect(widget.actionBandscope,SIGNAL(triggered()),this,SLOT(actionBandscope())); connect(widget.actionRecord,SIGNAL(triggered()),this,SLOT(actionRecord())); connect(&connection,SIGNAL(isConnected()),this,SLOT(connected())); connect(&connection,SIGNAL(disconnected(QString)),this,SLOT(disconnected(QString))); connect(&connection,SIGNAL(audioBuffer(char*,char*)),this,SLOT(audioBuffer(char*,char*))); connect(&connection,SIGNAL(spectrumBuffer(char*,char*)),this,SLOT(spectrumBuffer(char*,char*))); connect(widget.actionConfig,SIGNAL(triggered()),this,SLOT(actionConfigure())); connect(widget.actionMuteMainRx,SIGNAL(triggered()),this,SLOT(actionMuteMainRx())); connect(widget.actionMuteSubRx,SIGNAL(triggered()),this,SLOT(actionMuteSubRx())); connect(widget.actionGain_10,SIGNAL(triggered()),this,SLOT(actionGain_10())); connect(widget.actionGain_20,SIGNAL(triggered()),this,SLOT(actionGain_20())); connect(widget.actionGain_30,SIGNAL(triggered()),this,SLOT(actionGain_30())); connect(widget.actionGain_40,SIGNAL(triggered()),this,SLOT(actionGain_40())); connect(widget.actionGain_50,SIGNAL(triggered()),this,SLOT(actionGain_50())); connect(widget.actionGain_60,SIGNAL(triggered()),this,SLOT(actionGain_60())); connect(widget.actionGain_70,SIGNAL(triggered()),this,SLOT(actionGain_70())); connect(widget.actionGain_80,SIGNAL(triggered()),this,SLOT(actionGain_80())); connect(widget.actionGain_90,SIGNAL(triggered()),this,SLOT(actionGain_90())); connect(widget.actionGain_100,SIGNAL(triggered()),this,SLOT(actionGain_100())); connect(widget.actionKeypad, SIGNAL(triggered()),this,SLOT(actionKeypad())); connect(&keypad,SIGNAL(setKeypadFrequency(long long)),this,SLOT(setKeypadFrequency(long long))); connect(widget.action160, SIGNAL(triggered()),this,SLOT(action160())); connect(widget.action80, SIGNAL(triggered()),this,SLOT(action80())); connect(widget.action60, SIGNAL(triggered()),this,SLOT(action60())); connect(widget.action40, SIGNAL(triggered()),this,SLOT(action40())); connect(widget.action30, SIGNAL(triggered()),this,SLOT(action30())); connect(widget.action20, SIGNAL(triggered()),this,SLOT(action20())); connect(widget.action17, SIGNAL(triggered()),this,SLOT(action17())); connect(widget.action15, SIGNAL(triggered()),this,SLOT(action15())); connect(widget.action12, SIGNAL(triggered()),this,SLOT(action12())); connect(widget.action10, SIGNAL(triggered()),this,SLOT(action10())); connect(widget.action6, SIGNAL(triggered()),this,SLOT(action6())); connect(widget.actionGen, SIGNAL(triggered()),this,SLOT(actionGen())); connect(widget.actionWWV, SIGNAL(triggered()),this,SLOT(actionWWV())); connect(widget.actionCWL,SIGNAL(triggered()),this,SLOT(actionCWL())); connect(widget.actionCWU,SIGNAL(triggered()),this,SLOT(actionCWU())); connect(widget.actionLSB,SIGNAL(triggered()),this,SLOT(actionLSB())); connect(widget.actionUSB,SIGNAL(triggered()),this,SLOT(actionUSB())); connect(widget.actionDSB,SIGNAL(triggered()),this,SLOT(actionDSB())); connect(widget.actionAM,SIGNAL(triggered()),this,SLOT(actionAM())); connect(widget.actionSAM,SIGNAL(triggered()),this,SLOT(actionSAM())); connect(widget.actionFMN,SIGNAL(triggered()),this,SLOT(actionFMN())); connect(widget.actionDIGL,SIGNAL(triggered()),this,SLOT(actionDIGL())); connect(widget.actionDIGU,SIGNAL(triggered()),this,SLOT(actionDIGU())); connect(widget.actionFilter_0,SIGNAL(triggered()),this,SLOT(actionFilter0())); connect(widget.actionFilter_1,SIGNAL(triggered()),this,SLOT(actionFilter1())); connect(widget.actionFilter_2,SIGNAL(triggered()),this,SLOT(actionFilter2())); connect(widget.actionFilter_3,SIGNAL(triggered()),this,SLOT(actionFilter3())); connect(widget.actionFilter_4,SIGNAL(triggered()),this,SLOT(actionFilter4())); connect(widget.actionFilter_5,SIGNAL(triggered()),this,SLOT(actionFilter5())); connect(widget.actionFilter_6,SIGNAL(triggered()),this,SLOT(actionFilter6())); connect(widget.actionFilter_7,SIGNAL(triggered()),this,SLOT(actionFilter7())); connect(widget.actionFilter_8,SIGNAL(triggered()),this,SLOT(actionFilter8())); connect(widget.actionFilter_9,SIGNAL(triggered()),this,SLOT(actionFilter9())); connect(widget.actionANF,SIGNAL(triggered()),this,SLOT(actionANF())); connect(widget.actionNR,SIGNAL(triggered()),this,SLOT(actionNR())); connect(widget.actionNB,SIGNAL(triggered()),this,SLOT(actionNB())); connect(widget.actionSDROM,SIGNAL(triggered()),this,SLOT(actionSDROM())); connect(widget.actionPolyphase,SIGNAL(triggered()),this,SLOT(actionPolyphase())); connect(widget.actionLong,SIGNAL(triggered()),this,SLOT(actionLong())); connect(widget.actionSlow,SIGNAL(triggered()),this,SLOT(actionSlow())); connect(widget.actionMedium,SIGNAL(triggered()),this,SLOT(actionMedium())); connect(widget.actionFast,SIGNAL(triggered()),this,SLOT(actionFast())); connect(widget.actionPreamp,SIGNAL(triggered()),this,SLOT(actionPreamp())); connect(widget.actionBookmarkThisFrequency,SIGNAL(triggered()),this,SLOT(actionBookmark())); connect(widget.actionEditBookmarks,SIGNAL(triggered()),this,SLOT(editBookmarks())); // connect up band and frequency changes connect(&band,SIGNAL(bandChanged(int,int)),this,SLOT(bandChanged(int,int))); // connect(&band,SIGNAL(frequencyChanged(long long)),this,SLOT(frequencyChanged(long long))); // connect up mode changes connect(&mode,SIGNAL(modeChanged(int,int)),this,SLOT(modeChanged(int,int))); // connect up filter changes connect(&filters,SIGNAL(filtersChanged(FiltersBase*,FiltersBase*)),this,SLOT(filtersChanged(FiltersBase*,FiltersBase*))); connect(&filters,SIGNAL(filterChanged(int,int)),this,SLOT(filterChanged(int,int))); // connect up spectrum frame connect(widget.spectrumFrame, SIGNAL(frequencyMoved(int,int)), this, SLOT(frequencyMoved(int,int))); connect(widget.spectrumFrame, SIGNAL(frequencyChanged(long long)), this, SLOT(frequencyChanged(long long))); connect(widget.spectrumFrame, SIGNAL(spectrumHighChanged(int)), this,SLOT(spectrumHighChanged(int))); connect(widget.spectrumFrame, SIGNAL(spectrumLowChanged(int)), this,SLOT(spectrumLowChanged(int))); connect(widget.spectrumFrame, SIGNAL(waterfallHighChanged(int)), this,SLOT(waterfallHighChanged(int))); connect(widget.spectrumFrame, SIGNAL(waterfallLowChanged(int)), this,SLOT(waterfallLowChanged(int))); // connect up waterfall frame connect(widget.waterfallFrame, SIGNAL(frequencyMoved(int,int)), this, SLOT(frequencyMoved(int,int))); // connect up configuration changes connect(&configure,SIGNAL(spectrumHighChanged(int)),this,SLOT(spectrumHighChanged(int))); connect(&configure,SIGNAL(spectrumLowChanged(int)),this,SLOT(spectrumLowChanged(int))); connect(&configure,SIGNAL(fpsChanged(int)),this,SLOT(fpsChanged(int))); connect(&configure,SIGNAL(waterfallHighChanged(int)),this,SLOT(waterfallHighChanged(int))); connect(&configure,SIGNAL(waterfallLowChanged(int)),this,SLOT(waterfallLowChanged(int))); connect(&configure,SIGNAL(waterfallAutomaticChanged(bool)),this,SLOT(waterfallAutomaticChanged(bool))); configure.initAudioDevices(&audio); connect(&configure,SIGNAL(audioDeviceChanged(QAudioDeviceInfo,int,int,QAudioFormat::Endian)),this,SLOT(audioDeviceChanged(QAudioDeviceInfo,int,int,QAudioFormat::Endian))); connect(&configure,SIGNAL(hostChanged(QString)),this,SLOT(hostChanged(QString))); connect(&configure,SIGNAL(receiverChanged(int)),this,SLOT(receiverChanged(int))); connect(&configure,SIGNAL(nrValuesChanged(int,int,double,double)),this,SLOT(nrValuesChanged(int,int,double,double))); connect(&configure,SIGNAL(anfValuesChanged(int,int,double,double)),this,SLOT(anfValuesChanged(int,int,double,double))); connect(&configure,SIGNAL(nbThresholdChanged(double)),this,SLOT(nbThresholdChanged(double))); connect(&configure,SIGNAL(sdromThresholdChanged(double)),this,SLOT(sdromThresholdChanged(double))); connect(&bookmarks,SIGNAL(bookmarkSelected(QAction*)),this,SLOT(selectBookmark(QAction*))); connect(&bookmarkDialog,SIGNAL(accepted()),this,SLOT(addBookmark())); connect(&configure,SIGNAL(addXVTR(QString,long long,long long,long long,long long,int,int)),this,SLOT(addXVTR(QString,long long,long long,long long,long long,int,int))); connect(&configure,SIGNAL(deleteXVTR(int)),this,SLOT(deleteXVTR(int))); connect(&xvtr,SIGNAL(xvtrSelected(QAction*)),this,SLOT(selectXVTR(QAction*))); bandscope=NULL; fps=15; gain=100; subRx=FALSE; subRxGain=100; agc=AGC_SLOW; cwPitch=600; audio_device=0; audio_sample_rate=configure.getSampleRate(); audio_channels=configure.getChannels(); audio_byte_order=configure.getByteOrder(); audio.initialize_audio(AUDIO_BUFFER_SIZE); // load any saved settings loadSettings(); switch(agc) { case AGC_SLOW: widget.actionSlow->setChecked(TRUE); break; case AGC_MEDIUM: widget.actionMedium->setChecked(TRUE); break; case AGC_FAST: widget.actionFast->setChecked(TRUE); break; case AGC_LONG: widget.actionLong->setChecked(TRUE); break; } fps=configure.getFps(); configure.updateXvtrList(&xvtr); xvtr.buildMenu(widget.menuXVTR); widget.spectrumFrame->setHost(configure.getHost()); widget.spectrumFrame->setReceiver(configure.getReceiver()); widget.actionSubrx->setDisabled(TRUE); widget.actionMuteSubRx->setDisabled(TRUE); band.initBand(band.getBand()); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { /****************** Menu Bar ******************/ /* * File Menu */ QAction *newAction = new QAction("&New File", this); newAction->setShortcut(tr("Ctrl+N")); connect(newAction, SIGNAL(triggered()), this, SLOT(actionNew())); QAction *openAction = new QAction("&Open File", this); openAction->setShortcut(tr("Ctrl+O")); connect(openAction, SIGNAL(triggered()), this, SLOT(actionOpen())); QAction *saveAction = new QAction("&Save File", this); saveAction->setShortcut(tr("Ctrl+S")); connect(saveAction, SIGNAL(triggered()), this, SLOT(actionSave())); QAction *quitAction = new QAction("&Quit", this); quitAction->setShortcut(tr("Ctrl+Q")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QMenu *fileMenu; fileMenu = menuBar()->addMenu("&File"); fileMenu->addAction(newAction); fileMenu->addAction(openAction); fileMenu->addAction(saveAction); fileMenu->addAction(quitAction); /* * Edit Menu */ QAction *chooseWireColorAction = new QAction("Choose Wire &Color", this); chooseWireColorAction->setShortcut(tr("Ctrl+C")); connect(chooseWireColorAction, SIGNAL(triggered()), this, SLOT(actionChooseWireColor())); QMenu *editMenu; editMenu = menuBar()->addMenu("&Edit"); editMenu->addSeparator(); editMenu->addAction(chooseWireColorAction); /* * Insert Menu */ QAction *insertWireAction = new QAction("Insert &Wire", this); insertWireAction->setShortcut(tr("Ctrl+W")); connect(insertWireAction, SIGNAL(triggered()), this, SLOT(actionInsertWire())); QAction *insertLEDAction = new QAction("Insert &LED", this); insertLEDAction->setShortcut(tr("Ctrl+L")); connect(insertLEDAction, SIGNAL(triggered()), this, SLOT(actionInsertLED())); QAction *insertICAction = new QAction("Insert &IC", this); insertICAction->setShortcut(tr("Ctrl+I")); connect(insertICAction, SIGNAL(triggered()), this, SLOT(actionInsertIC())); QAction *insertTagAction = new QAction("Insert &Tag", this); insertTagAction->setShortcut(tr("Ctrl+T")); connect(insertTagAction, SIGNAL(triggered()), this, SLOT(actionInsertTag())); QMenu *insertMenu; insertMenu = menuBar()->addMenu("&Insert"); insertMenu->addAction(insertWireAction); insertMenu->addAction(insertLEDAction); insertMenu->addAction(insertICAction); insertMenu->addSeparator(); insertMenu->addAction(insertTagAction); /* * Circuit Menu */ QAction *runCircuitAction = new QAction("&Run Circuit", this); runCircuitAction->setShortcut(tr("F5")); connect(runCircuitAction, SIGNAL(triggered()), this, SLOT(actionRunCircuit())); QAction *stopCircuitAction = new QAction("&Stop Circuit", this); stopCircuitAction->setShortcut(tr("F12")); connect(stopCircuitAction, SIGNAL(triggered()), this, SLOT(actionStopCircuit())); QAction *truthTableAction = new QAction("Generate &Truth Table", this); truthTableAction->setShortcut(tr("F6")); connect(truthTableAction, SIGNAL(triggered()), this, SLOT(actionTruthTable())); QMenu *circuitMenu; circuitMenu = menuBar()->addMenu("&Circuit"); circuitMenu->addAction(runCircuitAction); circuitMenu->addAction(stopCircuitAction); circuitMenu->addAction(truthTableAction); /* * Help Menu */ QAction *aboutAction = new QAction("&About", this); connect(aboutAction, SIGNAL(triggered()), this, SLOT(actionAbout())); QMenu *helpMenu; helpMenu = menuBar()->addMenu("&Help"); helpMenu->addAction(aboutAction); /* * Invisible Actions */ QShortcut *toggleInput1 = new QShortcut(QKeySequence(tr("Alt+1")), this); QShortcut *toggleInput2 = new QShortcut(QKeySequence(tr("Alt+2")), this); QShortcut *toggleInput3 = new QShortcut(QKeySequence(tr("Alt+3")), this); QShortcut *toggleInput4 = new QShortcut(QKeySequence(tr("Alt+4")), this); QShortcut *toggleInput5 = new QShortcut(QKeySequence(tr("Alt+5")), this); QShortcut *toggleInput6 = new QShortcut(QKeySequence(tr("Alt+6")), this); QShortcut *toggleInput7 = new QShortcut(QKeySequence(tr("Alt+7")), this); QShortcut *toggleInput8 = new QShortcut(QKeySequence(tr("Alt+8")), this); QShortcut *toggleInput9 = new QShortcut(QKeySequence(tr("Alt+9")), this); QShortcut *toggleInput0 = new QShortcut(QKeySequence(tr("Alt+0")), this); connect(toggleInput1, SIGNAL(activated()), this, SLOT(actionToggleInput1())); connect(toggleInput2, SIGNAL(activated()), this, SLOT(actionToggleInput2())); connect(toggleInput3, SIGNAL(activated()), this, SLOT(actionToggleInput3())); connect(toggleInput4, SIGNAL(activated()), this, SLOT(actionToggleInput4())); connect(toggleInput5, SIGNAL(activated()), this, SLOT(actionToggleInput5())); connect(toggleInput6, SIGNAL(activated()), this, SLOT(actionToggleInput6())); connect(toggleInput7, SIGNAL(activated()), this, SLOT(actionToggleInput7())); connect(toggleInput8, SIGNAL(activated()), this, SLOT(actionToggleInput8())); connect(toggleInput9, SIGNAL(activated()), this, SLOT(actionToggleInput9())); connect(toggleInput0, SIGNAL(activated()), this, SLOT(actionToggleInput0())); QShortcut *cheatNO_GND_VCC_sh = new QShortcut( QKeySequence(Qt::Key_N, Qt::Key_G, Qt::Key_V), this); connect(cheatNO_GND_VCC_sh, SIGNAL(activated()), this, SLOT(actionCheatNO_GND_VCC())); /*************** Central Contents ***************/ QWidget *centralWidget = new QWidget; centralWidget->setObjectName(QObject::tr("centralWidget")); console = nullptr; consoleView = new QGraphicsView(); consoleView->setFixedSize(Console::CONSOLE_WIDTH, Console::CONSOLE_HEIGHT); actionNew(); QVBoxLayout *vLayout = new QVBoxLayout; QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addStretch(1); hLayout->addWidget(consoleView); hLayout->addStretch(1); vLayout->addStretch(1); vLayout->addLayout(hLayout); vLayout->addStretch(1); centralWidget->setLayout(vLayout); setCentralWidget(centralWidget); /*************** Containers *****************/ icNameList = new QStringList; icPinsList = new QStringList; icDescList = new QStringList; icLabelList = new QStringList; /*************** Functions ******************/ parseICs(); icdialog = new ICDialog(this, icNameList, icDescList); /*************** Booleans *******************/ circuitState = false; cheatNO_GND_VCC = false; }