author | alwin <alwin> | 2004-04-19 11:39:36 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-19 11:39:36 (UTC) |
commit | 2add0a39efab1af658ab3515090b31fba30df0d5 (patch) (unidiff) | |
tree | 50ba1101316b70d724b218dfc8f89ecfaa7f7149 | |
parent | e3ca538f7ce2e7b7df2f29f263778acc342d51db (diff) | |
download | opie-2add0a39efab1af658ab3515090b31fba30df0d5.zip opie-2add0a39efab1af658ab3515090b31fba30df0d5.tar.gz opie-2add0a39efab1af658ab3515090b31fba30df0d5.tar.bz2 |
last iconview mode will be saved and restored
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 45 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/viewmodebutton.cpp | 4 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/viewmodebutton.h | 2 |
4 files changed, 30 insertions, 25 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index d546b64..660c4fa 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -125,103 +125,104 @@ namespace { | |||
125 | currentView()->dirLister()->imageInfo( m_path ); | 125 | currentView()->dirLister()->imageInfo( m_path ); |
126 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); | 126 | g_stringInf.insert( m_path, const_cast<IconViewItem*>(this)); |
127 | } | 127 | } |
128 | 128 | ||
129 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); | 129 | m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); |
130 | if (!m_pix && !g_stringPix.contains( m_path )) { | 130 | if (!m_pix && !g_stringPix.contains( m_path )) { |
131 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); | 131 | currentView()->dirLister()->thumbNail( m_path, 64, 64 ); |
132 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); | 132 | g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); |
133 | } | 133 | } |
134 | return m_pix ? m_pix : _unkPix; | 134 | return m_pix ? m_pix : _unkPix; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | inline void IconViewItem::setText( const QString& str ) { | 137 | inline void IconViewItem::setText( const QString& str ) { |
138 | QString text = QIconViewItem::text()+"\n"+str; | 138 | QString text = QIconViewItem::text()+"\n"+str; |
139 | m_noInfo = true; | 139 | m_noInfo = true; |
140 | QIconViewItem::setText( text ); | 140 | QIconViewItem::setText( text ); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | /* | 145 | /* |
146 | * Set up the GUI.. initialize the slave set up gui | 146 | * Set up the GUI.. initialize the slave set up gui |
147 | * and also load a dir | 147 | * and also load a dir |
148 | */ | 148 | */ |
149 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) | 149 | PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg ) |
150 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) | 150 | : QVBox( wid ), m_cfg( cfg ), m_updatet( false ) |
151 | { | 151 | { |
152 | { | 152 | { |
153 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 153 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
154 | } | 154 | } |
155 | m_path = QDir::homeDirPath(); | 155 | m_path = QDir::homeDirPath(); |
156 | m_mode = 0; | 156 | m_mode = 0; |
157 | 157 | ||
158 | QHBox *hbox = new QHBox( this ); | 158 | QHBox *hbox = new QHBox( this ); |
159 | QLabel* lbl = new QLabel( hbox ); | 159 | QLabel* lbl = new QLabel( hbox ); |
160 | lbl->setText( tr("View as" ) ); | 160 | lbl->setText( tr("View as" ) ); |
161 | 161 | ||
162 | m_views = new QComboBox( hbox, "View As" ); | 162 | m_views = new QComboBox( hbox, "View As" ); |
163 | connect( m_views, SIGNAL(activated(int)), | 163 | connect( m_views, SIGNAL(activated(int)), |
164 | this, SLOT(slotViewChanged(int)) ); | 164 | this, SLOT(slotViewChanged(int)) ); |
165 | 165 | ||
166 | m_view= new QIconView( this ); | 166 | m_view= new QIconView( this ); |
167 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), | 167 | connect(m_view, SIGNAL(clicked(QIconViewItem*) ), |
168 | this, SLOT(slotClicked(QIconViewItem*)) ); | 168 | this, SLOT(slotClicked(QIconViewItem*)) ); |
169 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), | 169 | connect(m_view, SIGNAL(returnPressed(QIconViewItem*)), |
170 | this, SLOT(slotClicked(QIconViewItem*)) ); | 170 | this, SLOT(slotClicked(QIconViewItem*)) ); |
171 | 171 | ||
172 | m_view->setArrangement( QIconView::LeftToRight ); | 172 | m_view->setArrangement( QIconView::LeftToRight ); |
173 | m_view->setItemTextPos( QIconView::Right ); | ||
174 | 173 | ||
175 | int dw = QApplication::desktop()->width(); | 174 | m_mode = cfg->readNumEntry("ListViewMode", 1); |
176 | int viewerWidth = dw-style().scrollBarExtent().width(); | ||
177 | m_view->setGridX( viewerWidth-3*m_view->spacing()); | ||
178 | m_view->setGridY( fontMetrics().height()*2+40 ); | ||
179 | 175 | ||
176 | if (m_mode < 1 || m_mode>3) m_mode = 1; | ||
177 | |||
178 | m_view->setItemTextPos( QIconView::Right ); | ||
179 | |||
180 | calculateGrid(); | ||
180 | 181 | ||
181 | initKeys(); | 182 | initKeys(); |
182 | 183 | ||
183 | loadViews(); | 184 | loadViews(); |
184 | slotViewChanged( m_views->currentItem() ); | 185 | slotViewChanged( m_views->currentItem() ); |
185 | } | 186 | } |
186 | 187 | ||
187 | /* | 188 | /* |
188 | * Unref the slave and save the keyboard manager | 189 | * Unref the slave and save the keyboard manager |
189 | */ | 190 | */ |
190 | PIconView::~PIconView() { | 191 | PIconView::~PIconView() { |
191 | { | 192 | { |
192 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 193 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
193 | } | 194 | } |
194 | m_viewManager->save(); | 195 | m_viewManager->save(); |
195 | delete m_viewManager; | 196 | delete m_viewManager; |
196 | } | 197 | } |
197 | 198 | ||
198 | Opie::Core::OKeyConfigManager* PIconView::manager() { | 199 | Opie::Core::OKeyConfigManager* PIconView::manager() { |
199 | return m_viewManager; | 200 | return m_viewManager; |
200 | } | 201 | } |
201 | 202 | ||
202 | 203 | ||
203 | /* | 204 | /* |
204 | * init the KeyBoard Shortcuts | 205 | * init the KeyBoard Shortcuts |
205 | * called from the c'tor | 206 | * called from the c'tor |
206 | */ | 207 | */ |
207 | void PIconView::initKeys() { | 208 | void PIconView::initKeys() { |
208 | Opie::Core::OKeyPair::List lst; | 209 | Opie::Core::OKeyPair::List lst; |
209 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); | 210 | lst.append( Opie::Core::OKeyPair::upArrowKey() ); |
210 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); | 211 | lst.append( Opie::Core::OKeyPair::downArrowKey() ); |
211 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); | 212 | lst.append( Opie::Core::OKeyPair::leftArrowKey() ); |
212 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); | 213 | lst.append( Opie::Core::OKeyPair::rightArrowKey() ); |
213 | lst.append( Opie::Core::OKeyPair::returnKey() ); | 214 | lst.append( Opie::Core::OKeyPair::returnKey() ); |
214 | 215 | ||
215 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", | 216 | m_viewManager = new Opie::Core::OKeyConfigManager(m_cfg, "View-KeyBoard-Config", |
216 | lst, false,this, "keyconfig name" ); | 217 | lst, false,this, "keyconfig name" ); |
217 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", | 218 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam", |
218 | Resource::loadPixmap("beam"), BeamItem, | 219 | Resource::loadPixmap("beam"), BeamItem, |
219 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), | 220 | Opie::Core::OKeyPair(Qt::Key_B, Qt::ShiftButton), |
220 | this, SLOT(slotBeam())) ); | 221 | this, SLOT(slotBeam())) ); |
221 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", | 222 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete", |
222 | Resource::loadPixmap("trash"), DeleteItem, | 223 | Resource::loadPixmap("trash"), DeleteItem, |
223 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), | 224 | Opie::Core::OKeyPair(Qt::Key_D, Qt::ShiftButton), |
224 | this, SLOT(slotTrash())) ); | 225 | this, SLOT(slotTrash())) ); |
225 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", | 226 | m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view", |
226 | Resource::loadPixmap("1to1"), ViewItem, | 227 | Resource::loadPixmap("1to1"), ViewItem, |
227 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), | 228 | Opie::Core::OKeyPair(Qt::Key_V, Qt::ShiftButton), |
@@ -520,95 +521,97 @@ void PIconView::slotShowNext() | |||
520 | bool isDir = false; | 521 | bool isDir = false; |
521 | QString name = nextFileName(isDir); | 522 | QString name = nextFileName(isDir); |
522 | if (name.isEmpty()) return; | 523 | if (name.isEmpty()) return; |
523 | if (isDir) return; | 524 | if (isDir) return; |
524 | /* if we got a name we have a next item */ | 525 | /* if we got a name we have a next item */ |
525 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); | 526 | m_view->setCurrentItem(m_view->currentItem()->nextItem()); |
526 | slotShowImage(name); | 527 | slotShowImage(name); |
527 | } | 528 | } |
528 | 529 | ||
529 | void PIconView::slotShowPrev() | 530 | void PIconView::slotShowPrev() |
530 | { | 531 | { |
531 | bool isDir = false; | 532 | bool isDir = false; |
532 | QString name = prevFileName(isDir); | 533 | QString name = prevFileName(isDir); |
533 | if (name.isEmpty()) return; | 534 | if (name.isEmpty()) return; |
534 | if (isDir) return; | 535 | if (isDir) return; |
535 | /* if we got a name we have a prev item */ | 536 | /* if we got a name we have a prev item */ |
536 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); | 537 | m_view->setCurrentItem(m_view->currentItem()->prevItem()); |
537 | slotShowImage(name); | 538 | slotShowImage(name); |
538 | } | 539 | } |
539 | 540 | ||
540 | void PIconView::slotShowImage() | 541 | void PIconView::slotShowImage() |
541 | { | 542 | { |
542 | bool isDir = false; | 543 | bool isDir = false; |
543 | QString name = currentFileName(isDir); | 544 | QString name = currentFileName(isDir); |
544 | if (isDir) return; | 545 | if (isDir) return; |
545 | 546 | ||
546 | slotShowImage( name ); | 547 | slotShowImage( name ); |
547 | } | 548 | } |
548 | void PIconView::slotShowImage( const QString& name) { | 549 | void PIconView::slotShowImage( const QString& name) { |
549 | emit sig_display( name ); | 550 | emit sig_display( name ); |
550 | } | 551 | } |
551 | void PIconView::slotImageInfo() { | 552 | void PIconView::slotImageInfo() { |
552 | bool isDir = false; | 553 | bool isDir = false; |
553 | QString name = currentFileName(isDir); | 554 | QString name = currentFileName(isDir); |
554 | if (isDir) return; | 555 | if (isDir) return; |
555 | 556 | ||
556 | slotImageInfo( name ); | 557 | slotImageInfo( name ); |
557 | } | 558 | } |
558 | 559 | ||
559 | void PIconView::slotImageInfo( const QString& name) { | 560 | void PIconView::slotImageInfo( const QString& name) { |
560 | emit sig_showInfo( name ); | 561 | emit sig_showInfo( name ); |
561 | } | 562 | } |
562 | 563 | ||
563 | 564 | ||
564 | void PIconView::slotChangeMode( int mode ) { | 565 | void PIconView::slotChangeMode( int mode ) { |
565 | if ( mode >= 1 && mode <= 3 ) | 566 | if ( mode >= 1 && mode <= 3 ) |
566 | m_mode = mode; | 567 | m_mode = mode; |
567 | 568 | ||
568 | QIconView::ItemTextPos pos; | 569 | m_cfg->writeEntry("ListViewMode", m_mode); |
569 | switch( m_mode ) { | ||
570 | case 2: | ||
571 | pos = QIconView::Bottom; | ||
572 | break; | ||
573 | case 3: | ||
574 | case 1: | ||
575 | default: | ||
576 | pos = QIconView::Right; | ||
577 | break; | ||
578 | } | ||
579 | m_view->setItemTextPos( pos ); | ||
580 | |||
581 | calculateGrid(); | 570 | calculateGrid(); |
582 | slotReloadDir(); | 571 | slotReloadDir(); |
583 | } | 572 | } |
584 | 573 | ||
585 | 574 | ||
586 | void PIconView::resizeEvent( QResizeEvent* re ) { | 575 | void PIconView::resizeEvent( QResizeEvent* re ) { |
587 | QVBox::resizeEvent( re ); | 576 | QVBox::resizeEvent( re ); |
588 | calculateGrid(); | 577 | calculateGrid(); |
589 | } | 578 | } |
590 | 579 | ||
591 | 580 | ||
592 | void PIconView::calculateGrid() { | 581 | void PIconView::calculateGrid() { |
593 | odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; | 582 | odebug << "Calc grid: x=" << m_view->gridX() << " y=" << m_view->gridY() << oendl; |
594 | odebug << "Size of view: " << m_view->size() << oendl; | 583 | odebug << "Size of view: " << m_view->size() << oendl; |
584 | int dw = QApplication::desktop()->width(); | ||
585 | int viewerWidth = dw-style().scrollBarExtent().width(); | ||
595 | 586 | ||
587 | QIconView::ItemTextPos pos; | ||
588 | switch( m_mode ) { | ||
589 | case 2: | ||
590 | pos = QIconView::Bottom; | ||
591 | break; | ||
592 | case 3: | ||
593 | case 1: | ||
594 | default: | ||
595 | pos = QIconView::Right; | ||
596 | break; | ||
597 | } | ||
598 | m_view->setItemTextPos( pos ); | ||
596 | switch (m_mode) { | 599 | switch (m_mode) { |
597 | case 2: | 600 | case 2: |
598 | m_view->setGridX(50); | 601 | m_view->setGridX(50); |
599 | m_view->setGridY(20); | 602 | m_view->setGridY(20); |
600 | PPixmapCache::self()->setMaxImages(40); | 603 | PPixmapCache::self()->setMaxImages(40); |
601 | break; | 604 | break; |
602 | case 3: | 605 | case 3: |
603 | m_view->setGridX(m_view->width()); | 606 | m_view->setGridX( fontMetrics().width("testimage.jpg")+20); |
604 | m_view->setGridY(8); | 607 | m_view->setGridY(8); |
605 | PPixmapCache::self()->setMaxImages(2); | 608 | PPixmapCache::self()->setMaxImages(2); |
606 | break; | 609 | break; |
607 | case 1: | 610 | case 1: |
608 | default: | 611 | default: |
609 | m_view->setGridX(m_view->width()); | 612 | m_view->setGridX( viewerWidth-3*m_view->spacing()); |
610 | m_view->setGridY(80); | 613 | m_view->setGridY( fontMetrics().height()*2+40 ); |
611 | PPixmapCache::self()->setMaxImages(20); | 614 | PPixmapCache::self()->setMaxImages(20); |
612 | break; | 615 | break; |
613 | } | 616 | } |
614 | } | 617 | } |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index ef6e6df..a90231b 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -46,97 +46,99 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
46 | /* | 46 | /* |
47 | * Initialize ToolBar and IconView | 47 | * Initialize ToolBar and IconView |
48 | * And Connect Them | 48 | * And Connect Them |
49 | */ | 49 | */ |
50 | QToolBar *bar = new QToolBar( this ); | 50 | QToolBar *bar = new QToolBar( this ); |
51 | bar->setHorizontalStretchable( true ); | 51 | bar->setHorizontalStretchable( true ); |
52 | setToolBarsMovable( false ); | 52 | setToolBarsMovable( false ); |
53 | 53 | ||
54 | m_stack = new Opie::Ui::OWidgetStack( this ); | 54 | m_stack = new Opie::Ui::OWidgetStack( this ); |
55 | setCentralWidget( m_stack ); | 55 | setCentralWidget( m_stack ); |
56 | 56 | ||
57 | m_view = new PIconView( m_stack, m_cfg ); | 57 | m_view = new PIconView( m_stack, m_cfg ); |
58 | m_stack->addWidget( m_view, IconView ); | 58 | m_stack->addWidget( m_view, IconView ); |
59 | m_stack->raiseWidget( IconView ); | 59 | m_stack->raiseWidget( IconView ); |
60 | connect(m_view, SIGNAL(sig_display(const QString&)), | 60 | connect(m_view, SIGNAL(sig_display(const QString&)), |
61 | this, SLOT(slotDisplay(const QString&))); | 61 | this, SLOT(slotDisplay(const QString&))); |
62 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 62 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
63 | this, SLOT(slotShowInfo(const QString&)) ); | 63 | this, SLOT(slotShowInfo(const QString&)) ); |
64 | 64 | ||
65 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 65 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
66 | 66 | ||
67 | upButton = new QToolButton( bar ); | 67 | upButton = new QToolButton( bar ); |
68 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); | 68 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); |
69 | connect( upButton, SIGNAL(clicked()), | 69 | connect( upButton, SIGNAL(clicked()), |
70 | m_view, SLOT(slotDirUp()) ); | 70 | m_view, SLOT(slotDirUp()) ); |
71 | 71 | ||
72 | fsButton = new PFileSystem( bar ); | 72 | fsButton = new PFileSystem( bar ); |
73 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), | 73 | connect( fsButton, SIGNAL( changeDir( const QString& ) ), |
74 | m_view, SLOT(slotChangeDir( const QString& ) ) ); | 74 | m_view, SLOT(slotChangeDir( const QString& ) ) ); |
75 | 75 | ||
76 | QToolButton*btn = new QToolButton( bar ); | 76 | QToolButton*btn = new QToolButton( bar ); |
77 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); | 77 | btn->setIconSet( Resource::loadIconSet( "edit" ) ); |
78 | connect( btn, SIGNAL(clicked()), | 78 | connect( btn, SIGNAL(clicked()), |
79 | m_view, SLOT(slotRename()) ); | 79 | m_view, SLOT(slotRename()) ); |
80 | 80 | ||
81 | if ( Ir::supported() ) { | 81 | if ( Ir::supported() ) { |
82 | btn = new QToolButton( bar ); | 82 | btn = new QToolButton( bar ); |
83 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); | 83 | btn->setIconSet( Resource::loadIconSet( "beam" ) ); |
84 | connect( btn, SIGNAL(clicked()), | 84 | connect( btn, SIGNAL(clicked()), |
85 | m_view, SLOT(slotBeam()) ); | 85 | m_view, SLOT(slotBeam()) ); |
86 | } | 86 | } |
87 | 87 | ||
88 | btn = new QToolButton( bar ); | 88 | btn = new QToolButton( bar ); |
89 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); | 89 | btn->setIconSet( Resource::loadIconSet( "trash" ) ); |
90 | connect( btn, SIGNAL(clicked() ), | 90 | connect( btn, SIGNAL(clicked() ), |
91 | m_view, SLOT(slotTrash() ) ); | 91 | m_view, SLOT(slotTrash() ) ); |
92 | 92 | ||
93 | 93 | ||
94 | viewModeButton = new ViewModeButton( bar ); | 94 | int mode = m_cfg->readNumEntry("ListViewMode", 1); |
95 | if (mode < 1 || mode>3) mode = 1; | ||
96 | viewModeButton = new ViewModeButton( bar,mode ); | ||
95 | connect( viewModeButton, SIGNAL(changeMode(int)), | 97 | connect( viewModeButton, SIGNAL(changeMode(int)), |
96 | m_view, SLOT(slotChangeMode(int))); | 98 | m_view, SLOT(slotChangeMode(int))); |
97 | 99 | ||
98 | btn = new QToolButton( bar ); | 100 | btn = new QToolButton( bar ); |
99 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); | 101 | btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); |
100 | connect( btn, SIGNAL(clicked() ), | 102 | connect( btn, SIGNAL(clicked() ), |
101 | this, SLOT(slotConfig() ) ); | 103 | this, SLOT(slotConfig() ) ); |
102 | 104 | ||
103 | 105 | ||
104 | 106 | ||
105 | prevButton = new QToolButton(bar); | 107 | prevButton = new QToolButton(bar); |
106 | prevButton->setIconSet( Resource::loadIconSet( "back" ) ); | 108 | prevButton->setIconSet( Resource::loadIconSet( "back" ) ); |
107 | connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); | 109 | connect(prevButton,SIGNAL(clicked()),m_view,SLOT(slotShowPrev())); |
108 | 110 | ||
109 | nextButton = new QToolButton(bar); | 111 | nextButton = new QToolButton(bar); |
110 | nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); | 112 | nextButton->setIconSet( Resource::loadIconSet( "forward" ) ); |
111 | connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); | 113 | connect(nextButton,SIGNAL(clicked()),m_view,SLOT(slotShowNext())); |
112 | 114 | ||
113 | rotateButton = new QToolButton(bar); | 115 | rotateButton = new QToolButton(bar); |
114 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); | 116 | rotateButton->setIconSet( Resource::loadIconSet( "rotate" ) ); |
115 | rotateButton->setToggleButton(true); | 117 | rotateButton->setToggleButton(true); |
116 | 118 | ||
117 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { | 119 | if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) { |
118 | rotateButton->setOn(true); | 120 | rotateButton->setOn(true); |
119 | autoRotate = true; | 121 | autoRotate = true; |
120 | prevButton->hide(); | 122 | prevButton->hide(); |
121 | nextButton->hide(); | 123 | nextButton->hide(); |
122 | } else { | 124 | } else { |
123 | rotateButton->setOn(false); | 125 | rotateButton->setOn(false); |
124 | autoRotate = false; | 126 | autoRotate = false; |
125 | } | 127 | } |
126 | 128 | ||
127 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); | 129 | connect(rotateButton,SIGNAL(toggled(bool)),this,SLOT(slotRotateToggled(bool))); |
128 | 130 | ||
129 | btn = new QToolButton(bar); | 131 | btn = new QToolButton(bar); |
130 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); | 132 | btn->setIconSet( Resource::loadIconSet( "1to1" ) ); |
131 | btn->setToggleButton(true); | 133 | btn->setToggleButton(true); |
132 | btn->setOn(false); | 134 | btn->setOn(false); |
133 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); | 135 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotScaleToggled(bool))); |
134 | autoScale = true; | 136 | autoScale = true; |
135 | 137 | ||
136 | btn = new QToolButton(bar); | 138 | btn = new QToolButton(bar); |
137 | btn->setIconSet( Resource::loadIconSet( "mag" ) ); | 139 | btn->setIconSet( Resource::loadIconSet( "mag" ) ); |
138 | btn->setToggleButton(true); | 140 | btn->setToggleButton(true); |
139 | btn->setOn(true); | 141 | btn->setOn(true); |
140 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); | 142 | connect(btn,SIGNAL(toggled(bool)),this,SLOT(slotZoomerToggled(bool))); |
141 | zoomerOn = true; | 143 | zoomerOn = true; |
142 | } | 144 | } |
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp index 0e4a7cb..36e5dcf 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp | |||
@@ -1,45 +1,45 @@ | |||
1 | #include "viewmodebutton.h" | 1 | #include "viewmodebutton.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | 4 | ||
5 | #include <qtoolbar.h> | 5 | #include <qtoolbar.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | 7 | ||
8 | ViewModeButton::ViewModeButton( QToolBar* bar ) | 8 | ViewModeButton::ViewModeButton( QToolBar* bar,int def ) |
9 | : QToolButton( bar ) | 9 | : QToolButton( bar ) |
10 | { | 10 | { |
11 | slotChange( 1 ); | 11 | slotChange( def ); |
12 | QPopupMenu *pop= new QPopupMenu( this ); | 12 | QPopupMenu *pop= new QPopupMenu( this ); |
13 | pop->setCheckable( true ); | 13 | pop->setCheckable( true ); |
14 | pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); | 14 | pop->insertItem( tr("Thumbnail and Imageinfo"), 1 ); |
15 | pop->insertItem( tr("Thumbnail and Name" ), 2 ); | 15 | pop->insertItem( tr("Thumbnail and Name" ), 2 ); |
16 | pop->insertItem( tr("Name Only" ), 3 ); | 16 | pop->insertItem( tr("Name Only" ), 3 ); |
17 | connect(pop, SIGNAL(activated(int)), | 17 | connect(pop, SIGNAL(activated(int)), |
18 | this, SIGNAL(changeMode(int)) ); | 18 | this, SIGNAL(changeMode(int)) ); |
19 | connect(pop, SIGNAL(activated(int)), | 19 | connect(pop, SIGNAL(activated(int)), |
20 | this, SLOT(slotChange(int)) ); | 20 | this, SLOT(slotChange(int)) ); |
21 | 21 | ||
22 | 22 | ||
23 | setPopup( pop ); | 23 | setPopup( pop ); |
24 | } | 24 | } |
25 | 25 | ||
26 | ViewModeButton::~ViewModeButton() { | 26 | ViewModeButton::~ViewModeButton() { |
27 | } | 27 | } |
28 | 28 | ||
29 | void ViewModeButton::slotChange( int i ) { | 29 | void ViewModeButton::slotChange( int i ) { |
30 | QString name; | 30 | QString name; |
31 | switch( i ) { | 31 | switch( i ) { |
32 | case 1: | 32 | case 1: |
33 | name = "opie-eye/opie-eye-thumb"; | 33 | name = "opie-eye/opie-eye-thumb"; |
34 | break; | 34 | break; |
35 | case 2: | 35 | case 2: |
36 | name = "opie-eye/opie-eye-thumbonly"; | 36 | name = "opie-eye/opie-eye-thumbonly"; |
37 | break; | 37 | break; |
38 | case 3: | 38 | case 3: |
39 | name = "opie-eye/opie-eye-textview"; | 39 | name = "opie-eye/opie-eye-textview"; |
40 | break; | 40 | break; |
41 | } | 41 | } |
42 | 42 | ||
43 | qWarning("foo %d" +name, i ); | 43 | qWarning("foo %d" +name, i ); |
44 | setIconSet( Resource::loadIconSet( name ) ); | 44 | setIconSet( Resource::loadIconSet( name ) ); |
45 | } | 45 | } |
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.h b/noncore/graphics/opie-eye/gui/viewmodebutton.h index 3247114..48f0e67 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.h +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * GPLv2 only | 2 | * GPLv2 only |
3 | * zecke@handhelds.org | 3 | * zecke@handhelds.org |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef PHUNK_VIEW_MODE_BUTTON_H | 6 | #ifndef PHUNK_VIEW_MODE_BUTTON_H |
7 | #define PHUNK_VIEW_MODE_BUTTON_H | 7 | #define PHUNK_VIEW_MODE_BUTTON_H |
8 | 8 | ||
9 | #include <qpe/resource.h> | 9 | #include <qpe/resource.h> |
10 | 10 | ||
11 | #include <qtoolbutton.h> | 11 | #include <qtoolbutton.h> |
12 | 12 | ||
13 | class ViewModeButton : public QToolButton { | 13 | class ViewModeButton : public QToolButton { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | public: | 15 | public: |
16 | ViewModeButton( QToolBar* ); | 16 | ViewModeButton( QToolBar*,int def=1 ); |
17 | ~ViewModeButton(); | 17 | ~ViewModeButton(); |
18 | 18 | ||
19 | signals: | 19 | signals: |
20 | void changeMode( int ); | 20 | void changeMode( int ); |
21 | private slots: | 21 | private slots: |
22 | void slotChange( int i ); | 22 | void slotChange( int i ); |
23 | }; | 23 | }; |
24 | 24 | ||
25 | #endif | 25 | #endif |