/*! * \brief MetaModelicaHighlighter::MetaModelicaHighlighter * \param pMetaModelicaEditorPage * \param pPlainTextEdit */ MetaModelicaHighlighter::MetaModelicaHighlighter(MetaModelicaEditorPage *pMetaModelicaEditorPage, QPlainTextEdit *pPlainTextEdit) : QSyntaxHighlighter(pPlainTextEdit->document()) { mpMetaModelicaEditorPage = pMetaModelicaEditorPage; mpPlainTextEdit = pPlainTextEdit; initializeSettings(); }
IDEApplication::IDEApplication(int& argc, char **argv) : QApplication(argc, argv), mSettings(NULL) { setOrganizationName(PROJECT_ORGANIZATION); setApplicationName(PROJECT_NAME); setApplicationVersion(PROJECT_VERSION); setWindowIcon(QIcon(":/images/arduide.png")); // translation support initializeTranslator(); // fix the data path mDataPath = QDir(DATA_PATH).absolutePath(); registerMetaTypes(); // initialize Grantlee initializeTemplates(); // start the GUI initializeGui(); // check the settings are correct, or start the wizard initializeSettings(); // further gui initialization mMainWindow->initialize(); // initialize the plugins initializePlugins(); }
//! Constructor TLMHighlighter::TLMHighlighter(TLMEditorPage *pTLMEditorPage, QPlainTextEdit *pPlainTextEdit) : QSyntaxHighlighter(pPlainTextEdit->document()) { mpTLMEditorPage = pTLMEditorPage; mpPlainTextEdit = pPlainTextEdit; initializeSettings(); }
// Supporting function implementation Accelerometer::Accelerometer() { // Initialize variables uint8_t value; // Configure VDDIO, SDA and SCL pins ioport_set_pin_dir(ACCELEROMETER_VDDIO_PIN, IOPORT_DIR_OUTPUT); ioport_set_pin_level(ACCELEROMETER_VDDIO_PIN, IOPORT_PIN_LEVEL_HIGH); ioport_set_pin_mode(ACCELEROMETER_SDA_PIN, IOPORT_MODE_WIREDANDPULL); ioport_set_pin_mode(ACCELEROMETER_SCL_PIN, IOPORT_MODE_WIREDANDPULL); // Configure interface twi_options_t options; options.speed = BUS_SPEED; options.chip = MASTER_ADDRESS; options.speed_reg = TWI_BAUD(sysclk_get_cpu_hz(), BUS_SPEED); // Initialize interface sysclk_enable_peripheral_clock(&TWI_MASTER); twi_master_init(&TWI_MASTER, &options); twi_master_enable(&TWI_MASTER); // Create packet twi_package_t packet; packet.addr[0] = WHO_AM_I; packet.addr_length = 1; packet.chip = ACCELEROMETER_ADDRESS; packet.buffer = &value; packet.length = 1; packet.no_wait = false; // Check if transmitting or receiving failed if(twi_master_read(&TWI_MASTER, &packet) != TWI_SUCCESS || value != DEVICE_ID) // Clear is working isWorking = false; // Otherwise else { // Reset the accelerometer writeValue(CTRL_REG2, CTRL_REG2_RST); // Wait enough time for accelerometer to initialize delay_ms(1); // Initialize settings initializeSettings(); // Calibrate //calibrate(); // Set is working isWorking = true; } }
RS232VisualizerMain::RS232VisualizerMain(QObject *parent) : QObject(parent) { initializeSettings(); startSerialPort(); startGUI(); connectionsGUIserial(); connectionsCore(); }
MeshCombiner::MeshCombiner() { m_MeshCombinerConfig = new ConfigFile(); // Configuration einladen m_MeshCombinerConfig->loadDirect("media/cfg/meshcombiner.cfg","="); initializeSettings(); consoleMeshCombiner(); consoleSkeletonCombiner(); }
void Accelerometer::calibrate() { // Initialize variables int32_t averageXValue = 0; int32_t averageYValue = 0; int32_t averageZValue = 0; // Put accelerometer into standby mode writeValue(CTRL_REG1, 0); // Set dynamic range to 2g writeValue(XYZ_DATA_CFG, 0); // Set oversampling mode to high resolution writeValue(CTRL_REG2, CTRL_REG2_MODS1); // Clear offsets writeValue(OFF_X, 0); writeValue(OFF_Y, 0); writeValue(OFF_Z, 0); // Set output data rate frequency to 1.56Hz and enable active mode writeValue(CTRL_REG1, CTRL_REG1_DR2 | CTRL_REG1_DR1 | CTRL_REG1_DR0 | CTRL_REG1_ACTIVE); // Get average values for(uint8_t i = 0; i < 10; i++) { // Read acceleration values readAccelerationValues(); // Add values to average averageXValue += xValue; averageYValue += yValue; averageZValue += zValue; } // Compute averages averageXValue /= 10; averageYValue /= 10; averageZValue /= 10; // Put accelerometer into standby mode writeValue(CTRL_REG1, 0); // Set offsets int8_t xOffset = -averageXValue / 2; int8_t yOffset = -averageYValue / 2; int8_t zOffset = -(averageZValue - SENSITIVITY_2G) / 2; writeValue(OFF_X, xOffset); writeValue(OFF_Y, yOffset); writeValue(OFF_Z, zOffset); // Initialize settings initializeSettings(); }
GHOST_TSuccess GHOST_DisplayManager::initialize( void) { GHOST_TSuccess success; if (!m_settingsInitialized) { success = initializeSettings(); m_settingsInitialized = true; } else { success = GHOST_kSuccess; } return success; }
MainWindow::MainWindow(QMainWindow *parent) :QMainWindow(parent) { mw.setupUi(this); //Default Debug Settings. Set in Config file to overwrite logLevel=verbose; //Default Level is Verbose logToFile=true; //Default Level is to log to file //Variables userHomeDir = QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory); //Default path to user home serverUrl = ""; // Url to destination folder; Must end with / defaultPage = ""; // Default page to show in the event of a 404 defaultPageDuration = 0; // Length of time to show default page in the event of a 404 timerDelay = 5000; // in milliseconds, 1000ms = 1s index = 0; // set array index to be 0 //Set application name QCoreApplication::setOrganizationName("sign"); QCoreApplication::setApplicationName("sign"); //Initialize the application and if successful start timer. if(initializeSettings()) { //Create web-engine for displaying the page view = new QWebEngineView(this); //Errata solution: Make sure we always get the most current page view->page()->profile()->setCachePath(userHomeDir + ".config/sign/tmp/browserCache"); view->page()->profile()->setHttpCacheType(QWebEngineProfile::NoCache); view->page()->profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies); //Set display to the view setCentralWidget(view); //Create Timer timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(timerEvent())); connect(timer, SIGNAL(timeout()), this, SLOT(timerStart())); timer->start(timerDelay); //Load initial page loadPage(); } else { exit(EXIT_FAILURE); } }
/*! If there are no exceptions to stop it, the TNxSpooler object is constructed. \param qwidgetParent If "qwidgetParent" is not specified, the TNxSpooler will be an independent window. */ TNxSpooler::TNxSpooler(QWidget *qwidgetParent) : QDialog(qwidgetParent) { QDEBUG_METHOD_NAME; // "Adopt" member objects that need this m_settings.setParent(this); m_sys_tray_icon.setParent(this); m_timer.setParent(this); // Define constant values by default m_default_interval = 3; m_special_extension = ".nxspooler-open"; // A special extension for files that contain a path to be opened by NxSpooler m_default_formats.append("pdf"); m_default_formats.append("ods"); m_default_formats.append("sxc"); m_default_shared_resource = "nxspooler$"; m_default_folder = QDir::toNativeSeparators(QDir::homePath().append(QDir::separator()).append(".nxspooler")); setupUi(this); prepareTrayIconOrShowProgram(); try { initializeSettings(); prepareSharedFolder(); } catch (std::exception &excep) { // If the path did not exist and the path could not be created, show the options dialog if (QString(excep.what()).startsWith("2805093")) { syst.showWarning(excep.what()); show(); openOptions(); } else { throw excep; } } prepareTimer(); }
ControllableSplitter::ControllableSplitter(XmlOptionFile options, QWidget *parent) : mShiftSplitterLeft(NULL), mShiftSplitterRight(NULL), mSplitterRatio(0.5), mOptions(options) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); mSplitter = new QSplitter(Qt::Horizontal); connect(mSplitter, &QSplitter::splitterMoved, this, &ControllableSplitter::onSplitterMoved); layout->addWidget(mSplitter, 1); mSplitterRatio = this->getSplitterRatioOption().readValue(QString::number(0.5)).toDouble(); // must set geometry after sizes have been set, i.e. after return to the main loop: QTimer::singleShot(0, this, SLOT(initializeSettings())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), server(new LogServer("127.0.0.1",2333,this)), dynamicChart(new QChart()), m_series(new QLineSeries(dynamicChart)), axis_X(new QDateTimeAxis), axis_Y(new QValueAxis), m_mobile_series(new QLineSeries(dynamicChart)), serverThread(new QThread()) { ui->setupUi(this); connect(server,&LogServer::newServerInformation,this,&MainWindow::handleNewServerInformation); connect(serverThread,&QThread::started,server,&LogServer::initializeServer); server->moveToThread(serverThread); serverThread->start(); initializeSettings(); }
PostgreChartProvider::PostgreChartProvider() : dataSource(0), detailLevel(0), settings(0) { selectedLayers.insert("deptharea_r"); selectedLayers.insert("generarea_r"); selectedLayers.insert("signsound_p"); selectedLayers.insert("depthcont_l"); selectedLayers.insert("navaid_p"); selectedLayers.insert("navigline_l"); selectedLayers.insert("rock_p"); selectedLayers.insert("wreck_p"); selectedLayers.insert("transmline_l"); // selectedLayers.insert("bridge_l"); initializeSettings(); settingsUI = new SettingsUI(); settingsUI->setPGChart(this); settingsUI->setupSettings(settings); }
int main(int argc, char *argv[]) { int fd = 0; /* File descriptor providing CUPS raster data */ cups_raster_t * ras = NULL; /* Raster stream for printing */ cups_page_header_t header; /* CUPS Page header */ int page = 0; /* Current page */ int y = 0; /* Vertical position in page 0 <= y <= header.cupsHeight */ int vertDot = 0; /* Vertical position in 8-dot heigh scan line 0 <= vertDot <= 8 */ int i = 0; /* Horizontal byte index in CUPS raster data 0 <= i < header.cupsBytesPerLine */ unsigned char * rasterData = NULL; /* CUPS raster data [0 ... header.cupsBytesPerLine - 1] -- 1 byte = 8 horizontal dots */ unsigned char * bitImageData = NULL; /* Line mode bit image data [0 ... header.cupsWidth - 1] -- 1 byte = 8 vertical dots */ int scanLineBlank = FALSE; /* TRUE iff 1-dot heigh scan line in CUPS raster data is blank */ int blankScanLines = 0; /* Count of blank 1-dot heigh scan lines 0 <= blankScanLines <= 8 */ int blankPasses = 0; /* Count of blank 8-dot heigh scan lines */ struct settings_ settings; /* Configuration settings */ #ifdef RPMBUILD void * libCupsImage = NULL; /* Pointer to libCupsImage library */ void * libCups = NULL; /* Pointer to libCups library */ libCups = dlopen ("libcups.so", RTLD_NOW | RTLD_GLOBAL); if (! libCups) { fputs("ERROR: libcups.so load failure\n", stderr); return EXIT_FAILURE; } libCupsImage = dlopen ("libcupsimage.so", RTLD_NOW | RTLD_GLOBAL); if (! libCupsImage) { fputs("ERROR: libcupsimage.so load failure\n", stderr); dlclose(libCups); return EXIT_FAILURE; } GET_LIB_FN_OR_EXIT_FAILURE(ppdClose_fn, libCups, "ppdClose" ); GET_LIB_FN_OR_EXIT_FAILURE(ppdFindChoice_fn, libCups, "ppdFindChoice" ); GET_LIB_FN_OR_EXIT_FAILURE(ppdFindMarkedChoice_fn, libCups, "ppdFindMarkedChoice" ); GET_LIB_FN_OR_EXIT_FAILURE(ppdFindOption_fn, libCups, "ppdFindOption" ); GET_LIB_FN_OR_EXIT_FAILURE(ppdMarkDefaults_fn, libCups, "ppdMarkDefaults" ); GET_LIB_FN_OR_EXIT_FAILURE(ppdOpenFile_fn, libCups, "ppdOpenFile" ); GET_LIB_FN_OR_EXIT_FAILURE(cupsFreeOptions_fn, libCups, "cupsFreeOptions" ); GET_LIB_FN_OR_EXIT_FAILURE(cupsParseOptions_fn, libCups, "cupsParseOptions" ); GET_LIB_FN_OR_EXIT_FAILURE(cupsMarkOptions_fn, libCups, "cupsMarkOptions" ); GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterOpen_fn, libCupsImage, "cupsRasterOpen" ); GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterReadHeader_fn, libCupsImage, "cupsRasterReadHeader" ); GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterReadPixels_fn, libCupsImage, "cupsRasterReadPixels" ); GET_LIB_FN_OR_EXIT_FAILURE(cupsRasterClose_fn, libCupsImage, "cupsRasterClose" ); #endif if (argc < 6 || argc > 7) { fputs("ERROR: rastertostar job-id user title copies options [file]\n", stderr); #ifdef RPMBUILD dlclose(libCupsImage); dlclose(libCups); #endif return EXIT_FAILURE; } if (argc == 7) { if ((fd = open(argv[6], O_RDONLY)) == -1) { perror("ERROR: Unable to open raster file - "); sleep(1); #ifdef RPMBUILD dlclose(libCupsImage); dlclose(libCups); #endif return EXIT_FAILURE; } } else { fd = 0; } initializeSettings(argv[5], &settings); jobSetup(settings,argv); ras = CUPSRASTEROPEN(fd, CUPS_RASTER_READ); page = 0; while (CUPSRASTERREADHEADER(ras, &header)) { if ((header.cupsHeight == 0) || (header.cupsBytesPerLine == 0)) { break; } if (bitImageData == NULL) { bitImageData = malloc(MAX(header.cupsWidth * settings.bytesPerHorizDot, settings.bytesPerScanLine)); if (bitImageData == NULL) { CLEANUP; return EXIT_FAILURE; } memset(bitImageData, 0x00, settings.bytesPerScanLine); } if (rasterData == NULL) { rasterData = malloc(header.cupsBytesPerLine); if (rasterData == NULL) { CLEANUP; return EXIT_FAILURE; } } pageSetup(settings, header); page++; fprintf(stderr, "PAGE: %d %d\n", page, header.NumCopies); for (vertDot = 8, y = 0; y < header.cupsHeight; y++) { if ((y & 127) == 0) { fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, (100 * y / header.cupsHeight)); } if (CUPSRASTERREADPIXELS(ras, rasterData, header.cupsBytesPerLine) < 1) { break; } vertDot--; scanLineBlank = TRUE; for (i = 0; i < header.cupsBytesPerLine; i++) { scanLineBlank &= (rasterData[i] == 0); switch (header.cupsWidth - (i * 8)) { default: bitImageData[(i * 8) + 7] |= ((rasterData[i] & 0x01) >> 0) << vertDot; case 6: bitImageData[(i * 8) + 6] |= ((rasterData[i] & 0x02) >> 1) << vertDot; case 5: bitImageData[(i * 8) + 5] |= ((rasterData[i] & 0x04) >> 2) << vertDot; case 4: bitImageData[(i * 8) + 4] |= ((rasterData[i] & 0x08) >> 3) << vertDot; case 3: bitImageData[(i * 8) + 3] |= ((rasterData[i] & 0x10) >> 4) << vertDot; case 2: bitImageData[(i * 8) + 2] |= ((rasterData[i] & 0x20) >> 5) << vertDot; case 1: bitImageData[(i * 8) + 1] |= ((rasterData[i] & 0x40) >> 6) << vertDot; case 0: bitImageData[(i * 8) + 0] |= ((rasterData[i] & 0x80) >> 7) << vertDot; } } if (scanLineBlank == TRUE) { blankScanLines++; } if (vertDot == 0) { vertDot = 8; if (blankScanLines == 8) { blankPasses++; } else { while (blankPasses > 0) { putchar(0x1b); putchar('J'); putchar(0x08); blankPasses--; } switch(settings.modelNumber) { case SP512: case SP542: case SP712: case SP742: case SP717: case SP747: if (settings.resolutionX == 170) { putchar(0x1b); putchar('L'); putchar(settings.bytesPerScanLine % 256); // 420 % 256 = 164 putchar(settings.bytesPerScanLine / 256); // 420 / 256 = 1 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } else if (settings.resolutionX == 85) { putchar(0x1b); putchar('K'); putchar(settings.bytesPerScanLine % 256); // 210 % 256 = 210 putchar(settings.bytesPerScanLine / 256); // 210 / 256 = 0 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } break; case HSP7000S: case HSP7000V: if (settings.resolutionX == 160) { putchar(0x1b); putchar('L'); putchar(settings.bytesPerScanLine % 256); // 540 % 256 = 28 putchar(settings.bytesPerScanLine / 256); // 540 / 256 = 2 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } else if (settings.resolutionX == 80) { putchar(0x1b); putchar('K'); putchar(settings.bytesPerScanLine % 256); // 270 % 256 = 14 putchar(settings.bytesPerScanLine / 256); // 270 / 256 = 1 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } } putchar(0x1b); putchar('J'); putchar(0x08); } blankScanLines = 0; memset(bitImageData, 0x00, settings.bytesPerScanLine); } } if (vertDot != 8) { if (blankScanLines + vertDot == 8) { blankPasses++; } else { while (blankPasses > 0) { putchar(0x1b); putchar('J'); putchar(0x08); blankPasses--; } switch (settings.modelNumber) { case SP512: case SP542: case SP712: case SP742: case SP717: case SP747: if (settings.resolutionX == 170) { putchar(0x1b); putchar('L'); putchar(settings.bytesPerScanLine % 256); // 420 % 256 = 164 putchar(settings.bytesPerScanLine / 256); // 420 / 256 = 1 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } else if (settings.resolutionX == 85) { putchar(0x1b); putchar('K'); putchar(settings.bytesPerScanLine % 256); // 210 % 256 = 210 putchar(settings.bytesPerScanLine / 256); // 210 / 256 = 0 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } break; case HSP7000S: case HSP7000V: if (settings.resolutionX == 160) { putchar(0x1b); putchar('L'); putchar(settings.bytesPerScanLine % 256); // 540 % 256 = 28 putchar(settings.bytesPerScanLine / 256); // 540 / 256 = 2 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } else if (settings.resolutionX == 80) { putchar(0x1b); putchar('K'); putchar(settings.bytesPerScanLine % 256); // 270 % 256 = 14 putchar(settings.bytesPerScanLine / 256); // 270 / 256 = 1 for (i = 0; i < settings.bytesPerScanLine; i++) { putchar(bitImageData[i]); } } break; } putchar(0x1b); putchar('J'); putchar(0x08); memset(bitImageData, 0x00, settings.bytesPerScanLine); } blankScanLines = 0; vertDot = 8; } if (settings.pageType == PAGETYPE_TICKET) { while (blankPasses--) { putchar(0x1b); putchar('J'); putchar(0x08); } } endPage(settings); } endJob(settings); CLEANUP; if (page == 0) { fputs("ERROR: No pages found!\n", stderr); } else { fputs("INFO: Ready to print.\n", stderr); } return (page == 0)?EXIT_FAILURE:EXIT_SUCCESS; }
FolderTreeWidget::FolderTreeWidget(QWidget* parent) : QTreeWidget(parent) { initializeSettings(); connect(this, SIGNAL(itemClicked(QTreeWidgetItem*,int)) , SLOT(onItemClick(QTreeWidgetItem*))); }
//! Constructor ModelicaTextHighlighter::ModelicaTextHighlighter(ModelicaTextSettings *pSettings, QTextDocument *pParent) : QSyntaxHighlighter(pParent) { mpModelicaTextSettings = pSettings; initializeSettings(); }