summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/mainwindow.cpp
authoralwin <alwin>2004-11-01 01:58:25 (UTC)
committer alwin <alwin>2004-11-01 01:58:25 (UTC)
commitd69955ef9cddc3acc37b9dc96945cd4bae56eed5 (patch) (side-by-side diff)
tree7982a6da8f8141292eb0a1c09ce384784af2801d /noncore/graphics/opie-eye/gui/mainwindow.cpp
parent01fb5d6957984fe6fe5ed2109a024be7e8159d16 (diff)
downloadopie-d69955ef9cddc3acc37b9dc96945cd4bae56eed5.zip
opie-d69955ef9cddc3acc37b9dc96945cd4bae56eed5.tar.gz
opie-d69955ef9cddc3acc37b9dc96945cd4bae56eed5.tar.bz2
some menu working
some debug messages removed tried to remove some interesting effects when switching view mode
Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp52
1 files changed, 37 insertions, 15 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp
index 570ee45..ece51a1 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.cpp
+++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp
@@ -40,14 +40,14 @@
OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>)
PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style)
: QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 )
{
setCaption( QObject::tr("Opie Eye Caramba" ) );
- m_cfg = new Opie::Core::OConfig("phunkview");
- m_cfg->setGroup("Zecke_view" );
+ m_cfg = new Opie::Core::OConfig("opie-eye");
+ m_cfg->setGroup("main" );
m_storage = new StorageInfo();
connect(m_storage, SIGNAL(disksChanged() ),
this, SLOT( dirChanged() ) );
m_stack = new Opie::Ui::OWidgetStack( this );
@@ -105,13 +105,12 @@ void PMainWindow::slotToggleAutoscale()
bool cur = m_aAutoScale->isOn();
m_aAutoScale->setOn(!cur);
}
void PMainWindow::slotRotateToggled(bool how)
{
- odebug << "Autorotate: " << how << oendl;
autoRotate = how;
if (m_disp) {
m_disp->setAutoScaleRotate(!m_aAutoScale->isOn(),m_aAutoRotate->isOn());
}
}
@@ -223,16 +222,18 @@ void PMainWindow::initT( const char* name, T** ptr, int id) {
m_stack->addWidget( *ptr, id );
connect(*ptr, SIGNAL(sig_return()),
this,SLOT(slotReturn()));
}
+
void PMainWindow::initInfo() {
initT<imageinfo>( "Image Info", &m_info, ImageInfo );
connect(m_info,SIGNAL(dispImage(const QString&)),this,SLOT(slotDisplay(const QString&)));
}
+
void PMainWindow::initDisp() {
initT<ImageView>( "Image ScrollView", &m_disp, ImageDisplay );
if (m_disp) {
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_disp->setMinimumSize(QApplication::desktop()->size()/2);
}
@@ -253,31 +254,45 @@ void PMainWindow::initDisp() {
slotFullScreenToggled(m_aFullScreen->isOn());
}
}
void PMainWindow::slotToggleFullScreen()
{
- odebug << "Toggle full " << oendl;
bool current = !m_aFullScreen->isOn();
m_aFullScreen->setOn(current);
}
-void PMainWindow::slotFullScreenToggled(bool current)
+void PMainWindow::slotFullScreenButton(bool current)
+{
+ if (m_disp) odebug << "Disp fenster ist hidden: "<<m_disp->isHidden()<<oendl;
+ if (!m_disp) return;
+
+ /* I can not solve this effects here - it seems that we require some
+ status variable, too. so we will live with some interesting effects
+ meanwhile */
+#if 0
+ bool th = m_disp->isHidden();
+ setupViewWindow(current, false);
+ /* realy - after setting up the fullscreenmode while the window is hidden
+ it is unvisibile not hidden!!!!! Hell. */
+ if (th) m_disp->hide();
+#endif
+ setupViewWindow(current, true);
+}
+
+void PMainWindow::setupViewWindow(bool current, bool forceDisplay)
{
- odebug << "slotFullScreenToggled " << current << oendl;
if (!m_disp) return;
if (current) {
- odebug << "full" << oendl;
m_disp->setBackgroundColor(black);
m_disp->reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0));
m_disp->setVScrollBarMode(QScrollView::AlwaysOff);
m_disp->setHScrollBarMode(QScrollView::AlwaysOff);
m_disp->resize(qApp->desktop()->width(), qApp->desktop()->height());
} else {
setUpdatesEnabled(false);
- odebug << "window" << oendl;
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_disp->setMinimumSize(QApplication::desktop()->size()/2);
} else {
m_disp->setMinimumSize(10,10);
}
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
@@ -286,19 +301,25 @@ void PMainWindow::slotFullScreenToggled(bool current)
m_disp->reparent(0,QPoint(0,0));
}
m_disp->setBackgroundColor(white);
m_stack->addWidget(m_disp,ImageDisplay);
m_disp->setVScrollBarMode(QScrollView::Auto);
m_disp->setHScrollBarMode(QScrollView::Auto);
+ if (forceDisplay || m_disp->isVisible())
m_stack->raiseWidget(m_disp);
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_disp->resize(m_disp->minimumSize());
}
setUpdatesEnabled(true);
}
- m_disp->setFullScreen(current);
+ m_disp->setFullScreen(current,forceDisplay);
+}
+
+void PMainWindow::slotFullScreenToggled(bool current)
+{
+ setupViewWindow(current,true);
}
/**
* With big Screen the plan could be to 'detach' the image
* window if visible and to create a ne wone
* init* already supports it but I make no use of it for
@@ -326,13 +347,12 @@ void PMainWindow::slotShowInfo( const QString& inf ) {
fsButton->hide();
}
m_stack->raiseWidget( ImageInfo );
}
void PMainWindow::slotDisplay( const QString& inf ) {
- odebug << "slotDisplay: " << inf << oendl;
if ( !m_disp ) {
initDisp();
}
m_disp->setImage( inf );
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
if (m_gPrevNext->isEnabled()==false) {
@@ -344,13 +364,12 @@ void PMainWindow::slotDisplay( const QString& inf ) {
m_aViewfile->setEnabled(false);
m_aStartSlide->setEnabled(false);
fsButton->hide();
}
}
if (m_disp->fullScreen()) {
- //m_disp->showFullScreen();
qwsDisplay()->requestFocus( m_disp->winId(), TRUE);
} else {
m_stack->raiseWidget( ImageDisplay );
}
}
@@ -515,13 +534,13 @@ void PMainWindow::setupActions()
m_gPrevNext->insert(m_aNext);
m_aFullScreen = new QAction( tr( "Show images fullscreen" ),
Resource::loadIconSet("fullscreen"), 0, 0, this, 0, true );
m_aFullScreen->setToggleAction(true);
m_aFullScreen->setOn(false);
- connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenToggled(bool)));
+ connect(m_aFullScreen,SIGNAL(toggled(bool)),this,SLOT(slotFullScreenButton(bool)));
m_gDisplayType = new QActionGroup(this,"imagedisplaytype",false);
m_aAutoRotate = new QAction( tr( "Auto rotate images" ), Resource::loadIconSet( "rotate" ), 0, 0, this, 0, true );
m_aAutoRotate->setToggleAction(true);
if (m_stack->mode() == Opie::Ui::OWidgetStack::SmallScreen) {
m_aAutoRotate->setOn(true);
@@ -566,13 +585,13 @@ void PMainWindow::setupToolbar()
if (m_aBeam) {
m_aBeam->addTo( toolBar );
}
m_aShowInfo->addTo(toolBar);
m_aTrash->addTo(toolBar);
- m_aSetup->addTo(toolBar);
+// m_aSetup->addTo(toolBar);
m_gDisplayType->addTo(toolBar);
if (m_stack->mode() != Opie::Ui::OWidgetStack::SmallScreen) {
m_gPrevNext->addTo(toolBar);
} else {
@@ -583,12 +602,14 @@ void PMainWindow::setupToolbar()
void PMainWindow::setupMenu()
{
fileMenu = new QPopupMenu( menuBar() );
menuBar()->insertItem( tr( "File" ), fileMenu );
dispMenu = new QPopupMenu( menuBar() );
menuBar()->insertItem( tr( "Show" ), dispMenu );
+ settingsMenu = new QPopupMenu( menuBar() );
+ menuBar()->insertItem( tr( "Settings" ), settingsMenu );
m_aViewfile->addTo(fileMenu);
m_aShowInfo->addTo(fileMenu);
m_aStartSlide->addTo(fileMenu);
fileMenu->insertSeparator();
@@ -601,24 +622,25 @@ void PMainWindow::setupMenu()
if ( m_aBeam ) {
fileMenu->insertSeparator();
m_aBeam->addTo( fileMenu );
}
fileMenu->insertSeparator();
- m_aSetup->addTo(fileMenu);
m_aTrash->addTo(fileMenu);
- m_aHideToolbar->addTo(dispMenu);
listviewMenu = new QPopupMenu(dispMenu);
dispMenu->insertItem(Resource::loadIconSet("opie-eye/opie-eye-thumb"),tr("Listview mode"),listviewMenu);
m_gListViewMode->addTo(listviewMenu);
dispMenu->insertSeparator();
m_aFullScreen->addTo(dispMenu);
m_gDisplayType->addTo(dispMenu);
dispMenu->insertSeparator();
m_gPrevNext->addTo(dispMenu);
+
+ m_aSetup->addTo(settingsMenu);
+ m_aHideToolbar->addTo(settingsMenu);
}
void PMainWindow::listviewselected(QAction*which)
{
if (!which || which->isOn()==false) return;
int val = 1;