Ejemplo n.º 1
0
Settings::Settings(QWidget *parent) : Dialog(parent),
_passcodeSwitch(""),
_passCodePage(parent),
_changePassCodePage(parent),
_langPage(parent)
{
	_mainLayout.setContentsMargins(24, 24, 24, 24);
	setLayout(&_mainLayout);
	initGeneral();
	initSecurity();
	initDataBase();

	_mainLayout.insertSpacing(2, 24);
	_mainLayout.insertSpacing(5, 24);
	_mainLayout.insertSpacing(8, 24);
	setMinimumWidth(400);
	_passCodePage.hide();
	_changePassCodePage.hide();
	_langPage.hide();
	QSettings setting("MyOrg", "MyApp");
	_passcodeSwitch.setChecked(setting.value("authentication/hasPasscode").toBool());
	_langLabel.setText(Tr(setting.value("Language").toString()));
	QObject::connect(&_passcodeSwitch, SIGNAL(toggled(bool)), this, SLOT(onSwitch(bool)));
	QObject::connect(&_passCodePage, SIGNAL(cancel()), this, SLOT(onPassCodeCancel()));
	QObject::connect(&_changePassCodePage, SIGNAL(cancel()), this, SLOT(onPassCodeCancel()));
	QObject::connect(&_passCodePage, SIGNAL(save(QByteArray)), this, SLOT(onPassCodeSave(QByteArray)));
	QObject::connect(&_changePassCodePage, SIGNAL(save(QByteArray)), this, SLOT(onPassCodeSave(QByteArray)));
	QObject::connect(&_langItem, SIGNAL(clicked()), this, SLOT(onLanguage()));
	QObject::connect(&_langPage, SIGNAL(ok()), this, SLOT(onLanguageOk()));
	QObject::connect(&_langPage, SIGNAL(restart(QString)), this, SLOT(onLanguageRestart(QString)));
	QObject::connect(&_passCodeItem, SIGNAL(clicked()), this, SLOT(onChangePassCode()));
}
Ejemplo n.º 2
0
void PrefsDialog::initLayout(QFileInfoList & list)
{
	m_tabWidget = new QTabWidget();
	m_general = new QWidget();
	m_breadboard = new QWidget();
	//m_schematic = new QWidget();
	//m_pcb = new QWidget();

	m_tabWidget->addTab(m_general, tr("General"));
	m_tabWidget->addTab(m_breadboard, m_viewInfoThings[0].viewName);
	//m_tabWidget->addTab(m_schematic, m_viewInfoThings[1].viewName);
	//m_tabWidget->addTab(m_pcb, m_viewInfoThings[2].viewName);

	QVBoxLayout * vLayout = new QVBoxLayout();
	vLayout->addWidget(m_tabWidget);

	initGeneral(m_general, list);

	initBreadboard(m_breadboard, &m_viewInfoThings[0]);
	//initSchematic(m_schematic, &m_viewInfoThings[1]);
	//initPCB(m_pcb, &m_viewInfoThings[2]);

    QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
	buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
	buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	vLayout->addWidget(buttonBox);

    this->setLayout(vLayout);

}
Ejemplo n.º 3
0
void PrefsDialog::initLayout(QFileInfoList & languages, QList<Platform *> platforms)
{
	m_tabWidget = new QTabWidget();
	m_general = new QWidget();
	m_breadboard = new QWidget();
	m_schematic = new QWidget();
	m_pcb = new QWidget();
    m_code = new QWidget();
    m_tabWidget->setObjectName("preDia_tabs");

	m_tabWidget->addTab(m_general, tr("General"));
	m_tabWidget->addTab(m_breadboard, m_viewInfoThings[0].viewName);
	m_tabWidget->addTab(m_schematic, m_viewInfoThings[1].viewName);
	m_tabWidget->addTab(m_pcb, m_viewInfoThings[2].viewName);
    m_tabWidget->addTab(m_code, tr("Code View"));

	QVBoxLayout * vLayout = new QVBoxLayout();
	vLayout->addWidget(m_tabWidget);

    initGeneral(m_general, languages);

	initBreadboard(m_breadboard, &m_viewInfoThings[0]);
	initSchematic(m_schematic, &m_viewInfoThings[1]);
	initPCB(m_pcb, &m_viewInfoThings[2]);

    initCode(m_code, platforms);
    m_platforms = platforms;

    QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
	buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
	buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	vLayout->addWidget(buttonBox);

    this->setLayout(vLayout);

}
Ejemplo n.º 4
0
/*
 * Initialize all necessary state, and indicate that we're ready to go.
 */
static void initOnce(void)
{
    initGlobals();
    initGeneral();
}
Ejemplo n.º 5
0
  template <class F> boost::shared_ptr<std::vector<std::complex<F> > > IterativeSolverBase<F>::getPolVec (const std::vector<ctype>& einc, ftype eps, std::ostream& log, const std::vector<ctype>& start, Core::ProfilingDataPtr prof) {
    this->inprodR_ = initGeneral (einc, log, start, prof);
    log << "inprodR = " << this->inprodR_ << std::endl;

    this->epsB = eps * eps / this->residScale;
    this->prev_err = std::sqrt (this->residScale * this->inprodR_);
    this->count = 0;
    this->counter = 0;

    this->inprodRInit = this->inprodR_;
    this->needNewline = false;
    this->initTime = Core::getCurrentTime ();

    {
      Core::ProfileHandle _p1 (prof, "itsolv");
      init (log, prof);
      while (inprodR_ >= epsB /* && count + 1 <= maxIter && counter <= maxResIncrease */) {
        if (this->count >= maxIter) {
          ABORT_MSG ("Too many iterations");
        } else if (this->counter > this->maxResIncrease) {
          ABORT_MSG ("Too many iterations w/o increase");
        }
        ftype inprodRplus1 = iteration (count, log, false, prof);
        count++;
        { // LoopUpdate
          if (inprodRplus1 <= inprodR_) {
            inprodR_ = inprodRplus1;
            counter = 0;
          } else {
            counter++;
          }
          ftype err = std::sqrt (residScale * inprodRplus1);
          ftype progr = 1 - err / prev_err;
          std::stringstream progStr;
          ftype prog = (std::log (this->inprodR_) - std::log (this->inprodRInit)) / (std::log (epsB) - std::log (this->inprodRInit));
          Core::TimeSpan now = Core::getCurrentTime ();
          Core::TimeSpan remain = (now - this->initTime) * static_cast<double> ((1 - prog) / prog);
          progStr << "RE_" << std::setfill ('0') << std::setw (5) << count << " = " << std::scientific << std::setfill (' ') << std::setw (12) << err << "  ";
          if (counter == 0)
            progStr << "+ ";
          else if (progr > 0)
            progStr << "-+";
          else
            progStr << "- ";
          progStr << "  [" << std::fixed << std::setprecision (2) << std::setw (6) << prog * 100 << "%]  [" << std::setfill (' ') << std::setw (12) << remain.toString () << "]";
          if (this->needNewline)
            Core::OStream::getStderr () << "\n";
          Core::OStream::getStderr () << progStr.str ();
          /*
            this->needNewline = count <= 1
            || (count < 100 && count % 10 == 0)
            || (count <= 1000 && count % 100 == 0);
          */
          this->needNewline = false;
          Core::OStream::getStderr () << "\r" << std::flush;
          log << progStr.str () << std::endl;
          prev_err = err;
        }
      }
      Core::OStream::getStderr () << std::endl;
    }

    return getResult (log, prof);
  }