void LuaCore::setUi(Lua4RSWidget *ui) { _ui = ui; QObject::connect(this, SIGNAL(appendLog(QString)), _ui, SLOT(appendLog(QString))); QObject::connect(this, SIGNAL(appendOutput(QString)), _ui, SLOT(appendOutput(QString))); QObject::connect(this, SIGNAL(clearOutput()), _ui, SLOT(clearOutput())); }
void ModelValidationWidget::validateModel(void) { try { DBConnection *conn=nullptr; QString ver; //Get the connection only the checkbox is checked. if(sql_validation_chk->isChecked() && connections_cmb->count() > 0) { ver=(version_cmb->currentIndex() > 0 ? version_cmb->currentText() : ""); conn=reinterpret_cast<DBConnection *>(connections_cmb->itemData(connections_cmb->currentIndex()).value<void *>()); } clearOutput(); prog_info_wgt->setVisible(true); validate_btn->setEnabled(false); model_wgt->setEnabled(false); clear_btn->setEnabled(true); validation_helper.validateModel(model_wgt->getDatabaseModel(), conn, ver); model_wgt->setEnabled(true); validate_btn->setEnabled(true); fix_btn->setEnabled(model_wgt->getDatabaseModel()->isInvalidated()); } catch(Exception &e) { output_trw->scrollToBottom(); model_wgt->setEnabled(true); validate_btn->setEnabled(true); throw Exception(ERR_VALIDATION_FAILURE,__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
// *************** phase control Initialisation **************** void init_phase_cntrl() { //Output //DDRA = 0xFF; pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); //PORTA= 0xFF; //high Output clearOutput(); //ZC Input //DDRD &= ~(1<<PD3); //input with pull up //PORTD |= (1<<PD3); //Timer1 TCCR1A= 0; TCCR1B= (1<<CS11); //set T1 @clk/8 //ext. Int1. (zc) //MCUCR = (1<<ISC10); //irq on logical change //GICR |= (1<<INT1); //enable INT1 for zc attachInterrupt(1, INT1vect, CHANGE); GIFR = (1<<INTF1); //clear INT1 flag }
void PythonEditorWidget::run() { if (unsavedChanges_ && scriptFileName_.size() != 0) // save if needed save(); runAction_->setDisabled(true); util::OnScopeExit reenable([&]() { runAction_->setEnabled(true); }); PyInviwo::getPtr()->addObserver(this); if (!appendLog_) { clearOutput(); } app_->getInteractionStateManager().beginInteraction(); Clock c; c.start(); bool ok = script_.run(); c.tick(); if (ok) { LogInfo("Python Script Executed successfully"); } LogInfo("Execution time: " << c.getElapsedMiliseconds() << " ms"); app_->getInteractionStateManager().endInteraction(); PyInviwo::getPtr()->removeObserver(this); }
void FutureBucket::clear() { mState = FB_CLEAR; clearInputs(); clearOutput(); }
void SerialDevice::close() { if(isOpen()) { QIODevice::close(); clearInput(); clearOutput(); m_port = NULL; } }
void OpenCLRidgeDetector::obtainAdditionalOutput() { clearOutput(); output = new float[width * height]; size_t origin[] = {0, 0, 0}; size_t region[] = {width, height, 1}; cl_int err = clEnqueueReadImage(command_queue, additional_output_image_memory, CL_TRUE, origin, region, 0, 0, output, 0, NULL, NULL); ASSERT_OPENCL_ERR(err, "Can't read aditional image for OpenCLRidgeDetector"); }
void ModelValidationWidget::setModel(ModelWidget *model_wgt) { bool enable=model_wgt!=nullptr; this->model_wgt=model_wgt; output_trw->setEnabled(enable); validate_btn->setEnabled(enable); options_btn->setEnabled(enable); options_frm->setEnabled(enable); fix_btn->setEnabled(false); curr_step=0; clearOutput(); }
void ModelValidationWidget::emitValidationInProgress(void) { clearOutput(); emit s_validationInProgress(true); ico_lbl->setVisible(true); object_lbl->setVisible(true); prog_info_wgt->setVisible(true); validate_btn->setEnabled(false); swap_ids_btn->setEnabled(false); options_btn->setEnabled(false); model_wgt->setEnabled(false); cancel_btn->setEnabled(true); }
void PixelToBufferProcessor::invokeEvent(Event* event) { MouseEvent* mouseEvent = dynamic_cast<MouseEvent*>(event); if (mouseEvent) { int button = mouseEvent->button(); int state = mouseEvent->state(); if (button == MouseEvent::MOUSE_BUTTON_LEFT && state == MouseEvent::MOUSE_STATE_PRESS) { fromPixel_.set(mouseEvent->pos()); clearOutput(); } mouseEvent->markAsUsed(); return; } }
OutputWindow::OutputWindow(QWidget *parent) : QWidget(parent) { QGridLayout *mainLayout = new QGridLayout; QPushButton *buttonClear = new QPushButton(QIcon(":/media/icons/output_clear.png"), "", this); buttonClear->setFixedSize(36, 36); connect(buttonClear, SIGNAL(clicked()), this, SLOT(clearOutput())); mainLayout->addWidget(buttonClear, 0, 10); mOutputLog = new QTextEdit(this); mainLayout->addWidget(mOutputLog, 1, 0, 1, 11); setLayout(mainLayout); setWindowTitle(tr("Build log")); }
/** * @brief Verify if passing no options to commandline handler succeeds * @test Expected result: * - call handler indicates success * - empty output stream * - empty error stream */ TEST_F(CynaraCommandlineTest, noOption) { std::string err; std::string out; clearOutput(); prepare_argv({ execName }); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_FALSE(options.m_error); ASSERT_FALSE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, static_cast<mode_t>(-1)); ASSERT_EQ(options.m_uid, static_cast<uid_t>(-1)); ASSERT_EQ(options.m_gid, static_cast<gid_t>(-1)); ASSERT_TRUE(out.empty()); ASSERT_TRUE(err.empty()); }
void PythonEditorWidget::run() { if (unsavedChanges_ && scriptFileName_.size() != 0) // save if needed save(); PythonExecutionOutputObservable::getPtr()->addObserver(this); clearOutput(); Clock c; c.start(); bool ok = script_.run(); c.tick(); if (ok) { LogInfo("Python Script Executed succesfully"); } LogInfo("Execution time: " << c.getElapsedMiliseconds() << " ms"); PythonExecutionOutputObservable::getPtr()->removeObserver(this); }
/** * @brief Verify if passing "version" option to commandline handler returns version message * @test Expected result: * - call handler indicates success * - version message in output stream * - empty error stream */ TEST_F(CynaraCommandlineTest, version) { std::string err; std::string out; for (const auto &opt : { "-V", "--version" }) { clearOutput(); prepare_argv({ execName, opt }); SCOPED_TRACE(opt); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_FALSE(options.m_error); ASSERT_TRUE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, static_cast<mode_t>(-1)); ASSERT_EQ(options.m_uid, static_cast<uid_t>(-1)); ASSERT_EQ(options.m_gid, static_cast<gid_t>(-1)); ASSERT_EQ(std::string(CYNARA_VERSION) + "\n", out); ASSERT_TRUE(err.empty()); } }
/** * @brief Verify if passing no group option to commandline fails * @test Expected result: * - call handler indicates failure * - help message in output stream * - error message in error stream */ TEST_F(CynaraCommandlineTest, groupOptionNoParam) { std::string err; std::string out; for (const auto &groupOpt : { "-g", "--group" }) { clearOutput(); prepare_argv({ execName, groupOpt}); SCOPED_TRACE(groupOpt); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_TRUE(options.m_error); ASSERT_TRUE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, static_cast<mode_t>(-1)); ASSERT_EQ(options.m_uid, static_cast<uid_t>(-1)); ASSERT_EQ(options.m_gid, static_cast<gid_t>(-1)); ASSERT_EQ(helpMessage, out); ASSERT_EQ(std::string("Missing argument for option: ") + groupOpt + "\n", err); } }
/** * @brief Verify if passing unknown option to commandline handler returns error message * @test Expected result: * - call handler indicates failure * - help message in output stream * - error message in error stream */ TEST_F(CynaraCommandlineTest, unknownOption) { std::string err; std::string out; for (const auto &badOpt : { "-b", "--badOption" }) { clearOutput(); prepare_argv({ execName, badOpt }); SCOPED_TRACE(badOpt); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_TRUE(options.m_error); ASSERT_TRUE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, static_cast<mode_t>(-1)); ASSERT_EQ(options.m_uid, static_cast<uid_t>(-1)); ASSERT_EQ(options.m_gid, static_cast<gid_t>(-1)); ASSERT_EQ(helpMessage, out); ASSERT_EQ(std::string("Unknown option: ") + badOpt + "\n", err); } }
KonsolePreviewer::KonsolePreviewer(const QString & title, QWidget *parent, const QString& projectType, const QString& packagePath) : QDockWidget(title, parent), m_textEdit(0), m_projectType(projectType), m_packagePath(packagePath) { QVBoxLayout *layout = new QVBoxLayout(); KToolBar *toolBar = new KToolBar(this, true, true); KAction *clear = KStandardAction::clear(this, SLOT(clearOutput()), this); KAction *save = KStandardAction::save(this, SLOT(saveOutput()), this); //we want those only for the kwin scripts if (m_projectType == "KWin/Script") { KAction *execute = new KAction(this); execute->setText("Execute"); execute->setIcon(KIcon("system-run")); connect(execute, SIGNAL(triggered(bool)), this, SLOT(executeKWinScript())); //add it to toolbar toolBar->addAction(execute); }
/** * @brief Verify if passing invalid group option to commandline fails * @test Expected result: * - call handler indicates success * - help message in output stream * - error message in error stream */ TEST_F(CynaraCommandlineTest, groupOptionInvalid) { std::string err; std::string out; std::string groupParam("GroupThatDoNotExist"); for (const auto &groupOpt : { "-g", "--group" }) { clearOutput(); prepare_argv({ execName, groupOpt, groupParam}); SCOPED_TRACE(groupOpt); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_TRUE(options.m_error); ASSERT_TRUE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, static_cast<mode_t>(-1)); ASSERT_EQ(options.m_uid, static_cast<uid_t>(-1)); ASSERT_EQ(options.m_gid, static_cast<gid_t>(-1)); ASSERT_EQ(helpMessage, out); ASSERT_EQ("Invalid param: GroupThatDoNotExist\n", err); } }
/** * @brief Verify if passing group option to commandline succeeds * @test Expected result: * - call handler indicates success * - empty output stream * - empty error stream */ TEST_F(CynaraCommandlineTest, groupOptionGid) { std::string err; std::string out; std::string groupParam("1234"); for (const auto &groupOpt : { "-g", "--group" }) { clearOutput(); prepare_argv({ execName, groupOpt, groupParam}); SCOPED_TRACE(groupOpt); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_FALSE(options.m_error); ASSERT_FALSE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, static_cast<mode_t>(-1)); ASSERT_EQ(options.m_uid, static_cast<uid_t>(-1)); ASSERT_EQ(options.m_gid, 1234); ASSERT_TRUE(out.empty()); ASSERT_TRUE(err.empty()); } }
/** * @brief Verify if passing user option to commandline succeeds * @test Expected result: * - call handler indicates success * - empty output stream * - empty error stream */ TEST_F(CynaraCommandlineTest, userOptionName) { std::string err; std::string out; std::string userParam("root"); for (const auto &userOpt : { "-u", "--user" }) { clearOutput(); prepare_argv({ execName, userOpt, userParam}); SCOPED_TRACE(userOpt); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_FALSE(options.m_error); ASSERT_FALSE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, static_cast<mode_t>(-1)); ASSERT_EQ(options.m_uid, 0); ASSERT_EQ(options.m_gid, static_cast<gid_t>(-1)); ASSERT_TRUE(out.empty()); ASSERT_TRUE(err.empty()); } }
/** * @brief Verify if passing mask option to commandline succeeds * @test Expected result: * - call handler indicates success * - empty output stream * - empty error stream */ TEST_F(CynaraCommandlineTest, maskOption) { std::string err; std::string out; std::string maskParam("0666"); for (const auto &maskOpt : { "-m", "--mask" }) { clearOutput(); prepare_argv({ execName, maskOpt, maskParam}); SCOPED_TRACE(maskOpt); const auto options = Parser::handleCmdlineOptions(this->argc(), this->argv()); getOutput(out, err); ASSERT_FALSE(options.m_error); ASSERT_FALSE(options.m_exit); ASSERT_FALSE(options.m_daemon); ASSERT_EQ(options.m_mask, 0666); ASSERT_EQ(options.m_uid, static_cast<uid_t>(-1)); ASSERT_EQ(options.m_gid, static_cast<gid_t>(-1)); ASSERT_TRUE(out.empty()); ASSERT_TRUE(err.empty()); } }
PythonEditorWidget::PythonEditorWidget(InviwoMainWindow* ivwwin, InviwoApplication* app) : InviwoDockWidget(tr("Python Editor"), ivwwin) , settings_("Inviwo", "Inviwo") , infoTextColor_(153, 153, 153) , errorTextColor_(255, 107, 107) , runAction_(nullptr) , script_() , unsavedChanges_(false) , app_(app) , appendLog_(true) { setObjectName("PythonEditor"); settings_.beginGroup("PythonEditor"); QString lastFile = settings_.value("lastScript", "").toString(); appendLog_ = settings_.value("appendLog", appendLog_).toBool(); settings_.endGroup(); setVisible(false); setWindowIcon(QIcon(":/icons/python.png")); QMainWindow* mainWindow = new QMainWindow(); mainWindow->setContextMenuPolicy(Qt::NoContextMenu); QToolBar* toolBar = new QToolBar(); mainWindow->addToolBar(toolBar); toolBar->setFloatable(false); toolBar->setMovable(false); setWidget(mainWindow); { runAction_ = toolBar->addAction(QIcon(":/icons/python.png"), "Compile and Run"); runAction_->setShortcut(QKeySequence(tr("F5"))); runAction_->setShortcutContext(Qt::WidgetWithChildrenShortcut); runAction_->setToolTip("Compile and Run Script"); mainWindow->addAction(runAction_); connect(runAction_, &QAction::triggered, [this]() {run(); }); } { auto action = toolBar->addAction(QIcon(":/icons/new.png"), tr("&New Script")); action->setShortcut(QKeySequence::New); action->setShortcutContext(Qt::WidgetWithChildrenShortcut); action->setToolTip("New Script"); mainWindow->addAction(action); connect(action, &QAction::triggered, [this](){setDefaultText();}); } { auto action = toolBar->addAction(QIcon(":/icons/open.png"), tr("&Open Script")); action->setShortcut(QKeySequence::Open); action->setShortcutContext(Qt::WidgetWithChildrenShortcut); action->setToolTip("Open Script"); mainWindow->addAction(action); connect(action, &QAction::triggered, [this](){open();}); } { auto action = toolBar->addAction(QIcon(":/icons/save.png"), tr("&Save Script")); action->setShortcut(QKeySequence::Save); action->setShortcutContext(Qt::WidgetWithChildrenShortcut); action->setToolTip("Save Script"); mainWindow->addAction(action); connect(action, &QAction::triggered, [this](){save();}); } { auto action = toolBar->addAction(QIcon(":/icons/saveas.png"), tr("&Save Script As...")); action->setShortcut(QKeySequence::SaveAs); action->setShortcutContext(Qt::WidgetWithChildrenShortcut); action->setToolTip("Save Script As..."); mainWindow->addAction(action); connect(action, &QAction::triggered, [this](){saveAs();}); } { QIcon icon; icon.addFile(":/icons/log-append.png", QSize(), QIcon::Normal, QIcon::On); icon.addFile(":/icons/log-clearonrun.png", QSize(), QIcon::Normal, QIcon::Off); QString str = (appendLog_ ? "Append Log" : "Clear Log on Run"); auto action = toolBar->addAction(icon, str); action->setShortcut(Qt::ControlModifier + Qt::Key_E); action->setShortcutContext(Qt::WidgetWithChildrenShortcut); action->setCheckable(true); action->setChecked(appendLog_); action->setToolTip(appendLog_ ? "Append Log" : "Clear Log on Run"); mainWindow->addAction(action); connect(action, &QAction::toggled, [this, action](bool toggle) { appendLog_ = toggle; // update tooltip and menu entry QString tglstr = (toggle ? "Append Log" : "Clear Log on Run"); action->setText(tglstr); action->setToolTip(tglstr); // update settings settings_.beginGroup("PythonEditor"); settings_.setValue("appendLog", appendLog_); settings_.endGroup(); }); } { auto action = toolBar->addAction(QIcon(":/icons/log-clear.png"), "Clear Log Output"); action->setShortcut(Qt::ControlModifier + Qt::Key_E); action->setShortcutContext(Qt::WidgetWithChildrenShortcut); action->setToolTip("Clear Log Output"); mainWindow->addAction(action); connect(action, &QAction::triggered, [this](){clearOutput();}); } // Done creating buttons QSplitter* splitter = new QSplitter(nullptr); splitter->setOrientation(Qt::Vertical); pythonCode_ = new PythonTextEditor(nullptr); pythonCode_->setObjectName("pythonEditor"); pythonCode_->setUndoRedoEnabled(true); setDefaultText(); pythonOutput_ = new QTextEdit(nullptr); pythonOutput_->setObjectName("pythonConsole"); pythonOutput_->setReadOnly(true); pythonOutput_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); syntaxHighligther_ = SyntaxHighligther::createSyntaxHighligther<Python>(pythonCode_->document()); splitter->addWidget(pythonCode_); splitter->addWidget(pythonOutput_); splitter->setStretchFactor(0, 1); splitter->setStretchFactor(1, 0); splitter->setHandleWidth(2); // enable QSplitter:hover stylesheet // QTBUG-13768 https://bugreports.qt.io/browse/QTBUG-13768 splitter->handle(1)->setAttribute(Qt::WA_Hover); mainWindow->setCentralWidget(splitter); QObject::connect(pythonCode_, SIGNAL(textChanged()), this, SLOT(onTextChange())); // close this window before the main window is closed QObject::connect(ivwwin, &InviwoMainWindow::closingMainWindow, [this]() { delete this; }); this->updateStyle(); this->resize(500, 700); if (app_) { app_->getSettingsByType<SystemSettings>()->pythonSyntax_.onChange( this, &PythonEditorWidget::updateStyle); app_->getSettingsByType<SystemSettings>()->pyFontSize_.onChange( this, &PythonEditorWidget::updateStyle); app_->registerFileObserver(this); } unsavedChanges_ = false; if (lastFile.size() != 0) loadFile(lastFile.toLocal8Bit().constData(), false); setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); setFloating(true); }
void clearOutputPin(Pin* pin) { clearOutput(pin->port, pin->pin); }
OpenCLRidgeDetector::~OpenCLRidgeDetector(void) { clearOutput(); }
int main(void) { initOutput(); clearOutput(); }
void LuaCore::emitClearOutput() { emit clearOutput(); }
void PythonEditorWidget::buildWidget() { setWindowIcon(QIcon(":/icons/python.png")); QWidget* content = new QWidget(this); QVBoxLayout* verticalLayout = new QVBoxLayout(content); ////Create Buttons QHBoxLayout* horizontalLayout = new QHBoxLayout(); QToolButton* runButton = new QToolButton(content); QToolButton* newButton = new QToolButton(content); QToolButton* openButton = new QToolButton(content); QToolButton* saveButton = new QToolButton(content); QToolButton* saveAsButton = new QToolButton(content); QPushButton* clearOutputButton = new QPushButton(content); runButton->setShortcut(QKeySequence(tr("F5"))); runButton->setIcon(QIcon(":/icons/python.png")); runButton->setToolTip("Compile and run (F5)"); newButton->setIcon(QIcon(":/icons/new.png")); newButton->setToolTip("New file (Ctrl+N)"); openButton->setIcon(QIcon(":/icons/open.png")); openButton->setToolTip("Open Python script"); saveButton->setIcon(QIcon(":/icons/save.png")); saveButton->setToolTip("Save (Ctrl+S)"); saveAsButton->setIcon(QIcon(":/icons/saveas.png")); saveAsButton->setToolTip("Save as"); clearOutputButton->setText("Clear Output"); QFrame* line1 = new QFrame(content); line1->setFrameShape(QFrame::VLine); line1->setFrameShadow(QFrame::Sunken); QFrame* line2 = new QFrame(content); line2->setFrameShape(QFrame::VLine); line2->setFrameShadow(QFrame::Sunken); QFrame* line3 = new QFrame(content); line3->setFrameShape(QFrame::VLine); line3->setFrameShadow(QFrame::Sunken); horizontalLayout->addWidget(runButton); horizontalLayout->addWidget(line1); horizontalLayout->addWidget(newButton); horizontalLayout->addWidget(openButton); horizontalLayout->addWidget(saveButton); horizontalLayout->addWidget(saveAsButton); horizontalLayout->addWidget(line2); horizontalLayout->addWidget(clearOutputButton); horizontalLayout->addWidget(line3); QSpacerItem* horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer); // Done creating buttons QSplitter* splitter = new QSplitter(content); splitter->setOrientation(Qt::Vertical); pythonCode_ = new PythonTextEditor(content); pythonCode_->setObjectName("pythonEditor"); pythonCode_->setUndoRedoEnabled(true); setDefaultText(); pythonOutput_ = new QTextEdit(content); pythonOutput_->setObjectName("pythonConsole"); pythonOutput_->setReadOnly(true); pythonOutput_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); syntaxHighligther_ = SyntaxHighligther::createSyntaxHighligther<Python>(pythonCode_->document()); verticalLayout->addLayout(horizontalLayout); splitter->addWidget(pythonCode_); splitter->addWidget(pythonOutput_); splitter->setStretchFactor(0, 1); splitter->setStretchFactor(1, 0); splitter->setHandleWidth(2); // enable QSplitter:hover stylesheet // QTBUG-13768 https://bugreports.qt.io/browse/QTBUG-13768 splitter->handle(1)->setAttribute(Qt::WA_Hover); verticalLayout->addWidget(splitter); setWidget(content); connect(pythonCode_, SIGNAL(textChanged()), this, SLOT(onTextChange())); connect(runButton, SIGNAL(clicked()), this, SLOT(run())); connect(newButton, SIGNAL(clicked()), this, SLOT(setDefaultText())); connect(openButton, SIGNAL(clicked()), this, SLOT(open())); connect(saveButton, SIGNAL(clicked()), this, SLOT(save())); connect(saveAsButton, SIGNAL(clicked()), this, SLOT(saveAs())); connect(clearOutputButton, SIGNAL(clicked()), this, SLOT(clearOutput())); updateStyle(); InviwoApplication::getPtr()->getSettingsByType<SystemSettings>()->pythonSyntax_.onChange(this, &PythonEditorWidget::updateStyle); InviwoApplication::getPtr()->getSettingsByType<SystemSettings>()->pyFontSize_.onChange(this, &PythonEditorWidget::updateStyle); }
CCuteCom::CCuteCom(QWidget* parent) :QWidget(parent) ,m_isConnected(false) ,m_fd(-1) ,m_cmdBufIndex(0) ,m_notifier(0) ,m_sz(0) ,m_progress(0) ,m_progressStepSize(1000) ,m_fileDlg(0) ,m_outputTimer(this) ,m_keyRepeatTimer(this) ,m_keyCode(0) ,m_hexBytes(0) ,m_previousChar('\0') { WRITE_ERROR_LOGGER() QCoreApplication::setOrganizationName("CuteCom"); // QCoreApplication::setOrganizationDomain("mysoft.com"); QCoreApplication::setApplicationName("CuteCom"); this->setupUi(this); fillBaudCb(); connect(m_connectPb, SIGNAL(clicked()), this, SLOT(connectTTY())); connect(m_closePb, SIGNAL(clicked()), this, SLOT(disconnectTTY())); connect(m_clearOutputPb, SIGNAL(clicked()), this, SLOT(clearOutput())); // connect(m_clearInputPb, SIGNAL(clicked()), m_oldCmdsLb, SLOT(clear())); connect(m_cmdLe, SIGNAL(returnPressed()), this, SLOT(execCmd())); connect(m_sendPb, SIGNAL(clicked()), this, SLOT(sendFile())); connect(m_aboutPb, SIGNAL(clicked()), this, SLOT(showAboutMsg())); connect(m_quitPb, SIGNAL(clicked()), this, SLOT(close())); connect(m_oldCmdsLb, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(oldCmdClicked(QListWidgetItem*))); connect(m_oldCmdsLb, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(execCmd())); connect(m_hexOutputCb, SIGNAL(toggled(bool)), this, SLOT(hexOutputClicked(bool))); connect(m_connectPb, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_deviceCb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_baudCb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_dataBitsCb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_parityCb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_stopCb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_protoPb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_softwareCb, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_hardwareCb, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_readCb, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_writeCb, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_applyCb, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_hexOutputCb, SIGNAL(clicked()), this, SLOT(saveSettings())); connect(m_inputModeCb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_charDelaySb, SIGNAL(valueChanged(int)), this, SLOT(saveSettings())); connect(m_logAppendCb, SIGNAL(activated(int)), this, SLOT(saveSettings())); connect(m_applyCb, SIGNAL(toggled(bool)), this, SLOT(enableSettingWidgets(bool))); connect(m_logFileFileDialog, SIGNAL(clicked()), this, SLOT(chooseLogFile())); connect(&m_outputTimer, SIGNAL(timeout()), this, SLOT(doOutput())); connect(&m_keyRepeatTimer, SIGNAL(timeout()), this, SLOT(sendKey())); connect(m_enableLoggingCb, SIGNAL(toggled(bool)), this, SLOT(enableLogging(bool))); // connect(m_enableLoggingCb, SIGNAL(toggled(bool)), this, SLOT(enableLogging(bool))); m_outputView->setWordWrapMode(QTextOption::WrapAnywhere); m_outputView->document()->setMaximumBlockCount(500); // TODO ? m_outputView->setWordWrap(Q3TextEdit::WidgetWidth); /* QAccel* accel=new QAccel(this); accel->insertItem(CTRL+Key_C, 3); accel->insertItem(CTRL+Key_Q, 17); accel->insertItem(CTRL+Key_S, 19); connect(accel, SIGNAL(activated(int)), this, SLOT(sendByte(int)));*/ m_outputTimerStart.start(); readSettings(); disconnectTTY(); m_cmdLe->installEventFilter(this); }