Esempio n. 1
0
MiningPage::MiningPage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MiningPage)
{
    ui->setupUi(this);

    setFixedSize(400, 420);

    minerActive = false;

    minerProcess = new QProcess(this);
    minerProcess->setProcessChannelMode(QProcess::MergedChannels);

    readTimer = new QTimer(this);

    acceptedShares = 0;
    rejectedShares = 0;

    roundAcceptedShares = 0;
    roundRejectedShares = 0;

    initThreads = 0;

    connect(readTimer, SIGNAL(timeout()), this, SLOT(readProcessOutput()));

    connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPressed()));
    connect(ui->typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int)));
    connect(ui->debugCheckBox, SIGNAL(toggled(bool)), this, SLOT(debugToggled(bool)));
    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()));
}
Esempio n. 2
0
int MiningPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: startPressed(); break;
        case 1: startPoolMining(); break;
        case 2: stopPoolMining(); break;
        case 3: updateSpeed(); break;
        case 4: loadSettings(); break;
        case 5: saveSettings(); break;
        case 6: reportToList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
        case 7: minerStarted(); break;
        case 8: minerError((*reinterpret_cast< QProcess::ProcessError(*)>(_a[1]))); break;
        case 9: minerFinished(); break;
        case 10: readProcessOutput(); break;
        case 11: { QString _r = getTime((*reinterpret_cast< QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; }  break;
        case 12: enableMiningControls((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 13: enablePoolMiningControls((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 14: { ClientModel::MiningType _r = getMiningType();
            if (_a[0]) *reinterpret_cast< ClientModel::MiningType*>(_a[0]) = _r; }  break;
        case 15: typeChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 16: debugToggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 17;
    }
    return _id;
}
Esempio n. 3
0
void MiningPage::setModel(ClientModel *model)
{
    this->model = model;

    loadSettings();

    bool pool = model->getMiningType() == ClientModel::PoolMining;
    ui->threadsBox->setValue(model->getMiningThreads());
    ui->typeBox->setCurrentIndex(pool ? 1 : 0);
    if (model->getMiningStarted())
        startPressed();
}
Esempio n. 4
0
FeedView::FeedView(QObject *parent):
    QObject(parent),
    mView(NULL),
    iWriter(NULL),
    iReader(NULL),
    mManager(NULL),
    mUpdateTimer(NULL),
    mStarted(false)
{
    bool ok = false;
    mDocumentLoader.load(":/xml/feedview.docml", &ok);

    if (ok)
    {
        mView = static_cast<HbView*>(mDocumentLoader.findWidget(QString("view")));
    }
    else
    {
        qFatal("Unable to read :/xml/feedview.docml");
    }

    HbPushButton *create = static_cast<HbPushButton*>(mDocumentLoader.findObject("createContactsButton"));
    connect(create, SIGNAL(clicked()), this, SLOT(createPressed()));

    HbPushButton *start = static_cast<HbPushButton*>(mDocumentLoader.findObject("startButton"));
    connect(start, SIGNAL(clicked()), this, SLOT(startPressed()));

    HbPushButton *stop = static_cast<HbPushButton*>(mDocumentLoader.findObject("stopButton"));
    connect(stop, SIGNAL(clicked()), this, SLOT(stopPressed()));

    iWriter = PrcPresenceWriter::createWriter();
    iReader = PrcPresenceReader::createReader();

    mManager = new QContactManager("symbian");

    mUpdateTimer = new QTimer();
    mUpdateTimer->setInterval(2000);
    connect(mUpdateTimer, SIGNAL(timeout()), this, SLOT(updateRandomPresence()));
}
Esempio n. 5
0
MiningPage::MiningPage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MiningPage)
{ 
    ui->setupUi(this);
    minerSet = false;
    setFixedSize(400, 420);
    minerActive = false;

    typeChanged(0);

    minerProcess = new QProcess(this);
    minerProcess->setProcessChannelMode(QProcess::MergedChannels);

    readTimer = new QTimer(this);

    acceptedShares = 0;
    rejectedShares = 0;

    roundAcceptedShares = 0;
    roundRejectedShares = 0;

    initThreads = 0;

    connect(readTimer, SIGNAL(timeout()), this, SLOT(readProcessOutput()));

    connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPressed()));
    connect(ui->typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int)));
    connect(ui->debugCheckBox, SIGNAL(toggled(bool)), this, SLOT(debugToggled(bool)));
    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()));

    // error: no known function for call ClientModel (MiningPage* const)
    // candidates are ClientModel::ClientModel(OptionsModel*, QObject*)
    setModel(new ClientModel(0, this));
}
Esempio n. 6
0
void StageControl::startClicked ()
{
    startPressed (_number);
}
Esempio n. 7
0
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);
}