texteditor.cpp
branchqt4-port
changeset 15 699f28529079
parent 10 e2a80d9b5858
child 18 70c41284cb48
     1.1 --- a/texteditor.cpp	Thu Jul 06 15:39:54 2006 +0000
     1.2 +++ b/texteditor.cpp	Tue Aug 15 12:01:14 2006 +0000
     1.3 @@ -39,7 +39,7 @@
     1.4  TextEditor::TextEditor()
     1.5  {
     1.6      printer = new QPrinter( QPrinter::HighResolution );
     1.7 -	printer->setPrinterName (settings.readEntry("/vym/mainwindow/printerName",printer->printerName()));
     1.8 +	printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString());
     1.9  
    1.10  	// Editor (use MyTextEdit to wrap verticalAlignmentChanged to 
    1.11  	//         int argument. see header file)
    1.12 @@ -64,25 +64,23 @@
    1.13  	setInactive();
    1.14  
    1.15  	// Load Settings
    1.16 -	resize (settings.readNumEntry( "/vym/noteeditor/geometry/width", 450),
    1.17 -	        settings.readNumEntry( "/vym/noteeditor/geometry/height",600));
    1.18 -	move   (settings.readNumEntry( "/vym/noteeditor/geometry/posX", 150),
    1.19 -	        settings.readNumEntry( "/vym/noteeditor/geometry/posY",  50));
    1.20 +	resize (settings.value ( "/noteeditor/geometry/size", QSize(450,600)).toSize());
    1.21 +	move   (settings.value ( "/noteeditor/geometry/pos", QPoint (250,50)).toPoint());
    1.22  	
    1.23 -	if (settings.readEntry( "/vym/noteeditor/showWithMain","yes") =="yes")
    1.24 +	if (settings.value ( "/noteeditor/showWithMain",true).toBool())
    1.25  		setShowWithMain(true);
    1.26  	else	
    1.27  		setShowWithMain(false);
    1.28  
    1.29 -	varFont.fromString( settings.readEntry 
    1.30 -		("/vym/noteeditor/fonts/varFont",
    1.31 -		"Nimbus Sans l,14,-1,5,48,0,0,0,0,0") 
    1.32 +	varFont.fromString( settings.value
    1.33 +		("/noteeditor/fonts/varFont",
    1.34 +		"Nimbus Sans l,14,-1,5,48,0,0,0,0,0").toString() 
    1.35  	);
    1.36 -	fixedFont.fromString (settings.readEntry (
    1.37 -		"/vym/noteeditor/fonts/fixedFont",
    1.38 -		"Courier,14,-1,5,48,0,0,0,1,0") 
    1.39 +	fixedFont.fromString (settings.value(
    1.40 +		"/noteeditor/fonts/fixedFont",
    1.41 +		"Courier,14,-1,5,48,0,0,0,1,0").toString() 
    1.42  	);
    1.43 -	QString s=settings.readEntry ("/vym/noteeditor/fonts/fonthintDefault","variable");
    1.44 +	QString s=settings.value ("/noteeditor/fonts/fonthintDefault","variable").toString();
    1.45  	if (s == "fixed")
    1.46  	{	
    1.47  		actionSettingsFonthintDefault->setOn (true);
    1.48 @@ -95,7 +93,7 @@
    1.49  	filenameHint="";
    1.50  
    1.51  	// Save settings in vymrc
    1.52 -	settings.writeEntry("/vym/mainwindow/printerName",printer->printerName());
    1.53 +	settings.setValue("/mainwindow/printerName",printer->printerName());
    1.54  }
    1.55  
    1.56  
    1.57 @@ -103,26 +101,19 @@
    1.58  {
    1.59      if (printer) delete printer;
    1.60  	// Save Settings
    1.61 -	settings.writeEntry( "/vym/noteeditor/geometry/width", width() );
    1.62 -	settings.writeEntry( "/vym/noteeditor/geometry/height", height() );
    1.63 -	settings.writeEntry( "/vym/noteeditor/geometry/posX", pos().x() );
    1.64 -	settings.writeEntry( "/vym/noteeditor/geometry/posY", pos().y() );
    1.65 +	settings.setValue( "/noteeditor/geometry/size", size() );
    1.66 +	settings.setValue( "/noteeditor/geometry/pos", pos() );
    1.67  	
    1.68 -	if (showWithMain())
    1.69 -		settings.writeEntry( "/vym/noteeditor/showWithMain","yes");
    1.70 -	else	
    1.71 -		settings.writeEntry( "/vym/noteeditor/showWithMain","no");
    1.72 +	settings.setValue( "/noteeditor/showWithMain",showWithMain());
    1.73  
    1.74  	QString s;
    1.75  	if (actionSettingsFonthintDefault->isOn() )
    1.76  		s="fixed";
    1.77  	else	
    1.78  		s="variable";
    1.79 -	settings.writeEntry( "/vym/noteeditor/fonts/fonthintDefault",s );
    1.80 -	settings.writeEntry ("/vym/noteeditor/fonts/varFont",
    1.81 -		varFont.toString() );
    1.82 -	settings.writeEntry ("/vym/noteeditor/fonts/fixedFont",
    1.83 -		fixedFont.toString() );
    1.84 +	settings.setValue( "/noteeditor/fonts/fonthintDefault",s );
    1.85 +	settings.setValue("/noteeditor/fonts/varFont", varFont.toString() );
    1.86 +	settings.setValue("/noteeditor/fonts/fixedFont", fixedFont.toString() );
    1.87  }
    1.88  
    1.89  bool TextEditor::isEmpty()
    1.90 @@ -208,8 +199,8 @@
    1.91  
    1.92  void TextEditor::setupFileActions()
    1.93  {
    1.94 -    QToolBar *tb = addToolBar ( tr("File Actions") );
    1.95 -    QMenu *fileMenu = menuBar()->addMenu( tr( "&File" ));
    1.96 +    QToolBar *tb = addToolBar ( tr("Note Actions") );
    1.97 +    QMenu *fileMenu = menuBar()->addMenu( tr( "&Note" ));
    1.98  
    1.99      QAction *a;
   1.100      a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Import..." ),this);
   1.101 @@ -342,7 +333,7 @@
   1.102      a = new QAction( QPixmap(iconPath+"formatfixedfont.png"), tr( "&Font hint" ), Qt::ALT + Qt::Key_I, this, "fontHint" );
   1.103  	a->setStatusTip (tr( "Toggle font hint for the whole text" ) );
   1.104  	a->setToggleAction (true);
   1.105 -	a->setOn (settings.readBoolEntry ("/vym/noteeditor/fonts/useFixedByDefault",false) );
   1.106 +	a->setOn (settings.value("/noteeditor/fonts/useFixedByDefault",false).toBool() );
   1.107      connect( a, SIGNAL( activated() ), this, SLOT( toggleFonthint() ) );
   1.108  	formatMenu->addAction (a);
   1.109  	tb->addAction (a);