void BrowserNavigationActions::generateActions(QWebHistory *history)
{
    category()->setText(QCoreApplication::tr("Navigation"));

    actions_.clear();

    shared_ptr<QAction> ozon(new QAction(exclusiveGroup()));
    ozon->setText(QCoreApplication::tr("OZON"));
    ozon->setIcon(QIcon(QPixmap(":/images/home.png")));
    ozon->setData(NAVIGATE_HOME);
    ozon->setEnabled(true);
    ozon->setCheckable(true);
    ozon->setChecked(false);
    actions_.push_back(ozon);

    shared_ptr<QAction> backward(new QAction(exclusiveGroup()));
    backward->setText(QCoreApplication::tr("Backward"));
    backward->setIcon(QIcon(QPixmap(":/images/backward.png")));
    backward->setData(NAVIGATE_BACKWARD);
    backward->setEnabled(history->canGoBack());
    backward->setCheckable(true);
    backward->setChecked(false);
    actions_.push_back(backward);


    shared_ptr<QAction> forward(new QAction(exclusiveGroup()));
    forward->setText(QCoreApplication::tr("Forward"));
    forward->setIcon(QIcon(QPixmap(":/images/forward.png")));
    forward->setData(NAVIGATE_FORWARD);
    forward->setEnabled(history->canGoForward());
    forward->setCheckable(true);
    forward->setChecked(false);
    actions_.push_back(forward);


    shared_ptr<QAction> home(new QAction(exclusiveGroup()));
    home->setText(QCoreApplication::tr("History"));
    home->setIcon(QIcon(QPixmap(":/images/home.png")));
    home->setData(NAVIGATE_SHOW_HISTORY);
    home->setEnabled(true);
    home->setCheckable(true);
    home->setChecked(false);
    actions_.push_back(home);


    shared_ptr<QAction> clear(new QAction(exclusiveGroup()));
    clear->setText(QCoreApplication::tr("Clear History"));
    clear->setIcon(QIcon(QPixmap(":/images/clear_history.png")));
    clear->setData(NAVIGATE_CLEAR_HISTORY);
    clear->setEnabled(true);
    clear->setCheckable(true);
    clear->setChecked(false);
    actions_.push_back(clear);

}
示例#2
0
void TTSSpeakerActions::generateActions(QStringList & speakers, const QString & current)
{
    category()->setText(QCoreApplication::tr("Speaker"));
    actions_.clear();

    QStringList::const_iterator begin = speakers.begin();
    QStringList::const_iterator end   = speakers.end();
    for(QStringList::const_iterator iter = begin; iter != end; ++iter)
    {
        // The text
        QString text = *iter;

        // Add to category automatically.
        shared_ptr<QAction> act(new QAction(text, exclusiveGroup()));

        // Change font and make it as checkable.
        act->setCheckable(true);
        act->setData(*iter);

        QString icon_name = QString(":/images/%1.png").arg(text);
        act->setIcon(QIcon(QPixmap(icon_name)));
        if ( *iter == current )
        {
            act->setChecked(true);
        }

        actions_.push_back(act);
    }
}
示例#3
0
void SystemActions::addAboutAction()
{
    shared_ptr<QAction> about(new QAction(exclusiveGroup()));
    about->setCheckable(true);
    about->setText(QCoreApplication::tr("About"));
    about->setIcon(QIcon(QPixmap(":/images/about.png")));
    about->setData(ABOUT_INFO);
    actions_.push_back(about);
}
示例#4
0
ReadingStyleType ReadingStyleActions::selected()
{
    QAction * act = exclusiveGroup()->checkedAction();
    if (act)
    {
        return static_cast<ReadingStyleType>(act->data().toInt());
    }
    return STYLE_INVALID;
}
示例#5
0
SystemAction SystemActions::selected()
{
    // Search for the changed actions.
    QAction * act = exclusiveGroup()->checkedAction();
    if (act)
    {
        return static_cast<SystemAction>(act->data().toInt());
    }
    return INVALID_SYSTEM_ACTION;
}
示例#6
0
ReadingToolsType ReadingToolsActions::selectedTool()
{
    // Search for the changed actions.
    QAction * act = exclusiveGroup()->checkedAction();
    if (act)
    {
        return static_cast<ReadingToolsType>(act->data().toInt());
    }
    return INVALID_TOOL;
}
/// Retrieve the selected action.
NavigationType BrowserNavigationActions::selected()
{
    // Search for the changed actions.
    QAction * act = exclusiveGroup()->checkedAction();
    if (act)
    {
        return static_cast<NavigationType>(act->data().toInt());
    }
    return NAVIGATE_NONE;
}
示例#8
0
QString TTSSpeakerActions::selectedSpeaker()
{
    // Search for the changed actions.
    QString selected;
    QAction * act = exclusiveGroup()->checkedAction();
    if (act)
    {
        selected = act->data().toString();
    }
    return selected;
}
示例#9
0
int TTSSpeedActions::selectedSpeed()
{
    // Search for the changed actions.
    int speed = 2;
    QAction * act = exclusiveGroup()->checkedAction();
    if (act)
    {
        bool ok = false;
        speed = act->data().toInt(&ok);
    }
    return speed;
}
示例#10
0
int TTSStyleActions::selectedStyle()
{
    // Search for the changed actions.
    int style = SPEAK_STYLE_NORMAL;
    QAction * act = exclusiveGroup()->checkedAction();
    if (act)
    {
        bool ok = false;
        style = act->data().toInt(&ok);
    }
    return style;
}
示例#11
0
void TTSStyleActions::generateActions(QVector<int> & styles, const int current)
{
    category()->setText(QCoreApplication::tr("Style"));
    actions_.clear();

    QVector<int>::const_iterator begin = styles.begin();
    QVector<int>::const_iterator end   = styles.end();
    for(QVector<int>::const_iterator iter = begin; iter != end; ++iter)
    {
        // The text
        QString text;
        QString icon_name(":/images/style_item.png");
        switch ( *iter )
        {
        case SPEAK_STYLE_CLEAR:
            text = QCoreApplication::tr("Clear");
            icon_name = ":/images/tts_clear.png";
            break;
        case SPEAK_STYLE_NORMAL:
            text = QCoreApplication::tr("Normal");
            icon_name = ":/images/tts_normal.png";
            break;
        case SPEAK_STYLE_PLAIN:
            text = QCoreApplication::tr("Plain");
            icon_name = ":/images/tts_plain.png";
            break;
        case SPEAK_STYLE_VIVID:
            text = QCoreApplication::tr("Vivid");
            icon_name = ":/images/tts_vivid.png";
            break;
        default:
            text = QCoreApplication::tr("Invalid Speed");
            break;
        }

        // Add to category automatically.
        shared_ptr<QAction> act(new QAction(text, exclusiveGroup()));

        // Change font and make it as checkable.
        act->setCheckable(true);
        act->setData(*iter);
        act->setIcon(QIcon(QPixmap(icon_name)));

        if ( *iter == current )
        {
            act->setChecked(true);
        }

        actions_.push_back(act);
    }
}
示例#12
0
void TTSSpeedActions::generateActions(QVector<int> & speeds, const int current)
{
    category()->setText(QCoreApplication::tr("Speed"));
    actions_.clear();

    QVector<int>::const_iterator begin = speeds.begin();
    QVector<int>::const_iterator end   = speeds.end();
    for(QVector<int>::const_iterator iter = begin; iter != end; ++iter)
    {
        // The text
        QString text;
        switch ( *iter )
        {
        case 0:
            text = QCoreApplication::tr("Very Slow");
            break;
        case 1:
            text = QCoreApplication::tr("Slow");
            break;
        case 2:
            text = QCoreApplication::tr("Medium");
            break;
        case 3:
            text = QCoreApplication::tr("Fast");
            break;
        case 4:
            text = QCoreApplication::tr("Very Fast");
            break;
        default:
            text = QCoreApplication::tr("Invalid Speed");
            break;
        }

        // Add to category automatically.
        shared_ptr<QAction> act(new QAction(text, exclusiveGroup()));

        // Change font and make it as checkable.
        act->setCheckable(true);
        act->setData(*iter);
        act->setIcon(QIcon(QPixmap(":/images/speed_item.png")));

        if ( *iter == current )
        {
            act->setChecked(true);
        }

        actions_.push_back(act);
    }
}
示例#13
0
/// Generate all supported font family here.
void FontFamilyActions::generateActions(const QString &font_family,
                                        bool scan_others)
{
    category()->setFont(actionFont());
    category()->setText(QCoreApplication::tr("Font Family"));
    actions_.clear();

    QFontDatabase fdb;
    if (scan_others)
    {
        // Scan both internal flash and sd card.
        loadExternalFonts(&fonts_);
    }

    QStringList list;
    list =  fdb.families();

    foreach (QString family, list)
    {
        // Add to category automatically.
        shared_ptr<QAction> act(new QAction(family, exclusiveGroup()));

        // Change font and set it as checkable.
        act->setFont(QFont(family));
        act->setCheckable(true);
        act->setData(family);
        act->setIcon(QIcon(QPixmap(":/images/font_family_item.png")));

        if (family == font_family)
        {
            act->setChecked(true);
            font_family_ = font_family;
        }

        actions_.push_back(act);
    }
示例#14
0
void ReadingToolsActions::generateActions(const vector<ReadingToolsType> & values, bool append)
{
    category()->setText(QCoreApplication::tr("Tools"));
    if ( !append )
    {
        actions_.clear();
    }
    else
    {
        // add separator
        shared_ptr<QAction> separator(new QAction(exclusiveGroup()));
        separator->setSeparator(true);
        actions_.push_back(separator);
    }

    vector<ReadingToolsType>::const_iterator begin = values.begin();
    vector<ReadingToolsType>::const_iterator end   = values.end();
    for(vector<ReadingToolsType>::const_iterator iter = begin;
        iter != end; ++iter)
    {
        // Add to category automatically.
        shared_ptr<QAction> act(new QAction(exclusiveGroup()));

        // Change font and make it as checkable.
        act->setCheckable(true);
        act->setData(*iter);
        switch (*iter)
        {
        case SEARCH_TOOL:
            {
                act->setText(QCoreApplication::tr("Search"));
                act->setIcon(QIcon(QPixmap(":/images/free_text_search.png")));
            }
            break;
        case RETRIEVE_WORD:
            {
                act->setText(QCoreApplication::tr("Mark"));
                act->setIcon(QIcon(QPixmap(":/images/retrieve_word.png")));
            }
            break;
        case TOC_VIEW_TOOL:
            {
                act->setText(QCoreApplication::tr("Table of Content"));
                act->setIcon(QIcon(QPixmap(":/images/table_of_content.png")));
            }
            break;
        case ANNOTATION_VIEW_TOOL:
            {
                act->setText(QCoreApplication::tr("Annotations View"));
                act->setIcon(QIcon(QPixmap(":/images/show_all_bookmarks.png")));
            }
            break;
        case NOTES_BACKGROUND_SELECTION:
            {
                act->setText(QCoreApplication::tr("Select Background"));
                act->setIcon(QIcon(QPixmap(":/images/background_selection.png")));
            }
            break;
        case EXPORT_SKETCH_DATA:
            {
                act->setText(QCoreApplication::tr("Export"));
                act->setIcon(QIcon(QPixmap(":/images/export.png")));
            }
            break;
        case INSERT_NOTE:
            {
                act->setText(QCoreApplication::tr("Insert Page"));
                act->setIcon(QIcon(QPixmap(":/images/insert_note.png")));
            }
            break;
        case REMOVE_NOTE:
            {
                act->setText(QCoreApplication::tr("Remove Page"));
                act->setIcon(QIcon(QPixmap(":/images/remove_note.png")));
            }
            break;
        case SLIDE_SHOW:
            {
                act->setText(QCoreApplication::tr("Slide Show"));
                act->setIcon(QIcon(QPixmap(":/images/slide_show.png")));
            }
            break;
        case DISPLAY_HYPERLINKS:
            {
                act->setText(QCoreApplication::tr("Show Hyperlinks"));
                act->setIcon(QIcon(QPixmap(":/images/show_hyperlinks.png")));
            }
            break;
        case DICTIONARY_TOOL:
            {
                act->setText(QCoreApplication::tr("Dictionary Lookup"));
                act->setIcon(QIcon(QPixmap(":/images/dictionary.png")));
            }
            break;
        case GOTO_PAGE:
            {
                act->setText(QCoreApplication::tr("Go To Page"));
                act->setIcon(QIcon(QPixmap(":/images/goto_page.png")));
            }
            break;
        case TEXT_TO_SPEECH:
            {
                act->setText(QCoreApplication::tr("Text To Speech"));
                act->setIcon(QIcon(QPixmap(":/images/tts.png")));
            }
            break;
        case SCROLL_PAGE:
            {
                act->setText(QCoreApplication::tr("Hand Tool"));
                act->setIcon(QIcon(QPixmap(":/images/scroll_page.png")));
            }
            break;
        case PREVIOUS_VIEW:
            {
                act->setText(QCoreApplication::tr("Previous View"));
                act->setIcon(QIcon(QPixmap(":/images/backward.png")));
            }
            break;
        case NEXT_VIEW:
            {
                act->setText(QCoreApplication::tr("Next View"));
                act->setIcon(QIcon(QPixmap(":/images/forward.png")));
            }
            break;
        case ADD_BOOKMARK:
            {
                act->setText(QCoreApplication::tr("Add Bookmark"));
                act->setIcon(QIcon(QPixmap(":/images/add_bookmark.png")));
            }
            break;
        case DELETE_BOOKMARK:
            {
                act->setText(QCoreApplication::tr("Delete Bookmark"));
                act->setIcon(QIcon(QPixmap(":/images/delete_bookmark.png")));
            }
            break;
        case SHOW_ALL_BOOKMARKS:
            {
                act->setText(QCoreApplication::tr("Show Bookmarks"));
                act->setIcon(QIcon(QPixmap(":/images/show_all_bookmarks.png")));
            }
            break;
        case SET_TOBE_BOOTSPLASH:
            {
                act->setText(QCoreApplication::tr("Set Boot Splash"));
                act->setIcon(QIcon(QPixmap(":/images/set_boot_splash.png")));
            }
            break;
        case SELECT_ALL:
            {
                act->setText(QCoreApplication::tr("Select All"));
                act->setIcon(QIcon(QPixmap(":/images/select_all.png")));
            }
            break;
        case SAVE_DOCUMENT:
            {
                act->setText(QCoreApplication::tr("Save Document"));
                act->setIcon(QIcon(QPixmap(":/images/save_document.png")));
            }
            break;
        case UNDO_TOOL:
            {
                act->setText(QCoreApplication::tr("Undo"));
                act->setIcon(QIcon(QPixmap(":/images/undo.png")));
            }
            break;
        case REDO_TOOL:
            {
                act->setText(QCoreApplication::tr("Redo"));
                act->setIcon(QIcon(QPixmap(":/images/redo.png")));
            }
            break;
        case SAVE_ACCOUNT:
            {
                act->setText(QCoreApplication::tr("Save Account"));
                act->setIcon(QIcon(QPixmap(":/images/save_account.png")));
            }
            break;
        case DISPLAY_ACCOUNT:
            {
                act->setText(QCoreApplication::tr("Display Account"));
                act->setIcon(QIcon(QPixmap(":/images/display_bookmark.png")));
            }
            break;
        case DELETE_ACCOUNT:
            {
                act->setText(QCoreApplication::tr("Delete Password"));
                act->setIcon(QIcon(QPixmap(":/images/delete_account.png")));
            }
            break;
        case CLEAR_COOKIES:
            {
                act->setText(QCoreApplication::tr("Clear Cookies"));
                act->setIcon(QIcon(QPixmap(":/images/clear_cookies.png")));
            }
            break;
        case AUTO_LOAD_IMAGE:
            {
                act->setText(QCoreApplication::tr("Auto-load Image"));
                act->setIcon(QIcon(QPixmap(":/images/auto_load_image.png")));
            }
            break;
        case COPY_CONTENT:
            {
                act->setText(QCoreApplication::tr("Copy"));
                act->setIcon(QIcon(QPixmap(":/images/copy.png")));
            }
            break;
        case PASTE_CONTENT:
            {
                act->setText(QCoreApplication::tr("Paste"));
                act->setIcon(QIcon(QPixmap(":/images/paste.png")));
            }
            break;
        case CLOCK_TOOL:
            {
                act->setText(QCoreApplication::tr("Clock"));
                act->setIcon(QIcon(QPixmap(":/images/clock_tool.png")));
            }
            break;
        case COMIC_MODE:
            {
                act->setText(QCoreApplication::tr("Comic Mode"));
                act->setIcon(QIcon(QPixmap(":/images/comic_mode.png")));
            }
            break;
        default:
            break;
        }
        actions_.push_back(act);
    }
}
示例#15
0
void ReadingStyleActions::generateActions(ReadingStyleType selected)
{
    category()->setText(QCoreApplication::tr("Style"));
    actions_.clear();

    for(int i = STYLE_LINE_SPACING_8; i <= STYLE_LINE_SPACING_20; ++i)
    {
        // Add to category automatically.
        shared_ptr<QAction> act(new QAction(exclusiveGroup()));

        // Change font and make it as checkable.
        act->setCheckable(true);
        act->setData(i);

        QString t(tr("%1% line spacing"));
        int percentage = 80 + (i - STYLE_LINE_SPACING_8) * 10;
        t = t.arg(percentage);
        act->setText(t);
        act->setIcon(QIcon(QPixmap(":/images/line_space.png")));

        if (selected == i)
        {
            act->setChecked(true);
        }
        actions_.push_back(act);
    }

#if defined(BUILD_WITH_TFT) || defined(_WINDOWS)

    shared_ptr<QAction> separator(new QAction(exclusiveGroup()));
    separator->setSeparator(true);
    actions_.push_back(separator);

    shared_ptr<QAction> day(new QAction(exclusiveGroup()));
    day->setCheckable(true);
    day->setData(STYLE_WHITE_BACKGROUND);
    QString d(tr("White Backgroud"));
    day->setText(d);
    day->setIcon(QIcon(QPixmap(":/images/line_space.png")));
    actions_.push_back(day);

    shared_ptr<QAction> night(new QAction(exclusiveGroup()));
    night->setCheckable(true);
    night->setData(STYLE_BLACK_BACKGROUND);
    QString n(tr("Black Backgroud"));
    night->setText(n);
    night->setIcon(QIcon(QPixmap(":/images/line_space.png")));
    actions_.push_back(night);

#endif
    /*
    shared_ptr<QAction> separator(new QAction(exclusiveGroup()));
    separator->setSeparator(true);
    actions_.push_back(separator);

    for(int i = STYLE_PAGE_MARGINS_SMALL; i <= STYLE_PAGE_MARGINS_LARGE; ++i)
    {
        // Add to category automatically.
        shared_ptr<QAction> act(new QAction(exclusiveGroup()));
        act->setCheckable(true);
        act->setData(i);

        QString t;
        switch (i)
        {
        case STYLE_PAGE_MARGINS_SMALL:
            t = QCoreApplication::tr("Small");
            break;
        case STYLE_PAGE_MARGINS_MIDDLE:
            t = QCoreApplication::tr("Middle");
            break;
        case STYLE_PAGE_MARGINS_LARGE:
            t = QCoreApplication::tr("Middle");
            break;
        }
        act->setText(t);
        act->setIcon(QIcon(QPixmap(":/images/free_text_search.png")));
        actions_.push_back(act);
    }
    */
}
示例#16
0
void SystemActions::generateActions(const std::vector<int> & actions)
{
    category()->setFont(actionFont());
    category()->setText(QCoreApplication::tr("System"));
    actions_.clear();

    std::vector<int> all = actions;
    if (all.size() <= 0)
    {
        all.push_back(ROTATE_SCREEN);
        all.push_back(SCREEN_UPDATE_TYPE);
        all.push_back(MUSIC);

#ifdef BUILD_WITH_TFT
        all.push_back(BACKLIGHT_BRIGHTNESS);
#endif
        all.push_back(RETURN_TO_LIBRARY);
    }

    for(int i = 0; i < static_cast<int>(all.size()); ++i)
    {
        switch (all[i])
        {
        case ROTATE_SCREEN:
            {
                shared_ptr<QAction> rotate(new QAction(exclusiveGroup()));
                rotate->setCheckable(true);
                rotate->setFont(actionFont());
                rotate->setText(QCoreApplication::tr("Rotate Screen"));
                rotate->setIcon(QIcon(QPixmap(":/images/screen_rotation.png")));
                rotate->setData(ROTATE_SCREEN);
                actions_.push_back(rotate);
                break;
            }
        case SCREEN_UPDATE_TYPE:
            {
                // Screen update type.
                shared_ptr<QAction> screen(new QAction(exclusiveGroup()));
                screen->setCheckable(true);
                screen->setFont(actionFont());
                if (onyx::screen::instance().defaultWaveform() == onyx::screen::ScreenProxy::GC)
                {
                    screen->setText(QCoreApplication::tr("Full Refresh Off"));
                    screen->setIcon(QIcon(QPixmap(":/images/fast_update.png")));
                }
                else
                {
                    screen->setText(QCoreApplication::tr("Full Refresh On"));
                    screen->setIcon(QIcon(QPixmap(":/images/full_update.png")));
                }
                screen->setData(SCREEN_UPDATE_TYPE);
                actions_.push_back(screen);
                break;
            }
        case FULL_SCREEN:
            {
                shared_ptr<QAction> fullScreen(new QAction(exclusiveGroup()));
                fullScreen->setCheckable(true);
                fullScreen->setFont(actionFont());
                fullScreen->setText(QCoreApplication::tr("Full Screen"));
                fullScreen->setIcon(QIcon(QPixmap(":/images/full_screen.png")));
                fullScreen->setData(FULL_SCREEN);
                actions_.push_back(fullScreen);
                break;
            }
        case EXIT_FULL_SCREEN:
            {
                shared_ptr<QAction> exitFullScreen(new QAction(exclusiveGroup()));
                exitFullScreen->setCheckable(true);
                exitFullScreen->setFont(actionFont());
                exitFullScreen->setText(QCoreApplication::tr("Exit Full Screen"));
                exitFullScreen->setIcon(QIcon(QPixmap(
                        ":/images/exit_full_screen.png")));
                exitFullScreen->setData(EXIT_FULL_SCREEN);
                actions_.push_back(exitFullScreen);
                break;
            }
        case MUSIC:
            {
                if (sys::SystemConfig::isMusicPlayerAvailable())
                {
                    // Music.
                    shared_ptr<QAction> music(new QAction(exclusiveGroup()));
                    music->setCheckable(true);
                    music->setFont(actionFont());
                    music->setText(QCoreApplication::tr("Music"));
                    music->setIcon(QIcon(QPixmap(":/images/music.png")));
                    music->setData(MUSIC);
                    actions_.push_back(music);
                }
                break;
            }
        case SYSTEM_VOLUME:
            {
                // when music and tts both are disabled, do not show volume configure
                bool music_available = sys::SystemConfig::isMusicPlayerAvailable();
                bool disable_tts = qgetenv("DISABLE_TTS").toInt();
                if (!music_available && disable_tts)
                {
                    continue;
                }

                // system volume.
                shared_ptr<QAction> volume(new QAction(exclusiveGroup()));
                volume->setCheckable(true);
                volume->setFont(actionFont());
                volume->setText(QCoreApplication::tr("Volume"));
                volume->setIcon(QIcon(QPixmap(":/images/system_volume.png")));
                volume->setData(SYSTEM_VOLUME);
                actions_.push_back(volume);
                break;
            }
        case RETURN_TO_LIBRARY:
            {
                // Close document.
                shared_ptr<QAction> close(new QAction(exclusiveGroup()));
                close->setCheckable(true);
                close->setFont(actionFont());
                close->setText(QCoreApplication::tr("Close"));
                close->setIcon(QIcon(QPixmap(":/images/return_to_library.png")));
                close->setData(RETURN_TO_LIBRARY);
                actions_.push_back(close);
                break;
            }
        case BACKLIGHT_BRIGHTNESS:
            {
                shared_ptr<QAction> br(new QAction(exclusiveGroup()));
                br->setCheckable(true);
                br->setFont(actionFont());
                br->setText(QCoreApplication::tr("Brightness"));
                br->setIcon(QIcon(QPixmap(":/images/return_to_library.png")));
                br->setData(BACKLIGHT_BRIGHTNESS);
                actions_.push_back(br);
                break;
            }
        case GLOW_LIGHT_CONTROL:
            {
                if (!sys::hasGlowLight())
                {
                    continue;
                }

                shared_ptr<QAction> glow_light(new QAction(exclusiveGroup()));
                glow_light->setCheckable(true);
                glow_light->setFont(actionFont());
                glow_light->setText(QCoreApplication::tr("MOON Light Control"));
                glow_light->setIcon(QIcon(QPixmap(":/images/glow_light_switch.png")));
                glow_light->setData(GLOW_LIGHT_CONTROL);
                actions_.push_back(glow_light);
                break;
            }
        }
    }
}
示例#17
0
void SystemActions::generateActions(const std::vector<int> & actions)
{
    category()->setText(QCoreApplication::tr("System"));
    actions_.clear();

    std::vector<int> all = actions;
    if (all.size() <= 0)
    {
        all.push_back(ROTATE_SCREEN);
        all.push_back(SCREEN_UPDATE_TYPE);
        all.push_back(MUSIC);
        all.push_back(RETURN_TO_LIBRARY);
    }

    for(int i = 0; i < static_cast<int>(all.size()); ++i)
    {
        switch (all[i])
        {
        case ROTATE_SCREEN:
            {
                shared_ptr<QAction> rotate(new QAction(exclusiveGroup()));
                rotate->setCheckable(true);
                rotate->setText(QCoreApplication::tr("Rotate Screen"));
                rotate->setIcon(QIcon(QPixmap(":/images/screen_rotation.png")));
                rotate->setData(ROTATE_SCREEN);
                actions_.push_back(rotate);
                break;
            }
        case SCREEN_UPDATE_TYPE:
            {
                // Screen update type.
                shared_ptr<QAction> screen(new QAction(exclusiveGroup()));
                screen->setCheckable(true);
                if (onyx::screen::instance().defaultWaveform() == onyx::screen::ScreenProxy::GC)
                {
                    screen->setText(QCoreApplication::tr("Full Refresh Off"));
                    screen->setIcon(QIcon(QPixmap(":/images/fast_update.png")));
                }
                else
                {
                    screen->setText(QCoreApplication::tr("Full Refresh On"));
                    screen->setIcon(QIcon(QPixmap(":/images/full_update.png")));
                }
                screen->setData(SCREEN_UPDATE_TYPE);
                actions_.push_back(screen);
                break;
            }
        case FULL_SCREEN:
            {
                shared_ptr<QAction> fullScreen(new QAction(exclusiveGroup()));
                fullScreen->setCheckable(true);
                fullScreen->setText(QCoreApplication::tr("Full Screen"));
                fullScreen->setIcon(QIcon(QPixmap(":/images/full_screen.png")));
                fullScreen->setData(FULL_SCREEN);
                actions_.push_back(fullScreen);
                break;
            }
        case EXIT_FULL_SCREEN:
            {
                shared_ptr<QAction> exitFullScreen(new QAction(exclusiveGroup()));
                exitFullScreen->setCheckable(true);
                exitFullScreen->setText(QCoreApplication::tr("Exit Full Screen"));
                exitFullScreen->setIcon(QIcon(QPixmap(
                        ":/images/exit_full_screen.png")));
                exitFullScreen->setData(EXIT_FULL_SCREEN);
                actions_.push_back(exitFullScreen);
                break;
            }
        case MUSIC:
            {
                if (sys::SystemConfig::isMusicPlayerAvailable())
                {
                    // Music.
                    shared_ptr<QAction> music(new QAction(exclusiveGroup()));
                    music->setCheckable(true);
                    music->setText(QCoreApplication::tr("Music"));
                    music->setIcon(QIcon(QPixmap(":/images/music.png")));
                    music->setData(MUSIC);
                    actions_.push_back(music);
                }
                break;
            }
        case RETURN_TO_LIBRARY:
            {
                // Close document.
                shared_ptr<QAction> close(new QAction(exclusiveGroup()));
                close->setCheckable(true);
                close->setText(QCoreApplication::tr("Close"));
                close->setIcon(QIcon(QPixmap(":/images/return_to_library.png")));
                close->setData(RETURN_TO_LIBRARY);
                actions_.push_back(close);
                break;
            }
        }
    }
}
void BrowserNavigationActions::generateActions(QWebHistory *history,
        bool enable_hyperlink_navigation,
        bool hyperlink_navigation_mode,
        bool enable_mobile_mode,
        bool mobile_mode)
{
    category()->setFont(actionFont());
    category()->setText(QCoreApplication::tr("Navigation"));

    actions_.clear();

    bool can_go_back = history->canGoBack();
    if (can_go_back)
    {
        shared_ptr<QAction> backward(new QAction(exclusiveGroup()));
        backward->setFont(actionFont());
        backward->setText(QCoreApplication::tr("Backward"));
        backward->setIcon(QIcon(QPixmap(":/images/backward.png")));
        backward->setData(NAVIGATE_BACKWARD);
        backward->setEnabled(can_go_back);
        backward->setCheckable(true);
        backward->setChecked(false);
        actions_.push_back(backward);
    }

    bool can_go_forward = history->canGoForward();
    if (can_go_forward)
    {
        shared_ptr<QAction> forward(new QAction(exclusiveGroup()));
        forward->setFont(actionFont());
        forward->setText(QCoreApplication::tr("Forward"));
        forward->setIcon(QIcon(QPixmap(":/images/forward.png")));
        forward->setData(NAVIGATE_FORWARD);
        forward->setEnabled(can_go_forward);
        forward->setCheckable(true);
        forward->setChecked(false);
        actions_.push_back(forward);
    }

    shared_ptr<QAction> clear(new QAction(exclusiveGroup()));
    clear->setFont(actionFont());
    clear->setText(QCoreApplication::tr("Clear History"));
    clear->setIcon(QIcon(QPixmap(":/images/clear_history.png")));
    clear->setData(NAVIGATE_CLEAR_HISTORY);
    clear->setEnabled(true);
    clear->setCheckable(true);
    clear->setChecked(false);
    actions_.push_back(clear);

    if(enable_history_)
    {
        shared_ptr<QAction> Show(new QAction(exclusiveGroup()));
        Show->setFont(actionFont());
        Show->setText(QCoreApplication::tr("History"));
        Show->setIcon(QIcon(QPixmap(":/images/history.png")));
        Show->setData(NAVIGATE_SHOW_HISTORY);
        Show->setEnabled(true);
        Show->setCheckable(true);
        Show->setChecked(false);
        actions_.push_back(Show);
    }

    if (enable_hyperlink_navigation)
    {
        shared_ptr<QAction> navigate_hyperlink(new QAction(exclusiveGroup()));
        QString text;
        if (!hyperlink_navigation_mode)
        {
            text = QCoreApplication::tr("Hyperlink Navigation");
        }
        else {
            text = QCoreApplication::tr("Exit Navigation");
        }
        navigate_hyperlink->setText(text);
        navigate_hyperlink->setFont(actionFont());
        navigate_hyperlink->setIcon(QIcon(QPixmap(":/images/hyperlink_navigation_mode.png")));
        navigate_hyperlink->setData(NAVIGATE_HYPER_LINK_VIA_KEYBOARD);
        navigate_hyperlink->setEnabled(true);
        navigate_hyperlink->setCheckable(true);
        navigate_hyperlink->setChecked(false);
        actions_.push_back(navigate_hyperlink);
    }

    if (enable_mobile_mode)
    {
        shared_ptr<QAction> mode(new QAction(exclusiveGroup()));
        if (!mobile_mode)
        {
            mode->setText(QCoreApplication::tr("Mobile Mode"));
        }
        else
        {
            mode->setText(QCoreApplication::tr("Exit Mobile Mode"));
        }
        mode->setFont(actionFont());
        mode->setIcon(QIcon(QPixmap(":/images/mobile_mode.png")));
        mode->setData(NAVIGATE_BROWSER_MODE);
        mode->setEnabled(true);
        mode->setCheckable(true);
        mode->setChecked(false);
        actions_.push_back(mode);
    }
}
示例#19
0
void BooxActions::addSeparator()
{
    shared_ptr<QAction> separator(new QAction(exclusiveGroup()));
    separator->setSeparator(true);
    actions_.push_back(separator);
}