[Jahshaka-cvs] SF.net SVN: editopia: [72] cinesuite/cineplay-cinecode/trunk/src
Status: Beta
Brought to you by:
jahshaka
From: <tim...@us...> - 2008-03-06 17:46:17
|
Revision: 72 http://editopia.svn.sourceforge.net/editopia/?rev=72&view=rev Author: timdewhirst Date: 2008-03-06 09:45:46 -0800 (Thu, 06 Mar 2008) Log Message: ----------- cinesuite - hook up of favorites - tweaks to layout of tray entry Modified Paths: -------------- cinesuite/cineplay-cinecode/trunk/src/CinePlay.cpp cinesuite/cineplay-cinecode/trunk/src/CinePlay.h cinesuite/cineplay-cinecode/trunk/src/Common.cpp cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.cpp cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.h cinesuite/cineplay-cinecode/trunk/src/Utils.cpp cinesuite/cineplay-cinecode/trunk/src/windows/favorite_tray_entry.ui Modified: cinesuite/cineplay-cinecode/trunk/src/CinePlay.cpp =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/CinePlay.cpp 2008-03-06 15:14:45 UTC (rev 71) +++ cinesuite/cineplay-cinecode/trunk/src/CinePlay.cpp 2008-03-06 17:45:46 UTC (rev 72) @@ -32,6 +32,8 @@ #include <qnetwork.h> #include <qscrollview.h> #include <qlayout.h> +#include <qvbox.h> +#include <qpalette.h> // std #include <algorithm> @@ -49,6 +51,7 @@ // trays... m_favoritesTray = new Tray( this, Tray::LOCATION_RIGHT ); + m_favoritesTray->hide(); QWidget* toggleRightTrayButton = CineUtils::FindWidget( "toggle_right_tray", this ); connect( toggleRightTrayButton, SIGNAL( toggled( bool ) ), m_favoritesTray, SLOT( setShown( bool ) ) ); @@ -62,15 +65,15 @@ sv->setHScrollBarMode( QScrollView::AlwaysOff ); sv->setVScrollBarMode( QScrollView::AlwaysOn ); - m_trayPlaceholder = sv->viewport(); - QVBoxLayout* trayLayout = new QVBoxLayout( m_trayPlaceholder ); - trayLayout->setSpacing( 0 ); - trayLayout->setMargin( 0 ); - trayLayout->setAutoAdd( true ); + // setup a placeholder + m_trayPlaceholder = new QVBox( sv->viewport() ); + sv->addChild( m_trayPlaceholder ); + m_trayPlaceholder->layout()->setAutoAdd( true ); // connect to favourites changing connect( m_impl->m_favList, SIGNAL( changed() ), this, SLOT( onFavouritesChanged() ) ); + onFavouritesChanged(); } bool CinePlay::LoadCmdLineInput( const QString& fname ) @@ -80,7 +83,7 @@ void destroy( QWidget* w ) { - delete w; + w->deleteLater(); } void CinePlay::onFavouritesChanged() @@ -89,6 +92,10 @@ std::for_each( m_trayEntries.begin(), m_trayEntries.end(), cineplay::destroy ); m_trayEntries.clear(); + QPalette darker = palette(); + darker.setColor( QColorGroup::Background, + darker.color( QPalette::Normal, QColorGroup::Background ).dark( 120 ) ); + // create all... CFavourites* favorites = m_impl->m_favList; for ( unsigned int i=0; i<favorites->getEntryCount(); ++i ) @@ -101,13 +108,31 @@ QFont f( font() ); f.setPointSizeFloat( 0.6* f.pointSizeFloat() ); e->setFont( f ); + + if ( i%2 ) + e->setPalette( darker ); + + connect( e, SIGNAL( remove( int ) ), this, SLOT( onRemoveFavorite( int ) ) ); + connect( e, SIGNAL( selected( int ) ), this, SLOT( onSelectFavorite( int ) ) ); + e->show(); m_trayEntries.push_back( e ); } - m_trayPlaceholder->layout()->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); } +void CinePlay::onRemoveFavorite( int id ) +{ + m_impl->m_favList->removeEntry( id ); + m_impl->m_favList->BuildMenu( m_impl->m_favMenu, m_impl, SLOT( onFavSelected(int) ) ); + m_impl->updateFavMenu(); +} + +void CinePlay::onSelectFavorite( int id ) +{ + m_impl->onFavSelected( id ); +} + void CinePlay::keyPressEvent( QKeyEvent* e ) { QWidget::keyPressEvent( e ); Modified: cinesuite/cineplay-cinecode/trunk/src/CinePlay.h =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/CinePlay.h 2008-03-06 15:14:45 UTC (rev 71) +++ cinesuite/cineplay-cinecode/trunk/src/CinePlay.h 2008-03-06 17:45:46 UTC (rev 72) @@ -58,6 +58,8 @@ private slots: void onFavouritesChanged(); + void onRemoveFavorite( int ); + void onSelectFavorite( int ); private: Common* m_impl; Modified: cinesuite/cineplay-cinecode/trunk/src/Common.cpp =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/Common.cpp 2008-03-06 15:14:45 UTC (rev 71) +++ cinesuite/cineplay-cinecode/trunk/src/Common.cpp 2008-03-06 17:45:46 UTC (rev 72) @@ -795,7 +795,7 @@ QImage thumb; { QMutexLocker lock( &m_frameCacheMutex ); - thumb = CineUtils::ImageToQImage( il::rescale( m_frameCache->get_image(), 48, 48 ) ); + thumb = CineUtils::ImageToQImage( il::rescale( m_frameCache->get_image(), 64, 64 ) ); } AddFavouriteDlg dlg( m_parent, m_favList, m_lastFile, m_lastFrame, thumb ); Modified: cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.cpp =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.cpp 2008-03-06 15:14:45 UTC (rev 71) +++ cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.cpp 2008-03-06 17:45:46 UTC (rev 72) @@ -41,5 +41,15 @@ image->setPixmap( QPixmap( thumb ) ); location_label->setText( location ); name_label->setText( name ); - connect( bottom_button, SIGNAL( clicked() ), this, SIGNAL( remove() ) ); + connect( bottom_button, SIGNAL( clicked() ), this, SLOT( onRemoveClicked() ) ); } + +void FavoriteTrayEntry::mouseDoubleClickEvent( QMouseEvent* ) +{ + emit selected( id_ ); +} + +void FavoriteTrayEntry::onRemoveClicked() +{ + emit remove( id_ ); +} Modified: cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.h =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.h 2008-03-06 15:14:45 UTC (rev 71) +++ cinesuite/cineplay-cinecode/trunk/src/FavoriteTrayEntry.h 2008-03-06 17:45:46 UTC (rev 72) @@ -38,8 +38,15 @@ const QImage& thumb ); signals: - void remove(); + void remove( int id ); + void selected( int id ); +protected: + void mouseDoubleClickEvent( QMouseEvent* e ); + +private slots: + void onRemoveClicked(); + private: int id_; }; Modified: cinesuite/cineplay-cinecode/trunk/src/Utils.cpp =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/Utils.cpp 2008-03-06 15:14:45 UTC (rev 71) +++ cinesuite/cineplay-cinecode/trunk/src/Utils.cpp 2008-03-06 17:45:46 UTC (rev 72) @@ -403,7 +403,7 @@ } QImage im; - im.load( bytes ); + im.loadFromData( bytes, "PNG" ); return im; } Modified: cinesuite/cineplay-cinecode/trunk/src/windows/favorite_tray_entry.ui =================================================================== --- cinesuite/cineplay-cinecode/trunk/src/windows/favorite_tray_entry.ui 2008-03-06 15:14:45 UTC (rev 71) +++ cinesuite/cineplay-cinecode/trunk/src/windows/favorite_tray_entry.ui 2008-03-06 17:45:46 UTC (rev 72) @@ -8,8 +8,8 @@ <rect> <x>0</x> <y>0</y> - <width>198</width> - <height>52</height> + <width>204</width> + <height>58</height> </rect> </property> <property name="sizePolicy"> @@ -30,7 +30,7 @@ <property name="caption"> <string>Form1</string> </property> - <grid> + <hbox> <property name="name"> <cstring>unnamed</cstring> </property> @@ -40,217 +40,187 @@ <property name="spacing"> <number>0</number> </property> - <widget class="QLayoutWidget" row="0" column="1" rowspan="3" colspan="1"> + <widget class="QLabel"> <property name="name"> - <cstring>layout17</cstring> + <cstring>image</cstring> </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>0</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>image</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>48</width> - <height>48</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>48</width> - <height>48</height> - </size> - </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="text"> - <string></string> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - </widget> - </vbox> - </widget> - <widget class="QLabel" row="1" column="2"> - <property name="name"> - <cstring>location_label</cstring> - </property> <property name="sizePolicy"> <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>7</vsizetype> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string><i>location</i></string> + <property name="minimumSize"> + <size> + <width>48</width> + <height>48</height> + </size> </property> - <property name="alignment"> - <set>WordBreak|AlignTop|AlignLeft</set> - </property> - </widget> - <widget class="QLabel" row="0" column="2"> - <property name="name"> - <cstring>name_label</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>7</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="maximumSize"> <size> - <width>32767</width> - <height>32767</height> + <width>48</width> + <height>48</height> </size> </property> + <property name="lineWidth"> + <number>0</number> + </property> <property name="text"> - <string><qt><b>name</b></qt></string> + <string></string> </property> - <property name="alignment"> - <set>AlignTop|AlignLeft</set> + <property name="pixmap"> + <pixmap>image0</pixmap> </property> </widget> - <widget class="QFrame" row="0" column="3" rowspan="2" colspan="1"> + <widget class="QLayoutWidget"> <property name="name"> - <cstring>frame12</cstring> + <cstring>layout5</cstring> </property> - <property name="frameShape"> - <enum>StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>Plain</enum> - </property> - <property name="lineWidth"> - <number>0</number> - </property> <vbox> <property name="name"> <cstring>unnamed</cstring> </property> <property name="margin"> - <number>0</number> + <number>3</number> </property> <property name="spacing"> <number>0</number> </property> <widget class="QLayoutWidget"> <property name="name"> - <cstring>layout19</cstring> + <cstring>layout4</cstring> </property> - <grid> + <hbox> <property name="name"> <cstring>unnamed</cstring> </property> <property name="margin"> <number>0</number> </property> - <widget class="QLabel" row="1" column="1"> + <property name="spacing"> + <number>0</number> + </property> + <widget class="QLabel"> <property name="name"> - <cstring>bottom_label</cstring> + <cstring>name_label</cstring> </property> - <property name="text"> - <string>remove</string> - </property> - </widget> - <spacer row="2" column="0"> - <property name="name"> - <cstring>spacer13</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>9</width> - <height>41</height> - </size> - </property> - </spacer> - <widget class="jahwidgets::qt3::Pushbutton" row="1" column="0"> - <property name="name"> - <cstring>bottom_button</cstring> - </property> <property name="sizePolicy"> <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> + <hsizetype>1</hsizetype> + <vsizetype>7</vsizetype> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>16</width> - <height>16</height> - </size> - </property> <property name="maximumSize"> <size> - <width>16</width> - <height>16</height> + <width>32767</width> + <height>32767</height> </size> </property> - <property name="paletteBackgroundColor"> - <color> - <red>240</red> - <green>240</green> - <blue>240</blue> - </color> - </property> <property name="text"> - <string></string> + <string><qt><b>name</b></qt></string> </property> - <property name="pixmap"> - <pixmap>image1</pixmap> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> </property> - <property name="flat"> - <bool>true</bool> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> </property> - <property name="activeOnIcon"> - <pixmap>image2</pixmap> - </property> - <property name="normalOnIcon"> - <pixmap>image1</pixmap> - </property> - <property name="activeOffIcon"> - <pixmap>image2</pixmap> - </property> - <property name="normalOffIcon"> - <pixmap>image1</pixmap> - </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="jahwidgets::qt3::Pushbutton"> + <property name="name"> + <cstring>bottom_button</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16</width> + <height>16</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap>image1</pixmap> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <property name="activeOnIcon"> + <pixmap>image2</pixmap> + </property> + <property name="normalOnIcon"> + <pixmap>image1</pixmap> + </property> + <property name="activeOffIcon"> + <pixmap>image2</pixmap> + </property> + <property name="normalOffIcon"> + <pixmap>image1</pixmap> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>bottom_label</cstring> + </property> + <property name="text"> + <string>remove</string> + </property> + </widget> + </hbox> </widget> - </grid> + </hbox> </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>location_label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><i>location</i></string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter|AlignLeft</set> + </property> + </widget> </vbox> </widget> - </grid> + </hbox> </widget> <images> <image name="image0"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |