Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 7f384bd..88acd59 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -83,31 +83,64 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
83 | m_view, SLOT(slotBeam()) ); | 83 | m_view, SLOT(slotBeam()) ); |
84 | } | 84 | } |
85 | 85 | ||
86 | btn = new QToolButton( bar ); | 86 | btn = new QToolButton( bar ); |
87 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); | 87 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); |
88 | connect( btn, SIGNAL(clicked() ), | 88 | connect( btn, SIGNAL(clicked() ), |
89 | m_view, SLOT(slotTrash() ) ); | 89 | m_view, SLOT(slotTrash() ) ); |
90 | 90 | ||
91 | btn = new QToolButton( bar ); | 91 | btn = new QToolButton( bar ); |
92 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | 92 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); |
93 | connect( btn, SIGNAL(clicked() ), | 93 | connect( btn, SIGNAL(clicked() ), |
94 | this, SLOT(slotConfig() ) ); | 94 | this, SLOT(slotConfig() ) ); |
95 | |||
96 | rotateButton = new QToolButton(bar); | ||
97 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); | ||
98 | rotateButton->setToggleButton(true); | ||
99 | rotateButton->setOn(true); | ||
100 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | ||
101 | autoRotate = true; | ||
102 | |||
103 | btn = new QToolButton(bar); | ||
104 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); | ||
105 | btn->setToggleButton(true); | ||
106 | btn->setOn(false); | ||
107 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | ||
108 | autoScale = true; | ||
95 | 109 | ||
96 | } | 110 | } |
97 | 111 | ||
98 | PMainWindow::~PMainWindow() { | 112 | PMainWindow::~PMainWindow() { |
99 | odebug << "Shutting down" << oendl; | 113 | odebug << "Shutting down" << oendl; |
100 | } | 114 | } |
101 | 115 | ||
116 | void PMainWindow::slotRotateToggled(bool how) | ||
117 | { | ||
118 | autoRotate = how; | ||
119 | if (m_disp) { | ||
120 | m_disp->setAutoRotate(how); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | void PMainWindow::slotScaleToggled(bool how) | ||
125 | { | ||
126 | autoScale = !how; | ||
127 | if (m_disp) { | ||
128 | m_disp->setAutoScale(autoScale); | ||
129 | } | ||
130 | if (!autoScale && autoRotate) { | ||
131 | rotateButton->setOn(false); | ||
132 | } | ||
133 | rotateButton->setEnabled(!how); | ||
134 | } | ||
102 | 135 | ||
103 | void PMainWindow::slotConfig() { | 136 | void PMainWindow::slotConfig() { |
104 | /* | 137 | /* |
105 | * have a tab with the possible views | 138 | * have a tab with the possible views |
106 | * a tab for globals image cache size.. scaled loading | 139 | * a tab for globals image cache size.. scaled loading |
107 | * and one tab for the KeyConfigs | 140 | * and one tab for the KeyConfigs |
108 | */ | 141 | */ |
109 | QDialog dlg(this, 0, true); | 142 | QDialog dlg(this, 0, true); |
110 | dlg.setCaption( tr("Phunk View - Config" ) ); | 143 | dlg.setCaption( tr("Phunk View - Config" ) ); |
111 | 144 | ||
112 | QHBoxLayout *lay = new QHBoxLayout(&dlg); | 145 | QHBoxLayout *lay = new QHBoxLayout(&dlg); |
113 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); | 146 | Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); |
@@ -171,44 +204,50 @@ void PMainWindow::initT( const char* name, T** ptr, int id) { | |||
171 | *ptr = new T( m_stack, name ); | 204 | *ptr = new T( m_stack, name ); |
172 | m_stack->addWidget( *ptr, id ); | 205 | m_stack->addWidget( *ptr, id ); |
173 | 206 | ||
174 | connect(*ptr, SIGNAL(sig_return()), | 207 | connect(*ptr, SIGNAL(sig_return()), |
175 | this,SLOT(slotReturn())); | 208 | this,SLOT(slotReturn())); |
176 | 209 | ||
177 | } | 210 | } |
178 | void PMainWindow::initInfo() { | 211 | void PMainWindow::initInfo() { |
179 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); | 212 | initT<imageinfo>( "Image Info", &m_info, ImageInfo ); |
180 | } | 213 | } |
181 | void PMainWindow::initDisp() { | 214 | void PMainWindow::initDisp() { |
182 | initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay ); | 215 | initT<ImageScrollView>( "Image ScrollView", &m_disp, ImageDisplay ); |
216 | if (m_disp) { | ||
217 | m_disp->setAutoScale(autoScale); | ||
218 | m_disp->setAutoRotate(autoRotate); | ||
219 | } | ||
220 | |||
183 | } | 221 | } |
184 | 222 | ||
185 | /** | 223 | /** |
186 | * With big Screen the plan could be to 'detach' the image | 224 | * With big Screen the plan could be to 'detach' the image |
187 | * window if visible and to create a ne wone | 225 | * window if visible and to create a ne wone |
188 | * init* already supports it but I make no use of it for | 226 | * init* already supports it but I make no use of it for |
189 | * now. We set filename and raise | 227 | * now. We set filename and raise |
190 | * | 228 | * |
191 | * ### FIXME and talk to alwin | 229 | * ### FIXME and talk to alwin |
192 | */ | 230 | */ |
193 | void PMainWindow::slotShowInfo( const QString& inf ) { | 231 | void PMainWindow::slotShowInfo( const QString& inf ) { |
194 | if ( !m_info ) | 232 | if ( !m_info ) |
195 | initInfo(); | 233 | initInfo(); |
196 | m_info->setPath( inf ); | 234 | m_info->setPath( inf ); |
197 | m_stack->raiseWidget( ImageInfo ); | 235 | m_stack->raiseWidget( ImageInfo ); |
198 | } | 236 | } |
199 | 237 | ||
200 | void PMainWindow::slotDisplay( const QString& inf ) { | 238 | void PMainWindow::slotDisplay( const QString& inf ) { |
201 | if ( !m_disp ) | 239 | if ( !m_disp ) { |
202 | initDisp(); | 240 | initDisp(); |
241 | } | ||
203 | m_disp->setImage( inf ); | 242 | m_disp->setImage( inf ); |
204 | m_stack->raiseWidget( ImageDisplay ); | 243 | m_stack->raiseWidget( ImageDisplay ); |
205 | } | 244 | } |
206 | 245 | ||
207 | void PMainWindow::slotReturn() { | 246 | void PMainWindow::slotReturn() { |
208 | raiseIconView(); | 247 | raiseIconView(); |
209 | } | 248 | } |
210 | 249 | ||
211 | 250 | ||
212 | void PMainWindow::closeEvent( QCloseEvent* ev ) { | 251 | void PMainWindow::closeEvent( QCloseEvent* ev ) { |
213 | /* | 252 | /* |
214 | * return from view | 253 | * return from view |