// Read the command set from settings. bool QsciCommandSet::readSettings(QSettings &qs, const char *prefix) { bool rc = true; QString skey; for (int i = 0; i < cmds.count(); ++i) { QsciCommand *cmd = cmds.at(i); skey.sprintf("%s/keymap/c%d/", prefix, static_cast<int>(cmd->command())); int key; bool ok; // Read the key. key = qs.readNumEntry(skey + "key", 0, &ok); if (ok) cmd->setKey(key); else rc = false; // Read the alternate key. key = qs.readNumEntry(skey + "alt", 0, &ok); if (ok) cmd->setAlternateKey(key); else rc = false; } return rc; }
/*! Reads the registry to determine the location of the main window, and whether or not to display the splash screen. If so, it shows the GraspIt! logo splash screen in the center of the screen. */ void GraspItApp::showSplash() { QRect screen = QApplication::desktop()->screenGeometry(); QSettings config; config.insertSearchPath( QSettings::Windows, "/Columbia" ); QRect mainRect; QString keybase = "/GraspIt/0.9/"; bool show = config.readBoolEntry( keybase + "SplashScreen", TRUE ); mainRect.setX( config.readNumEntry( keybase + "Geometries/MainwindowX", 0 ) ); mainRect.setY( config.readNumEntry( keybase + "Geometries/MainwindowY", 0 ) ); mainRect.setWidth( config.readNumEntry( keybase + "Geometries/MainwindowWidth", 500 ) ); mainRect.setHeight( config.readNumEntry( keybase + "Geometries/MainwindowHeight", 500 ) ); screen = QApplication::desktop()->screenGeometry( QApplication::desktop()->screenNumber( mainRect.center() ) ); if ( show ) { splash = new QLabel( 0, "splash",Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); // WStyle_Customize | WStyle_StaysOnTop splash->setAttribute(Qt::WA_DeleteOnClose,true); splash->setFrameStyle( QFrame::WinPanel | QFrame::Raised ); splash->setPixmap(load_pixmap( "splash.jpg" )); splash->adjustSize(); splash->setFixedSize(splash->sizeHint()); splash->setCaption( "GraspIt!" ); splash->move( screen.center() - QPoint( splash->width() / 2, splash->height() / 2 ) ); splash->show(); splash->repaint( FALSE ); QApplication::flush(); // set_splash_status( "Initializing..." ); } }
void CODBCConfig::LoadState() { #if QT_VERSION>=300 #ifdef QT_V4LAYOUT QSettings settings( "unixODBC", "odbcinstQ" );; #else QSettings settings; #endif // main window { #ifdef Q_WS_X11 int nX = settings.readNumEntry( "/unixODBC/ODBCConfig/x", geometry().x() ); int nY = settings.readNumEntry( "/unixODBC/ODBCConfig/y", geometry().y() ); int nW = settings.readNumEntry( "/unixODBC/ODBCConfig/w", geometry().width() ); int nH = settings.readNumEntry( "/unixODBC/ODBCConfig/h", geometry().height() ); setGeometry( nX, nY, nW, nH ); #else int nW = settings.readNumEntry( "/unixODBC/ODBCConfig/w", geometry().width() ); int nH = settings.readNumEntry( "/unixODBC/ODBCConfig/h", geometry().height() ); resize( nW, nH ); #endif } #endif }
/*! *\~english * Reads window size from config file. *\~russian * Читает размер окна из конфиг. *\~ * \param mdname - \~english Window name. * If config not contains info about mdname, * return default value (400x300) * \~russian Имя окна. * Если конфиг не содержит информации об окне с таким именем, * возвращает значение по умолчанию (400x300) \~ * \return - \~english Window size \~russian Размер окна \~ * \see saveSize2Config(QRect windowSize, const QString &mdname) * */ QRect aService::loadSizeFromConfig(const QString &mdname) { QSettings settings; settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas")); settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" ); settings.beginGroup(QString("/config/%1").arg(mdname)); int l = settings.readNumEntry("/left", 0); int t = settings.readNumEntry("/top", 0); int r = settings.readNumEntry("/right", 400); int b = settings.readNumEntry("/bottom", 300); return QRect(l,t,r,b); }
void QCPPDialogImpl::readSettings() { QSettings settings; m_hardwareCb->setChecked(settings.readBoolEntry("/cutecom/HardwareHandshake", false)); m_softwareCb->setChecked(settings.readBoolEntry("/cutecom/SoftwareHandshake", false)); m_readCb->setChecked(settings.readBoolEntry("/cutecom/OpenForReading", true)); m_writeCb->setChecked(settings.readBoolEntry("/cutecom/OpenForWriting", true)); m_applyCb->setChecked(!settings.readBoolEntry("/cutecom/DontApplySettings", false)); enableSettingWidgets(m_applyCb->isChecked()); m_baudCb->setCurrentItem(settings.readNumEntry("/cutecom/Baud", 7)); m_dataBitsCb->setCurrentItem(settings.readNumEntry("/cutecom/Databits", 3)); m_parityCb->setCurrentItem(settings.readNumEntry("/cutecom/Parity", 0)); m_stopCb->setCurrentItem(settings.readNumEntry("/cutecom/Stopbits", 0)); m_protoPb->setCurrentItem(settings.readNumEntry("/cutecom/Protocol", 0)); m_inputModeCb->setCurrentItem(settings.readNumEntry("/cutecom/LineMode", 0)); m_hexOutputCb->setChecked(settings.readBoolEntry("/cutecom/HexOutput", false)); m_charDelaySb->setValue(settings.readNumEntry("/cutecom/CharDelay", 1)); m_sendFileDialogStartDir=settings.readEntry("/cutecom/SendFileDialogStartDir", QDir::homeDirPath()); m_logFileLe->setText(settings.readEntry("/cutecom/LogFileName", QDir::homeDirPath()+"/cutecom.log")); m_logAppendCb->setCurrentItem(settings.readNumEntry("/cutecom/AppendToLogFile", 0)); int x=settings.readNumEntry("/cutecom/width", -1); int y=settings.readNumEntry("/cutecom/height", -1); if ((x>100) && (y>100)) resize(x,y); bool entryFound=false; QStringList devices=settings.readListEntry("/cutecom/AllDevices", &entryFound); if (!entryFound) devices<<"/dev/ttyS0"<<"/dev/ttyS1"<<"/dev/ttyS2"<<"/dev/ttyS3"; m_deviceCb->insertStringList(devices); m_deviceCb->setCurrentText(settings.readEntry("/cutecom/CurrentDevice", "/dev/ttyS0")); QStringList history=settings.readListEntry("/cutecom/History"); if (!history.empty()) { m_oldCmdsLb->insertStringList(history); m_oldCmdsLb->setCurrentItem(m_oldCmdsLb->count()-1); m_oldCmdsLb->ensureCurrentVisible(); m_oldCmdsLb->clearSelection(); } }
QTlen::QTlen( QWidget *parent, const char *name ) : QMainWindow( parent, name ), v_tray( false ), v_quit( false ) { QSettings settings; settings.setPath( "qtlen.berlios.de", "QTlen" ); settings.beginGroup( "/window" ); setGeometry( settings.readNumEntry( "/main/xpos", 50 ), settings.readNumEntry( "/main/ypos", 50 ), settings.readNumEntry( "/main/width", 225 ), settings.readNumEntry( "/main/height", 450 ) ); settings.resetGroup(); PresenceManager::initModule(); Tlen::initModule(); MessageManager::initModule(); RosterManager::initModule(); PubdirManager::initModule(); SoundManager::initModule(); setCaption( "QTlen: "+tlen_manager->getJid() ); setIcon( takePixmap("offline") ); settings.beginGroup( "/general" ); roster = new RosterBox( this ); setCentralWidget( roster ); addToolBars(); if( settings.readBoolEntry( "/trayicon/activated" ) ) activeTrayIcon(); else v_quit = true; settings.resetGroup(); connect( presence_manager, SIGNAL( statusChanged( PresenceManager::PresenceStatus, const QString& ) ), SLOT( statusChanged( PresenceManager::PresenceStatus, const QString& ) ) ); connect( tlen_manager, SIGNAL( connecting() ), SLOT( connecting() ) ); }
void CODBCCreate::LoadState() { #if QT_VERSION>=300 QSettings settings; // main window { #ifdef Q_WS_X11 int nX = settings.readNumEntry( "/unixODBC/ODBCCreate/x", geometry().x() ); int nY = settings.readNumEntry( "/unixODBC/ODBCCreate/y", geometry().y() ); int nW = settings.readNumEntry( "/unixODBC/ODBCCreate/w", geometry().width() ); int nH = settings.readNumEntry( "/unixODBC/ODBCCreate/h", geometry().height() ); setGeometry( nX, nY, nW, nH ); #else int nW = settings.readNumEntry( "/unixODBC/ODBCCreate/w", geometry().width() ); int nH = settings.readNumEntry( "/unixODBC/ODBCCreate/h", geometry().height() ); resize( nW, nH ); #endif } #endif }
void RcFile::loadData (Parm name, int &value, const int n) { QString k; k.append("/Qtstalker/"); k.append(Key[name]); if (n > -1) k.append(QString::number(n)); QString v = Def[name]; value = v.toInt(); QSettings settings; value = settings.readNumEntry(k, value); }
//чтение настроек void MainForm::readSettings() { QSettings settings; settings.setPath("pku.ru", "ExecutionControl"); settings.beginGroup("/ExecutionControl"); settings.beginGroup("/geometry"); int x = settings.readNumEntry("/x", 200); int y = settings.readNumEntry("/y", 200); int w = settings.readNumEntry("/width", 400); int h = settings.readNumEntry("/height", 200); move(x, y); resize(w, h); settings.endGroup(); settings.beginGroup("/widthColumn"); for(int col = 0; col < topicTable->numCols(); col++) topicTable->setColumnWidth(col, settings.readNumEntry("/" + QString::number(col), 150)); settings.endGroup(); settings.beginGroup("/connectDatabase"); hostName = settings.readEntry("/hostname"); userName = settings.readEntry("/username"); password = settings.readEntry("/password"); settings.endGroup(); settings.endGroup(); }
void CDPWizard::loadDefaults() { QSettings myQSettings; leMeanTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/meanTemp")); leMinTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/minTemp")); leMaxTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/maxTemp")); leDiurnalTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/diurnalTemp")); leMeanPrecipitation->setText(myQSettings.readEntry("/qgis/cdpwizard/meanPrecip")); leFrostDays->setText(myQSettings.readEntry("/qgis/cdpwizard/frostDays")); leTotalSolarRadiation->setText(myQSettings.readEntry("/qgis/cdpwizard/totalSolarRadiation")); QString myOutputDir = myQSettings.readEntry("/qgis/cdpwizard/DefaultDirectories/OutputDir",QDir::homeDirPath()); leOutputPath->setText(myOutputDir); cboOutputFormat->setCurrentItem(myQSettings.readNumEntry("/qgis/cdpwizard/outputFormat")); }
void OptionHandler::reloadSettings() { // gather options... QSettings config; config.beginGroup("/baghira/Style"); //we need that first to make sure we use some proper settings ;) customButtonColor = QColor(config.readNumEntry("Design_ButtonColor",(int)qApp->palette().active().button().rgb())); // design handling: // first try file: QString tmpString; FILE *file = NULL; wmDesign = 5; for (int i = 0; i < 8; i++) custCols[i] = -1; if (qstrcmp( qApp->argv() [ 0 ], "ksplash" ) == 0) { style_ = Panther; _toolbuttonStyle = Panther; _buttonStyle = Panther; tabStyle_ = Clever; bgStipple = false; inactiveButtonColor = Background; } else { // first try for a tmp file from bab starter int tmpFile = 0; tmpString = QDir::homeDirPath() + "/.baghira/.bab/" + qApp->argv() [ 0 ]; file = fopen(tmpString.latin1(), "r"); if( file == NULL ) { tmpFile = 1; tmpString = QDir::homeDirPath() + "/.baghira/" + qApp->argv() [ 0 ]; file = fopen(tmpString.latin1(), "r"); if( file == NULL ) { tmpFile = 2; tmpString = QDir::homeDirPath() + "/.baghira/.bab/.style"; file = fopen(tmpString.latin1(), "r"); } } if (file != NULL) { style_ = _buttonStyle = _toolbuttonStyle = Panther; int i3 = inactiveButtonColor = -1; tabStyle_ = (tabStyle)-1; fscanf(file,"%u\n%u\n%u\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",&style_, &wmDesign, &_buttonStyle, &_toolbuttonStyle, &tabStyle_, &i3, &custCols[0], &custCols[1], &custCols[2], &custCols[3], &custCols[4], &custCols[5], &custCols[6], &custCols[7], &inactiveButtonColor); fclose(file); if (_toolbuttonStyle < 0 || _toolbuttonStyle >= NUMSTYLES) _toolbuttonStyle = (Style)config.readNumEntry( "Special_ToolbuttonStyle", style_); if (_buttonStyle < 0 || _buttonStyle >= NUMSTYLES) _buttonStyle = (Style)config.readNumEntry( "Special_ButtonStyle", style_); if (tabStyle_ < 0 || tabStyle_ > 2) tabStyle_ = (tabStyle) config.readNumEntry( (style_ == Brushed)?"Design_TabStyleBrushed":"Design_TabStyleAqua", Clever); if (inactiveButtonColor < 0 || inactiveButtonColor > 3) inactiveButtonColor = config.readNumEntry( "Design_InactiveButtonStyle", Background); if (style_ == Brushed) bgStipple = TRUE; else if (i3 == 0) bgStipple = FALSE; else bgStipple = config.readBoolEntry( "Design_StippleBackground", true ); // inactive Button if (tmpFile == 0) remove(tmpString.latin1()); // remove TEMPORARY file else if (tmpFile == 2) { tmpString = QDir::homeDirPath() + "/.baghira/.bab/.deco"; if ((file = fopen(tmpString.latin1(), "r")) != NULL) { fscanf(file,"%u\n%u\n",&i3, &wmDesign); fclose(file); } } } else { style_ = (Style)config.readNumEntry( "Design_Default", Panther ); _toolbuttonStyle = (Style)config.readNumEntry( "Special_ToolbuttonStyle", style_); _buttonStyle = (Style)config.readNumEntry( "Special_ButtonStyle", style_); tabStyle_ = (tabStyle) config.readNumEntry( (style_ == Brushed)?"Design_TabStyleBrushed":"Design_TabStyleAqua", Clever); bgStipple = (style_ == Brushed) ? true : config.readBoolEntry( "Design_StippleBackground", true ); inactiveButtonColor = config.readNumEntry( "Design_InactiveButtonStyle", Background); } } contrast = 0; if (wmDesign > 4) wmDesign = style_; if (style_ == Jaguar) contrast = 4; else if (style_ == Brushed) { tintBrush = config.readBoolEntry( "Colors_TintBrushedMetal", false ); if (tintBrush) brushTint.setRgb( config.readNumEntry( "Colors_BrushTint", ( int ) bgColor().rgb())); } // menu stuff glossyMenus_ = config.readBoolEntry( "Menu_Glossy", true ); menuBackground = config.readNumEntry( "Menu_Background", Standard); menuOpacity = config.readNumEntry( "Menu_Opacity", 70); int menuColorStyle = config.readNumEntry( "Menu_ColorStyle", 0); menuColorButton = (menuColorStyle == 1); useCustomMenuColor = (menuColorStyle == 2); shadowText = config.readBoolEntry( "Menu_ShadowText", false); if (useCustomMenuColor){ color = QColor( config.readNumEntry( "Menu_Color1", 0 ) ); color2 = QColor( config.readNumEntry( "Menu_Color2", 0 ) ); colorHigh = QColor( config.readNumEntry( "Menu_ColorHighlight", 0 ) ); fgColor = QColor( config.readNumEntry( "Menu_TextColor", 0 ) ); fgColorHigh = QColor( config.readNumEntry( "Menu_TextColorHighlight", 0 ) ); } else if (menuColorButton){ color = customButtonColor; color2 = customButtonColor.dark(130); } else { color = qApp->palette().active().background(); color2 = qApp->palette().active().background().dark(130); } drawMenuStripe_ = config.readBoolEntry("Menu_DrawMenuStripe", false); if (drawMenuStripe_) menuStripeColor_ = QColor(config.readNumEntry("Menu_StripeColor"),(int)Qt::white.rgb()); // color stuff // widgets customWidgetColor = config.readBoolEntry( "Colors_UseCustomColors", false); if ( customWidgetColor ) { customColors[ CustomRadioOn ].setRgb( config.readNumEntry( "Colors_RadioOn", ( int ) buttonColor().rgb() ) ); customColors[ CustomRadioOff ].setRgb( config.readNumEntry( "Colors_RadioOff", ( int ) bgColor().rgb() ) ); customColors[ CustomCBOn ].setRgb( config.readNumEntry( "Colors_CheckOn", ( int ) buttonColor().rgb() ) ); customColors[ CustomCBOff ].setRgb( config.readNumEntry( "Colors_CheckOff", ( int ) bgColor().rgb() ) ); customColors[ CustomTabOn ].setRgb( config.readNumEntry( "Colors_TabActive", ( int ) buttonColor().rgb() ) ); customColors[ CustomTabOff ].setRgb( config.readNumEntry( "Colors_TabInactive", ( int ) bgColor().rgb() ) ); customColors[ CustomSBSlider ].setRgb( config.readNumEntry( "Colors_Slider", ( int ) bgColor().rgb() ) ); customColors[ CustomSBSliderHover ].setRgb( config.readNumEntry( "Colors_SliderHovered", ( int ) buttonColor().rgb() ) ); customColors[ CustomSBSliderPressed ].setRgb( config.readNumEntry( "Colors_SliderPressed", ( int ) buttonColor().dark(110).rgb() ) ); customColors[ CustomSBGroove ].setRgb( config.readNumEntry( "Colors_SliderGroove", ( int ) bgColor().rgb() ) ); } if (inactiveButtonColor == Custom) customInactiveButtonColor = QColor( config.readNumEntry( "Design_InactiveButtonColor", (int) bgColor().rgb())); contrast += config.readNumEntry( "Design_StippleContrast", 3); bevelHighlights_ = config.readBoolEntry( "Design_BevelAsHighlight", true); //shadows groupboxshadow = (style_ == Brushed) ? false : config.readBoolEntry( "Design_ShadowGroupBoxes", true ); shadowDarkness = config.readNumEntry( "Design_GroupBoxeShadowDarkness", 6); //ListViews expanderStyle = config.readNumEntry( "Special_ExpanderStyle", Apple); useCustomExpanderColor = config.readBoolEntry( "Special_CustomExpanderColor", false); if (useCustomExpanderColor) expanderColor = QColor( config.readNumEntry( "Special_ExpanderColor", (int) qApp->palette().active().text().rgb())); drawDotlines = config.readBoolEntry( "Special_DrawTreeLines", true); if (drawDotlines){ dotlineStyle = config.readNumEntry( "Special_TreelineStyle", Line); dotlineColor = QColor( config.readNumEntry( "Special_TreelineColor", (int) qApp->palette().active().mid().rgb())); } //slider squeezesbslider = config.readBoolEntry( "Special_SqueezeSlider", false ); shadowsbslider = config.readBoolEntry( "Special_ShadowSlider", false ); animateSlider = config.readBoolEntry( "Special_AnimateSlider", true ); // toolbar int utb = config.readNumEntry( "Special_UnhoveredToolButtons", 2 ); tbFrame = (utb == 2) || ((style_ == Brushed) && (utb == 1)) || ((style_ != Brushed) && (utb == 0)); // tweaks centerTabs = config.readBoolEntry( "Design_CenterTabs", true); smoothListViewHeaders = (style_ == Milk) ? true : !config.readBoolEntry( "Special_UseFlatLVH", false); smootherLVH = config.readBoolEntry( "Special_RoundTaskbuttons", false); icyButtons = config.readNumEntry( "Design_ButtonStyle", 0) == 0; progressBar = config.readNumEntry( "Special_ProgressStyle", baghira); removeKickerBevel = config.readBoolEntry( "Special_RemoveKickerBevel", false); animateButton = config.readBoolEntry( "Design_AnimateButtons", true); animateProgress = config.readBoolEntry( "Design_AnimateProgress", true); drawProgressLabel = config.readBoolEntry( "Special_ShowProgressValue", false); config.endGroup(); config.beginGroup("/baghira/Deco"); titleButtonColor_[0] = QColor((unsigned int)config.readNumEntry( "CloseButtonColor", QColor(200,85,70).rgb())); titleButtonColor_[1] = QColor((unsigned int)config.readNumEntry( "MinButtonColor", QColor(230,155,40).rgb())); titleButtonColor_[2] = QColor((unsigned int)config.readNumEntry( "MaxButtonColor", QColor(121,180,54).rgb())); if (style_ == Jaguar) { titleColor_[0] = QColor((unsigned int)config.readNumEntry( "inactiveColor1_1", QColor(204,214,230).rgb())); titleColor_[1] = QColor((unsigned int)config.readNumEntry( "inactiveColor2_1", QColor(194,196,211).rgb())); } else if (style_ != Brushed) { titleColor_[0] = QColor((unsigned int)config.readNumEntry( "activeColor1_2", QColor(238,238,238).rgb())); titleColor_[1] = QColor((unsigned int)config.readNumEntry( "activeColor2_2", QColor(205,202,205).rgb())); } if (style_ == Tiger) { int r,g,b; aDecoColor1_ = QColor((unsigned int)config.readNumEntry( "activeColor2_4", (unsigned int) QColor(205,202,205).rgb())); aDecoColor2_ = QColor((unsigned int)config.readNumEntry( "activeColor1_4", (unsigned int) QColor(238,238,238).rgb())); r = (int)CLAMP(aDecoColor1_.red() * pow((double)aDecoColor1_.red() / (double)aDecoColor2_.red(),2.0),0,255); g = (int)CLAMP(aDecoColor1_.green() * pow((double)aDecoColor1_.green() / (double)aDecoColor2_.green(),2.0),0,255); b = (int)CLAMP(aDecoColor1_.blue() * pow((double)aDecoColor1_.blue() / (double)aDecoColor2_.blue(),2.0),0,255); aDecoColor2_.setRgb(r,g,b); } else { aDecoColor1_ = Qt::black; aDecoColor2_ = Qt::black; } config.endGroup(); // Option gathered }
Message::Message( QString j, MType t, QWidget *parent, const char *name ) : QWidget( parent, name ) { QSettings settings; settings.setPath( "qtlen.sf.net", "QTlen" ); settings.beginGroup( "/window/message" ); resize( settings.readNumEntry( "/width", 400 ), settings.readNumEntry( "/height", 450 ) ); settings.resetGroup(); setIcon( QPixmap("msg.png") ); setJid( takeJid( j ) ); setMType( t ); QBoxLayout *mainLayout = new QVBoxLayout( this, 0, -1, "Main layout for message widget" ); QBoxLayout *topLayout = new QHBoxLayout( this ); mainLayout->addLayout( topLayout ); QLabel *label = new QLabel( mtype == Message::New ? tr("To:") : tr("From:"), this ); topLayout->addWidget( label ); QString contactName = roster_manager->getContactName( jid ); destination = new QLineEdit( contactName.isEmpty() ? jid : contactName+" <"+jid+">", this ); topLayout->addWidget( destination ); if( mtype == Message::Revice ) destination->setReadOnly( true ); QString captionText = tr("Message "); captionText += mtype == Message::New ? tr("to: ") : tr("from: "); captionText += contactName.isEmpty() ? jid : contactName; setCaption( captionText ); topLayout = new QHBoxLayout( this ); mainLayout->addLayout( topLayout ); if( mtype == Message::New ) { label = new QLabel( tr("Send as:"), this ); topLayout->addWidget( label ); sendAs = new QComboBox( this ); sendAs->insertItem( takePixmap( "msg" ), tr("Normal") ); sendAs->insertItem( takePixmap( "msg-chat" ), tr("Chat") ); sendAs->setCurrentItem( 0 ); sendAs->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ); topLayout->addWidget( sendAs ); } else if( mtype == Message::Revice ) { QBoxLayout *datetimeLayout = new QHBoxLayout( this ); mainLayout->addLayout( datetimeLayout ); label = new QLabel( tr("Time:"), this ); datetimeLayout->addWidget( label ); datetimeEdit = new QLineEdit( this ); datetimeEdit->setReadOnly( true ); datetimeLayout->addWidget( datetimeEdit ); } message = new QTextEdit( this ); message->setTextFormat( Qt::PlainText ); mainLayout->addWidget( message ); if( mtype == Message::Revice ) message->setReadOnly( true ); QBoxLayout *buttomLayout = new QHBoxLayout( this ); mainLayout->addLayout( buttomLayout ); QPushButton *exitButton = new QPushButton( QIconSet( takePixmap( "close" ) ), tr("Exit"), this ); exitButton->setFixedWidth( 100 ); buttomLayout->addWidget( exitButton ); buttomLayout->addStretch(); if(destination->text().isEmpty()) destination->setFocus(); else message->setFocus(); QPushButton *sendButton = new QPushButton( QIconSet( takePixmap( "send" ) ), mtype == Message::New ? tr("Send") : tr("Reply"), this ); sendButton->setFixedWidth( 100 ); buttomLayout->addWidget( sendButton ); if( t == Message::New ) connect( sendButton, SIGNAL( released() ), SLOT( send() )); else connect( sendButton, SIGNAL( released() ), SLOT( reply() )); connect( destination, SIGNAL( textChanged( const QString & ) ), SLOT( changeCaption( const QString & ) ) ); connect( exitButton, SIGNAL( released() ), SLOT(close()) ); }
SessionControl::SessionControl(const char *name) { output = 0; input = 0; useoss = true; setVideoSW( QString::null ); setVideoDEV( QString::null ); dorem = false; dowat = false; doisb = true; prack=KSipPreferences::NoPRACK; pprack=KSipPreferences::NoPPRACK; audioMode=isOSS; QSettings settings; pFix = QString::fromAscii( name); payload = settings.readNumEntry( KStatics::dBase+pFix+"/dsp/SizeOfPayload", 160 ); useStun = false; stunSrv = ""; occupyActive=false; bool ok; int pcodec=0,scodec=0,tcodec=0,qcodec=0,fcodec=0; int l=0; for (l=0;l<20;l++) { useL4v[l] = usertpL4; allowHold[l] = false; allowTransfer[l] = false; onlyActive[l] = false; AllowRemoteStart[l]=false; } debug=KStatics::debugLevel; #ifndef SRTP settings.writeEntry( KStatics::dBase + "SRTP/Mode", "disabled" ); #endif notiExpires = settings.readNumEntry(KStatics::dBase+pFix+"/General/CTNotificationExpiresTime", 10)*1000 ; dtmfWait = settings.readNumEntry(KStatics::dBase+pFix+"/General/DTMFSequenceTime", 1000); Auacnt=settings.readEntry( KStatics::dBase+pFix+"/sip/AuaCnt", "60"); forwardNAcnt=settings.readEntry( KStatics::dBase+pFix+"/sip/callforwardNAcnt", "50"); if(forwardNAcnt<5) forwardNAcnt=5; //minimal time forwardNAuri=settings.readEntry( KStatics::dBase+pFix+"/sip/callforwardNAUri", ""); forwardBuri=settings.readEntry( KStatics::dBase+pFix+"/sip/callforwardBUri", ""); docfna=false; docfnb=false; doaua=false; totalNumberOfPrefAudioCodecs=NAUDIO; totalNumberOfPrefVideoCodecs=NVIDEO; vCodecName[0] = H261D; vCodecNum[0] = H261N; vCodecName[1] = H263D; vCodecNum[1] = H263N; vCodecName[2] = H263PD; vCodecNum[2] = H263PN; aCodecName[0] = PCMUD; aCodecNum[0] = PCMUN; aCodecName[1] = PCMAD; aCodecNum[1] = PCMAN; aCodecName[2] = GSMD; aCodecNum[2] = GSMN; aCodecName[3] = ILBCD; aCodecNum[3] = ILBCN; aCodecName[4] = SPEEXD; aCodecNum[4] = SPEEXN; //Initialisation of commandline and vectorID extSW[1] = settings.readEntry(KStatics::dBase+pFix+"/SessionType1/exec", "kedit" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType1/exec",extSW[1]); extSW[2] = settings.readEntry(KStatics::dBase+pFix+"/SessionType2/exec", "kedit" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType2/exec",extSW[2]); extSW[3] = settings.readEntry(KStatics::dBase+pFix+"/SessionType3/exec", "kedit" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType3/exec",extSW[3]); extSW[4] = settings.readEntry(KStatics::dBase+pFix+"/SessionType4/exec", "kedit" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType4/exec",extSW[4]); extPR[1] = settings.readEntry(KStatics::dBase+pFix+"/SessionType1/param", "" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType1/param", extPR[1]); extPR[2] = settings.readEntry(KStatics::dBase+pFix+"/SessionType2/param", "" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType2/param", extPR[2]); extPR[3] = settings.readEntry(KStatics::dBase+pFix+"/SessionType3/param", "" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType3/param", extPR[3]); extPR[4] = settings.readEntry(KStatics::dBase+pFix+"/SessionType4/param", "" ); settings.writeEntry( KStatics::dBase+pFix+"/SessionType4/param", extPR[4]); vectorId[1] = settings.readEntry(KStatics::dBase+pFix+"/SessionType1/VectorId","no"); settings.writeEntry( KStatics::dBase+pFix+"/SessionType1/VectorId",vectorId[1] ); vectorId[2] = settings.readEntry(KStatics::dBase+pFix+"/SessionType2/VectorId","no"); settings.writeEntry( KStatics::dBase+pFix+"/SessionType2/VectorId",vectorId[2] ); vectorId[3] = settings.readEntry(KStatics::dBase+pFix+"/SessionType3/VectorId","no"); settings.writeEntry( KStatics::dBase+pFix+"/SessionType3/VectorId",vectorId[3] ); vectorId[4] = settings.readEntry(KStatics::dBase+pFix+"/SessionType4/VectorId","no"); settings.writeEntry( KStatics::dBase+pFix+"/SessionType4/VectorId",vectorId[4] ); videoSW = settings.readEntry( KStatics::dBase+pFix+"/Video/videoSW","vic"); videoDEV = settings.readEntry( KStatics::dBase+pFix+"/Video/device","/dev/video0"); setOSSFilename( settings.readEntry( KStatics::dBase+pFix+"/Audio/oss-filename", "/dev/dsp") ); setOSSFilename2( settings.readEntry( KStatics::dBase+pFix+"/Audio/oss-filename2" , "/dev/dsp") ); setALSAFilename( settings.readEntry( KStatics::dBase+pFix+"/Audio/alsa-filename" , "hw:0,0") ); setRingtonedevice(settings.readEntry( KStatics::dBase+pFix+"/Audio/ringtone-device", "hw:0,0" ) ); setRingtonefile( settings.readEntry( KStatics::dBase+pFix+"/Audio/ringtone-file" , QString(SHARE_DIR) + "/ring/ring.wav") ); setRingtoneP( settings.readEntry( KStatics::dBase+pFix+"/Audio/ringtone-parameters", "%D %F" ) ); setRingtoneapp( settings.readEntry( KStatics::dBase+pFix+"/Audio/ringtone-application","kphoneringsh" ) ); setRinging (settings.readNumEntry( KStatics::dBase+pFix+"/General/Ringtone", 0 ) ); setAudioRW( settings.readEntry( KStatics::dBase+pFix+"/Audio/mode","readonly_writeonly" ) ); if( settings.readEntry( KStatics::dBase+pFix+"/Audio/audio","alsa" ) == "oss" ) { setAudioSys( isOSS ); } else if( settings.readEntry( KStatics::dBase+pFix+"/Audio/audio", "alsa" ) == "alsa" ) { setAudioSys( isALSA ); } else { setAudioSys( isALSA ); } if( settings.readEntry( KStatics::dBase + pFix + "/sip/remdialer", "No" ) == "Yes" ) { setRem( true ); } else { setRem( false ); } if( settings.readEntry( KStatics::dBase + pFix + "/sip/implsub", "No" ) == "Yes" ) { setIsb( true ); } else { setIsb( false ); } if( settings.readEntry( KStatics::dBase + pFix + "/sip/Prack", "PrackNo" ) == "PrackNo" ) { setPrack( KSipPreferences::NoPRACK ); } else if( settings.readEntry( KStatics::dBase + pFix + "/sip/Prack", "PrackNo" ) == "PrackSup" ) { setPrack( KSipPreferences::SupportPRACK ); } else { setPrack( KSipPreferences::RequirePRACK ); } if( settings.readEntry( KStatics::dBase + pFix + "/sip/PPrack", "PPrackNo" ) == "PPrackNo" ) { setPPrack( KSipPreferences::NoPPRACK ); } else { setPPrack( KSipPreferences::YesPPRACK ); } pcodec=0; scodec=0; tcodec=0; qcodec=0; pcodec=settings.readNumEntry( KStatics::dBase+pFix+"/Video/poscodec0",0); scodec=settings.readNumEntry( KStatics::dBase+pFix+"/Video/poscodec1",1); tcodec=settings.readNumEntry( KStatics::dBase+pFix+"/Video/poscodec2",2); initCodecVideo(pcodec, scodec,tcodec); pcodec=0; scodec=0; tcodec=0; qcodec=0;fcodec=0; pcodec=settings.readEntry( KStatics::dBase+pFix+"/Audio/poscodec0","0").toInt(&ok,10); scodec=settings.readEntry( KStatics::dBase+pFix+"/Audio/poscodec1","1").toInt(&ok,10); tcodec=settings.readEntry( KStatics::dBase+pFix+"/Audio/poscodec2","2").toInt(&ok,10); qcodec=settings.readEntry( KStatics::dBase+pFix+"/Audio/poscodec3","3").toInt(&ok,10); #ifdef SPEEX fcodec=settings.readEntry( KStatics::dBase+pFix+"/Audio/poscodec4","4").toInt(&ok,10); #else fcodec = -1; #endif minMediaPort = settings.readEntry( KStatics::dBase+ pFix +"/Media/MinPort","8000" ).toInt(&ok,10); maxMediaPort = settings.readEntry( KStatics::dBase+ pFix +"/Media/MaxPort","9000" ).toInt(&ok,10); minApplPort = settings.readEntry( KStatics::dBase+ pFix +"/Application/MinPort","10000" ).toInt(&ok,10); maxApplPort = settings.readEntry( KStatics::dBase+ pFix +"/Application/MaxPort","11000" ).toInt(&ok,10); initCodecAudio(pcodec, scodec,tcodec,qcodec,fcodec); rtbsel = settings.readNumEntry( KStatics::dBase+pFix+"/General/Ringtone",1); if( settings.readEntry( KStatics::dBase+ pFix +"/STUN/UseStun", "No" ) == "Yes" ) { setStun(true); } else { setStun(false); } if(settings.readEntry(KStatics::dBase +"SRTP/Mode", "disabled") == "PSK") { srtpmode = 1; } else if(settings.readEntry(KStatics::dBase +"SRTP/Mode", "disabled") == "PKE") { srtpmode = 2; } else { srtpmode = 0; } int i=0; //Presence related times and flags acti = settings.readEntry( KStatics::dBase+pFix+"/local/ActivityCheckTime","0").toInt(&ok,10); peti = settings.readEntry( KStatics::dBase+pFix+"/local/PublishExpiresTime","0").toInt(&ok,10); seti = settings.readEntry( KStatics::dBase+pFix+"/local/SubscribeExpiresTime","0").toInt(&ok,10); if( settings.readEntry( KStatics::dBase + pFix + "/sip/winfosub", "No" ) == "Yes" ) { setWat( true ); } else { setWat( false ); } //audio i= (int)SipCall::StandardCall; allowHold[i] = true; allowTransfer[i] = true; onlyActive[i] = true; AllowRemoteStart[i]=false; useL4v[i] = usertpL4; //auvi i= (int)SipCall::auviCall; allowHold[i] = true; allowTransfer[i] = true; onlyActive[i] = true; useL4v[i] = usertpL4; AllowRemoteStart[i]=false; if (settings.readEntry(KStatics::dBase+pFix+"/Video/Hold", "No" ) == "Yes") { allowHold[i] = true; } else { allowHold[i] = false; } if (settings.readEntry(KStatics::dBase+pFix+"/Video/Transfer", "No" ) == "Yes") { allowTransfer[i] = true; } else { allowTransfer[i] = false; } //Video i = (int)SipCall::videoCall; if (settings.readEntry(KStatics::dBase+pFix+"/Video/Hold", "No" ) == "Yes") { allowHold[i] = true; } else { allowHold[i] = false; } if (settings.readEntry(KStatics::dBase+pFix+"/Video/Transfer", "No" ) == "Yes") { allowTransfer[i] = true; } else { allowTransfer[i] = false; } useL4v[i] = usertpL4; onlyActive[i] = false; AllowRemoteStart[i]=false; // Privat: general for (i=(int)SipCall::extCall1; i<=(int)SipCall::extCall4;i++) { int i1=i-(int)SipCall::extCall1+1; if (settings.readEntry(KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Hold", "No" ) == "Yes") { allowHold[i] = true; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Hold", "Yes" ); } else { allowHold[i] = false; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Hold", "No" ); } if (settings.readEntry(KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Transfer", "No" ) == "Yes") { allowTransfer[i] = true; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Transfer", "Yes" ); } else { allowTransfer[i] = false; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Transfer", "No" ); } if (settings.readEntry(KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/UseSound", "No" ) == "Yes") { onlyActive[i] = true; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/UseSound", "Yes" ); } else { onlyActive[i] = false; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/UseSound", "No" ); } if (settings.readEntry(KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/UseL4", "UDP" ) == "UDP") { useL4v[i] = useudpL4; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/UseL4", "UDP" ); } else { useL4v[i] = usertpL4; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/UseL4", "RTP" ); } if (settings.readEntry(KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Rst", "No" ) == "Yes") { AllowRemoteStart[i] = true; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Rst", "Yes" ); } else { AllowRemoteStart[i] = false; settings.writeEntry( KStatics::dBase+pFix+"/SessionType" + QString::number(i1) + "/Rst", "No" ); } } if(debug >= 2) cout << ":::::SessionControl start\n"; }
int main( int argc, char ** argv ) { QApplication a( argc, argv ); QSettings settings; settings.setPath( "InfoSiAL", "FacturaLUX", QSettings::User ); QFont appFont; QString keybase( "/facturalux/lite/" ); a.setLibraryPaths( FLPREFIX "/plugins" ); #if defined (Q_OS_LINUX) QPaintDeviceMetrics pdm( QApplication::desktop() ); float relDpi; if ( pdm.logicalDpiX() < pdm.logicalDpiY() ) relDpi = 78. / pdm.logicalDpiY(); else relDpi = 78. / pdm.logicalDpiX(); int pointSize = 10 * relDpi; #else int pointSize = 10; #endif #if defined(Q_OS_WIN32) appFont.setFamily( settings.readEntry( keybase + "fuente/familia", "Tahoma" ) ); pointSize = 8; #else #if defined(Q_OS_MACX) appFont.setFamily( settings.readEntry( keybase + "fuente/familia", "Lucida Grande" ) ); pointSize = 10; #else appFont.setFamily( settings.readEntry( keybase + "fuente/familia", "Sans" ) ); #endif #endif appFont.setPointSize( settings.readNumEntry( keybase + "fuente/puntos", pointSize ) ); appFont.setBold( settings.readBoolEntry( keybase + "fuente/negrita", false ) ); appFont.setItalic( settings.readBoolEntry( keybase + "fuente/cursiva", false ) ); appFont.setUnderline( settings.readBoolEntry( keybase + "fuente/subrayado", false ) ); appFont.setStrikeOut( settings.readBoolEntry( keybase + "fuente/tachado", false ) ); a.setFont( appFont ); #if defined(Q_OS_WIN32) a.setStyle( settings.readEntry( keybase + "estilo", "Bluecurve" ) ); #else a.setStyle( settings.readEntry( keybase + "estilo", "Plastik" ) ); #endif if ( argc <= 1 ) { Teddy *mw = new Teddy(); mw->setCaption( "Teddy" ); mw->show(); } else { for (int i = 1; i < argc; i++) { Teddy *mw = new Teddy(); mw->load( argv[i] ); mw->show(); } } a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); return a.exec(); }
int main( int argc, char *argv[] ) { QApplication::setColorSpec( QApplication::ManyColor ); DesignerApplication a( argc, argv ); DesignerApplication::setOverrideCursor( Qt::WaitCursor ); bool creatPid = FALSE; if ( a.argc() > 1 ) { QString arg1 = a.argv()[ 1 ]; if ( arg1 == "-client" ) { QFile pf( QDir::homeDirPath() + "/.designerpid" ); if ( pf.exists() && pf.open( IO_ReadOnly ) ) { QString pidStr; pf.readLine( pidStr, pf.size() ); QFile f( QDir::homeDirPath() + "/.designerargs" ); f.open( IO_WriteOnly ); QTextStream ts( &f ); for ( int i = 1; i < a.argc(); ++i ) ts << a.argv()[ i ] << " "; ts << endl; f.close(); #if defined(Q_OS_UNIX) if ( kill( pidStr.toInt(), SIGUSR1 ) == -1 ) creatPid = TRUE; else return 0; #elif defined(Q_OS_WIN32) if ( !GetProcessVersion( pidStr.toUInt() ) ) { creatPid = TRUE; } else { if ( a.winVersion() & Qt::WV_NT_based ) SendMessage( HWND_BROADCAST, RegisterWindowMessage((TCHAR*)"QT_DESIGNER_OPEN_FILE"), 0, 0 ); else SendMessage( HWND_BROADCAST, RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"), 0, 0 ); return 0; } #endif } else { creatPid = TRUE; } } else if(arg1 == "-debug_stderr") { extern bool debugToStderr; //outputwindow.cpp debugToStderr = TRUE; } } if ( creatPid ) { QFile pf( QDir::homeDirPath() + "/.designerpid" ); pf.open( IO_WriteOnly ); QTextStream ts( &pf ); #if defined(Q_OS_UNIX) signal( SIGUSR1, signalHandler ); #endif ts << getpid() << endl; pf.close(); signal( SIGABRT, exitHandler ); signal( SIGFPE, exitHandler ); signal( SIGILL, exitHandler ); signal( SIGINT, exitHandler ); signal( SIGSEGV, exitHandler ); signal( SIGTERM, exitHandler ); } extern void qInitImages_designercore(); qInitImages_designercore(); QSettings config; QString keybase = DesignerApplication::settingsKey(); config.insertSearchPath( QSettings::Windows, "/Trolltech" ); QStringList pluginPaths = config.readListEntry( keybase + "PluginPaths" ); if (pluginPaths.count()) QApplication::setLibraryPaths(pluginPaths); QSplashScreen *splash = a.showSplash(); MainWindow *mw = new MainWindow( creatPid ); a.setMainWidget( mw ); #if defined(QT_NON_COMMERCIAL) mw->setCaption( "Qt Designer by Trolltech for non-commercial use" ); #else mw->setCaption( "Qt Designer by Trolltech" ); #endif if ( config.readBoolEntry( keybase + "Geometries/MainwindowMaximized", FALSE ) ) { int x = config.readNumEntry( keybase + "Geometries/MainwindowX", 0 ); int y = config.readNumEntry( keybase + "Geometries/MainwindowY", 0 ); mw->move( x, y ); mw->showMaximized(); } else { mw->show(); } if ( splash ) splash->finish( mw ); delete splash; QApplication::restoreOverrideCursor(); for ( int i = 1; i < a.argc(); ++i ) { QString arg = a.argv()[ i ]; if ( arg[0] != '-' ) mw->fileOpen( "", "", arg ); } return a.exec(); }
int Config::indentIndentSize( const QString &path ) { QSettings settings; int ret = settings.readNumEntry( path + QString::fromLatin1("/indentIndentSize"), 4 ); return ret; }
QMap<QString, ConfigStyle> Config::readStyles( const QString &path ) { QMap<QString, ConfigStyle> styles; styles = defaultStyles(); QString family; int size = 10; bool bold = FALSE, italic = FALSE, underline = FALSE; int red = 0, green = 0, blue = 0; QString elements[] = { QT_TR_NOOP( QString::fromLatin1("Comment") ), QT_TR_NOOP( QString::fromLatin1("Number") ), QT_TR_NOOP( QString::fromLatin1("String") ), QT_TR_NOOP( QString::fromLatin1("Type") ), QT_TR_NOOP( QString::fromLatin1("Keyword") ), QT_TR_NOOP( QString::fromLatin1("Preprocessor") ), QT_TR_NOOP( QString::fromLatin1("Label") ), QT_TR_NOOP( QString::fromLatin1("Standard") ), QString::null }; for ( int i = 0; elements[ i ] != QString::null; ++i ) { QSettings settings; bool ok = TRUE; for (;;) { family = settings.readEntry( path + elements[ i ] + "/family", QString::null, &ok ); if ( !ok ) break; size = settings.readNumEntry( path + elements[ i ] + "/size", 10, &ok ); if ( !ok ) break; bold = settings.readBoolEntry( path + elements[ i ] + "/bold", FALSE, &ok ); if ( !ok ) break; italic = settings.readBoolEntry( path + elements[ i ] + "/italic", FALSE, &ok ); if ( !ok ) break; underline = settings.readBoolEntry( path + elements[ i ] + "/underline", FALSE, &ok ); if ( !ok ) break; red = settings.readNumEntry( path + elements[ i ] + "/red", 0, &ok ); if ( !ok ) break; green = settings.readNumEntry( path + elements[ i ] + "/green", 0, &ok ); if ( !ok ) break; blue = settings.readNumEntry( path + elements[ i ] + "/blue", 0, &ok ); if ( !ok ) break; break; } if ( !ok ) continue; QFont f( family ); f.setPointSize( size ); f.setBold( bold ); f.setItalic( italic ); f.setUnderline( underline ); QColor c( red, green, blue ); ConfigStyle s; s.font = f; s.color = c; styles.remove( elements[ i ] ); styles.insert( elements[ i ], s ); } return styles; }
int main(int argc, char *argv[]) { QApplication::setColorSpec(QApplication::ManyColor); DesignerApplication a(argc, argv); DesignerApplication::setOverrideCursor(Qt::WaitCursor); bool creatPid = FALSE; if (a.argc() > 1) { QString arg1 = a.argv()[ 1 ]; if (arg1 == "-client") { QFile pf(QDir::homeDirPath() + "/.designerpid"); if (pf.exists() && pf.open(IO_ReadOnly)) { QString pidStr; pf.readLine(pidStr, pf.size()); QFile f(QDir::homeDirPath() + "/.designerargs"); f.open(IO_WriteOnly); QTextStream ts(&f); for (int i = 1; i < a.argc(); ++i) ts << a.argv()[ i ] << " "; ts << endl; f.close(); #if defined(Q_OS_UNIX) if (kill(pidStr.toInt(), SIGUSR1) == -1) creatPid = TRUE; else return 0; #elif defined(Q_OS_WIN32) if (!GetProcessVersion(pidStr.toUInt())) { creatPid = TRUE; } else { if (a.winVersion() & Qt::WV_NT_based) SendMessage(HWND_BROADCAST, RegisterWindowMessage((TCHAR *)"QT_DESIGNER_OPEN_FILE"), 0, 0); else SendMessage(HWND_BROADCAST, RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"), 0, 0); return 0; } #endif } else { creatPid = TRUE; } } else if (arg1 == "-debug_stderr") { extern bool debugToStderr; //outputwindow.cpp debugToStderr = TRUE; } } if (creatPid) { QFile pf(QDir::homeDirPath() + "/.designerpid"); pf.open(IO_WriteOnly); QTextStream ts(&pf); #if defined(Q_OS_UNIX) signal(SIGUSR1, signalHandler); #endif ts << getpid() << endl; pf.close(); signal(SIGABRT, exitHandler); signal(SIGFPE, exitHandler); signal(SIGILL, exitHandler); signal(SIGINT, exitHandler); signal(SIGSEGV, exitHandler); signal(SIGTERM, exitHandler); } extern void qInitImages_designercore(); qInitImages_designercore(); QSettings settings; settings.setPath("InfoSiAL", "AbanQ", QSettings::User); QFont appFont; QString keybase("AbanQ/"); #if defined (Q_OS_LINUX) QPaintDeviceMetrics pdm(QApplication::desktop()); float relDpi; if (pdm.logicalDpiX() < pdm.logicalDpiY()) relDpi = 78. / pdm.logicalDpiY(); else relDpi = 78. / pdm.logicalDpiX(); int pointSize = 10 * relDpi; #else int pointSize = 10; #endif #if defined(Q_OS_WIN32) appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Tahoma")); pointSize = 8; #else #if defined(Q_OS_MACX) appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Lucida Grande")); pointSize = 10; #else appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Sans")); #endif #endif appFont.setPointSize(settings.readNumEntry(keybase + "fuente/puntos", pointSize)); appFont.setBold(settings.readBoolEntry(keybase + "fuente/negrita", false)); appFont.setItalic(settings.readBoolEntry(keybase + "fuente/cursiva", false)); appFont.setUnderline(settings.readBoolEntry(keybase + "fuente/subrayado", false)); appFont.setStrikeOut(settings.readBoolEntry(keybase + "fuente/tachado", false)); a.setFont(appFont); #if defined(Q_OS_WIN32) a.setStyle(settings.readEntry(keybase + "estilo", "Bluecurve")); #else a.setStyle(settings.readEntry(keybase + "estilo", "Plastik")); #endif keybase = DesignerApplication::settingsKey(); QSettings config; config.insertSearchPath(QSettings::Windows, "/Trolltech"); QStringList pluginPaths = config.readListEntry(keybase + "PluginPaths"); pluginPaths << QString(qApp->applicationDirPath() + "/../plugins"); if (pluginPaths.count()) QApplication::setLibraryPaths(pluginPaths); QSplashScreen *splash = a.showSplash(); MainWindow *mw = new MainWindow(creatPid); a.setMainWidget(mw); #if defined(QT_NON_COMMERCIAL) mw->setCaption("Qt Designer by Trolltech for non-commercial use"); #else mw->setCaption("Qt Designer by Trolltech"); #endif if (config.readBoolEntry(keybase + "Geometries/MainwindowMaximized", FALSE)) { int x = config.readNumEntry(keybase + "Geometries/MainwindowX", 0); int y = config.readNumEntry(keybase + "Geometries/MainwindowY", 0); mw->move(x, y); mw->showMaximized(); } else { mw->show(); } if (splash) splash->finish(mw); delete splash; QApplication::restoreOverrideCursor(); for (int i = 1; i < a.argc(); ++i) { QString arg = a.argv()[ i ]; if (arg[0] != '-') mw->fileOpen("", "", arg); } return a.exec(); }