MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), mRenderCanvas(0), mImageDataRawPtr(0), mCurrUSMRadius(1), mCurrUSMSharpness(0) { arrayRegisterId = qRegisterMetaType<af::array>(); ui->setupUi(this); setWindowTitle(tr("WildFire Image Editor")); removeToolBar(ui->mainToolBar); ui->zoomXLineEdit->setValidator(new QIntValidator()); ui->zoomYLineEdit->setValidator(new QIntValidator()); ui->zoomWidthLineEdit->setValidator(new QIntValidator()); ui->zoomHeightLineEdit->setValidator(new QIntValidator()); // setup render window mRenderCanvas = new ImageCanvas(); this->setCentralWidget(mRenderCanvas); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(loadImage())); //connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveImage())); connect(ui->actionExit, SIGNAL(triggered()), QApplication::instance(), SLOT(quit())); connect(ui->contrastSlider, SIGNAL(valueChanged(int)), this, SLOT(contrastChanged(int))); connect(ui->brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(brightnessChanged(int))); connect(ui->usmRadiusSlider, SIGNAL(valueChanged(int)), this, SLOT(usmRadiusChanged(int))); connect(ui->usmSharpSlider, SIGNAL(valueChanged(int)), this, SLOT(usmChanged(int))); connect(ui->zoomPushButton, SIGNAL(clicked()), this, SLOT(zoomParamsChanged())); connect(ui->zoomResetPushButton, SIGNAL(clicked()), this, SLOT(zoomReset())); connect(ui->blendBgPushButton, SIGNAL(clicked()), this, SLOT(setBackgroundImageForBlend())); connect(ui->blendFgPushButton, SIGNAL(clicked()), this, SLOT(setForegroudImageForBlend())); connect(ui->blendMskPushButton, SIGNAL(clicked()), this, SLOT(setMaskImageForBlend())); connect(ui->blendBackRadioButton, SIGNAL(clicked()), this, SLOT(showBackground())); connect(ui->blendFrontRadioButton, SIGNAL(clicked()), this, SLOT(showForeground())); connect(ui->blendMskRadioButton, SIGNAL(clicked()), this, SLOT(showMask())); connect(ui->blendRadioButton, SIGNAL(clicked()), this, SLOT(showBlendedImage())); af::setDevice(0); af::info(); }
/** * create the action events create the gui. */ void KJezzball::initXMLUI() { m_newAction = KStdGameAction::gameNew( this, SLOT(newGame()), actionCollection() ); // AB: originally KBounce/KJezzball used Space for new game - but Ctrl+N is // default. We solve this by providing space as an alternative key KShortcut s = m_newAction->shortcut(); s.append(KKeySequence(QKeySequence(Key_Space))); m_newAction->setShortcut(s); KStdGameAction::quit(this, SLOT(close()), actionCollection() ); KStdGameAction::highscores(this, SLOT(showHighscore()), actionCollection() ); m_pauseButton = KStdGameAction::pause(this, SLOT(pauseGame()), actionCollection()); KStdGameAction::end(this, SLOT(closeGame()), actionCollection()); KStdGameAction::configureHighscores(this, SLOT(configureHighscores()),actionCollection()); new KAction( i18n("&Select Background Folder..."), 0, this, SLOT(selectBackground()), actionCollection(), "background_select" ); m_backgroundShowAction = new KToggleAction( i18n("Show &Backgrounds"), 0, this, SLOT(showBackground()), actionCollection(), "background_show" ); m_backgroundShowAction->setCheckedState(i18n("Hide &Backgrounds")); m_backgroundShowAction->setEnabled( !m_backgroundDir.isEmpty() ); m_backgroundShowAction->setChecked( m_showBackground ); m_soundAction = new KToggleAction( i18n("&Play Sounds"), 0, 0, 0, actionCollection(), "toggle_sound"); }
void MainMenu::setVisible (bool visible) { if (visible) updateMenu(); else showBackground( MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) && MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame); OEngine::GUI::Layout::setVisible (visible); }
int QwtDial::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QwtAbstractSlider::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = hasVisibleBackground(); break; case 1: *reinterpret_cast< int*>(_v) = lineWidth(); break; case 2: *reinterpret_cast< Shadow*>(_v) = frameShadow(); break; case 3: *reinterpret_cast< Mode*>(_v) = mode(); break; case 4: *reinterpret_cast< double*>(_v) = origin(); break; case 5: *reinterpret_cast< bool*>(_v) = wrapping(); break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: showBackground(*reinterpret_cast< bool*>(_v)); break; case 1: setLineWidth(*reinterpret_cast< int*>(_v)); break; case 2: setFrameShadow(*reinterpret_cast< Shadow*>(_v)); break; case 3: setMode(*reinterpret_cast< Mode*>(_v)); break; case 4: setOrigin(*reinterpret_cast< double*>(_v)); break; case 5: setWrapping(*reinterpret_cast< bool*>(_v)); break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
GraphLib::Object *Ellipse::copy() { Ellipse *ellipse = new Ellipse(); ellipse->setCorner(corner()); ellipse->setWidth(width()); ellipse->setHeight(height()); ellipse->setBorderWidth(borderWidth()); ellipse->setBorderColor(borderColor()); ellipse->setInnerColor(innerColor()); ellipse->setShowBackground(showBackground()); ellipse->setAspectType(aspectType()); ellipse->setLineStyle(lineStyle()); ellipse->setDashLength(dashLength()); return ellipse; }
void MainMenu::updateMenu() { setCoord(0,0, mWidth, mHeight); if (!mButtonBox) mButtonBox = mMainWidget->createWidget<MyGUI::Widget>("", MyGUI::IntCoord(0, 0, 0, 0), MyGUI::Align::Default); int curH = 0; MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState(); showBackground(state == MWBase::StateManager::State_NoGame); std::vector<std::string> buttons; if (state==MWBase::StateManager::State_Running) buttons.push_back("return"); buttons.push_back("newgame"); if (MWBase::Environment::get().getStateManager()->characterBegin()!= MWBase::Environment::get().getStateManager()->characterEnd()) buttons.push_back("loadgame"); if (state==MWBase::StateManager::State_Running && MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1) buttons.push_back("savegame"); buttons.push_back("options"); if (state==MWBase::StateManager::State_NoGame) buttons.push_back("credits"); buttons.push_back("exitgame"); // Create new buttons if needed for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it) { if (mButtons.find(*it) == mButtons.end()) { MWGui::ImageButton* button = mButtonBox->createWidget<MWGui::ImageButton> ("ImageBox", MyGUI::IntCoord(0, curH, 0, 0), MyGUI::Align::Default); button->setProperty("ImageHighlighted", "textures\\menu_" + *it + "_over.dds"); button->setProperty("ImageNormal", "textures\\menu_" + *it + ".dds"); button->setProperty("ImagePushed", "textures\\menu_" + *it + "_pressed.dds"); button->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::onButtonClicked); button->setUserData(std::string(*it)); mButtons[*it] = button; } } // Start by hiding all buttons int maxwidth = 0; for (std::map<std::string, MWGui::ImageButton*>::iterator it = mButtons.begin(); it != mButtons.end(); ++it) { it->second->setVisible(false); MyGUI::IntSize requested = it->second->getRequestedSize(); if (requested.width > maxwidth) maxwidth = requested.width; } // Now show and position the ones we want for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it) { assert(mButtons.find(*it) != mButtons.end()); MWGui::ImageButton* button = mButtons[*it]; button->setVisible(true); MyGUI::IntSize requested = button->getRequestedSize(); // Trim off some of the excessive padding // TODO: perhaps do this within ImageButton? int trim = 8; button->setImageCoord(MyGUI::IntCoord(0, trim, requested.width, requested.height-trim)); int height = requested.height-trim*2; button->setImageTile(MyGUI::IntSize(requested.width, height)); button->setCoord((maxwidth-requested.width) / 2, curH, requested.width, height); curH += height; } if (state == MWBase::StateManager::State_NoGame) { // Align with the background image int bottomPadding=48; mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight - curH - bottomPadding, maxwidth, curH); } else mButtonBox->setCoord (mWidth/2 - maxwidth/2, mHeight/2 - curH/2, maxwidth, curH); }