示例#1
0
    void WeekScene::updateStatusText(int up, int down, bool suspended, bool enabled)
    {
        KLocale* loc = KGlobal::locale();
        QString msg;
        if (suspended)
            msg = i18n("Current schedule: suspended");
        else if (up > 0 && down > 0)
            msg = i18n("Current schedule: %1/s download, %2/s upload",
                       loc->formatByteSize(down * 1024), loc->formatByteSize(up * 1024));
        else if (up > 0)
            msg = i18n("Current schedule: unlimited download, %1/s upload", loc->formatByteSize(up * 1024));
        else if (down > 0)
            msg = i18n("Current schedule: %1/s download, unlimited upload", loc->formatByteSize(down * 1024));
        else
            msg = i18n("Current schedule: unlimited upload and download");

        if (!enabled)
            msg += i18n(" (scheduler disabled)");

        status->setPlainText(msg);
    }