//Glut2D Class Static Timer Function(Calls the timer function of each instance of GlutInstace) void Glut2D::timer(int value) { for(unsigned int ii=0;ii<_instance.size();++ii) { if(_instance[ii]->_windowID==glutGetWindow()) { //Update Delta Time double nt=glutGet(GLUT_ELAPSED_TIME)*0.001; _instance[ii]->_dt=nt-_instance[ii]->_ot; _instance[ii]->_ot=nt; //Execute Timer Function _instance[ii]->_timer(*_instance[ii]); //Redraw Screen glutPostRedisplay(); //Call Timer in _timerTime Milisecs glutTimerFunc(_instance[ii]->_timerTime,timer,0); //Clear Pressed Key Bindings and Return clearPressed(); return; } } throw std::runtime_error("Glut2D - Invalid window id!!!"); }
TrendingTopicsWidget::TrendingTopicsWidget(QWidget *parent) : AbstractTopWidget(parent) { ui.setupUi(this); type=2; mode=TrendingTopicsFetcher::Current; QObject::connect(ui.current,SIGNAL(clicked()),this,SIGNAL(showCurrentTopics())); QObject::connect(ui.daily,SIGNAL(clicked()),this,SIGNAL(showDailyTopics())); QObject::connect(ui.weekly,SIGNAL(clicked()),this,SIGNAL(showWeeklyTopics())); QObject::connect(ui.topics,SIGNAL(currentRowChanged(int)),this,SLOT(handleRowChanged(int))); QObject::connect(ui.clear,SIGNAL(clicked()),this,SIGNAL(clearPressed())); ui.topics->setMinimumHeight(0); ui.topics->setMaximumHeight(0); ui.current->setProperty("active","true"); hadCurrent=false; hadDaily=false; hadWeekly=false; currentName=""; }
MiningPage::MiningPage(QWidget *parent) : QWidget(parent), ui(new Ui::MiningPage) { ui->setupUi(this); setFixedSize(400, 420); minerActive = false; ui->horizontalSlider->setMinimum(0); ui->horizontalSlider->setMaximum(100); ui->horizontalSlider->setValue(100); ui->labelPercentHR->setText(QString("%1").arg(100)); minerProcess = new QProcess(this); minerProcess->setProcessChannelMode(QProcess::MergedChannels); readTimer = new QTimer(this); hashTimer = new QTimer(this); acceptedShares = 0; rejectedShares = 0; roundAcceptedShares = 0; roundRejectedShares = 0; initThreads = 0; this->AddListItem(QString(introText.c_str())); ui->serverLine->setText(QString(GetArg("-poolserver", "stratum+tcp://ziftrpool.io").c_str())); ui->portLine->setText(QString(GetArg("-poolport", "3032").c_str())); string sPoolUsername = GetArg("-poolusername", ""); if (sPoolUsername.empty()) { // If getaccountaddress fails due to not having enough addresses in key pool, // just don't autofill try { json_spirit::Array params; params.push_back(string("Ziftr Pool Payouts")); params.push_back(true); sPoolUsername = getaccountaddress(params, false).get_str(); } catch (exception& e) {} } ui->usernameLine->setText(QString(sPoolUsername.c_str())); ui->passwordLine->setText(QString(GetArg("-poolpassword", "").c_str())); connect(readTimer, SIGNAL(timeout()), this, SLOT(readProcessOutput())); connect(hashTimer, SIGNAL(timeout()), this, SLOT(updateHashRates())); connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPressed())); connect(ui->clearButton, SIGNAL(pressed()), this, SLOT(clearPressed())); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(changePercentMiningPower(int))); connect(ui->pokCheckBox, SIGNAL(toggled(bool)), this, SLOT(usePoKToggled(bool))); connect(ui->debugCheckBox, SIGNAL(toggled(bool)), this, SLOT(debugToggled(bool))); connect(ui->typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int))); connect(minerProcess, SIGNAL(started()), this, SLOT(minerStarted())); connect(minerProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(minerError(QProcess::ProcessError))); connect(minerProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(minerFinished())); connect(minerProcess, SIGNAL(readyRead()), this, SLOT(readProcessOutput())); hashTimer->start(1500); }
SearchWidget::SearchWidget(int _offset, bool _isWithButton, QWidget* _parent) : QWidget(_parent) { if (this->objectName().isEmpty()) this->setObjectName(QStringLiteral("search_widget")); active_ = false; parent_search_vertical_layout_ = new QVBoxLayout(this); parent_search_vertical_layout_->setContentsMargins(0, 0, 0, 0); parent_search_vertical_layout_->setSpacing(0); horizontal_search_layout_ = new QHBoxLayout(); horizontal_search_layout_->setContentsMargins(0, 0, 0, Utils::scale_value(0)); parent_search_vertical_layout_->addLayout(horizontal_search_layout_); horizontal_search_layout_->addSpacing(Utils::scale_value(_offset - 8)); search_icon_ = new Ui::CustomButton(this, ":/resources/contr_search_100.png"); search_icon_->setOffsets(Utils::scale_value(8), Utils::scale_value(0)); search_icon_->setActiveImage(":/resources/contr_search_100_active.png"); search_icon_->setFixedWidth(Utils::scale_value(34)); search_icon_->setFixedHeight(Utils::scale_value(53)); search_icon_->setStyleSheet("border: none;"); horizontal_search_layout_->addWidget(search_icon_); parent_widget_ = new QWidget(this); search_vertical_layout_ = new QVBoxLayout(parent_widget_); search_vertical_layout_->setContentsMargins(0, Utils::scale_value(5), 0, 0); search_edit_ = new LineEditEx(this); search_edit_->setProperty("SearchEdit", true); search_edit_->setPlaceholderText(QT_TRANSLATE_NOOP("search_widget", "Search")); search_edit_->setContentsMargins(Utils::scale_value(6), 0, Utils::scale_value(22), 0); search_edit_->setAttribute(Qt::WA_MacShowFocusRect, false); search_edit_->setStyleSheet(QString("background-color: transparent")); Testing::setAccessibleName(search_edit_, "search_edit"); search_vertical_layout_->addSpacing(Utils::scale_value(0)); search_vertical_layout_->addWidget(search_edit_); horizontal_search_layout_->addWidget(parent_widget_); search_edit_icon_ = new CustomButton(this, ":/resources/contr_compose_100.png"); search_edit_icon_->setOffsets(Utils::scale_value(0), Utils::scale_value(0)); search_edit_icon_->setOffsetsForActive(Utils::scale_value(2), Utils::scale_value(0)); search_edit_icon_->setHoverImage(":/resources/contr_compose_100_hover.png"); search_edit_icon_->setActiveImage(":/resources/contr_clear_100.png"); search_edit_icon_->setFixedWidth(Utils::scale_value(50)); search_edit_icon_->setFixedHeight(Utils::scale_value(53)); search_edit_icon_->setCursor(Qt::PointingHandCursor); search_edit_icon_->setFocusPolicy(Qt::NoFocus); search_edit_icon_->setStyleSheet("background-color: transparent;"); Testing::setAccessibleName(search_edit_icon_, "CreateGroupChat"); horizontal_search_layout_->addWidget(search_edit_icon_); horizontal_line_widget_ = new QWidget(this); horizontal_line_widget_->setFixedHeight(Utils::scale_value(1)); horizontal_line_widget_->setStyleSheet(QString("background-color: #dadada;")); parent_search_vertical_layout_->addSpacing(0); widget_2_ = new QWidget(this); horizontal_layout_2_ = new QHBoxLayout(widget_2_); horizontal_layout_2_->setContentsMargins(Utils::scale_value(_isWithButton ? 24 : 16), 0, Utils::scale_value(_isWithButton ? 24 : 60), Utils::scale_value(10)); horizontal_layout_2_->addWidget(horizontal_line_widget_); parent_search_vertical_layout_->addWidget(widget_2_); QMetaObject::connectSlotsByName(this); connect(search_edit_, SIGNAL(textEdited(QString)), this, SLOT(searchChanged(QString)), Qt::QueuedConnection); connect(search_edit_, SIGNAL(clicked()), this, SLOT(searchStarted()), Qt::QueuedConnection); connect(search_edit_, SIGNAL(escapePressed()), this, SLOT(searchCompleted()), Qt::QueuedConnection); connect(search_edit_, SIGNAL(enter()), this, SLOT(editEnterPressed()), Qt::QueuedConnection); connect(search_edit_, SIGNAL(upArrow()), this, SLOT(editUpPressed()), Qt::QueuedConnection); connect(search_edit_, SIGNAL(downArrow()), this, SLOT(editDownPressed()), Qt::QueuedConnection); connect(search_edit_, SIGNAL(focusOut()), this, SLOT(focusedOut()), Qt::QueuedConnection); connect(search_edit_icon_, SIGNAL(clicked()), this, SLOT(clearPressed()), Qt::QueuedConnection); setActive(false); }