Exemple #1
0
/*! This virtual handler is called when a button is clicked. The
default implementation calls setChecked(!isChecked()) if the button
isCheckable().  It allows subclasses to implement intermediate button
states.

\sa checkStateSet()
*/
void QAbstractButton::nextCheckState()
{
    if (isCheckable())
        setChecked(!isChecked());
}
Exemple #2
0
/*!
    \fn void QAction::toggle()

    This is a convenience function for the \l checked property.
    Connect to it to change the checked state to its opposite state.
*/
void QAction::toggle()
{
    Q_D(QAction);
    setChecked(!d->checked);
}
/**
 * Creates a toggle button with the specified image
 * and selection state, but no text.
 *
 * @param icon  the image that the button should display
 * @param selected  if true, the button is initially selected;
 *                  otherwise, the button is initially unselected
 */
/*public*/ JToggleButton::JToggleButton(QIcon icon, bool selected, QWidget *parent) : QPushButton(icon, "", parent)
{
 //this(NULL, icon, selected);
 init();
 setChecked(selected);
}
Exemple #4
0
void GalaGV::onContextMenuRequest(const QPoint &pos)
{

    QGraphicsItem *item = itemAt(pos);
    QGraphicsEllipseItem *eSystemItem;
    ESystem  e;

    SendMenu menu(ShipTreeWidget::tree());
    QMenu *m  = menu.menu();
    QAction *openSys = m->addAction("openSys");
    QAction *openLog = m->addAction("openLog");
    QAction *setCheckd = m->addAction("check");
    QAction *setWerf = m->addAction("werft");
    QAction *clearChecked = m->addAction("clear all checked");
    setCheckd->setCheckable(true);
    setWerf->setCheckable(true);

    const QHash<QString,QGraphicsEllipseItem*> &esysteme = mData->eSysteme.value(mData->showESysteme.first+";"+QString::number(mData->gala));

    if(!mData->showESysteme.second || esysteme.size() == 0)
        clearChecked->setEnabled(false);

    if(item == NULL){
        openSys->setEnabled(false);
        openLog->setEnabled(false);
        setCheckd->setEnabled(false);
        setWerf->setEnabled(false);
    } else {
        if(!mData->mPlayerLogPlanis.contains(item))
            openLog->setEnabled(false);

        eSystemItem =esysteme.value(item->data(ID).toString());
        if(eSystemItem == NULL || !mData->showESysteme.second){
            setCheckd->setEnabled(false);
            setWerf->setEnabled(false);
        }else {
            e=eSystemItem->data(Esystem).value<ESystem>();
            setCheckd->setChecked(e.isChecked);
            setWerf->setChecked(e.isWerft);
        }
    }



    if( eSystemItem == NULL || !mData->showESysteme.second)
        menu.setDisable(true);

    do {
        QAction *ret = m->exec(mapToGlobal(pos));
        if(ret == openSys){
            emit loadPage("http://www.omega-day.com/game/?op=system&sys="+item->data(Qt::UserRole).toString());
        }else if (ret == openLog){
            emit loadPage("http://www.omega-day.com/game/"+item->data(Qt::UserRole+1).toString());
        } else if(ret == setCheckd){
            setChecked(eSystemItem,setCheckd->isChecked());
        } else if(ret == clearChecked){
            int ret =QMessageBox::warning(this,"muh","wirklich löschen",QMessageBox::Yes,QMessageBox::No);
            if(ret == QMessageBox::Yes)
                clearAllChecked();

        }else if (ret == setWerf) {
            setWerft(eSystemItem,setWerf->isChecked());
        }else if( menu.checkSendClicked(ret)){
           const  QStringList & l = menu.checkedID();
            const QString &oldID = menu.orbitID();
            if(l.size()>0){
                QString planiID = eSystemItem->data(Esystem).value<ESystem>().planiID;
                if(l.size() == 1)
                    emit sendShip(l.first(),oldID,planiID);
                else
                    emit sendShips(l,planiID);
            }
        }
    }while(!menu.exit());
}
Exemple #5
0
void CheckBoxImpl::toggle()
{
    setChecked(!m_checked);
}
Exemple #6
0
void FieldView::contextMenuEvent(QContextMenuEvent* event)
{

    QMenu menu(this);

    QModelIndex index = currentIndex();
    if(index.isValid())
    {

        menu.addAction(m_applyValueOnSelection);
        menu.addAction(m_applyValueOnAllLines);
        menu.addSeparator();
        menu.addAction(m_defineCode);
        if(nullptr != m_canvasList)
        {
            menu.addSeparator();
            menu.addAction(m_delItem);
        }
    }
    auto showSubMenu = menu.addMenu(tr("Show"));
    showSubMenu->addAction(m_showAllGroup);
    showSubMenu->addAction(m_showEsteticGroup);
    showSubMenu->addAction(m_showIdGroup);
    showSubMenu->addAction(m_showValueGroup);
    showSubMenu->addAction(m_showGeometryGroup);

    auto hideSubMenu = menu.addMenu(tr("Show/Hide"));
    auto columnCount = m_model->columnCount(QModelIndex());
    for(int i = 0; i < columnCount;++i)
    {
        auto name = m_model->headerData(i,Qt::Horizontal,Qt::DisplayRole).toString();
        auto  act = hideSubMenu->addAction(name);
        act->setCheckable(true);
        act->setChecked(!isColumnHidden(i));
        connect(act, SIGNAL(triggered(bool)) , m_mapper, SLOT(map()));
        m_mapper->setMapping(act,i);
    }


    QAction* act = menu.exec(event->globalPos());

    if(act == m_delItem)
    {
        auto itemData = static_cast<Field*>(index.internalPointer());
        DeleteFieldCommand* deleteCommand = new DeleteFieldCommand(itemData,m_canvasList->at(*m_currentPage),m_model,*m_currentPage);
        m_undoStack->push(deleteCommand);
    }
    else if( m_applyValueOnAllLines == act)
    {
        applyValue(index,false);
    }
    else if(m_applyValueOnSelection == act)
    {
        applyValue(index,true);
    }
    else if(m_defineCode == act)
    {
        defineItemCode(index);
    }
    else if(m_resetCode == act)
    {
        if(!index.isValid())
            return;

        Field* field = m_model->getFieldFromIndex(index);

        if(nullptr != field)
        {
            field->setGeneratedCode(QStringLiteral(""));
        }

    }
}
Exemple #7
0
void WAbstractToggleButton::setChecked()
{
  prevState_ = state_;
  setChecked(true);
}
void FlatCheckbox::onClicked() {
	if (_state & StateDisabled) return;
	setChecked(!checked());
}
Exemple #9
0
void CheckBox::setValueFromParam(ParamValue val) {
	setChecked(val.asBool());
}
Exemple #10
0
	void PlaylistWidget::SetSortOrderButton ()
	{
		auto sortButton = new QToolButton;
		sortButton->setIcon (Core::Instance ().GetProxy ()->
					GetIconThemeManager ()->GetIcon ("view-sort-ascending"));
		sortButton->setPopupMode (QToolButton::InstantPopup);

		auto menu = new QMenu (tr ("Sorting"));
		sortButton->setMenu (menu);

		auto getInts = [] (const QList<SortingCriteria>& crit) -> QVariantList
		{
			QVariantList result;
			std::transform (crit.begin (), crit.end (), std::back_inserter (result),
					[] (decltype (crit.front ()) item) { return static_cast<int> (item); });
			return result;
		};

		typedef QPair<QString, QList<SortingCriteria>> SortPair_t;
		QList<SortPair_t> stdSorts;
		stdSorts << SortPair_t (tr ("Artist / Year / Album / Track number"),
					{
						SortingCriteria::Artist,
						SortingCriteria::Year,
						SortingCriteria::Album,
						SortingCriteria::TrackNumber
					});
		stdSorts << SortPair_t (tr ("Artist / Track title"),
					{
						SortingCriteria::Artist,
						SortingCriteria::TrackTitle
					});
		stdSorts << SortPair_t (tr ("File path"),
					{
						SortingCriteria::DirectoryPath,
						SortingCriteria::FileName
					});
		stdSorts << SortPair_t (tr ("No sort"), {});

		const auto& currentCriteria = Player_->GetSortingCriteria ();

		auto sortGroup = new QActionGroup (this);
		bool wasChecked = false;
		Q_FOREACH (const auto& pair, stdSorts)
		{
			auto act = menu->addAction (pair.first);
			act->setProperty ("SortInts", getInts (pair.second));
			act->setCheckable (true);
			sortGroup->addAction (act);
			if (pair.second == currentCriteria)
			{
				act->setChecked (true);
				wasChecked = true;
			}
			else
				act->setChecked (false);

			connect (act,
					SIGNAL (triggered ()),
					this,
					SLOT (handleStdSort ()));
		}
/*! \internal

  Makes sure the button isn't pressed when the popup hides.
*/
void QtColorPicker::popupClosed()
{
    setChecked(false);
    setFocus();
}
Exemple #12
0
void KisAirbrushOption::readOptionSetting(const KisPropertiesConfiguration* setting)
{
    setChecked(setting->getBool(AIRBRUSH_ENABLED));
    m_optionWidget->sliderRate->setValue(setting->getInt(AIRBRUSH_RATE, 100));
}
void MappingBool::ConfigChanged()
{
  const QSignalBlocker blocker(this);
  setChecked(m_setting.GetValue());
}
Exemple #14
0
/*! \fn void QAbstractButton::toggle()

    Toggles the state of a checkable button.

     \sa checked
*/
void QAbstractButton::toggle()
{
    Q_D(QAbstractButton);
    setChecked(!d->checked);
}
Exemple #15
0
void caMessageButton::buttonhandle(int type)
{
    emit messageButtonSignal(type);
    if(type == 0) setChecked(true);
    else setChecked(false);
}
Exemple #16
0
void CheckBox::mousePressEvent (QMouseEvent* e) {
	Q_UNUSED(e);
	setChecked(!checked);
	emit onChange();
}
Exemple #17
0
void RazorTaskButton::nextCheckState()
{
    setChecked(xfitMan().getActiveAppWindow() == mWindow);
}
Exemple #18
0
void OptionButton::panelClosed()
{
	setChecked(false);
	minimizePanel();
}
Exemple #19
0
void MasterWindow::_setupMasterWindowUI()
{
    // add main tab widget
    setCentralWidget(new QTabWidget());

    // create menus in menu bar
    auto fileMenu = menuBar()->addMenu("&File");
    auto editMenu = menuBar()->addMenu("&Edit");
    auto viewMenu = menuBar()->addMenu("&View");
    auto helpMenu = menuBar()->addMenu("&Help");

    // create tool bar
    auto toolbar = addToolBar("toolbar");

    /** FILE menu */

    // open content action
    auto openContentAction = new QAction("Open Content", this);
    openContentAction->setStatusTip("Open content");
    connect(openContentAction, &QAction::triggered, this,
            &MasterWindow::_openContent);

    // open contents directory action
    auto openContentsDirectoryAction = new QAction("Open Directory", this);
    openContentsDirectoryAction->setStatusTip("Open directory of contents");
    connect(openContentsDirectoryAction, &QAction::triggered, this,
            &MasterWindow::_openContentsDirectory);

    // clear contents action
    auto clearContentsAction = new QAction("Clear", this);
    clearContentsAction->setStatusTip("Clear all contents");
    connect(clearContentsAction, &QAction::triggered,
            [this]() { _getActiveGroup().clear(); });

    // save session action
    auto saveSessionAction = new QAction("Save Session", this);
    saveSessionAction->setStatusTip("Save current session");
    connect(saveSessionAction, &QAction::triggered, this,
            &MasterWindow::_saveSession);

    // load session action
    auto loadSessionAction = new QAction("Load Session", this);
    loadSessionAction->setStatusTip("Load a session");
    connect(loadSessionAction, &QAction::triggered, this,
            &MasterWindow::_openSession);

#if TIDE_ENABLE_WEBBROWSER_SUPPORT
    // Open webbrowser action
    auto webbrowserAction = new QAction("Web Browser", this);
    webbrowserAction->setStatusTip("Open a web browser");
    connect(webbrowserAction, &QAction::triggered, _webbrowserWidget,
            &WebbrowserWidget::show);
#endif

    // Open whiteboard action
    auto whiteboardAction = new QAction("Whiteboard", this);
    whiteboardAction->setStatusTip("Open a whiteboard");
    connect(whiteboardAction, &QAction::triggered,
            [this] { emit openWhiteboard(_getActiveSceneIndex()); });

    // quit action
    auto quitAction = new QAction("Quit", this);
    quitAction->setStatusTip("Quit application");
    connect(quitAction, &QAction::triggered, this, &MasterWindow::close);

    /** EDIT menu */

    // background content action
    auto backgroundAction = new QAction("Background", this);
    backgroundAction->setStatusTip("Select the background color and content");
    connect(backgroundAction, &QAction::triggered, _backgroundWidget,
            &BackgroundWidget::show);
    connect(static_cast<QTabWidget*>(centralWidget()),
            &QTabWidget::currentChanged, _backgroundWidget,
            &BackgroundWidget::setActiveSurface);

    /** VIEW menu */

    // enable alpha blending
    auto enableAlphaBlendingAction = new QAction("Alpha Blending", this);
    enableAlphaBlendingAction->setStatusTip(
        "Enable alpha blending for transparent contents (png, svg, etc..)");
    enableAlphaBlendingAction->setCheckable(true);
    enableAlphaBlendingAction->setChecked(_options->isAlphaBlendingEnabled());
    connect(enableAlphaBlendingAction, &QAction::toggled, _options.get(),
            &Options::enableAlphaBlending);
    connect(_options.get(), &Options::alphaBlendingEnabledChanged,
            enableAlphaBlendingAction, &QAction::setChecked);

    // auto focus pixel streams
    auto autoFocusStreamersAction = new QAction("Auto-focus streamers", this);
    autoFocusStreamersAction->setStatusTip(
        "Open the windows of the external streamers in focus mode");
    autoFocusStreamersAction->setCheckable(true);
    autoFocusStreamersAction->setChecked(_options->getAutoFocusPixelStreams());
    connect(autoFocusStreamersAction, &QAction::toggled, _options.get(),
            &Options::setAutoFocusPixelStreams);
    connect(_options.get(), &Options::autoFocusPixelStreamsChanged,
            autoFocusStreamersAction, &QAction::setChecked);

    // show clock action
    auto showClockAction = new QAction("Clock", this);
    showClockAction->setStatusTip("Show a clock on the background");
    showClockAction->setCheckable(true);
    showClockAction->setChecked(_options->getShowClock());
    connect(showClockAction, &QAction::toggled, _options.get(),
            &Options::setShowClock);
    connect(_options.get(), &Options::showClockChanged, showClockAction,
            &QAction::setChecked);

    // show content tiles action
    auto showContentTilesAction = new QAction("Content Tiles", this);
    showContentTilesAction->setStatusTip("Show Content Tiles");
    showContentTilesAction->setCheckable(true);
    showContentTilesAction->setChecked(_options->getShowContentTiles());
    connect(showContentTilesAction, &QAction::toggled, _options.get(),
            &Options::setShowContentTiles);
    connect(_options.get(), &Options::showContentTilesChanged,
            showContentTilesAction, &QAction::setChecked);

    // show control area action
    auto showControlAreaAction = new QAction("Control Area", this);
    showControlAreaAction->setStatusTip("Show the Control Area");
    showControlAreaAction->setCheckable(true);
    showControlAreaAction->setChecked(_options->getShowControlArea());
    connect(showControlAreaAction, &QAction::toggled, _options.get(),
            &Options::setShowControlArea);
    connect(_options.get(), &Options::showControlAreaChanged,
            showControlAreaAction, &QAction::setChecked);

    // show file paths action
    auto showFilePathsAction = new QAction("File Paths", this);
    showFilePathsAction->setStatusTip("Show full file paths in the title bar");
    showFilePathsAction->setCheckable(true);
    showFilePathsAction->setChecked(_options->getShowFilePaths());
    connect(showFilePathsAction, &QAction::toggled, _options.get(),
            &Options::setShowFilePaths);
    connect(_options.get(), &Options::showFilePathsChanged, showFilePathsAction,
            &QAction::setChecked);

    // show streaming statistics action
    auto showStatisticsAction = new QAction("Statistics", this);
    showStatisticsAction->setStatusTip("Show statistics");
    showStatisticsAction->setCheckable(true);
    showStatisticsAction->setChecked(_options->getShowStatistics());
    connect(showStatisticsAction, &QAction::toggled, _options.get(),
            &Options::setShowStatistics);
    connect(_options.get(), &Options::showStatisticsChanged,
            showStatisticsAction, &QAction::setChecked);

    // show test pattern action
    auto showTestPatternAction = new QAction("Test Pattern", this);
    showTestPatternAction->setStatusTip("Show test pattern");
    showTestPatternAction->setCheckable(true);
    showTestPatternAction->setChecked(_options->getShowTestPattern());
    connect(showTestPatternAction, &QAction::toggled, _options.get(),
            &Options::setShowTestPattern);
    connect(_options.get(), &Options::showTestPatternChanged,
            showTestPatternAction, &QAction::setChecked);

    // show touch points action
    auto showTouchPoints = new QAction("Touch Points", this);
    showTouchPoints->setStatusTip("Show touch points");
    showTouchPoints->setCheckable(true);
    showTouchPoints->setChecked(_options->getShowTouchPoints());
    connect(showTouchPoints, &QAction::toggled, _options.get(),
            &Options::setShowTouchPoints);
    connect(_options.get(), &Options::showTouchPointsChanged, showTouchPoints,
            &QAction::setChecked);

    // show window borders action
    auto showWindowBordersAction = new QAction("Window Borders", this);
    showWindowBordersAction->setStatusTip("Show window borders");
    showWindowBordersAction->setCheckable(true);
    showWindowBordersAction->setChecked(_options->getShowWindowBorders());
    connect(showWindowBordersAction, &QAction::toggled, _options.get(),
            &Options::setShowWindowBorders);
    connect(_options.get(), &Options::showWindowBordersChanged,
            showWindowBordersAction, &QAction::setChecked);

    // show window title action
    auto showWindowTitlesAction = new QAction("Window Titles", this);
    showWindowTitlesAction->setStatusTip("Show window titles");
    showWindowTitlesAction->setCheckable(true);
    showWindowTitlesAction->setChecked(_options->getShowWindowTitles());
    connect(showWindowTitlesAction, &QAction::toggled, _options.get(),
            &Options::setShowWindowTitles);
    connect(_options.get(), &Options::showWindowTitlesChanged,
            showWindowTitlesAction, &QAction::setChecked);

    // show zoom context action
    auto showZoomContextAction = new QAction("Zoom Context", this);
    showZoomContextAction->setStatusTip("Show zoom context");
    showZoomContextAction->setCheckable(true);
    showZoomContextAction->setChecked(_options->getShowZoomContext());
    connect(showZoomContextAction, &QAction::toggled, _options.get(),
            &Options::setShowZoomContext);
    connect(_options.get(), &Options::showZoomContextChanged,
            showZoomContextAction, &QAction::setChecked);

    /** HELP menu */

    auto showAboutDialog = new QAction("About", this);
    showAboutDialog->setStatusTip("About Tide");
    connect(showAboutDialog, &QAction::triggered, this,
            &MasterWindow::_openAboutWidget);

    // add actions to menus
    fileMenu->addAction(openContentAction);
    fileMenu->addAction(openContentsDirectoryAction);
    fileMenu->addAction(loadSessionAction);
    fileMenu->addAction(saveSessionAction);
#if TIDE_ENABLE_WEBBROWSER_SUPPORT
    fileMenu->addAction(webbrowserAction);
#endif
    fileMenu->addAction(whiteboardAction);
    fileMenu->addAction(clearContentsAction);
    fileMenu->addAction(quitAction);
    editMenu->addAction(backgroundAction);
    viewMenu->addAction(autoFocusStreamersAction);
    viewMenu->addAction(enableAlphaBlendingAction);
    viewMenu->addAction(showClockAction);
    viewMenu->addAction(showContentTilesAction);
    viewMenu->addAction(showControlAreaAction);
    viewMenu->addAction(showFilePathsAction);
    viewMenu->addAction(showStatisticsAction);
    viewMenu->addAction(showTestPatternAction);
    viewMenu->addAction(showTouchPoints);
    viewMenu->addAction(showWindowBordersAction);
    viewMenu->addAction(showWindowTitlesAction);
    viewMenu->addAction(showZoomContextAction);
    helpMenu->addAction(showAboutDialog);

    // add actions to toolbar
    toolbar->addAction(openContentAction);
    toolbar->addAction(openContentsDirectoryAction);
    toolbar->addAction(loadSessionAction);
    toolbar->addAction(saveSessionAction);
#if TIDE_ENABLE_WEBBROWSER_SUPPORT
    toolbar->addAction(webbrowserAction);
#endif
    toolbar->addAction(whiteboardAction);
    toolbar->addAction(clearContentsAction);
    toolbar->addAction(backgroundAction);

    // create left dock widget
    auto contentsDockWidget = new QDockWidget("Contents", this);
    auto contentsWidget = new QWidget();
    auto contentsLayout = new QVBoxLayout();
    contentsWidget->setLayout(contentsLayout);
    contentsDockWidget->setWidget(contentsWidget);
    addDockWidget(Qt::LeftDockWidgetArea, contentsDockWidget);

    // add list widget (first display group only at the moment)
    auto displayGroupWidget = new DisplayGroupListWidget(this);
    displayGroupWidget->setDataModel(_scene->getGroup(0).shared_from_this());
    contentsLayout->addWidget(displayGroupWidget);
}
void LoopButton::updateButtonIcons( int value )
{
    setChecked( value != NORMAL );
    setIcon( ( value == REPEAT_ONE ) ? QIcon( ":/buttons/playlist/repeat_one" )
                                     : QIcon( ":/buttons/playlist/repeat_all" ) );
}
Exemple #21
0
void WAbstractToggleButton::setUnChecked()
{
  prevState_ = state_;
  setChecked(false);
}
Exemple #22
0
void TextFieldCheckBox::setText(const QString &s)
{
    setChecked(s == m_trueText);
}
Exemple #23
0
void MappingBool::Update()
{
  setChecked(m_setting->GetValue());
}
 void CheckBox::touchUp(ofTouchEventArgs &touch) {
     Label::touchUp(touch);
     setChecked(!checked);
 }
Exemple #25
0
void SimulatorWin::setupUI()
{
    auto menuBar = player::PlayerProtocol::getInstance()->getMenuService();

    // FILE
    menuBar->addItem("FILE_MENU", tr("File"));
    menuBar->addItem("EXIT_MENU", tr("Exit"), "FILE_MENU");

    // VIEW
    menuBar->addItem("VIEW_MENU", tr("View"));
    SimulatorConfig *config = SimulatorConfig::getInstance();
    int current = config->checkScreenSize(_project.getFrameSize());
    for (int i = 0; i < config->getScreenSizeCount(); i++)
    {
        SimulatorScreenSize size = config->getScreenSize(i);
        std::stringstream menuId;
        menuId << "VIEWSIZE_ITEM_MENU_" << i;
        auto menuItem = menuBar->addItem(menuId.str(), size.title.c_str(), "VIEW_MENU");

        if (i == current)
        {
            menuItem->setChecked(true);
        }
    }

    menuBar->addItem("DIRECTION_MENU_SEP", "-", "VIEW_MENU");
    menuBar->addItem("DIRECTION_PORTRAIT_MENU", tr("Portrait"), "VIEW_MENU")
        ->setChecked(_project.isPortraitFrame());
    menuBar->addItem("DIRECTION_LANDSCAPE_MENU", tr("Landscape"), "VIEW_MENU")
        ->setChecked(_project.isLandscapeFrame());

    menuBar->addItem("VIEW_SCALE_MENU_SEP", "-", "VIEW_MENU");
    std::vector<player::PlayerMenuItem*> scaleMenuVector;
    auto scale100Menu = menuBar->addItem("VIEW_SCALE_MENU_100", tr("Zoom Out").append(" (100%)"), "VIEW_MENU");
    auto scale75Menu = menuBar->addItem("VIEW_SCALE_MENU_75", tr("Zoom Out").append(" (75%)"), "VIEW_MENU");
    auto scale50Menu = menuBar->addItem("VIEW_SCALE_MENU_50", tr("Zoom Out").append(" (50%)"), "VIEW_MENU");
    auto scale25Menu = menuBar->addItem("VIEW_SCALE_MENU_25", tr("Zoom Out").append(" (25%)"), "VIEW_MENU");
    int frameScale = int(_project.getFrameScale() * 100);
    if (frameScale == 100)
    {
        scale100Menu->setChecked(true);
    }
    else if (frameScale == 75)
    {
        scale75Menu->setChecked(true);
    }
    else if (frameScale == 50)
    {
        scale50Menu->setChecked(true);
    }
    else if (frameScale == 25)
    {
        scale25Menu->setChecked(true);
    }
    else
    {
        scale100Menu->setChecked(true);
    }

    scaleMenuVector.push_back(scale100Menu);
    scaleMenuVector.push_back(scale75Menu);
    scaleMenuVector.push_back(scale50Menu);
    scaleMenuVector.push_back(scale25Menu);

    menuBar->addItem("REFRESH_MENU_SEP", "-", "VIEW_MENU");
    menuBar->addItem("REFRESH_MENU", tr("Refresh"), "VIEW_MENU");

    HWND &hwnd = _hwnd;
    ProjectConfig &project = _project;
    auto dispatcher = Director::getInstance()->getEventDispatcher();
    dispatcher->addEventListenerWithFixedPriority(EventListenerCustom::create("APP.EVENT", [&project, &hwnd, scaleMenuVector](EventCustom* event){
        auto menuEvent = dynamic_cast<AppEvent*>(event);
        if (menuEvent)
        {
            rapidjson::Document dArgParse;
            dArgParse.Parse<0>(menuEvent->getDataString().c_str());
            if (dArgParse.HasMember("name"))
            {
                string strcmd = dArgParse["name"].GetString();

                if (strcmd == "menuClicked")
                {
                    player::PlayerMenuItem *menuItem = static_cast<player::PlayerMenuItem*>(menuEvent->getUserData());
                    if (menuItem)
                    {
                        if (menuItem->isChecked())
                        {
                            return;
                        }

                        string data = dArgParse["data"].GetString();
                        auto player = player::PlayerProtocol::getInstance();

                        if ((data == "CLOSE_MENU") || (data == "EXIT_MENU"))
                        {
                            player->quit();
                        }
                        else if (data == "REFRESH_MENU")
                        {
                            player->relaunch();
                        }
                        else if (data.find("VIEW_SCALE_MENU_") == 0) // begin with VIEW_SCALE_MENU_
                        {
                            string tmp = data.erase(0, strlen("VIEW_SCALE_MENU_"));
                            float scale = atof(tmp.c_str()) / 100.0f;
                            project.setFrameScale(scale);

                            auto glview = static_cast<GLViewImpl*>(Director::getInstance()->getOpenGLView());
                            glview->setFrameZoomFactor(scale);

                            // update scale menu state
                            for (auto &it : scaleMenuVector)
                            {
                                it->setChecked(false);
                            }
                            menuItem->setChecked(true);

                            // update window size
                            RECT rect;
                            GetWindowRect(hwnd, &rect);
                            MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top + GetSystemMetrics(SM_CYMENU), FALSE);
                        
                            // fix: can not update window on some windows system 
                            ::SendMessage(hwnd, WM_MOVE, NULL, NULL);
                        }
                        else if (data.find("VIEWSIZE_ITEM_MENU_") == 0) // begin with VIEWSIZE_ITEM_MENU_
                        {
                            string tmp = data.erase(0, strlen("VIEWSIZE_ITEM_MENU_"));
                            int index = atoi(tmp.c_str());
                            SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(index);

                            if (project.isLandscapeFrame())
                            {
                                std::swap(size.width, size.height);
                            }

                            project.setFrameSize(cocos2d::Size(size.width, size.height));
                            project.setWindowOffset(cocos2d::Vec2(player->getPositionX(), player->getPositionY()));
                            player->openProjectWithProjectConfig(project);
                        }
                        else if (data == "DIRECTION_PORTRAIT_MENU")
                        {
                            project.changeFrameOrientationToPortait();
                            player->openProjectWithProjectConfig(project);
                        }
                        else if (data == "DIRECTION_LANDSCAPE_MENU")
                        {
                            project.changeFrameOrientationToLandscape();
                            player->openProjectWithProjectConfig(project);
                        }
                    }
                }
            }
        }
    }), 1);

    AppDelegate *app = _app;
    auto listener = EventListenerCustom::create(kAppEventDropName, [&project, app](EventCustom* event)
    {
        AppEvent *dropEvent = dynamic_cast<AppEvent*>(event);
        if (dropEvent)
        {
            string dirPath = dropEvent->getDataString() + "/";
            string configFilePath = dirPath + CONFIG_FILE;

            if (FileUtils::getInstance()->isDirectoryExist(dirPath) &&
                FileUtils::getInstance()->isFileExist(configFilePath))
            {
                // parse config.json
                ConfigParser::getInstance()->readConfig(configFilePath);

                project.setProjectDir(dirPath);
                project.setScriptFile(ConfigParser::getInstance()->getEntryFile());
                project.setWritablePath(dirPath);

                app->setProjectConfig(project);
                app->reopenProject();
            }
        }
    });
    dispatcher->addEventListenerWithFixedPriority(listener, 1);
}
Exemple #26
0
void StelAction::toggle()
{
	setChecked(!isChecked());
}
void PopupPushButton::popupClosed(int result)
{
    Q_UNUSED(result)
    setChecked(false);
}
void SettingsMenu::init()
{
    if (_initialized) return;
    State::init();

    setModal(true);
    setFullscreen(true);

    // background
    auto background = new Image("art/intrface/prefscrn.frm");
    auto backgroundX = (Game::getInstance()->renderer()->width() - background->width())*0.5;
    auto backgroundY = (Game::getInstance()->renderer()->height() - background->height())*0.5;
    background->setX(backgroundX);
    background->setY(backgroundY);
    addUI(background);

    // Switches (big)
    auto combatDifficultySwitch = new MultistateImageButton(MultistateImageButton::TYPE_BIG_SWITCH, backgroundX+76, backgroundY+71);
    combatDifficultySwitch->setMaxState(3);
    combatDifficultySwitch->setState(Game::getInstance()->settings()->combatDifficulty());
    addUI("combat_difficulty",combatDifficultySwitch);

    auto gameDifficultySwitch = new MultistateImageButton(MultistateImageButton::TYPE_BIG_SWITCH, backgroundX+76, backgroundY+149);
    gameDifficultySwitch->setMaxState(3);
    gameDifficultySwitch->setState(Game::getInstance()->settings()->gameDifficulty());
    addUI("game_difficulty",gameDifficultySwitch);

    auto violenceLevelSwitch = new MultistateImageButton(MultistateImageButton::TYPE_BIG_SWITCH, backgroundX+76, backgroundY+227);
    violenceLevelSwitch->setState(Game::getInstance()->settings()->violenceLevel());
    addUI("violence_level",violenceLevelSwitch);

    auto targetHighlightSwitch = new MultistateImageButton(MultistateImageButton::TYPE_BIG_SWITCH, backgroundX+76, backgroundY+309);
    targetHighlightSwitch->setMaxState(3);
    targetHighlightSwitch->setState(Game::getInstance()->settings()->targetHighlight());
    addUI("target_highlight",targetHighlightSwitch);

    auto combatLooksSwitch = new MultistateImageButton(MultistateImageButton::TYPE_BIG_SWITCH, backgroundX+76, backgroundY+387);
    combatLooksSwitch->setMaxState(2);
    combatLooksSwitch->setState(Game::getInstance()->settings()->combatLooks());
    addUI("combat_looks",combatLooksSwitch);

    // Switches (small)
    auto combatMessagesSwitch = new MultistateImageButton(MultistateImageButton::TYPE_SMALL_SWITCH, backgroundX+299, backgroundY+74);
    combatMessagesSwitch->setState(Game::getInstance()->settings()->combatMessages());
    addUI("combat_messages",combatMessagesSwitch);

    auto combatTauntsSwitch = new MultistateImageButton(MultistateImageButton::TYPE_SMALL_SWITCH, backgroundX+299, backgroundY+74+66);
    combatTauntsSwitch->setState(Game::getInstance()->settings()->combatTaunts());
    addUI("combat_taunts",combatTauntsSwitch);

    auto languageFilterSwitch = new MultistateImageButton(MultistateImageButton::TYPE_SMALL_SWITCH, backgroundX+299, backgroundY+74+66*2);
    languageFilterSwitch->setState(Game::getInstance()->settings()->languageFilter());
    addUI("language_filter",languageFilterSwitch);

    auto runningSwitch = new MultistateImageButton(MultistateImageButton::TYPE_SMALL_SWITCH, backgroundX+299, backgroundY+74+66*3);
    runningSwitch->setState(Game::getInstance()->settings()->running());
    addUI("running",runningSwitch);

    auto subtitlesSwitch = new MultistateImageButton(MultistateImageButton::TYPE_SMALL_SWITCH, backgroundX+299, backgroundY+74+66*4);
    subtitlesSwitch->setState(Game::getInstance()->settings()->subtitles());
    addUI("subtitles",subtitlesSwitch);

    auto itemHightlightSwitch = new MultistateImageButton(MultistateImageButton::TYPE_SMALL_SWITCH, backgroundX+299, backgroundY+74+66*5);
    itemHightlightSwitch->setState(Game::getInstance()->settings()->itemHighlight());
    addUI("item_highlight",itemHightlightSwitch);

    // LABELS
    auto font1_907824ff = ResourceManager::font("font1.aaf", 0x907824ff);
    auto font3_907824ff = ResourceManager::font("font3.aaf", 0x907824ff);
    auto font4_907824ff = ResourceManager::font("font4.aaf", 0x907824ff);

    // GAME PREFERENCES
    _addTextArea(_t(MSG_OPTIONS, 100), backgroundX+74, backgroundY+10)->setFont(font4_907824ff);

    // COMBAT DIFFICULTY
    auto difficulty = _addTextArea(_t(MSG_OPTIONS, 102), backgroundX+21, backgroundY+48);
    difficulty->setWidth(158)->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_CENTER)->setFont(font1_907824ff);

    // GAME DIFFICULTY
    _addTextArea(difficulty, backgroundX+21, backgroundY+48+77)->setText(_t(MSG_OPTIONS, 101));

    // VIOLENCE LEVEL
    _addTextArea(difficulty, backgroundX+21, backgroundY+48+156)->setText(_t(MSG_OPTIONS, 103));

    // TARGET HIGHLIGHT
    _addTextArea(difficulty, backgroundX+21, backgroundY+128+158)->setText(_t(MSG_OPTIONS, 104));

    // COMBAT LOOKS
    _addTextArea(difficulty, backgroundX+21, backgroundY+128+235)->setText(_t(MSG_OPTIONS, 105));

    // COMBAT MESSAGES
    auto combatMessages = _addTextArea(_t(MSG_OPTIONS, 106), backgroundX+206, backgroundY+49);
    combatMessages->setFont(font1_907824ff);

    // COMBAT TAUNTS
    _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66)->setText(_t(MSG_OPTIONS, 107));

    // LANGUAGE FILTER
    _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*2)->setText(_t(MSG_OPTIONS, 108));

    // RUNNING
    _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*3)->setText(_t(MSG_OPTIONS, 109));

    // SUBTITLES
    _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*4)->setText(_t(MSG_OPTIONS, 110));

    // ITEM HIGHLIGHT
    _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*5)->setText(_t(MSG_OPTIONS, 111));

    // COMBAT SPEED
    auto combatSpeed = _addTextArea(_t(MSG_OPTIONS, 112), backgroundX+384, backgroundY+19);
    combatSpeed->setFont(font1_907824ff);

    // TEXT DELAY
    _addTextArea(combatSpeed, backgroundX+384, backgroundY+95)->setText(_t(MSG_OPTIONS, 113));

    // MASTER AUDIO VOLUME
    _addTextArea(combatSpeed, backgroundX+384, backgroundY+165)->setText(_t(MSG_OPTIONS, 114));

    // MUSIC/MOVIE VOLUME
    _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51)->setText(_t(MSG_OPTIONS, 115));

    // SOUND EFFECTS VOLUME
    _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*2)->setText(_t(MSG_OPTIONS, 116));

    // SPEECH VOLUME
    _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*3)->setText(_t(MSG_OPTIONS, 117));

    // BRIGHTNESS LEVEL
    _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*4)->setText(_t(MSG_OPTIONS, 118));

    // MOUSE SENSITIVITY
    _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*5)->setText(_t(MSG_OPTIONS, 119));

    // DEFAULT BUTTON LABEL
    _addTextArea(combatSpeed, backgroundX+43, backgroundY+449)->setText(_t(MSG_OPTIONS, 120))->setFont(font3_907824ff);

    // DONE BUTTON LABEL
    _addTextArea(combatSpeed, backgroundX+169, backgroundY+449)->setText(_t(MSG_OPTIONS, 300))->setFont(font3_907824ff);

    // CANCEL BUTTON LABEL
    _addTextArea(combatSpeed, backgroundX+283, backgroundY+449)->setText(_t(MSG_OPTIONS, 121))->setFont(font3_907824ff);

    // COMBAT DIFFICULTY SWITCH LABELS
    _addTextArea(_t(MSG_OPTIONS, 203), backgroundX+43, backgroundY+81)->setFont(font1_907824ff);     // EASY
    _addTextArea(_t(MSG_OPTIONS, 204), backgroundX+68, backgroundY+67)->setFont(font1_907824ff);     // NORMAL
    _addTextArea(_t(MSG_OPTIONS, 205), backgroundX+122, backgroundY+81)->setFont(font1_907824ff);    // HARD

    // GAME DIFFICULTY SWITCH LABELS
    _addTextArea(_t(MSG_OPTIONS, 206), backgroundX+13, backgroundY+159)->setFont(font1_907824ff);    // WIMPY
    _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+68, backgroundY+145)->setFont(font1_907824ff);    // NORMAL
    _addTextArea(_t(MSG_OPTIONS, 208), backgroundX+122, backgroundY+159)->setFont(font1_907824ff);   // ROUGH

    // VIOLENCE LEVEL SWITCH LABELS
    _addTextArea(_t(MSG_OPTIONS, 214), backgroundX+56, backgroundY+236)->setFont(font1_907824ff);    // NONE
    _addTextArea(_t(MSG_OPTIONS, 215), backgroundX+65, backgroundY+222)->setFont(font1_907824ff);    // MINIMUM
    _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+122, backgroundY+236)->setFont(font1_907824ff);   // NORMAL
    _addTextArea(_t(MSG_OPTIONS, 216), backgroundX+122, backgroundY+257)->setFont(font1_907824ff)->setWidth(60); // MAXIMUM BLOOD

    // TARGET HIGHLIGHT SWITCH LABELS
    _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+42, backgroundY+319)->setFont(font1_907824ff);    // OFF
    _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+88, backgroundY+305)->setFont(font1_907824ff);    // ON
    _addTextArea(_t(MSG_OPTIONS, 213), backgroundX+122, backgroundY+319)->setFont(font1_907824ff)->setWidth(70)->setWordWrap(true); // TARGETING ONLY

    // COMBAT LOOKS SWITCH LABELS
    _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+42, backgroundY+397)->setFont(font1_907824ff);    // OFF
    _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+88, backgroundY+383)->setFont(font1_907824ff);    // ON

    // COMBAT MESSAGES SWITCH LABELS
    auto verboseLabel = _addTextArea(_t(MSG_OPTIONS, 211), backgroundX+203, backgroundY+69);         // VERBOSE
    verboseLabel->setFont(font1_907824ff)
                ->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT)
                ->setWidth(100);
    _addTextArea(_t(MSG_OPTIONS, 212), backgroundX+320, backgroundY+69)->setFont(font1_907824ff);    // BRIEF

    // COMBAT TAUNTS SWITCH LABELS
    _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67)->setText(_t(MSG_OPTIONS, 202)); // OFF
    _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67)->setFont(font1_907824ff); // ON

    // LANGUAGE FILTER SWITCH LABELS
    _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66)->setText(_t(MSG_OPTIONS, 202)); // OFF
    _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67+66)->setFont(font1_907824ff); // ON

    // RUNNING SWITCH LABELS
    _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64)->setText(_t(MSG_OPTIONS, 209)); // NORMAL
    _addTextArea(_t(MSG_OPTIONS, 219), backgroundX+320, backgroundY+69+67+66+64)->setFont(font1_907824ff); // ALWAYS

    // SUBTITLES SWITCH LABELS
    _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+66+65)->setText(_t(MSG_OPTIONS, 202)); // OFF
    _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+66+67+66+65)->setFont(font1_907824ff); // OFF

    // ITEM HIGHLIGHT SWITCH LABELS
    _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64+65+68)->setText(_t(MSG_OPTIONS, 202)); // OFF
    _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+64+67+66+65+68)->setFont(font1_907824ff); // ON

    // AFFECT PLAYER SPEECH
    _addTextArea(_t(MSG_OPTIONS, 122), backgroundX+405, backgroundY+72)->setFont(font1_907824ff);

    // COMBAT SPEED SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+38)->setFont(font1_907824ff);      // NORMAL
    auto fastestLabel = _addTextArea(_t(MSG_OPTIONS, 210), backgroundX+524, backgroundY+38);           // FASTEST
    fastestLabel->setFont(font1_907824ff)
            ->setHorizontalAlign(TextArea::HORIZONTAL_ALIGN_RIGHT)
            ->setWidth(100);

    // TEXT DELAY SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 217), backgroundX+384, backgroundY+113)->setFont(font1_907824ff);     // SLOW
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+469, backgroundY+113)->setFont(font1_907824ff);     // NORMAL
    _addTextArea(fastestLabel, backgroundX+524, backgroundY+113)->setText(_t(MSG_OPTIONS, 218));       // FASTER

    // MASTER AUDIO VOLUME SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184)->setFont(font1_907824ff);     // OFF
    _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+450, backgroundY+184)->setFont(font1_907824ff);     // QUIET
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+494, backgroundY+184)->setFont(font1_907824ff);     // NORMAL
    _addTextArea(fastestLabel, backgroundX+524, backgroundY+184)->setText(_t(MSG_OPTIONS, 222));       // LOUD

    // MUSIC/MOVIE VOLUME SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51)->setFont(font1_907824ff);  // OFF
    _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+450, backgroundY+184+51)->setFont(font1_907824ff);  // QUIET
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+494, backgroundY+184+51)->setFont(font1_907824ff);  // NORMAL
    _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51)->setText(_t(MSG_OPTIONS, 222));    // LOUD

    // SOUND EFFECTS SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*2)->setFont(font1_907824ff);// OFF
    _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+450, backgroundY+184+51*2)->setFont(font1_907824ff);// QUIET
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+494, backgroundY+184+51*2)->setFont(font1_907824ff);// NORMAL
    _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*2)->setText(_t(MSG_OPTIONS, 222));  // LOUD

    // SPEECH VOLUME SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*3)->setFont(font1_907824ff);// OFF
    _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+450, backgroundY+184+51*3)->setFont(font1_907824ff);// QUIET
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+494, backgroundY+184+51*3)->setFont(font1_907824ff);// NORMAL
    _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*3)->setText(_t(MSG_OPTIONS, 222));  // LOUD

    // BRIGHTNESS LEVEL SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*4)->setFont(font1_907824ff);// NORMAL
    _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*4)->setText(_t(MSG_OPTIONS, 223));  // BRIGHTER

    // MOUSE SENSITIVITY SLIDER LABELS
    _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*5)->setFont(font1_907824ff);// NORMAL
    _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*5)->setText(_t(MSG_OPTIONS, 218));  // FASTER

    // BUTTONS

    // button: Default
    auto defaultButton = new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, backgroundX+23, backgroundY+450);
    defaultButton->addEventHandler("mouseleftclick", [this](Event* event){ this->onDefaultButtonClick(dynamic_cast<MouseEvent*>(event)); });
    addUI(defaultButton);

    // button: Done
    auto doneButton = new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, backgroundX+148, backgroundY+450);
    doneButton->addEventHandler("mouseleftclick", [this](Event* event){ this->doSave(); });
    addUI(doneButton);

    // button: Cancel
    auto cancelButton = new ImageButton(ImageButton::TYPE_SMALL_RED_CIRCLE, backgroundX+263, backgroundY+450);
    cancelButton->addEventHandler("mouseleftclick", [this](Event* event){ this->doCancel(); });
    addUI(cancelButton);

    // button: Affect player speed
    auto affectPlayerSpeedCheckBox = new ImageButton(ImageButton::TYPE_CHECKBOX, backgroundX+383, backgroundY+68);
    affectPlayerSpeedCheckBox->setChecked(Game::getInstance()->settings()->playerSpeedup());
    addUI("player_speedup", affectPlayerSpeedCheckBox);

    // SLIDERS
    // COMBAT SPEED SLIDER
    auto combatSpeedSlider = new Slider(backgroundX+384, backgroundY+50);
    combatSpeedSlider->setMinValue(0.0);
    combatSpeedSlider->setMaxValue(50.0);
    combatSpeedSlider->setValue(Game::getInstance()->settings()->combatSpeed());
    addUI("combat_speed",combatSpeedSlider);

    // TEXT DELAY SLIDER
    auto textDelaySlider = new Slider(backgroundX+384, backgroundY+125);
    textDelaySlider->setValue(Game::getInstance()->settings()->textDelay());
    addUI("text_delay",textDelaySlider);

    // MASTER AUDIO VOLUME SLIDER
    auto masterAudioVolumeSlider = new Slider(backgroundX+384, backgroundY+196);
    masterAudioVolumeSlider->setValue(Game::getInstance()->settings()->masterVolume());
    addUI("master_volume", masterAudioVolumeSlider);

    // MUSIC VOLUME SLIDER
    auto musicVolumeSlider = new Slider(backgroundX+384, backgroundY+196+51);
    musicVolumeSlider->setValue(Game::getInstance()->settings()->musicVolume());
    addUI("music_volume", musicVolumeSlider);

    // SOUND EFFECTS VOLUME SLIDER
    auto soundEffectsVolumeSlider = new Slider(backgroundX+384, backgroundY+196+51*2);
    soundEffectsVolumeSlider->setValue(Game::getInstance()->settings()->sfxVolume());
    addUI("sfx_volume", soundEffectsVolumeSlider);

    // SPEECH VOLUME SLIDER
    auto speechVolumeSlider = new Slider(backgroundX+384, backgroundY+196+51*3);
    speechVolumeSlider->setValue(Game::getInstance()->settings()->voiceVolume());
    addUI("voice_volume", speechVolumeSlider);

    // BRIGHTNESS LEVEL SLIDER
    auto brightnessLevelSlider = new Slider(backgroundX+384, backgroundY+196+51*4);
    brightnessLevelSlider->setValue(Game::getInstance()->settings()->brightness());
    addUI("brightness", brightnessLevelSlider);

    // MOUSE SENSITIVITY SLIDER
    auto mouseSensitivitySlider = new Slider(backgroundX+384, backgroundY+196+51*5);
    mouseSensitivitySlider->setValue(Game::getInstance()->settings()->mouseSensitivity());
    addUI("mouse_sensitivity",mouseSensitivitySlider);
}
Exemple #29
0
void ZoomSettingsWidget::fromSettings(const QDesignerSharedSettings &s)
{
    setChecked(s.zoomEnabled());
    const int idx = m_zoomCombo->findData(QVariant(s.zoom()));
    m_zoomCombo->setCurrentIndex(qMax(0, idx));
}
Exemple #30
0
void CheckBox::actionToggle()
{
  setChecked(!checked);
}