Пример #1
0
time_t
DateRangeDaily::setStart( time_t newStart )
{
  return( setTimeT( newStart ) );
}
Пример #2
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    for (int i = 0; i < 6 ;i++)
    {
        levels.append(0);
    }
    ui->setupUi(this);
    settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "enkidu", "battalbot");
    ui->le_server->setText(settings->value("server", "").toString());
    ui->le_channel->setText(settings->value("channel", "").toString());
    ui->le_botname->setText(settings->value("botname", "").toString());
    QHash<QString, QVariant> tmp;
    auths = settings->value("auths", tmp).toHash();
    onFinish = false;
    added = 0;
    QLocale::setDefault(QLocale::English);
    trayIcon = new QSystemTrayIcon();
    QMenu *menu = new QMenu();
    QAction *actionQuit = new QAction("Quit", trayIcon);
    menu->addAction(actionQuit);
    trayIcon->setContextMenu(menu);
    trayIcon->setIcon(QIcon(":/icon.png"));
    trayIcon->show();
    this->setWindowIcon(QIcon(":/icon.png"));
    this->setWindowTitle("eRepublik wall-watching BOT");
    connect(ui->pb_connect, SIGNAL(clicked()), this, SLOT(connectToServer()));
    irc = new Irc(this);
    reader = new Reader;
    battle = new Battle;
    refreshTree();
    connect(battle, SIGNAL(getWall()), reader, SLOT(read()));
    connect(ui->pb_StartCount, SIGNAL(clicked()), this, SLOT(getInfo()));
    connect(reader, SIGNAL(startCounting(int,QTime)), battle, SLOT(startCounting(int, QTime)));
    connect(reader, SIGNAL(startCounting(int,QTime)), this, SLOT(setInitialWall(int,QTime)));
    connect(battle, SIGNAL(setTimeT(QTime)), this, SLOT(setTimeElapsed(QTime)));
    connect(reader, SIGNAL(wall(int,bool)), battle, SLOT(actWall(int,bool)));
    connect(reader, SIGNAL(wall(int,bool)), this, SLOT(setWall(int,bool)));
    connect(battle, SIGNAL(setText(QString)), irc, SLOT(write(QString)));
    connect(reader, SIGNAL(battleInfo(QString)), irc, SLOT(setTopic(QString)));

    connect(trayIcon,
            SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this,
            SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));

    connect(irc, SIGNAL(authRequest(QString,QString,QString)),
            this, SLOT(auth(QString,QString,QString)));

    connect(irc, SIGNAL(wallRequest(QString,QString)),
            this, SLOT(wall(QString,QString)));

    connect(irc, SIGNAL(playerRequest(QString)),
            reader, SLOT(getPlayer(QString)));

    connect(reader, SIGNAL(playerInfo(QString)),
            irc, SLOT(write(QString)));

    connect(ui->pb_authAdd, SIGNAL(clicked()),
            this, SLOT(addAuth()));

    connect(ui->pb_delAuth, SIGNAL(clicked()),
            this, SLOT(delAuth()));

    connect(actionQuit, SIGNAL(triggered()), this, SLOT(appQuit()));
    curve = new QwtPlotCurve();
    curve->setRenderHint(QwtPlotItem::RenderAntialiased);
    curve->attach(ui->qwtPlot);
    for (int i = 0; i < 6; i++)
    {
        QwtPlotCurve *line = new QwtPlotCurve();
        if (i == 0 || i == 5)
        {
            line->setPen(QPen(QColor(0,0,255)));
        }
        else
        {
            line->setPen(QPen(QColor(0,200,0)));
        }
        line->attach(ui->qwtPlot);
        lines.append(line);
    }
}