Changeset ed1011a in OpenModelica


Ignore:
Timestamp:
2016-02-08T12:18:15+01:00 (8 years ago)
Author:
hkiel <henning.kiel@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
56525d3
Parents:
12b2653
Message:

store font size in settings file

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r99b004e8 red1011a  
    2626mosh/src/omc_communication.cc
    2727mosh/src/omc_communication.h
     28qmake.sh
  • OMShell/OMShellGUI/oms.cpp

    r12b2653 red1011a  
    214214
    215215OMS::OMS( QWidget* parent )
    216   : QMainWindow( parent )
     216  : QMainWindow( parent ), mpSettings(getApplicationSettings())
    217217{
    218218  delegate_ = 0;
     
    236236  layout_->setSpacing( 5 );
    237237
    238   fontSize_ = 11;
     238  mpSettings->sync();
     239  if (mpSettings->contains("FontSize"))
     240    fontSize_ = mpSettings->value("FontSize").toInt();
     241  else
     242    fontSize_ = 11;
    239243  createMoshEdit();
    240244  //createMoshError();
     
    253257  setWindowIcon( QIcon(":/Resources/omshell-large.svg") );
    254258
    255   // sett start message
     259  // set start message
    256260  const char* dateStr = __DATE__; // "Mmm dd yyyy", so dateStr+7 = "yyyy"
    257261  copyright_info_ = QString("OMShell 1.1 Copyright Open Source Modelica Consortium (OSMC) 2002-") + (dateStr+7) + "\nDistributed under OMSC-PL and GPL, see www.openmodelica.org\n\nConnected to " + omc_version_;
     
    447451  moshEdit_->setTextCursor( cursor_ );
    448452
    449   // sett original text settings
     453  // set original text settings
    450454  moshEdit_->document()->setDefaultFont(QFont("Courier New", fontSize_, QFont::Normal));
    451455  textFormat_.setFontFamily( "Courier New" );
     
    839843    moshEdit_->document()->setDefaultFont(font);
    840844    textFormat_.setFontPointSize( fontSize_ );
     845    commandSignFormat_.setFontPointSize( fontSize_ );
    841846
    842847    //cursor_ = moshEdit_->textCursor();
    843848    cursor_.clearSelection();
    844849    moshEdit_->setTextCursor(cursor_);
     850
     851    mpSettings->setValue("FontSize", fontSize_);
     852    mpSettings->sync();
    845853  }
    846854  else
     
    945953  moshEdit_->clear();
    946954
    947   // sett original text settings
     955  // set original text settings
    948956  moshEdit_->document()->setDefaultFont(QFont("Courier New", fontSize_, QFont::Normal));
    949957
     
    977985}
    978986
     987QString OMS::organization = "openmodelica";  /* case-sensitive string. Don't change it. Used by ini settings file. */
     988QString OMS::application = "omshell"; /* case-sensitive string. Don't change it. Used by ini settings file. */
     989QString OMS::utf8 = "UTF-8";
     990
     991QSettings* OMS::getApplicationSettings()
     992{
     993  static int init = 0;
     994  static QSettings *pSettings;
     995  if (!init) {
     996    init = 1;
     997    pSettings = new QSettings(QSettings::IniFormat, QSettings::UserScope, organization, application);
     998    pSettings->setIniCodec(utf8.toStdString().data());
     999  }
     1000  return pSettings;
     1001}
     1002
  • OMShell/OMShellGUI/oms.h

    r8302b0e red1011a  
    6969#include <QtGui/QTextCursor>
    7070#include <QtGui/QPlainTextEdit>
     71#include <QtCore/QSettings>
    7172#endif
    7273
     
    137138  QString clipboard_;
    138139  QString copyright_info_;
     140  QSettings *mpSettings;
    139141
    140142  IAEX::CommandCompletion* commandcompletion_;
     
    163165  QAction* aboutQT_;        // Added 2006-02-21 AF
    164166  QAction* clearWindow_;
     167
     168  static QString organization;
     169  static QString application;
     170  static QString utf8;
     171
     172  QSettings* getApplicationSettings();
    165173};
    166174
Note: See TracChangeset for help on using the changeset viewer.