//------------------------------------------------------------------------- // Program Main method. //------------------------------------------------------------------------- void main(int argc, char **argv) { glutInit(&argc, argv); centerOnScreen(); glutInitWindowSize(window_width, window_height); glutInitWindowPosition(window_x, window_y); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutCreateWindow(window_title); // Initialiser init(); glewInit(); if (glewIsSupported("GL_VERSION_4_5")) { std::cout << "GLEW Version is 4.5" << std::endl; } else { std::cout << "GLEW 4.5 not supported" << std::endl; } //glEnable(GL_DEPTH_TEST); // Set the callback functions glutDisplayFunc(display); // Boucle executant les processus glutMainLoop(); }
Debrief::Debrief() : Dialog("Debrief"), mDebriefing(NULL), mNextMission(NULL), mReplay(NULL), mHomeBase(NULL), mMissionSelector(NULL) { setBackground(new FrameBackground()); Dimension screenSize = rGUIManager()->getScreenDimension(); setSize(MAGIC_DEBRIEF_WIDTH, MAGIC_DEBRIEF_HEIGHT); centerOnScreen(); mDebriefing = new Label(L"DEBRIEFING"); mNextMission = new Button(L"Next Mission", this); mReplay = new Button(L"Replay Mission", this); mHomeBase = new Button(L"Home Base", this); mMissionSelector = new Button(L"Missions", this); GridLayout* gridLayout = new GridLayout(this, 32, 24); gridLayout->set_borders(3); gridLayout->set_padding(2); gridLayout->add(new Label(L"Mission Complete: Debriefing"), 0, 0, 26, 1); gridLayout->add(mDebriefing, 0, 1, 32, 22); gridLayout->add(mMissionSelector, 0, 23, 6, 1); gridLayout->add(mHomeBase, 6, 23, 6, 1); gridLayout->add(mReplay, 20, 23, 6, 1); gridLayout->add(mNextMission, 26, 23, 6, 1); layout(); }
//------------------------------------------------------------------------- // Program Main method. //------------------------------------------------------------------------- void main (int argc, char **argv) { // Set the window x and y coordinates such that the // window becomes centered centerOnScreen (); // Connect to the windowing system + create a window // with the specified dimensions and position // + set the display mode + specify the window title. glutInit(&argc, argv); glutInitWindowSize (window_width, window_height); glutInitWindowPosition (window_x, window_y); glutInitDisplayMode (GLUT_RGBA | GLUT_DOUBLE); glutCreateWindow (window_title); // View in full screen if the full_screen flag is on if (full_screen) glutFullScreen (); // Set OpenGL program initial state. init(); // Set the callback functions glutDisplayFunc (display); glutReshapeFunc (reshape); glutMouseFunc (mouse); glutMotionFunc (motion); glutPassiveMotionFunc (pmotion); glutKeyboardFunc (keyboard); glutSpecialFunc (special); // Start GLUT event processing loop glutMainLoop(); }
ActivateDialog::ActivateDialog() : Dialog("ActivateDialog") { setBackground(new FrameBackground()); Dimension screenSize = rGUIManager()->getScreenDimension(); setSize(MAGIC_ACTIVATE_DIALOG_WIDTH, MAGIC_ACTIVATE_DIALOG_HEIGHT); centerOnScreen(); mInstructions = new Label(L"Please type in your ordering email address"); mInstructions->setSize(480, 25); mInstructions->setPosition(10, 10); add(mInstructions); mEmailField = new TextField(); mEmailField->setSize(480, 25); mEmailField->setPosition(10, 40); add(mEmailField); mActivateButton = new Button(L"Activate"); mActivateButton->setSize(60, 20); mActivateButton->setPosition(370, 70); mActivateButton->addActionListener(this); add(mActivateButton); mCancelButton = new Button(L"Cancel"); mCancelButton->setSize(60, 20); mCancelButton->setPosition(433, 70); mCancelButton->addActionListener(this); add(mCancelButton); #ifndef SELF_TEST mLoadingDialog = new LoadingDialog("ActivateDialog"); #endif }
MessageReader::MessageReader() : Dialog("MessageReader"), mMessageList(NULL), mMessagePane(NULL), mCloseButton(NULL) { setBackground(new FrameBackground()); Dimension screenSize = rGUIManager()->getScreenDimension(); setSize(MAGIC_MESSAGE_READER_WIDTH, MAGIC_MESSAGE_READER_HEIGHT); centerOnScreen(); mMessageList = new List(3, this, true); mMessageList->setBackground(new FrameBackground()); mMessageList->setColumnWidth(0, 0.15); mMessageList->setColumnWidth(1, 0.30); mMessageList->setColumnWidth(2, 0.55); mMessagePane = new Label(); mMessagePane->setBackground(new FrameBackground()); mCloseButton = new Button(L"Close", this); GridLayout* gridLayout = new GridLayout(this, 32, 24); gridLayout->set_borders(3); gridLayout->set_padding(2); gridLayout->add(new Label(L"Messages"), 0, 0, 26, 1); gridLayout->add(mCloseButton, 26, 0, 6, 1); gridLayout->add(mMessageList, 0, 1, 32, 11); gridLayout->add(mMessagePane, 0, 12, 32, 12); layout(); }
void LLAlertDialog::setVisible( BOOL visible ) { LLModalDialog::setVisible( visible ); if( visible ) { centerOnScreen(); make_ui_sound("UISndAlert"); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ setupUi(this); centerOnScreen(); initAudioReader(); initAudioWriter(); connect(audioReader, SIGNAL(dataUpdated(const char*,int)), audioWriter, SLOT(writeData(const char*,int))); }
void WebViewWindow::open(const QUrl& url) { show(); mWebView->show(); loadWebInspector(); centerOnScreen(); if (mWebView->url() == url) mWebView->reload(); else mWebView->setUrl(url); mAddressBar->setText(url.toString()); }
LLModalDialog::LLModalDialog( const LLSD& key, BOOL modal ) : LLFloater(key), mModal( modal ) { if (modal) { setCanMinimize(FALSE); setCanClose(FALSE); } setVisible( FALSE ); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); centerOnScreen(); // default position mCloseSignal.connect(boost::bind(&LLModalDialog::stopModal, this)); }
LLModalDialog::LLModalDialog( const LLString& title, S32 width, S32 height, BOOL modal ) : LLFloater( "modal container", LLRect( 0, height, width, 0 ), title, FALSE, // resizable DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, // drag_on_left modal ? FALSE : TRUE, // minimizable modal ? FALSE : TRUE, // close button TRUE), // bordered mModal( modal ) { setVisible( FALSE ); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); centerOnScreen(); // default position }
MissionSelector::MissionSelector() : Dialog("MissionSelector"), mCampaignList(NULL), mCampaignDesc(NULL), mMissionList(NULL), mMissionDesc(NULL), mHomeBaseButton(NULL), mStartButton(NULL), mCloseButton(NULL), mMissionNum(0), mCurrentCampaign(NULL) { setBackground(new FrameBackground()); Dimension screenSize = rGUIManager()->getScreenDimension(); setSize(MAGIC_MISSION_SELECTOR_WIDTH, MAGIC_MISSION_SELECTOR_HEIGHT); centerOnScreen(); mCampaignList = new List(1, this); mCampaignList->setBackground(new FrameBackground()); mCampaignDesc = new Label(); mCampaignDesc->setBackground(new FrameBackground()); mMissionList = new List(1, this); mMissionList->setBackground(new FrameBackground()); mMissionDesc = new Label(); mMissionDesc->setBackground(new FrameBackground()); mHomeBaseButton = new Button(L"Home Base", this); mStartButton = new Button(L"Start Mission", this); mCloseButton = new Button(L"Close", this); GridLayout* gridLayout = new GridLayout(this, 32, 24); gridLayout->set_borders(3); gridLayout->set_padding(2); gridLayout->add(new Label(L"Missions available - Select Campaign"), 0, 0, 26, 1); gridLayout->add(mCampaignList, 0, 1, 14, 7); gridLayout->add(mCampaignDesc, 14, 1, 18, 7); gridLayout->add(new Label(L"Available missions"), 0, 8, 26, 1); gridLayout->add(mMissionList, 0, 9, 14, 14); gridLayout->add(mMissionDesc, 14, 9, 18, 14); gridLayout->add(mHomeBaseButton, 6, 23, 6, 1); gridLayout->add(mStartButton, 0, 23, 6, 1); gridLayout->add(mCloseButton, 26, 23, 6, 1); layout(); }
reportView::reportView(const QString &reportLocation) : KDialogBase( (QWidget *)0, "report", false, QString::null, Close ), m_locationCode(reportLocation) { QVBox *vbox = makeVBoxMainWidget(); m_reportView = new KHTMLPart(vbox, "m_reportView"); KConfig config( "weather_panelappletrc" ); config.setGroup( "General Options" ); QSize defaultSize( 450, 325 ); resize( config.readSizeEntry( "reportview_size", &defaultSize ) ); centerOnScreen( this ); m_weatherService = new WeatherService_stub( "KWeatherService", "WeatherService" ); QPixmap icon = m_weatherService->icon( m_locationCode ); setIcon( icon ); render(); }
void main(int argc, char* argv[]){ /****************************************/ /* Initialize GLUT and create window */ /****************************************/ glutInit(&argc, argv); // Set the window x and y coordinates such that the // window becomes centered centerOnScreen(); // Connect to the windowing system + create a window // with the specified dimensions and position // + set the display mode + specify the window title. glutInitWindowSize(window_width, window_height); glutInitWindowPosition(window_x, window_y); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); main_window = glutCreateWindow("Bind Mesh"); init(); glutDisplayFunc(onDisplay); glutReshapeFunc(onReshape); glutKeyboardFunc(onKeyboard); GLUI_Master.set_glutDisplayFunc(onDisplay); GLUI_Master.set_glutReshapeFunc(onReshape); GLUI_Master.set_glutKeyboardFunc(onKeyboard); scene = Scene(800, 600); //scene.createModel("tube.skel", "tube.skin"); //window = Window(800, 600, scene); //window.main_window = main_window; // Setup all GLUI stuff setupGLUI(); glutMainLoop(); }
AddAppletDialog::AddAppletDialog(ContainerArea* cArea, QWidget* parent, const char* name) : KDialogBase(parent, name, false, i18n("Add Applet"), 0), m_selectedApplet(0), m_containerArea(cArea), m_insertionPoint(Kicker::the()->insertionPoint()), m_closing(false), m_searchDelay(new QTimer(this)) { m_mainWidget = new AppletView(this, "AddAppletDialog::m_mainWidget"); m_mainWidget->appletScrollView->setResizePolicy(QScrollView::Manual); m_mainWidget->appletScrollView->setHScrollBarMode(QScrollView::AlwaysOff); m_mainWidget->appletScrollView->viewport()->setPaletteBackgroundColor(KGlobalSettings::baseColor()); setMainWidget(m_mainWidget); resize(configDialogSize("AddAppletDialog Settings")); centerOnScreen(this); KGuiItem addGuiItem = KStdGuiItem::add(); addGuiItem.setText(m_mainWidget->appletInstall->text()); m_mainWidget->appletInstall->setEnabled(false); m_mainWidget->appletInstall->setGuiItem(addGuiItem); m_mainWidget->closeButton->setGuiItem(KStdGuiItem::close()); connect(m_mainWidget->appletSearch, SIGNAL(textChanged(const QString&)), this, SLOT(delayedSearch())); connect(m_searchDelay, SIGNAL(timeout()), this, SLOT(search())); connect(m_mainWidget->appletFilter, SIGNAL(activated(int)), this, SLOT(filter(int))); connect(m_mainWidget->appletInstall, SIGNAL(clicked()), this, SLOT(addCurrentApplet())); connect(m_mainWidget->closeButton, SIGNAL(clicked()), this, SLOT(close())); m_selectedType = AppletInfo::Undefined; m_appletBox = 0; QTimer::singleShot(0, this, SLOT(populateApplets())); }
void setupWindow(int argc, char* args[]){ // Hide the mouse cursor //GLUT Window Initialization glutInit(&(argc),args); glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE); glutInitWindowSize(width,height); centerOnScreen (); glutInitWindowPosition(window_x ,window_y); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glutCreateWindow("skyGesture Pre-Alpha Build v0.001a"); //register callback glutDisplayFunc(display); glutReshapeFunc(reshape); glutIdleFunc(display); glutKeyboardFunc(pressNormalKeys); glutKeyboardUpFunc(releaseNormalKeys); glutSpecialFunc(pressSpecialKeys); glutSpecialUpFunc(releaseSpecialKeys); glutMouseFunc(mouse); glutMotionFunc(mouseMotion); // OpenGL init //glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); //initialize loop for(int i = 0; i < 256; i++) keyStates[i] = false; for(int i = 0; i < 246; i++) keySpecialStates[i] = false; //enter GLUT event processing cycle glutMainLoop(); }
//------------------------------------------------------------------------- // Program Main method. //------------------------------------------------------------------------- void main (int argc, char **argv) { // Connect to the windowing system glutInit(&argc, argv); // create a window with the specified dimensions glutInitWindowSize (window_width, window_height); // Set the window x and y coordinates such that the // window becomes centered centerOnScreen (); // Position Window glutInitWindowPosition (window_x, window_y); // Set Display mode glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE); // Create window with the specified title glutCreateWindow (window_title); // View in full screen if the full_screen flag is on if (full_screen) glutFullScreen (); // Set OpenGL program initial state. init(); // Set the callback functions glutDisplayFunc (display); glutReshapeFunc (reshape); glutIdleFunc (idle); // Start GLUT event processing loop glutMainLoop(); }
CGUIAudioDialog::CGUIAudioDialog() : CRRCDialog() { // Create Widgets comboSampleRate = new puaComboBox(LABEL_W + DLG_DEF_SPACE, BUTTON_BOX_HEIGHT + 4 * DLG_DEF_SPACE + 2 * SLIDER_H + COMBO_H, LABEL_W + COMBO_W, BUTTON_BOX_HEIGHT + 4 * DLG_DEF_SPACE + 2 * SLIDER_H + 2 * COMBO_H, NULL, false); comboSampleRate->setChildColourScheme(PUCLASS_POPUPMENU, dlgCol1[0], dlgCol1[1], dlgCol1[2]); comboSampleRate->newList((char**) samplerates); comboSampleRate->setLabelPlace(PUPLACE_CENTERED_LEFT); comboSampleRate->setLabel(_("Sample Rate")); { int nIdx = 0; std::string cr = cfgfile->getString("sound.samplerate"); std::string tmp; for (int n=0; n<3; n++) { tmp = samplerates[n]; if (tmp.find(cr) == 0) nIdx = n; } comboSampleRate->setCurrentItem(nIdx); } comboSampleRate->reveal(); comboEngine = new puaComboBox(LABEL_W + DLG_DEF_SPACE, BUTTON_BOX_HEIGHT + 3 * DLG_DEF_SPACE + 2 * SLIDER_H, LABEL_W + COMBO_W, BUTTON_BOX_HEIGHT + 3 * DLG_DEF_SPACE + 2 * SLIDER_H + COMBO_H, NULL, false); comboEngine->setChildColourScheme(PUCLASS_POPUPMENU, dlgCol1[0], dlgCol1[1], dlgCol1[2]); comboEngine->newList((char**) enginesound); comboEngine->setLabelPlace(PUPLACE_CENTERED_LEFT); comboEngine->setLabel(_("Engine sound")); comboEngine->setCurrentItem(cfgfile->getInt("sound.throttle.mode", 1)); comboEngine->hide(); slider_variovol = new puSlider(LABEL_W + DLG_DEF_SPACE, BUTTON_BOX_HEIGHT + 2 * DLG_DEF_SPACE + 1 * SLIDER_H, SLIDER_W, FALSE, SLIDER_H); slider_variovol->setLabelPlace(PUPLACE_CENTERED_LEFT); slider_variovol->setLabel(_("Variometer volume")); slider_variovol->setSliderFraction(0.05); slider_variovol->setMinValue(0); slider_variovol->setMaxValue(16); slider_variovol->setStepSize(1); slider_variovol->setValue(cfgfile->getInt("sound.variometer.vol")); slider_modelvol = new puSlider(LABEL_W + DLG_DEF_SPACE, BUTTON_BOX_HEIGHT + 1 * DLG_DEF_SPACE + 0* SLIDER_H, SLIDER_W, FALSE, SLIDER_H); slider_modelvol->setLabelPlace(PUPLACE_CENTERED_LEFT); slider_modelvol->setLabel(_("Model volume")); slider_modelvol->setSliderFraction(0.05); slider_modelvol->setMinValue(0); slider_modelvol->setMaxValue(1.0); slider_modelvol->setStepSize(0.05); slider_modelvol->setValue((float)Global::soundserver->getModelVolume() / (float)SDL_MIX_MAXVOLUME); // finalize the dialog close(); setSize(SLIDER_W + LABEL_W + 2*DLG_DEF_SPACE, 2*SLIDER_H + 5*DLG_DEF_SPACE + 2 * COMBO_H + BUTTON_BOX_HEIGHT); setCallback(CGUIAudioCallback); centerOnScreen(); reveal(); }
void LLModalDialog::reshape(S32 width, S32 height, BOOL called_from_parent) { LLFloater::reshape(width, height, called_from_parent); centerOnScreen(); }
CGUICalibMapDialog::CGUICalibMapDialog() : CRRCDialog(0, 0, CRRC_DIALOG_OK), state(0), numaxis(0) { // activate the test mode to see the movements of the model activate_test_mode(); //activate verbosity sVerbosity = Global::nVerbosity; Global::nVerbosity =1; // create some label strings from scratch // ("0", "1", ...) for (int i = 0; i < TX_MAXAXIS; i++) { // attention: only works for TX_MAXAXIS < 10 axislabel[i] = new char[2]; *(axislabel[i]) = 0x30 + i; *(axislabel[i] + 1) = '\0'; } axislabel[TX_MAXAXIS] = NULL; // Create the selection list for the SelectBoxes. // Contains as many axis as the interface features, // plus "-" (deactivate) and NULL (terminate). // The number of axis will be stored to make sure // it doesn't change until the dialog is closed. numaxis = Global::TXInterface->getNumAxes(); if (numaxis > TX_MAXAXIS) { numaxis = TX_MAXAXIS; } for (int i = 0; i < numaxis; i++) { selectlist[i] = axislabel[i]; } selectlist[numaxis] = mapped_to_keyboard; selectlist[numaxis+1] = NULL; // The "mapping group" (left part of the dialog). // The combo box on top is not part of the group // because it controls hiding and revealing of the // other widgets. mapgroup = new puGroup(LABEL_W + DLG_DEF_SPACE, BUTTON_BOX_HEIGHT); for (int i = 0; i < NUM_FUNCTIONS; i++) { int index = NUM_FUNCTIONS - 1; axismapping[i] = new puaSelectBox(0, (index-i)* DLG_DEF_SPACE + (index-i) * INPUT_H, INPUT_W, (index-i)* DLG_DEF_SPACE + (index+1-i) * INPUT_H, (char **)selectlist ); axismapping[i]->setLabelPlace(PUPLACE_CENTERED_LEFT); axismapping[i]->setLabel(Global::inputDev->AxisStringsGUI[i+1]); int item = Global::TXInterface->map->func[i+1]; if (item < 0) { // disable (set to "K") item = numaxis; } axismapping[i]->setCurrentItem(item); axismapping[i]->setUserData(this); axismapping[i]->setCallback(CGUIMapCallback); invert[i] = new puButton(DLG_DEF_SPACE + INPUT_W, 4 + (index-i)* DLG_DEF_SPACE + (index-i) * INPUT_H, DLG_DEF_SPACE + INPUT_W + DLG_CHECK_W, 4 + (index-i)* DLG_DEF_SPACE + (index-i) * INPUT_H + DLG_CHECK_H); invert[i]->setButtonType(PUBUTTON_VCHECK); invert[i]->setLabelPlace(PUPLACE_CENTERED_RIGHT); invert[i]->setLabel(_("Inv")); if (Global::TXInterface->map->inv[i+1] > 0) { invert[i]->setValue(0); } else { invert[i]->setValue(1); } invert[i]->setUserData(this); invert[i]->setCallback(CGUIMapCallback); } mapgroup->close(); mapgroup->hide(); // The combo box above the "mapping group" combo_radiotype = new puaComboBox(LABEL_W + DLG_DEF_SPACE, BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS)* DLG_DEF_SPACE + (NUM_FUNCTIONS) * INPUT_H, LABEL_W + DLG_DEF_SPACE + COMBO_W, BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS)* DLG_DEF_SPACE + (NUM_FUNCTIONS + 1) * INPUT_H, NULL, false); combo_radiotype->setChildColourScheme(PUCLASS_POPUPMENU, dlgCol1[0], dlgCol1[1], dlgCol1[2]); combo_radiotype->newList(radioTypes); combo_radiotype->setLabelPlace(PUPLACE_CENTERED_LEFT); combo_radiotype->setLabel(_("Radio type")); combo_radiotype->setUserData(this); combo_radiotype->setCurrentItem(Global::TXInterface->map->radioType()); combo_radiotype->setCallback(CGUIComboCallback); if (combo_radiotype->getCurrentItem() == T_AxisMapper::CUSTOM) { mapgroup->reveal(); } if ((Global::TXInterface->inputMethod() == T_TX_Interface::eIM_mouse) || (Global::TXInterface->inputMethod() == T_TX_Interface::eIM_joystick)) { Global::TXInterface->map->setRadioType(T_AxisMapper::CUSTOM); combo_radiotype->setCurrentItem(Global::TXInterface->map->radioType()); combo_radiotype->hide(); } else { combo_radiotype->reveal(); } // The "calibration group" (right part of the dialog). calibgroup = new puGroup(LABEL_W + 3*DLG_DEF_SPACE + DLG_CHECK_W + INPUT_W + HORIZ_SPACER, BUTTON_BOX_HEIGHT + DLG_DEF_SPACE); for (int i = 0; i < TX_MAXAXIS; i++) { axis[i] = new puSlider( i*SLIDER_SP + i * SLIDER_W, LABEL_H + DLG_DEF_SPACE + DLG_DEF_BUTTON_HEIGHT, SLIDER_SZ, TRUE, SLIDER_W); axis[i]->setLabelPlace(PUPLACE_BOTTOM_CENTERED); axis[i]->setLabel(axislabel[i]); axis[i]->setValue((float)0.5); // set min and max to some excessive values minval[i] = 1.0e30; maxval[i] = -1.0e30; } butCalibrate = new puOneShot( 0, 0, DLG_DEF_BUTTON_WIDTH + 10, DLG_DEF_BUTTON_HEIGHT); butCalibrate->setLegend(_("Calibrate")); butCalibrate->setLabelPlace(PUPLACE_BOTTOM_LEFT); butCalibrate->setLabel(""); butCalibrate->setUserData(this); butCalibrate->setCallback(CGUICalibButtonCallback); if (Global::TXInterface->usesCalibration()) { butCalibrate->reveal(); } else { butCalibrate->hide(); } calibgroup->close(); // finalize the dialog close(); setSize(LABEL_W + (TX_MAXAXIS -1)*SLIDER_SP + DLG_DEF_SPACE+ DLG_CHECK_W + INPUT_W + 2*HORIZ_SPACER + TX_MAXAXIS * SLIDER_W, BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS+3) * DLG_DEF_SPACE + (NUM_FUNCTIONS+1) * INPUT_H); setCallback(CGUICalibMapCallback); centerOnScreen(); //set the dialogue transparent and hide the others dialogues to better see the model setTransparency(.3); hideOthers(); reveal(); }
static inline void centerOnScreen(QWidget *w) { centerOnScreen(w, w->geometry().size()); }
HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, const char* name) : KDialogBase(parent, name, false, i18n("History for %1").arg(mc->displayName()), 0), mSearching(false) { QString fontSize; QString htmlCode; QString fontStyle; kdDebug(14310) << k_funcinfo << "called." << endl; setWFlags(Qt::WDestructiveClose); // send SIGNAL(closing()) on quit // FIXME: Allow to show this dialog for only one contact mMetaContact = mc; // Widgets initializations mMainWidget = new HistoryViewer(this, "HistoryDialog::mMainWidget"); mMainWidget->searchLine->setFocus(); mMainWidget->searchLine->setTrapReturnKey (true); mMainWidget->searchLine->setTrapReturnKey(true); mMainWidget->searchErase->setPixmap(BarIcon("locationbar_erase")); mMainWidget->contactComboBox->insertItem(i18n("All")); mMetaContactList = Kopete::ContactList::self()->metaContacts(); QPtrListIterator<Kopete::MetaContact> it(mMetaContactList); for(; it.current(); ++it) { mMainWidget->contactComboBox->insertItem((*it)->displayName()); } if (mMetaContact) mMainWidget->contactComboBox->setCurrentItem(mMetaContactList.find(mMetaContact)+1); mMainWidget->dateSearchLine->setListView(mMainWidget->dateListView); mMainWidget->dateListView->setSorting(0, 0); //newest-first setMainWidget(mMainWidget); // Initializing HTML Part mMainWidget->htmlFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); QVBoxLayout *l = new QVBoxLayout(mMainWidget->htmlFrame); mHtmlPart = new KHTMLPart(mMainWidget->htmlFrame, "htmlHistoryView"); //Security settings, we don't need this stuff mHtmlPart->setJScriptEnabled(false); mHtmlPart->setJavaEnabled(false); mHtmlPart->setPluginsEnabled(false); mHtmlPart->setMetaRefreshEnabled(false); mHtmlPart->setOnlyLocalReferences(true); mHtmlView = mHtmlPart->view(); mHtmlView->setMarginWidth(4); mHtmlView->setMarginHeight(4); mHtmlView->setFocusPolicy(NoFocus); mHtmlView->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); l->addWidget(mHtmlView); QTextOStream( &fontSize ) << KopetePrefs::prefs()->fontFace().pointSize(); fontStyle = "<style>.hf { font-size:" + fontSize + ".0pt; font-family:" + KopetePrefs::prefs()->fontFace().family() + "; color: " + KopetePrefs::prefs()->textColor().name() + "; }</style>"; mHtmlPart->begin(); htmlCode = "<html><head>" + fontStyle + "</head><body class=\"hf\"></body></html>"; mHtmlPart->write( QString::fromLatin1( htmlCode.latin1() ) ); mHtmlPart->end(); connect(mHtmlPart->browserExtension(), SIGNAL(openURLRequestDelayed(const KURL &, const KParts::URLArgs &)), this, SLOT(slotOpenURLRequest(const KURL &, const KParts::URLArgs &))); connect(mMainWidget->dateListView, SIGNAL(clicked(QListViewItem*)), this, SLOT(dateSelected(QListViewItem*))); connect(mMainWidget->searchButton, SIGNAL(clicked()), this, SLOT(slotSearch())); connect(mMainWidget->searchLine, SIGNAL(returnPressed()), this, SLOT(slotSearch())); connect(mMainWidget->searchLine, SIGNAL(textChanged(const QString&)), this, SLOT(slotSearchTextChanged(const QString&))); connect(mMainWidget->searchErase, SIGNAL(clicked()), this, SLOT(slotSearchErase())); connect(mMainWidget->contactComboBox, SIGNAL(activated(int)), this, SLOT(slotContactChanged(int))); connect(mMainWidget->messageFilterBox, SIGNAL(activated(int)), this, SLOT(slotFilterChanged(int ))); connect(mHtmlPart, SIGNAL(popupMenu(const QString &, const QPoint &)), this, SLOT(slotRightClick(const QString &, const QPoint &))); //initActions KActionCollection* ac = new KActionCollection(this); mCopyAct = KStdAction::copy( this, SLOT(slotCopy()), ac ); mCopyURLAct = new KAction( i18n( "Copy Link Address" ), QString::fromLatin1( "editcopy" ), 0, this, SLOT( slotCopyURL() ), ac ); resize(650, 700); centerOnScreen(this); // show the dialog before people get impatient show(); // Load history dates in the listview init(); }
//------------------------------------------------------------------------- // Program Main method. //------------------------------------------------------------------------- void main (int argc, char **argv) { // Connect to the windowing system glutInit(&argc, argv); // create a window with the specified dimensions glutInitWindowSize (window_width, window_height); // Set the window x and y coordinates such that the // window becomes centered centerOnScreen (); // Position Window glutInitWindowPosition (window_x, window_y); // Set Display mode glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE); // Create window with the specified title main_window = glutCreateWindow (window_title); // Set the callback functions for main window glutDisplayFunc (main_display); glutReshapeFunc (main_reshape); glutKeyboardFunc (keyboard); // Set the position and dimensions of subwindows! subwindow_1 = glutCreateSubWindow (main_window, GAP, GAP, 200, 200); glutDisplayFunc (display1); glutMouseFunc (mouse); glutMotionFunc (motion); glutKeyboardFunc (keyboard); subwindow_2 = glutCreateSubWindow (main_window, 200 + GAP*2, GAP, 200, 200); glutDisplayFunc (display2); glutMouseFunc (mouse); glutMotionFunc (motion); glutKeyboardFunc (keyboard); subwindow_3 = glutCreateSubWindow (main_window, 400 + GAP*3, GAP, 200, 200); glutDisplayFunc (display3); glutMouseFunc (mouse); glutMotionFunc (motion); glutKeyboardFunc (keyboard); subwindow_4 = glutCreateSubWindow (main_window, GAP, 200 + GAP * 2, 200, 200); glutDisplayFunc (display4); glutMouseFunc (mouse); glutMotionFunc (motion); glutKeyboardFunc (keyboard); subwindow_5 = glutCreateSubWindow (main_window, 200 + GAP*2, 200 + GAP * 2, 200, 200); glutDisplayFunc (display5); glutMouseFunc (mouse); glutMotionFunc (motion); glutKeyboardFunc (keyboard); subwindow_6 = glutCreateSubWindow (main_window, 400 + GAP*3, 200 + GAP * 2, 200, 200); glutDisplayFunc (display6); glutMouseFunc (mouse); glutMotionFunc (motion); glutKeyboardFunc (keyboard); // Start GLUT event processing loop glutMainLoop(); }