void SeedManager::updateInform() {
    erase();
    std::vector<libtorrent::torrent_handle> v = session->get_torrents();

    printw("%s\n", ("/ #|" + setStringSize("Name", 20) + "|Upload speed(KB/s)|Uploaded(MB)|Size(MB)|" +
                   setStringSize("state", 11) + "\\").toLocal8Bit().constData());
    for (int i = firstDisplayingTorrent; i < firstDisplayingTorrent + numberDisplayingTorrents(); i++) {
        printw("|%s|%s|%s|%s|%s|",
               setStringSize(QString::number(i + 1), 2).toLocal8Bit().constData(),
               setStringSize(QString::fromStdString(v[i].name()), 20).toLocal8Bit().constData(),
               setStringSize(QString::number(v[i].status().upload_payload_rate / 1000), 18).toLocal8Bit().constData(),
               setStringSize(QString::number(v[i].status().all_time_upload / 1000000), 12).toLocal8Bit().constData(),
               setStringSize(QString::number(v[i].get_torrent_info().total_size() / 1000000), 8).toLocal8Bit().constData());
        printw("%s|\n", setStringSize(getNormalStatus(v[i].status().state), 11).toLocal8Bit().constData());
    }

    if ((firstDisplayingTorrent + numberDisplayingTorrents() < v.size()))
        if (firstDisplayingTorrent)
            printw("Arrows to navigate (up and down)\n");
        else
            printw("Arrows to navigate (only down)\n");
    else if (firstDisplayingTorrent)
        printw("Arrow to navigate (only up)\n");

    if (session->upload_rate_limit() != 0)
        printw("Upload rate limit: %d(KB/s)", session->upload_rate_limit() / 1000);

    refresh();
}
Example #2
0
void MainWindow::updateStandartText() {
    QString text;
    if (session->download_rate_limit() != 0)
        text += QString("Download rate limit: %1KB/s\n").arg(session->download_rate_limit() / 1000);

    if (main != NULL) {
        text += "Status: ";
        text += getNormalStatus(main->torrent->status().state);
        text += "\n";
        if (!main->agressive)
            text += "Non agressive piece picking\n";
    }

    for (int i = 1; i < stdscr->_maxx; i++)
        text += '=';
    text += '\n';

    standartText = standartText.left(standartTextLen) + text.toLocal8Bit();
}