void PropertyWidget_OptMargins::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldnt really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); configureWidgets(); if (m_item) { if (m_item->asTextFrame() || m_item->asPathText()) { ParagraphStyle parStyle = m_item->itemText.defaultStyle(); if (m_doc->appMode == modeEdit) m_item->currentTextProps(parStyle); displayOpticalMargins(parStyle); } connectSignals(); } }
void PropertyWidget_PathText::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldnt really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); configureWidgets(); if (m_item) { if (m_item->asPathText()) { pathTextType->setCurrentIndex(m_item->textPathType); flippedPathText->setChecked(m_item->textPathFlipped); showCurveCheckBox->setChecked(m_item->PoShow); distFromCurve->setValue(m_item->BaseOffs * -1); startOffset->setValue(m_item->textToFrameDistLeft()); } connectSignals(); } }
void PropertyWidget_Distance::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldn't really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This won't work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); configureWidgets(); if (!m_item) return; PageItem_TextFrame *textItem = m_item->asTextFrame(); if (m_doc->appMode == modeEditTable) textItem = m_item->asTable()->activeCell().textFrame(); if (!textItem) return; columns->setMaximum(qMax(qRound(textItem->width() / qMax(textItem->ColGap, 10.0)), 1)); columns->setMinimum(1); columns->setValue(textItem->Cols); columnGap->setMinimum(0); if (columnGapLabel->currentIndex() == 0) { columnGap->setMaximum(qMax((textItem->width() / textItem->Cols - textItem->textToFrameDistLeft() - textItem->textToFrameDistRight()) * m_unitRatio, 0.0)); columnGap->setValue(textItem->ColGap*m_unitRatio); } else { columnGap->setMaximum(qMax((textItem->width() / textItem->Cols) * m_unitRatio, 0.0)); columnGap->setValue(textItem->columnWidth() * m_unitRatio); } leftDistance->setValue(textItem->textToFrameDistLeft()*m_unitRatio); topDistance->setValue(textItem->textToFrameDistTop()*m_unitRatio); bottomDistance->setValue(textItem->textToFrameDistBottom()*m_unitRatio); rightDistance->setValue(textItem->textToFrameDistRight()*m_unitRatio); if (columns->value() == 1) { columnGap->setEnabled(false); columnGapLabel->setEnabled(false); } else { columnGap->setEnabled(true); columnGapLabel->setEnabled(true); } showTextDistances(textItem->textToFrameDistLeft(), textItem->textToFrameDistTop(), textItem->textToFrameDistBottom(), textItem->textToFrameDistRight()); verticalAlign->setCurrentIndex(textItem->verticalAlignment()); connectSignals(); }
void SettingsWindow::configureWidgets(MyGUI::Widget* widget) { MyGUI::EnumeratorWidgetPtr widgets = widget->getEnumerator(); while (widgets.next()) { MyGUI::Widget* current = widgets.current(); std::string type = getSettingType(current); if (type == checkButtonType) { std::string initialValue = Settings::Manager::getBool(getSettingName(current), getSettingCategory(current)) ? "#{sOn}" : "#{sOff}"; current->castType<MyGUI::Button>()->setCaptionWithReplacing(initialValue); current->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); } if (type == sliderType) { MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>(); std::string valueStr; if (getSettingValueType(current) == "Float") { // TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget float min,max; getSettingMinMax(scroll, min, max); float value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current)); valueStr = MyGUI::utility::toString((int)value); value = std::max(min, std::min(value, max)); value = (value-min)/(max-min); scroll->setScrollPosition(static_cast<size_t>(value * (scroll->getScrollRange() - 1))); } else { int value = Settings::Manager::getInt(getSettingName(current), getSettingCategory(current)); valueStr = MyGUI::utility::toString(value); scroll->setScrollPosition(value); } scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition); updateSliderLabel(scroll, valueStr); } configureWidgets(current); } }
MainForm::MainForm(QWidget *parent):QWidget(parent) { // Icon für die Anwendung festlegen QIcon Icon(":/img/gnuboy.png"); qApp->setWindowIcon(Icon); this->setWindowTitle(trUtf8("KBoy")); // Objektmember initialisieren Spieleliste=new CGBSpielListModel(); Spieleliste->fromXml(QDir::homePath()+"/.kboy/gamelist.xml"); // Wenn Datei nicht geladen werden kann, bleibt die Liste leer Gnuboy=new QProcess(this); // Grafische Oberfläche aufbauen initWidgets(); buildGUI(); configureWidgets(); // Signal-/Slot-Objekte verknüpfen connectObjects(); }
void PropertyWidget_TextColor::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldnt really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; disconnectSignals(); m_item = item; if (item && m_doc.isNull()) setDoc(item->doc()); configureWidgets(); if (m_item == NULL) return; if (!m_item->isTable() && !m_item->isTextFrame()) return; PageItem_TextFrame *i2; if (m_doc->appMode == modeEditTable) i2 = m_item->asTable()->activeCell().textFrame(); else i2 = m_item->asTextFrame(); if (i2 != 0) revertButton->setChecked(i2->reversed()); if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable()) { ParagraphStyle parStyle = m_item->itemText.defaultStyle(); if (m_doc->appMode == modeEdit) m_item->currentTextProps(parStyle); else if (m_doc->appMode == modeEditTable) m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle); updateStyle(parStyle); } connectSignals(); }
void PropertyWidget_ParEffect::setCurrentItem(PageItem *item) { if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); if (!m_item) return; if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable()) { configureWidgets(); ParagraphStyle parStyle = m_item->itemText.defaultStyle(); if (m_doc->appMode == modeEdit || m_doc->appMode == modeEditTable) m_item->currentTextProps(parStyle); updateStyle(parStyle); connectSignals(); } }
AssetChildItem::AssetChildItem( QListViewItem *parent, const AssetVersion &ver, const std::string &msg ) : QListViewItem( parent ), AssetWatcher(ver->GetRef()) { configureWidgets(ver, msg); }
AssetChildItem::AssetChildItem( QListView *parent, const AssetVersion &ver) : QListViewItem( parent ), AssetWatcher(ver->GetRef()) { configureWidgets(ver); }
SettingsWindow::SettingsWindow() : WindowBase("openmw_settings_window.layout"), mKeyboardMode(true) { configureWidgets(mMainWidget); setTitle("#{sOptions}"); getWidget(mSettingsTab, "SettingsTab"); getWidget(mOkButton, "OkButton"); getWidget(mResolutionList, "ResolutionList"); getWidget(mFullscreenButton, "FullscreenButton"); getWidget(mWindowBorderButton, "WindowBorderButton"); getWidget(mTextureFilteringButton, "TextureFilteringButton"); getWidget(mAnisotropyBox, "AnisotropyBox"); getWidget(mControlsBox, "ControlsBox"); getWidget(mResetControlsButton, "ResetControlsButton"); getWidget(mKeyboardSwitch, "KeyboardButton"); getWidget(mControllerSwitch, "ControllerButton"); getWidget(mWaterTextureSize, "WaterTextureSize"); #ifndef WIN32 // hide gamma controls since it currently does not work under Linux MyGUI::ScrollBar *gammaSlider; getWidget(gammaSlider, "GammaSlider"); gammaSlider->setVisible(false); MyGUI::TextBox *textBox; getWidget(textBox, "GammaText"); textBox->setVisible(false); getWidget(textBox, "GammaTextDark"); textBox->setVisible(false); getWidget(textBox, "GammaTextLight"); textBox->setVisible(false); #endif mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &SettingsWindow::onWindowResize); mSettingsTab->eventTabChangeSelect += MyGUI::newDelegate(this, &SettingsWindow::onTabChanged); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged); mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected); mWaterTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterTextureSizeChanged); mKeyboardSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onKeyboardSwitchClicked); mControllerSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onControllerSwitchClicked); center(); mResetControlsButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onResetDefaultBindings); // fill resolution list int screen = Settings::Manager::getInt("screen", "Video"); int numDisplayModes = SDL_GetNumDisplayModes(screen); std::vector < std::pair<int, int> > resolutions; for (int i = 0; i < numDisplayModes; i++) { SDL_DisplayMode mode; SDL_GetDisplayMode(screen, i, &mode); resolutions.push_back(std::make_pair(mode.w, mode.h)); } std::sort(resolutions.begin(), resolutions.end(), sortResolutions); for (std::vector < std::pair<int, int> >::const_iterator it=resolutions.begin(); it!=resolutions.end(); ++it) { std::string str = MyGUI::utility::toString(it->first) + " x " + MyGUI::utility::toString(it->second) + " (" + getAspect(it->first,it->second) + ")"; if (mResolutionList->findItemIndexWith(str) == MyGUI::ITEM_NONE) mResolutionList->addItem(str); } highlightCurrentResolution(); std::string tmip = Settings::Manager::getString("texture mipmap", "General"); mTextureFilteringButton->setCaption(textureMipmappingToStr(tmip)); int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water"); if (waterTextureSize >= 512) mWaterTextureSize->setIndexSelected(0); if (waterTextureSize >= 1024) mWaterTextureSize->setIndexSelected(1); if (waterTextureSize >= 2048) mWaterTextureSize->setIndexSelected(2); mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video")); mKeyboardSwitch->setStateSelected(true); mControllerSwitch->setStateSelected(false); }