Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CanvasSettings.cxx

Go to the documentation of this file.
00001 
00012 #include "CanvasSettings.h"
00013 
00014 #include <qspinbox.h>
00015 #include <qradiobutton.h>
00016 
00017 #if QT_VERSION < 0x040000
00018 CanvasSettings::
00019 CanvasSettings ( QWidget * parent,
00020                  const char * name, 
00021                  bool modal,
00022                  Qt::WFlags flags )
00023   : CanvasSettingsBase ( parent, name, modal, flags )
00024 {
00025 #else
00026 CanvasSettings::
00027 CanvasSettings ( QWidget * parent )
00028     : QDialog ( parent )
00029 {
00030   setupUi ( this );
00031 #endif
00032 }
00033 
00034 void
00035 CanvasSettings::
00036 cancel ()
00037 {
00038   done ( CanvasSettings::Rejected );
00039 }
00040 
00041 void
00042 CanvasSettings::
00043 saveRetile ()
00044 {
00045   done ( CanvasSettings::AcceptedAndRetile );
00046 }
00047 
00048 void
00049 CanvasSettings::
00050 on_retile_clicked ()
00051 {
00052   done ( CanvasSettings::Retile );
00053 }
00054 
00055 int
00056 CanvasSettings::
00057 getWidthNumber () const
00058 {
00059   return m_h_spin -> value();
00060 }
00061 
00062 void
00063 CanvasSettings::
00064 setWidthNumber ( int number )
00065 {
00066   m_h_spin -> setValue ( number );
00067 }
00068 
00069 int
00070 CanvasSettings::
00071 getHeightNumber () const
00072 {
00073   return m_v_spin -> value();
00074 }
00075 
00076 void
00077 CanvasSettings::
00078 setHeightNumber ( int number )
00079 {
00080   m_v_spin -> setValue ( number );
00081 }
00082 
00083 void
00084 CanvasSettings::
00085 on_portraitRadioButton_toggled ( bool )
00086 {
00087   orientationChanged();
00088 }
00089 
00090 void
00091 CanvasSettings::
00092 orientationChanged ()
00093 {
00094   int vSpinNumber = getHeightNumber ();
00095   int hSpinNumber = getWidthNumber ();
00096 
00097   setHeightNumber( hSpinNumber );
00098   setWidthNumber( vSpinNumber );
00099   
00100 }
00101 
00102 QPrinter::Orientation
00103 CanvasSettings::orientation()
00104 {
00105   if ( portraitRadioButton -> isChecked() ) {
00106     return QPrinter::Portrait;
00107   }
00108   else {
00109     return QPrinter::Landscape;
00110   }
00111 
00112   return QPrinter::Portrait;
00113 }
00114 
00115 void CanvasSettings::setOrientation(  QPrinter::Orientation orientation )
00116 {
00117   if ( orientation == QPrinter::Portrait ) {
00118     portraitRadioButton -> setChecked( true );
00119   }
00120   else {
00121     landscapeRadioButton -> setChecked( true );
00122   }
00123 }
00124 
00125 bool CanvasSettings::printerBounds()
00126 {
00127   return m_visibleMarginRadioButton -> isChecked();
00128 }
00129 
00130 void CanvasSettings::setPrinterBounds( bool flag )
00131 {
00132   if( flag == true )
00133     m_visibleMarginRadioButton -> setChecked( true );
00134   else
00135     m_invisibleMarginRadioButton -> setChecked( true );
00136 }
00137 
00138 bool
00139 CanvasSettings::
00140 getAddSelected () const
00141 {
00142   return m_add_selected -> isChecked ();
00143 }

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3