void DATVDemodGUI::on_spiExcursion_valueChanged(int arg1) { (void) arg1; applySettings(); }
void AMDemodGUI::on_squelch_valueChanged(int value) { ui->squelchText->setText(QString("%1 dB").arg(value)); m_settings.m_squelch = value; applySettings(); }
void AMDemodGUI::setCenterFrequency(qint64 centerFrequency) { m_channelMarker.setCenterFrequency(centerFrequency); applySettings(); }
void AMDemodGUI::on_deltaFrequency_changed(qint64 value) { m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); applySettings(); }
void AMDemodGUI::on_bandpassEnable_toggled(bool checked) { m_settings.m_bandpassEnable = checked; applySettings(); }
void LoRaDemodGUI::resetToDefaults() { ui->BW->setValue(0); ui->Spread->setValue(0); applySettings(); }
int main(int argc, char **argv) { int status; CPXENVptr *env; CPXLPptr *lp; char const *modelfile = NULL; CPXASYNCptr *handle; CPXENVGROUPptr group; int i; int jobs = 0; int active; int *finished; char const **machine; char cwd[MAX_PATH_LEN]; char usrfunc[MAX_PATH_LEN]; int frequency; double absgap = 1e-6; int bestidx; CPXDIM c, cols; double *x; enum { OUTPUT_SILENT, OUTPUT_PREFIXED, OUTPUT_LOG } output = OUTPUT_SILENT; #if defined(USE_MPI) int numprocs, rank; MPI_Init(&argc, &argv); MPI_Comm_size (MPI_COMM_WORLD, &numprocs); if ( numprocs < 3 ) { fprintf (stderr, "Invalid number of processors (%d)\n", numprocs); abort (); } MPI_Comm_rank (MPI_COMM_WORLD, &rank); if ( rank != 0 ) { fprintf (stderr, "Master must have rank 0!\n"); MPI_Finalize (); abort (); } machine = malloc (sizeof (*machine) * numprocs); if ( machine == NULL ) { fprintf (stderr, "Out of memory!\n"); abort (); } for (i = 0; i < numprocs; ++i) machine[i] = "mpimachine"; jobs = numprocs - 1; #elif defined(USE_PROCESS) char const *bin = "./cplex"; machine = malloc (sizeof (*machine) * argc); if ( machine == NULL ) { fprintf (stderr, "Out of memory!\n"); abort (); } #elif defined(USE_TCPIP) machine = malloc (sizeof (*machine) * argc); if ( machine == NULL ) { fprintf (stderr, "Out of memory!\n"); abort (); } #else # error "No transport type selected" #endif /* Parse the command line. */ for (i = 1; i < argc; ++i) { if ( strncmp (argv[i], "-model=", 7) == 0 ) modelfile = argv[i] + 7; #if defined(USE_MPI) #elif defined(USE_PROCESS) else if ( strncmp (argv[i], "-machine=", 9) == 0 ) machine[jobs++] = argv[i] + 9; else if ( strncmp (argv[i], "-bin=", 5) == 0 ) bin = argv[i] + 5; #elif defined(USE_TCPIP) else if ( strncmp (argv[i], "-address=", 9) == 0 ) machine[jobs++] = argv[i]; #endif else if ( strncmp (argv[i], "-absgap=", 8) == 0 ) absgap = strtod (argv[i] + 8, NULL); else if ( strcmp (argv[i], "-output-prefixed") == 0 ) output = OUTPUT_PREFIXED; else if ( strcmp (argv[i], "-output-log") == 0 ) output = OUTPUT_LOG; } /* Validate arguments. */ if ( modelfile == NULL ) { fprintf (stderr, "No model file specified with -model=<modelfile>\n"); abort (); } if ( jobs < 1 ) { fprintf (stderr, "Invalid job count %d\n", jobs); abort (); } /* Allocate working arrays. */ if ( (env = malloc (sizeof (*env) * jobs)) == NULL || (handle = malloc (sizeof (*handle) * jobs)) == NULL || (lp = malloc (sizeof (*lp) * jobs)) == NULL || (finished = calloc (jobs, sizeof (*finished))) == NULL || (remotestats = calloc (jobs, sizeof (*remotestats))) == NULL ) { fprintf (stderr, "Out of memory!\n"); abort (); } /* Find the place at which to find the shared object that implements * the user function. On Windows the path to the current directory is * likely to contain blanks, so better quote it. */ getcwd (cwd, sizeof (cwd)); usrfunc[0] = 0; #ifdef _WIN32 strcat (usrfunc, "-libpath=\""); strcat (usrfunc, cwd); strcat (usrfunc, "\""); #else strcat (usrfunc, "-libpath="); strcat (usrfunc, cwd); #endif /* Create a remote object instances. */ for (i = 0; i < jobs; ++i) { /* These values define how we connect to the remote object. It is * important to use a transport configuration that actually supports * disconnect/reconnect. For the "processtransport" this means to use * named pipes instead of anonymous pipes or stdio. */ char const *transport; char const *args[16]; int nextarg = 0; char *logpath = NULL; #if defined(USE_MPI) char rankbuf[256]; sprintf (rankbuf, "-remoterank=%d", i + 1); transport = "mpitransport"; args[nextarg++] = rankbuf; #elif defined(USE_PROCESS) char logbuf[1024]; transport = "processtransport"; /* If the machine is not "localhost" then use ssh to connect to * this machine. Otherwise just fork a process on the local * machine. */ if ( machine[i] != NULL && strcmp (machine[i], "localhost") != 0 ) { args[nextarg++] = "/usr/bin/ssh"; args[nextarg++] = machine[i]; } args[nextarg++] = bin; args[nextarg++] = "-worker=process"; if ( machine[i] != NULL ) args[nextarg++] = "-stdio"; else args[nextarg++] = "-namedpipes=."; args[nextarg++] = usrfunc; args[nextarg++] = "-userfunction=parmipopt_userfunction=REGISTER_USERFUNCTION"; sprintf (logbuf, "-logfile=server%d.log", i); if ( (args[nextarg] = logpath = strdup (logbuf)) != NULL ) ++nextarg; #elif defined(USE_TCPIP) transport = "tcpiptransport"; args[nextarg++] = machine[i]; #endif printf ("Creating env on %s\n", machine[i]); env[i] = CPXXopenCPLEXremote(transport, nextarg, args, &status); if ( status || env[i] == NULL ) { fprintf (stderr, "CPXXopenCPLEXremote: %d\n", status); abort (); } free (logpath); /* Enable output */ switch (output) { case OUTPUT_SILENT: /* nothing */ break; case OUTPUT_PREFIXED: { CPXCHANNELptr cres, cwar, cerr, clog; if ( (status = CPXXgetchannels (env[i], &cres, &cwar, &cerr, &clog)) != 0 ) { fprintf (stderr, "CPXXgetchannels: %d\n", status); abort (); } if ( (status = CPXXaddfuncdest (env[i], cres, env[i], printer)) != 0 || (status = CPXXaddfuncdest (env[i], cwar, env[i], printer)) != 0 || (status = CPXXaddfuncdest (env[i], clog, env[i], printer)) != 0 ) { fprintf (stderr, "CPXXaddfpdest: %d\n", status); abort (); } } break; case OUTPUT_LOG: { if ( (status = CPXXsetintparam (env[i], CPXPARAM_ScreenOutput, CPX_ON)) != 0 ) { fprintf (stderr, "CPXXgetchannels: %d\n", status); abort (); } } break; } /* Create empty problem object for this remote solver. */ printf ("Creating LP %d\n", i); lp[i] = CPXXcreateprob(env[i], &status, "problem"); if ( status || lp[i] == NULL ) { fprintf (stderr, "CPXXcreateprob: %d\n", status); abort (); } /* Install and configure callbacks. */ remotestats[i].env = env[i]; remotestats[i].idx = i; if ( (status = CPXXsetinfohandler (env[i], infohandler, &remotestats[i])) != 0 ) { fprintf (stderr, "CPXXsetinfohandler: %d\n", status); abort (); } if ( (status = changeObjdiff (env[i], 1e-5)) != 0 ) { fprintf (stderr, "changeObjdiff: %d\n", status); abort (); } if ( (status = installCallback (env[i])) != 0 ) { fprintf (stderr, "installCallback: %d\n", status); abort (); } /* Apply predefined perameter settings for this solver. */ applySettings (env[i], i); } /* Put all environments into one group so that we can use multicasts * on operations that are the same for all solvers and/or imply lots * of data exchange. */ status = CPXXcreateenvgroup (&group, jobs, env); if ( status != 0 ) { fprintf (stderr, "CPXXcreateenvgroup: %d\n", status); abort (); } /* Read the model into all remote solver. */ status = CPXXreadcopyprob_multicast (group, modelfile, NULL); if ( status != 0 ) { fprintf (stderr, "CPXXreadcopyprob_multicast: %d\n", status); abort (); } objsen = CPXXgetobjsen (env[0], lp[0]); /* We set the thread count for each solver to 1 so that we do not * run into problems if multiple solves are performed on the same * machine. */ status = CPXXsetintparam_multicast (group, CPXPARAM_Threads, 1); if ( status != 0 ) { fprintf (stderr, "CPXXsetintparam_multicast: %d\n", status); abort (); } /* Start an asynchronous solve on each remote solver. */ for (i = 0; i < jobs; ++i) { printf ("Solving %d\n", i); if ( (status = CPXXmipopt_async (env[i], lp[i], &handle[i])) != 0 ) { fprintf (stderr, "CPXXmipopt_async: %d\n", status); abort (); } } /* All solves are started. Loop until the stopping criterion is met. */ active = jobs; frequency = 10000; /* Print current bounds every two seconds. */ while (active > 0) { int running = 0; /* Check if we shold stop all solves. * We stop them if the absolute mipgap is reached. */ if ( primal.valid && dual.valid && ((objsen == CPX_MIN && dual.bound + absgap >= primal.bound) || (objsen == CPX_MAX && dual.bound - absgap <= primal.bound)) ) { printf ("Stopping criterion reached. Stopping all pending solves.\n"); for (i = 0; i < jobs; ++i) { if ( !finished[i] ) CPXXasynckill (handle[i]); } break; } if ( --frequency == 0 ) { printf ("dual=%f, primal=%f\n", dual.bound, primal.bound); frequency = 10000; } /* Loop over all solvers and test if they are still running. */ for (i = 0; i < jobs; ++i) { if ( finished[i] ) continue; CPXXasynctest (handle[i], &running); if ( !running ) { /* The job is finished. We have a solution, so kill all * others. */ int j; --active; finished[i] = 1; printf ("First job (%d) is finished, killing the rest\n", i); for (j = 0; j < jobs; ++j) { if ( j != i ) CPXXasynckill (handle[j]); } break; } } millisleep (10); } /* All solves have finished. Join them. */ for (i = 0; i < jobs; ++i) { double obj = -CPX_INFBOUND; int stat; status = CPXXmipopt_join (&handle[i]); if ( status ) { fprintf (stderr, "CPXXmipopt_join: %d\n", status); abort (); } status = CPXXgetobjval (env[i], lp[i], &obj); if ( status == CPXERR_NO_SOLN ) { /* No feasible solution found (yet) on this machine. * Just set objective function to a very big value */ obj = (objsen == CPX_MIN) ? CPX_INFBOUND : -CPX_INFBOUND; } else if ( status ) { fprintf (stderr, "CPXXgetobjval: %d\n", status); abort (); } stat = CPXXgetstat (env[i], lp[i]); printf ("Job %d: %f, stat %d\n", i, obj, stat); printf ("\t%f, %f, %f\n", remotestats[i].dettime, remotestats[i].dual, remotestats[i].primal); if ( (status = removeCallback (env[i])) != 0 ) { fprintf (stderr, "removeCallback: %d\n", status); abort (); } } /* Fetch the x vector from the solver that produced the best * primal bound. */ bestidx = primal.idx; cols = CPXXgetnumcols (env[bestidx], lp[bestidx]); if ( (x = malloc (cols * sizeof (*x))) == NULL ) { fprintf (stderr, "Out of memory!\n"); abort (); } status = CPXXgetx (env[bestidx], lp[bestidx], x, 0, cols - 1); if ( status ) { fprintf (stderr, "CPXXgetx: %d\n", status); abort (); } printf ("Optimal solution:\n"); for (c = 0; c < cols; ++c) printf ("x[%5d]: %f\n", c, x[c]); free (x); CPXXfreeenvgroup (&group); /* Close the CPLEX objects in _reverse_ order. */ for (i = jobs - 1; i >= 0; --i) CPXXcloseCPLEX (&env[i]); free (remotestats); free (env); free (lp); free (handle); free (finished); free ((char **)machine); #ifdef USE_MPI MPI_Finalize (); #endif return 0; }
NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent) : RollupWidget(parent), ui(new Ui::NFMDemodGUI), m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), m_channelMarker(this), m_basicSettingsShown(false), m_doApplySettings(true), m_squelchOpen(false), m_tickCount(0) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); m_nfmDemod = reinterpret_cast<NFMDemod*>(rxChannel); //new NFMDemod(m_deviceUISet->m_deviceSourceAPI); m_nfmDemod->setMessageQueueToGUI(getInputMessageQueue()); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute); connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect())); blockApplySettings(true); ui->rfBW->clear(); for (int i = 0; i < NFMDemodSettings::m_nbRfBW; i++) { ui->rfBW->addItem(QString("%1").arg(NFMDemodSettings::getRFBW(i) / 1000.0, 0, 'f', 2)); } int ctcss_nbTones; const Real *ctcss_tones = m_nfmDemod->getCtcssToneSet(ctcss_nbTones); ui->ctcss->addItem("--"); for (int i=0; i<ctcss_nbTones; i++) { ui->ctcss->addItem(QString("%1").arg(ctcss_tones[i])); } blockApplySettings(false); ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); // squelch closed ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03))); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); m_channelMarker.blockSignals(true); m_channelMarker.setColor(Qt::red); m_channelMarker.setBandwidth(5000); m_channelMarker.setCenterFrequency(0); m_channelMarker.setTitle("NFM Demodulator"); m_channelMarker.blockSignals(false); m_channelMarker.setVisible(true); // activate signal on the last setting only m_settings.setChannelMarker(&m_channelMarker); m_deviceUISet->registerRxChannelInstance(NFMDemod::m_channelIdURI, this); m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addRollupWidget(this); connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor())); connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor())); QChar delta = QChar(0x94, 0x03); ui->deltaSquelch->setText(delta); connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); displaySettings(); applySettings(true); }
LRESULT MainWindow::wndProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_NCHITTEST: return HTCAPTION; case WM_CTLCOLORSTATIC: SetTextColor(reinterpret_cast<HDC>(wParam), theme::color(theme::WINDOW_TITLE)); SetBkColor(reinterpret_cast<HDC>(wParam), theme::color(theme::BACKGROUND)); return (LRESULT)GetStockObject(NULL_BRUSH); case WM_CTLCOLORBTN: return (LRESULT)theme::brush(theme::BACKGROUND); case WM_ERASEBKGND: { HDC dc = HDC(wParam); RECT r; GetClientRect(m_wnd, &r); SelectObject(dc, theme::brush(theme::BACKGROUND)); SelectObject(dc, theme::pen(theme::LINE)); Rectangle(dc, r.left, r.top, r.right, r.bottom); return 1; } case WM_MENUCOMMAND: { HMENU menu = (HMENU)lParam; int idx = wParam; switch (GetMenuItemID(menu, idx)) { case ID_USER_MENU: { MENUITEMINFO info; info.cbSize = sizeof(info); info.fMask = MIIM_DATA; GetMenuItemInfo(menu, idx, TRUE, &info); auto& item = m_menuItems[info.dwItemData]; Table* table = nullptr; for (auto t : m_tables) { if (t->isVisible()) { table = t; break; } } table->launch(item.verb.c_str(), item.path.c_str(), item.args.c_str(), false); break; } case ID_MENU_REFRESH: refresh(); break; case IDM_ABOUT: m_inDialog = true; DialogBox(m_instance, MAKEINTRESOURCE(IDD_ABOUTBOX), m_wnd, about); m_inDialog = false; break; case IDM_EXIT: PostQuitMessage(0); break; case IDM_SETTINGS: { m_inDialog = true; auto ok = ShowSettingsDialog(m_wnd); if (ok) { applySettings(); } m_inDialog = false; break; } } break; } case WM_COMMAND: { int wmId = LOWORD(wParam); switch (wmId) { case IDC_MENU: { HMENU menu = createMenu(); RECT rect; GetWindowRect(GetDlgItem(m_wnd, IDC_MENU), &rect); TrackPopupMenu(menu, TPM_RIGHTALIGN | TPM_TOPALIGN, rect.right, rect.bottom, 0, m_wnd, NULL); break; } case IDC_TAB: switchTab(); return 0; case IDC_EMPTY_LINK: { m_inDialog = true; auto ok = ShowSettingsDialog(m_wnd, SETTINGS_CONTENT); if (ok) { applySettings(); } m_inDialog = false; break; } default: return DefWindowProc(m_wnd, message, wParam, lParam); } } break; case WM_DRAWITEM: { auto draw = reinterpret_cast<LPDRAWITEMSTRUCT>(lParam); FillRect(draw->hDC, &draw->rcItem, theme::brush(theme::BACKGROUND)); SelectPen(draw->hDC, theme::pen(theme::TEXT)); SelectBrush(draw->hDC, theme::brush(theme::TEXT)); const int radius = 4; Ellipse(draw->hDC, 0, 12, radius, 12 + radius); Ellipse(draw->hDC, 8, 12, radius + 8, 12 + radius); Ellipse(draw->hDC, 16, 12, radius + 16, 12 + radius); break; } case WM_ACTIVATEAPP: if (!m_inDialog && wParam == FALSE && settings::settings()[L"general"][L"bottomWindow"].asNumber() == 0) { PostQuitMessage(0); } break; case WM_MOVE: { RECT r; GetWindowRect(m_wnd, &r); settings::cache()[L"left"] = simplejson::Value::number(r.left); settings::cache()[L"top"] = simplejson::Value::number(r.top); settings::saveCache(); break; } default: return DefWindowProc(m_wnd, message, wParam, lParam); } return 0; }
void NFMDemodGUI::on_ctcssOn_toggled(bool checked) { m_settings.m_ctcssOn = checked; applySettings(); }
void NFMDemodGUI::on_ctcss_currentIndexChanged(int index) { m_settings.m_ctcssIndex = index; applySettings(); }
void NFMDemodGUI::on_squelchGate_valueChanged(int value) { ui->squelchGateText->setText(QString("%1").arg(value * 10.0f, 0, 'f', 0)); m_settings.m_squelchGate = value; applySettings(); }
void NFMDemodGUI::on_afBW_valueChanged(int value) { ui->afBWText->setText(QString("%1 k").arg(value)); m_settings.m_afBandwidth = value * 1000.0; applySettings(); }
QPixmap markerPixmap(const QColor& color, const QColor& bgColor) { // create unique string-name for color combinations QString cacheName(color.name()+bgColor.name()); QPixmap px(16, 16); // The method signature was changed: it's // bool QPixmapCache::find ( const QString & key, QPixmap & pm ) in Qt <= 4.5 // and // bool QPixmapCache::find ( const QString & key, QPixmap * pm ) in Qt >= 4.6 #if QT_VERSION >= 0x040600 if ( QPixmapCache::find(cacheName, &px) ) { #else if ( QPixmapCache::find(cacheName, px) ) { #endif return px; } px.fill(bgColor); QPainter p(&px); // As we are using pixmap cache for most pixmap access // we can use more resource and time consuming rendering // to get better results (smooth rounded bullet in this case). // Remember: painting is performed only once per running juffed // in the ideal case. p.setRenderHint(QPainter::Antialiasing); int red = color.red(); int green = color.green(); int blue = color.blue(); QColor light(red + (255 - red) / 2, green + (255 - green) / 2, blue + (255 - blue) / 2); QColor dark(red / 2, green / 2, blue / 2); QRadialGradient gr(0.4, 0.4, 0.5, 0.4, 0.4); gr.setCoordinateMode(QGradient::ObjectBoundingMode); gr.setColorAt(0, light); gr.setColorAt(1, dark); p.setPen(dark); p.setBrush(gr); p.drawEllipse(1, 1, 14, 14); p.end(); QPixmapCache::insert(cacheName, px); return px; } class SciDoc::Interior { public: Interior(QWidget* w) { // LOGGER; curEdit_ = NULL; spl_ = new QSplitter(Qt::Vertical); QVBoxLayout* vBox = new QVBoxLayout(); vBox->setContentsMargins(0, 0, 0, 0); vBox->addWidget(spl_); w->setLayout(vBox); edit1_ = createEdit(); edit2_ = createEdit(); spl_->addWidget(edit1_); spl_->addWidget(edit2_); edit1_->setDocument(edit2_->document()); w->setFocusProxy(spl_); spl_->setSizes(QList<int>() << 0 << spl_->height()); hlTimer_ = new QTimer( w ); hlTimer_->setSingleShot( true ); connect(hlTimer_, SIGNAL(timeout()), w, SLOT(highlightWord())); } JuffScintilla* createEdit() { // LOGGER; JuffScintilla* edit = new JuffScintilla(); edit->setFocusPolicy(Qt::ClickFocus); edit->setUtf8(true); edit->setFolding(QsciScintilla::BoxedTreeFoldStyle); edit->setAutoIndent(true); edit->setBraceMatching(QsciScintilla::SloppyBraceMatch); // margins edit->setMarginLineNumbers(0, false); edit->setMarginLineNumbers(1, true); edit->setMarginSensitivity(0, true); edit->setMarginWidth(0, 20); edit->setMarginWidth(2, 12); // markers edit->markerDefine(QsciScintilla::Background, 2); // Set the 0th margin accept markers numbered 1 and 2 // Binary mask for markers 1 and 2 is 00000110 ( == 6 ) edit->setMarginMarkerMask(0, 6); edit->setMarginMarkerMask(1, 0); return edit; } void setCurrentEdit(JuffScintilla* edit) { // LOGGER; curEdit_ = edit; spl_->setFocusProxy(edit); } JuffScintilla* edit1_; JuffScintilla* edit2_; JuffScintilla* curEdit_; QString syntax_; QSplitter* spl_; QTimer* hlTimer_; }; SciDoc::SciDoc(const QString& fileName) : Juff::Document(fileName) { // LOGGER; int_ = new Interior(this); JuffScintilla* edits[] = { int_->edit1_, int_->edit2_ }; for ( int i = 0; i < 2; ++i) { JuffScintilla* edit = edits[i]; connect(edit, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(onCursorMoved(int, int))); // connect(int_->edit1_, SIGNAL(contextMenuCalled(int, int)), this, SIGNAL(contextMenuCalled(int, int))); connect(edit, SIGNAL(marginClicked(int, int, Qt::KeyboardModifiers)), SLOT(onMarginClicked(int, int, Qt::KeyboardModifiers))); connect(edit, SIGNAL(focusReceived()), SLOT(onEditFocused())); connect(edit, SIGNAL(markersMenuRequested(const QPoint&)), SIGNAL(markersMenuRequested(const QPoint&))); connect(edit, SIGNAL(escapePressed()), SIGNAL(escapePressed())); } connect(int_->edit1_, SIGNAL(modificationChanged(bool)), this, SIGNAL(modified(bool))); connect(int_->edit1_, SIGNAL(linesChanged()), SLOT(onLineCountChanged())); connect(int_->edit1_, SIGNAL(textChanged()), this, SIGNAL(textChanged())); QString lexName = "none"; SciDoc::Eol eol = guessEol(fileName); std::pair<bool,int> indentation = guessIndentation(fileName); if ( !fileName.isEmpty() && !isNoname() ) { QString codecName = Document::guessCharset(fileName); if ( !codecName.isEmpty() ) setCharset(codecName); readFile(); setEol(eol); setIndentationsUseTabs(indentation.first); setTabWidth(indentation.second); int_->edit1_->setModified(false); // syntax highlighting lexName = LexerStorage::instance()->lexerName(fileName); } else { setEol(eol); setIndentationsUseTabs(indentation.first); setTabWidth(indentation.second); } setLexer(lexName); applySettings(); QAction* hlWordAct = new QAction("", this); hlWordAct->setShortcut(QKeySequence("Ctrl+H")); connect(hlWordAct, SIGNAL(triggered()), SLOT(highlightWord())); addAction(hlWordAct); } /*SciDoc::SciDoc(Juff::Document* doc) : Juff::Document(doc) { SciDoc* d = qobject_cast<SciDoc*>(doc); if ( d != 0 ) { int_->edit1_->setDocument(d->int_->edit1_->document()); int_->edit2_->setDocument(d->int_->edit2_->document()); } }*/ SciDoc::~SciDoc() { delete int_; } QString SciDoc::type() const { return "QSci"; } bool SciDoc::supportsAction(Juff::ActionID id) const { switch (id) { case Juff::FileClone : return true; default : return Juff::Document::supportsAction(id); } } /*Juff::Document* SciDoc::createClone() { if ( hasClone() ) return NULL; else return new SciDoc(this); } void SciDoc::updateClone() { LOGGER; // SciDoc* cln = qobject_cast<SciDoc*>(clone()); // if ( cln != 0 ) { // if ( cln->int_->syntax_ != int_->syntax_ ) { // cln->int_->syntax_ = int_->syntax_; // QsciLexer* lexer = LexerStorage::instance()->lexer(int_->syntax_); // cln->int_->edit1_->setLexer(lexer); // cln->int_->edit2_->setLexer(lexer); // } // } Juff::Document::updateClone(); }*/ void SciDoc::init() { int_->setCurrentEdit(int_->edit2_); }
void AMDemodGUI::on_rfBW_valueChanged(int value) { ui->rfBWText->setText(QString("%1 kHz").arg(value / 10.0, 0, 'f', 1)); m_channelMarker.setBandwidth(value * 100); applySettings(); }
//------------------------------------------------------------------------------------------------ void Window::closeWanted() { hide(); applySettings(); writeSettings(); }
void AMDemodGUI::on_audioMute_toggled(bool checked) { applySettings(); }
WidgetIrcMain::WidgetIrcMain(QWidget* parent) : QWidget(parent), treeWidget(0), dockTile(0) { tabWidget = new MultiSessionTabWidget(this); qRegisterMetaTypeStreamOperators<ConnectionInfo>("ConnectionInfo"); qRegisterMetaTypeStreamOperators<ConnectionInfos>("ConnectionInfos"); connect(tabWidget, SIGNAL(newTabRequested()), this, SLOT(connectTo()), Qt::QueuedConnection); connect(tabWidget, SIGNAL(splitterChanged(QByteArray)), this, SLOT(splitterChanged(QByteArray))); WidgetIrcHomePage* homePage = new WidgetIrcHomePage(tabWidget); connect(homePage, SIGNAL(connectRequested()), this, SLOT(initialize())); tabWidget->insertTab(0, homePage, tr("Home")); splitterIrcMain = new QSplitter(this); splitterIrcMain->setHandleWidth(1); splitterIrcMain->addWidget(tabWidget); QVBoxLayout *centralLayout = new QVBoxLayout(this); setLayout(centralLayout); centralLayout->addWidget(splitterIrcMain); if (QtDockTile::isAvailable()) dockTile = new QtDockTile(this); QShortcut* shortcut = new QShortcut(QKeySequence(tr("Ctrl+Q")), this); connect(shortcut, SIGNAL(activated()), this, SLOT(close())); #ifdef Q_WS_MAC QMenu* menu = new QMenu(this); menuBar()->addMenu(menu); QAction* action = new QAction(tr("Connect"), this); connect(action, SIGNAL(triggered()), this, SLOT(connectTo())); menu->addAction(action); action = new QAction(tr("Settings"), this); action->setMenuRole(QAction::PreferencesRole); connect(action, SIGNAL(triggered()), qApp, SLOT(showSettings())); menu->addAction(action); action = new QAction(tr("About %1").arg(Application::applicationName()), this); action->setMenuRole(QAction::AboutRole); connect(action, SIGNAL(triggered()), qApp, SLOT(aboutApplication())); menu->addAction(action); action = new QAction(tr("About Qt"), this); action->setMenuRole(QAction::AboutQtRole); connect(action, SIGNAL(triggered()), qApp, SLOT(aboutQt())); menu->addAction(action); #endif // Q_WS_MAC quazaaSettings.loadChat(); applySettings(); connect(&quazaaSettings, SIGNAL(chatSettingsChanged()), this, SLOT(applySettings())); QFile file(":Resource/stylesheet.css"); if (file.open(QFile::ReadOnly | QIODevice::Text)) setStyleSheet(QString::fromUtf8(file.readAll())); if(quazaaSettings.Chat.ConnectOnStartup) QTimer::singleShot(600, this, SLOT(initialize())); }
void LoRaDemodGUI::viewChanged() { applySettings(); }
void TIGLViewerWindow::changeSettings() { settingsDialog->updateEntries(); settingsDialog->exec(); applySettings(); }
void AMDemodGUI::channelMarkerChangedByCursor() { ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); applySettings(); }
void SettingsWindow::apply() { applySettings(); hide(); }
void AMDemodGUI::on_ssb_toggled(bool checked) { m_settings.m_syncAMOperation = checked ? m_samUSB ? AMDemodSettings::SyncAMUSB : AMDemodSettings::SyncAMLSB : AMDemodSettings::SyncAMDSB; applySettings(); }
static void saveSettings(WMWidget *button, void *client_data) { InspectorPanel *panel = (InspectorPanel *) client_data; WWindow *wwin = panel->inspected; WDDomain *db = w_global.domain.window_attr; WMPropList *dict = NULL; WMPropList *winDic, *appDic, *value, *value1, *key = NULL, *key2; char *icon_file, *buf1, *buf2; int flags = 0, i = 0, different = 0, different2 = 0; /* Save will apply the changes and save them */ applySettings(panel->applyBtn, panel); if (WMGetButtonSelected(panel->instRb) != 0) { key = WMCreatePLString(wwin->wm_instance); } else if (WMGetButtonSelected(panel->clsRb) != 0) { key = WMCreatePLString(wwin->wm_class); } else if (WMGetButtonSelected(panel->bothRb) != 0) { buf1 = StrConcatDot(wwin->wm_instance, wwin->wm_class); key = WMCreatePLString(buf1); wfree(buf1); } else if (WMGetButtonSelected(panel->defaultRb) != 0) { key = WMRetainPropList(AnyWindow); flags = UPDATE_DEFAULTS; } if (!key) return; dict = db->dictionary; if (!dict) { dict = WMCreatePLDictionary(NULL, NULL); if (dict) { db->dictionary = dict; } else { WMReleasePropList(key); return; } } if (showIconFor(WMWidgetScreen(button), panel, NULL, NULL, USE_TEXT_FIELD) < 0) return; WMPLSetCaseSensitive(True); winDic = WMCreatePLDictionary(NULL, NULL); appDic = WMCreatePLDictionary(NULL, NULL); /* Save the icon info */ /* The flag "Ignore client suplied icon is not selected" */ buf1 = wmalloc(4); snprintf(buf1, 4, "%s", (WMGetButtonSelected(panel->alwChk) != 0) ? "Yes" : "No"); value1 = WMCreatePLString(buf1); different |= insertAttribute(dict, winDic, AAlwaysUserIcon, value1, flags); WMReleasePropList(value1); wfree(buf1); /* The icon filename (if exists) */ icon_file = WMGetTextFieldText(panel->fileText); if (icon_file != NULL) { if (icon_file[0] != '\0') { value = WMCreatePLString(icon_file); different |= insertAttribute(dict, winDic, AIcon, value, flags); different2 |= insertAttribute(dict, appDic, AIcon, value, flags); WMReleasePropList(value); } wfree(icon_file); } i = WMGetPopUpButtonSelectedItem(panel->wsP) - 1; if (i >= 0 && i < w_global.workspace.count) { value = WMCreatePLString(w_global.workspace.array[i]->name); different |= insertAttribute(dict, winDic, AStartWorkspace, value, flags); WMReleasePropList(value); } flags |= IS_BOOLEAN; value = (WMGetButtonSelected(panel->attrChk[0]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoTitlebar, value, flags); value = (WMGetButtonSelected(panel->attrChk[1]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoResizebar, value, flags); value = (WMGetButtonSelected(panel->attrChk[2]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoCloseButton, value, flags); value = (WMGetButtonSelected(panel->attrChk[3]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoMiniaturizeButton, value, flags); value = (WMGetButtonSelected(panel->attrChk[4]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoBorder, value, flags); value = (WMGetButtonSelected(panel->attrChk[5]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AKeepOnTop, value, flags); value = (WMGetButtonSelected(panel->attrChk[6]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AKeepOnBottom, value, flags); value = (WMGetButtonSelected(panel->attrChk[7]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AOmnipresent, value, flags); value = (WMGetButtonSelected(panel->attrChk[8]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AStartMiniaturized, value, flags); value = (WMGetButtonSelected(panel->attrChk[9]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AStartMaximized, value, flags); value = (WMGetButtonSelected(panel->attrChk[10]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AFullMaximize, value, flags); value = (WMGetButtonSelected(panel->moreChk[0]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoKeyBindings, value, flags); value = (WMGetButtonSelected(panel->moreChk[1]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoMouseBindings, value, flags); value = (WMGetButtonSelected(panel->moreChk[2]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ASkipWindowList, value, flags); value = (WMGetButtonSelected(panel->moreChk[3]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ASkipSwitchPanel, value, flags); value = (WMGetButtonSelected(panel->moreChk[4]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AUnfocusable, value, flags); value = (WMGetButtonSelected(panel->moreChk[5]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AKeepInsideScreen, value, flags); value = (WMGetButtonSelected(panel->moreChk[6]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoHideOthers, value, flags); value = (WMGetButtonSelected(panel->moreChk[7]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ADontSaveSession, value, flags); value = (WMGetButtonSelected(panel->moreChk[8]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AEmulateAppIcon, value, flags); value = (WMGetButtonSelected(panel->moreChk[9]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, AFocusAcrossWorkspace, value, flags); value = (WMGetButtonSelected(panel->moreChk[10]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoMiniaturizable, value, flags); #ifdef XKB_BUTTON_HINT value = (WMGetButtonSelected(panel->moreChk[11]) != 0) ? Yes : No; different |= insertAttribute(dict, winDic, ANoLanguageButton, value, flags); #endif if (wwin->main_window != None && wApplicationOf(wwin->main_window) != NULL) { value = (WMGetButtonSelected(panel->appChk[0]) != 0) ? Yes : No; different2 |= insertAttribute(dict, appDic, AStartHidden, value, flags); value = (WMGetButtonSelected(panel->appChk[1]) != 0) ? Yes : No; different2 |= insertAttribute(dict, appDic, ANoAppIcon, value, flags); value = (WMGetButtonSelected(panel->appChk[2]) != 0) ? Yes : No; different2 |= insertAttribute(dict, appDic, ASharedAppIcon, value, flags); } if (wwin->fake_group) { key2 = WMCreatePLString(wwin->fake_group->identifier); if (WMIsPropListEqualTo(key, key2)) { WMMergePLDictionaries(winDic, appDic, True); different |= different2; } else { WMRemoveFromPLDictionary(dict, key2); if (different2) WMPutInPLDictionary(dict, key2, appDic); } WMReleasePropList(key2); } else if (wwin->main_window != wwin->client_win) { WApplication *wapp = wApplicationOf(wwin->main_window); if (wapp) { buf2 = StrConcatDot(wapp->main_window_desc->wm_instance, wapp->main_window_desc->wm_class); key2 = WMCreatePLString(buf2); wfree(buf2); if (WMIsPropListEqualTo(key, key2)) { WMMergePLDictionaries(winDic, appDic, True); different |= different2; } else { WMRemoveFromPLDictionary(dict, key2); if (different2) WMPutInPLDictionary(dict, key2, appDic); } WMReleasePropList(key2); } } else { WMMergePLDictionaries(winDic, appDic, True); different |= different2; } WMReleasePropList(appDic); WMRemoveFromPLDictionary(dict, key); if (different) WMPutInPLDictionary(dict, key, winDic); WMReleasePropList(key); WMReleasePropList(winDic); UpdateDomainFile(db); /* clean up */ WMPLSetCaseSensitive(False); }
void AMDemodGUI::on_volume_valueChanged(int value) { ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1)); m_settings.m_volume = value / 10.0; applySettings(); }
static void revertSettings(WMWidget *button, void *client_data) { InspectorPanel *panel = (InspectorPanel *) client_data; WWindow *wwin = panel->inspected; WApplication *wapp = wApplicationOf(wwin->main_window); int i, n, workspace, level; char *wm_instance = NULL, *wm_class = NULL; /* Parameter not used, but tell the compiler that it is ok */ (void) button; if (panel->instRb && WMGetButtonSelected(panel->instRb) != 0) wm_instance = wwin->wm_instance; else if (panel->clsRb && WMGetButtonSelected(panel->clsRb) != 0) wm_class = wwin->wm_class; else if (panel->bothRb && WMGetButtonSelected(panel->bothRb) != 0) { wm_instance = wwin->wm_instance; wm_class = wwin->wm_class; } memset(&wwin->defined_user_flags, 0, sizeof(WWindowAttributes)); memset(&wwin->user_flags, 0, sizeof(WWindowAttributes)); memset(&wwin->client_flags, 0, sizeof(WWindowAttributes)); wWindowSetupInitialAttributes(wwin, &level, &workspace); for (i = 0; i < wlengthof(panel->attrChk); i++) { int flag = 0; switch (i) { case 0: flag = WFLAGP(wwin, no_titlebar); break; case 1: flag = WFLAGP(wwin, no_resizebar); break; case 2: flag = WFLAGP(wwin, no_close_button); break; case 3: flag = WFLAGP(wwin, no_miniaturize_button); break; case 4: flag = WFLAGP(wwin, no_border); break; case 5: flag = WFLAGP(wwin, floating); break; case 6: flag = WFLAGP(wwin, sunken); break; case 7: flag = WFLAGP(wwin, omnipresent); break; case 8: flag = WFLAGP(wwin, start_miniaturized); break; case 9: flag = WFLAGP(wwin, start_maximized != 0); break; case 10: flag = WFLAGP(wwin, full_maximize); break; } WMSetButtonSelected(panel->attrChk[i], flag); } for (i = 0; i < wlengthof(panel->moreChk); i++) { int flag = 0; switch (i) { case 0: flag = WFLAGP(wwin, no_bind_keys); break; case 1: flag = WFLAGP(wwin, no_bind_mouse); break; case 2: flag = WFLAGP(wwin, skip_window_list); break; case 3: flag = WFLAGP(wwin, skip_switchpanel); break; case 4: flag = WFLAGP(wwin, no_focusable); break; case 5: flag = WFLAGP(wwin, dont_move_off); break; case 6: flag = WFLAGP(wwin, no_hide_others); break; case 7: flag = WFLAGP(wwin, dont_save_session); break; case 8: flag = WFLAGP(wwin, emulate_appicon); break; case 9: flag = WFLAGP(wwin, focus_across_wksp); break; case 10: flag = WFLAGP(wwin, no_miniaturizable); break; #ifdef XKB_BUTTON_HINT case 11: flag = WFLAGP(wwin, no_language_button); break; #endif } WMSetButtonSelected(panel->moreChk[i], flag); } if (panel->appFrm && wapp) { for (i = 0; i < wlengthof(panel->appChk); i++) { int flag = 0; switch (i) { case 0: flag = WFLAGP(wapp->main_window_desc, start_hidden); break; case 1: flag = WFLAGP(wapp->main_window_desc, no_appicon); break; case 2: flag = WFLAGP(wapp->main_window_desc, shared_appicon); break; } WMSetButtonSelected(panel->appChk[i], flag); } } WMSetButtonSelected(panel->alwChk, WFLAGP(wwin, always_user_icon)); showIconFor(WMWidgetScreen(panel->alwChk), panel, wm_instance, wm_class, REVERT_TO_DEFAULT); n = wDefaultGetStartWorkspace(wm_instance, wm_class); if (n >= 0 && n < w_global.workspace.count) WMSetPopUpButtonSelectedItem(panel->wsP, n + 1); else WMSetPopUpButtonSelectedItem(panel->wsP, 0); /* must auto apply, so that there wno't be internal * inconsistencies between the state in the flags and * the actual state of the window */ applySettings(panel->applyBtn, panel); }
void AMDemodGUI::on_audioMute_toggled(bool checked) { m_settings.m_audioMute = checked; applySettings(); }
void OverlayUserGroup::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { event->accept(); #ifdef Q_OS_MAC bool embed = g.ocIntercept != NULL; QMenu qm(embed ? NULL : event->widget()); if (embed) { QGraphicsScene *scene = g.ocIntercept->qgv.scene(); scene->addWidget(&qm); } #else QMenu qm(g.ocIntercept ? g.mw : event->widget()); #endif QMenu *qmShow = qm.addMenu(OverlayClient::tr("Filter")); QAction *qaShowTalking = qmShow->addAction(OverlayClient::tr("Only talking")); qaShowTalking->setCheckable(true); if (os->osShow == OverlaySettings::Talking) qaShowTalking->setChecked(true); QAction *qaShowActive = qmShow->addAction(OverlayClient::tr("Talking and recently active")); qaShowActive->setCheckable(true); if (os->osShow == OverlaySettings::Active) qaShowActive->setChecked(true); QAction *qaShowHome = qmShow->addAction(OverlayClient::tr("All in current channel")); qaShowHome->setCheckable(true); if (os->osShow == OverlaySettings::HomeChannel) qaShowHome->setChecked(true); QAction *qaShowLinked = qmShow->addAction(OverlayClient::tr("All in linked channels")); qaShowLinked->setCheckable(true); if (os->osShow == OverlaySettings::LinkedChannels) qaShowLinked->setChecked(true); qmShow->addSeparator(); QAction *qaShowSelf = qmShow->addAction(OverlayClient::tr("Always show yourself")); qaShowSelf->setCheckable(true); qaShowSelf->setEnabled(os->osShow == OverlaySettings::Talking || os->osShow == OverlaySettings::Active); if (os->bAlwaysSelf) qaShowSelf->setChecked(true); qmShow->addSeparator(); QAction *qaConfigureRecentlyActiveTime = qmShow->addAction(OverlayClient::tr("Configure recently active time (%1 seconds)...").arg(os->uiActiveTime)); qaConfigureRecentlyActiveTime->setEnabled(os->osShow == OverlaySettings::Active); QMenu *qmColumns = qm.addMenu(OverlayClient::tr("Columns")); QAction *qaColumns[6]; for (unsigned int i=1;i<=5;++i) { qaColumns[i] = qmColumns->addAction(QString::number(i)); qaColumns[i]->setCheckable(true); qaColumns[i]->setChecked(i == os->uiColumns); } QMenu *qmSort = qm.addMenu(OverlayClient::tr("Sort")); QAction *qaSortAlphabetically = qmSort->addAction(OverlayClient::tr("Alphabetically")); qaSortAlphabetically->setCheckable(true); if (os->osSort == OverlaySettings::Alphabetical) qaSortAlphabetically->setChecked(true); QAction *qaSortLastStateChange = qmSort->addAction(OverlayClient::tr("Last state change")); qaSortLastStateChange->setCheckable(true); if (os->osSort == OverlaySettings::LastStateChange) qaSortLastStateChange->setChecked(true); QAction *qaEdit = qm.addAction(OverlayClient::tr("Edit...")); QAction *qaZoom = qm.addAction(OverlayClient::tr("Reset Zoom")); QAction *act = qm.exec(event->screenPos()); if (! act) return; if (act == qaEdit) { if (g.ocIntercept) { QMetaObject::invokeMethod(g.ocIntercept, "openEditor", Qt::QueuedConnection); } else { OverlayEditor oe(qApp->activeModalWidget(), NULL, os); connect(&oe, SIGNAL(applySettings()), this, SLOT(updateLayout())); oe.exec(); } } else if (act == qaZoom) { os->fZoom = 1.0f; updateLayout(); } else if (act == qaShowTalking) { os->osShow = OverlaySettings::Talking; updateUsers(); } else if (act == qaShowActive) { os->osShow = OverlaySettings::Active; updateUsers(); } else if (act == qaShowHome) { os->osShow = OverlaySettings::HomeChannel; updateUsers(); } else if (act == qaShowLinked) { os->osShow = OverlaySettings::LinkedChannels; updateUsers(); } else if (act == qaShowSelf) { os->bAlwaysSelf = ! os->bAlwaysSelf; updateUsers(); } else if (act == qaConfigureRecentlyActiveTime) { // FIXME: This might not be the best place to configure this setting, but currently // there's not really a suitable place to put this. In the future an additional tab // might be added for some advanced overlay options, which could then include this // setting. bool ok; int newValue = QInputDialog::getInt( qm.parentWidget(), OverlayClient::tr("Configure recently active time"), OverlayClient::tr("Amount of seconds users remain active after talking:"), os->uiActiveTime, 1, 2147483647, 1, &ok); if (ok) { os->uiActiveTime = newValue; } updateUsers(); } else if (act == qaSortAlphabetically) { os->osSort = OverlaySettings::Alphabetical; updateUsers(); } else if (act == qaSortLastStateChange) { os->osSort = OverlaySettings::LastStateChange; updateUsers(); } else { for (int i=1;i<=5;++i) { if (act == qaColumns[i]) { os->uiColumns = i; updateLayout(); } } } }
void AMDemodGUI::resetToDefaults() { m_settings.resetToDefaults(); displaySettings(); applySettings(true); }
void DATVDemodGUI::on_spiRollOff_valueChanged(int arg1) { (void) arg1; applySettings(); }