diff options
author | gregory guy <[email protected]> | 2020-06-13 16:09:24 +0200 |
---|---|---|
committer | gregory guy <[email protected]> | 2020-06-13 16:09:24 +0200 |
commit | 2c9bc9b806f533df7b8f5349467d0f4be95314a4 (patch) | |
tree | 15f82ae94dd430374f3d939958912c4fb2855326 /src/app/mainWindow.cpp | |
parent | 38eaf7209a322a622e1b898eaa5477568ca9c6b6 (diff) | |
download | codeine-2c9bc9b806f533df7b8f5349467d0f4be95314a4.tar.gz codeine-2c9bc9b806f533df7b8f5349467d0f4be95314a4.zip |
Conversion qt3 -> tqt3
Signed-off-by: gregory guy <[email protected]>
Diffstat (limited to 'src/app/mainWindow.cpp')
-rw-r--r-- | src/app/mainWindow.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp index 856e0b6..bd16fc8 100644 --- a/src/app/mainWindow.cpp +++ b/src/app/mainWindow.cpp @@ -24,12 +24,12 @@ #include "playDialog.h" //::play() #include "playlistFile.h" #include "mxcl.library.h" -#include <qcstring.h> -#include <qdesktopwidget.h> -#include <qevent.h> //::stateChanged() -#include <qlayout.h> //ctor -#include <qpopupmenu.h> //because XMLGUI is poorly designed -#include <qobjectlist.h> +#include <ntqcstring.h> +#include <ntqdesktopwidget.h> +#include <ntqevent.h> //::stateChanged() +#include <ntqlayout.h> //ctor +#include <ntqpopupmenu.h> //because XMLGUI is poorly designed +#include <ntqobjectlist.h> #include "slider.h" #include "theStream.h" #include "volumeAction.h" @@ -48,13 +48,13 @@ namespace Codeine { /// @see codeine.h - QWidget *mainWindow() { return kapp->mainWidget(); } + TQWidget *mainWindow() { return kapp->mainWidget(); } MainWindow::MainWindow() : KMainWindow() , m_positionSlider( new Slider( this, 65535 ) ) - , m_timeLabel( new QLabel( " 0:00:00 ", this ) ) + , m_timeLabel( new TQLabel( " 0:00:00 ", this ) ) , m_titleLabel( new KSqueezedTextLabel( this ) ) { DEBUG_BLOCK @@ -65,11 +65,11 @@ MainWindow::MainWindow() new VideoWindow( this ); setCentralWidget( videoWindow() ); - setFocusProxy( videoWindow() ); // essential! See VideoWindow::event(), QEvent::FocusOut + setFocusProxy( videoWindow() ); // essential! See VideoWindow::event(), TQEvent::FocusOut // these have no affect beccause "KDE Knows Best" FFS - setDockEnabled( toolBar(), Qt::DockRight, false ); //doesn't make sense due to our large horizontal slider - setDockEnabled( toolBar(), Qt::DockLeft, false ); //as above + setDockEnabled( toolBar(), TQt::DockRight, false ); //doesn't make sense due to our large horizontal slider + setDockEnabled( toolBar(), TQt::DockLeft, false ); //as above m_titleLabel->setMargin( 2 ); m_timeLabel->setFont( KGlobalSettings::fixedFont() ); @@ -78,7 +78,7 @@ MainWindow::MainWindow() // work around a bug in KStatusBar // sizeHint width of statusbar seems to get stupidly large quickly - statusBar()->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Maximum ); + statusBar()->setSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Maximum ); statusBar()->addWidget( m_titleLabel, 1, false ); statusBar()->addWidget( m_analyzer = new Analyzer::Block( this ), 0, true ); @@ -90,16 +90,16 @@ MainWindow::MainWindow() // only show dvd button when playing a dvd { - struct KdeIsTehSuck : public QObject + struct KdeIsTehSuck : public TQObject { - virtual bool eventFilter( QObject*, QEvent *e ) + virtual bool eventFilter( TQObject*, TQEvent *e ) { - if (e->type() != QEvent::LayoutHint) + if (e->type() != TQEvent::LayoutHint) return false; // basically, KDE shows all tool-buttons, even if they are // hidden after it does any layout operation. Yay for KDE. Yay. - QWidget *button = (QWidget*)((KMainWindow*)mainWindow())->toolBar()->child( "toolbutton_toggle_dvd_menu" ); + TQWidget *button = (TQWidget*)((KMainWindow*)mainWindow())->toolBar()->child( "toolbutton_toggle_dvd_menu" ); if (button) button->setShown( TheStream::url().protocol() == "dvd" ); return false; @@ -111,11 +111,11 @@ MainWindow::MainWindow() } { - QPopupMenu *menu = 0, *settings = static_cast<QPopupMenu*>(factory()->container( "settings", this )); + TQPopupMenu *menu = 0, *settings = static_cast<TQPopupMenu*>(factory()->container( "settings", this )); int id = SubtitleChannelsMenuItemId, index = 0; #define make_menu( name, text ) \ - menu = new QPopupMenu( this, name ); \ + menu = new TQPopupMenu( this, name ); \ menu->setCheckable( true ); \ connect( menu, SIGNAL(activated( int )), engine(), SLOT(setStreamParameter( int )) ); \ connect( menu, SIGNAL(aboutToShow()), SLOT(aboutToShowMenu()) ); \ @@ -133,7 +133,7 @@ MainWindow::MainWindow() settings->insertSeparator( index ); } - QObjectList *list = toolBar()->queryList( "KToolBarButton" ); + TQObjectList *list = toolBar()->queryList( "KToolBarButton" ); if (list->isEmpty()) { MessageBox::error( i18n( "<qt>" PRETTY_NAME " could not load its interface, this probably means that " PRETTY_NAME " is not " @@ -154,8 +154,8 @@ MainWindow::MainWindow() else { //"faster" startup //TODO if we have a size stored for this video, do the "faster" route - QTimer::singleShot( 0, this, SLOT(init()) ); - QApplication::setOverrideCursor( KCursor::waitCursor() ); } + TQTimer::singleShot( 0, this, SLOT(init()) ); + TQApplication::setOverrideCursor( KCursor::waitCursor() ); } } void @@ -163,10 +163,10 @@ MainWindow::init() { DEBUG_BLOCK - connect( engine(), SIGNAL(statusMessage( const QString& )), this, SLOT(engineMessage( const QString& )) ); + connect( engine(), SIGNAL(statusMessage( const TQString& )), this, SLOT(engineMessage( const TQString& )) ); connect( engine(), SIGNAL(stateChanged( Engine::State )), this, SLOT(engineStateChanged( Engine::State )) ); - connect( engine(), SIGNAL(channelsChanged( const QStringList& )), this, SLOT(setChannels( const QStringList& )) ); - connect( engine(), SIGNAL(titleChanged( const QString& )), m_titleLabel, SLOT(setText( const QString& )) ); + connect( engine(), SIGNAL(channelsChanged( const TQStringList& )), this, SLOT(setChannels( const TQStringList& )) ); + connect( engine(), SIGNAL(titleChanged( const TQString& )), m_titleLabel, SLOT(setText( const TQString& )) ); connect( m_positionSlider, SIGNAL(valueChanged( int )), this, SLOT(showTime( int )) ); if( !engine()->init() ) { @@ -179,9 +179,9 @@ MainWindow::init() //would be dangerous for these to65535 happen before the videoWindow() is initialised setAcceptDrops( true ); connect( m_positionSlider, SIGNAL(sliderReleased( uint )), engine(), SLOT(seek( uint )) ); - connect( statusBar(), SIGNAL(messageChanged( const QString& )), engine(), SLOT(showOSD( const QString& )) ); + connect( statusBar(), SIGNAL(messageChanged( const TQString& )), engine(), SLOT(showOSD( const TQString& )) ); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); if( !kapp->isRestored() ) { KCmdLineArgs &args = *KCmdLineArgs::parsedArgs(); @@ -221,10 +221,10 @@ MainWindow::queryExit() // saving the window state without any controls fullScreenToggled( false ); showNormal(); - QApplication::sendPostedEvents( this, 0 ); + TQApplication::sendPostedEvents( this, 0 ); // otherwise KMainWindow saves the screensize as maximised Codeine::MessageBox::sorry( - "This annoying messagebox is to get round a bug in either KDE or Qt. " + "This annoying messagebox is to get round a bug in either KDE or TQt. " "Just press OK and Codeine will quit." ); //NOTE not actually needed saveAutoSaveSettings(); @@ -278,7 +278,7 @@ MainWindow::readProperties( KConfig *config ) } void -MainWindow::timerEvent( QTimerEvent* ) +MainWindow::timerEvent( TQTimerEvent* ) { static int counter = 0; @@ -310,24 +310,24 @@ MainWindow::timerEvent( QTimerEvent* ) void MainWindow::showTime( int pos ) { - #define zeroPad( n ) n < 10 ? QString("0%1").arg( n ) : QString::number( n ) + #define zeroPad( n ) n < 10 ? TQString("0%1").arg( n ) : TQString::number( n ) const int ms = (pos == -1) ? engine()->time() : int(engine()->length() * (pos / 65535.0)); const int s = ms / 1000; const int m = s / 60; const int h = m / 60; - QString time = zeroPad( s % 60 ); //seconds + TQString time = zeroPad( s % 60 ); //seconds time.prepend( ':' ); time.prepend( zeroPad( m % 60 ) ); //minutes time.prepend( ':' ); - time.prepend( QString::number( h ) ); //hours + time.prepend( TQString::number( h ) ); //hours m_timeLabel->setText( time ); } void -MainWindow::engineMessage( const QString &message ) +MainWindow::engineMessage( const TQString &message ) { statusBar()->message( message, 3500 ); } @@ -418,7 +418,7 @@ MainWindow::playMedia( bool show_welcome_dialog ) switch( dialog.exec() ) { case PlayDialog::FILE: { - const QString filter = engine()->fileFilter() + '|' + i18n("Supported Media Formats") + "\n*|" + i18n("All Files"); + const TQString filter = engine()->fileFilter() + '|' + i18n("Supported Media Formats") + "\n*|" + i18n("All Files"); const KURL url = KFileDialog::getOpenURL( ":default", filter, this, i18n("Select A File To Play") ); open( url ); } break; @@ -437,16 +437,16 @@ MainWindow::playMedia( bool show_welcome_dialog ) } } -class FullScreenToolBarHandler : QObject +class FullScreenToolBarHandler : TQObject { KToolBar *m_toolbar; int m_timer_id; bool m_stay_hidden_for_a_bit; - QPoint m_home; + TQPoint m_home; public: FullScreenToolBarHandler( KMainWindow *parent ) - : QObject( parent ) + : TQObject( parent ) , m_toolbar( parent->toolBar() ) , m_timer_id( 0 ) , m_stay_hidden_for_a_bit( false ) @@ -457,12 +457,12 @@ public: m_toolbar->installEventFilter( this ); } - bool eventFilter( QObject *o, QEvent *e ) + bool eventFilter( TQObject *o, TQEvent *e ) { - if (o == parent() && e->type() == QEvent::MouseMove) { + if (o == parent() && e->type() == TQEvent::MouseMove) { killTimer( m_timer_id ); - QMouseEvent const * const me = (QMouseEvent*)e; + TQMouseEvent const * const me = (TQMouseEvent*)e; if (m_stay_hidden_for_a_bit) { // wait for a small pause before showing the toolbar again // usage = user removes mouse from toolbar after using it @@ -485,7 +485,7 @@ public: // then cursor has moved far enough to trigger show toolbar show_toolbar: m_toolbar->show(), - m_home = QPoint(); + m_home = TQPoint(); else // cursor hasn't moved far enough yet // don't reset timer below, return instead @@ -497,22 +497,22 @@ show_toolbar: } } - if (o == parent() && e->type() == QEvent::Resize) + if (o == parent() && e->type() == TQEvent::Resize) { //we aren't managed by mainWindow when at FullScreen videoWindow()->move( 0, 0 ); - videoWindow()->resize( ((QWidget*)o)->size() ); + videoWindow()->resize( ((TQWidget*)o)->size() ); videoWindow()->lower(); } if (o == m_toolbar) switch (e->type()) { - case QEvent::Enter: + case TQEvent::Enter: m_stay_hidden_for_a_bit = false; killTimer( m_timer_id ); break; - case QEvent::Leave: + case TQEvent::Leave: m_toolbar->hide(); m_stay_hidden_for_a_bit = true; killTimer( m_timer_id ); @@ -525,7 +525,7 @@ show_toolbar: return false; } - void timerEvent( QTimerEvent* ) + void timerEvent( TQTimerEvent* ) { if (m_stay_hidden_for_a_bit) ; @@ -546,8 +546,8 @@ MainWindow::fullScreenToggled( bool isFullScreen ) DEBUG_FUNC_INFO if( isFullScreen ) - toolBar()->setPalette( palette() ), // due to 2px spacing in QMainWindow :( - setPaletteBackgroundColor( Qt::black ); // due to 2px spacing + toolBar()->setPalette( palette() ), // due to 2px spacing in TQMainWindow :( + setPaletteBackgroundColor( TQt::black ); // due to 2px spacing else toolBar()->unsetPalette(), unsetPalette(); @@ -555,7 +555,7 @@ MainWindow::fullScreenToggled( bool isFullScreen ) toolBar()->setMovingEnabled( !isFullScreen ); toolBar()->setHidden( isFullScreen && engine()->state() == Engine::Playing ); - reinterpret_cast<QWidget*>(menuBar())->setHidden( isFullScreen ); + reinterpret_cast<TQWidget*>(menuBar())->setHidden( isFullScreen ); statusBar()->setHidden( isFullScreen ); setMouseTracking( isFullScreen ); /// @see mouseMoveEvent() @@ -572,7 +572,7 @@ MainWindow::fullScreenToggled( bool isFullScreen ) void MainWindow::configure() { - const QCString sender = this->sender()->name(); + const TQCString sender = this->sender()->name(); if( sender == "video_settings" ) Codeine::showVideoSettingsDialog( this ); @@ -588,15 +588,15 @@ MainWindow::streamInformation() } void -MainWindow::setChannels( const QStringList &channels ) +MainWindow::setChannels( const TQStringList &channels ) { DEBUG_FUNC_INFO //TODO -1 = auto - QStringList::ConstIterator it = channels.begin(); + TQStringList::ConstIterator it = channels.begin(); - QPopupMenu *menu = (QPopupMenu*)child( (*it).latin1() ); + TQPopupMenu *menu = (TQPopupMenu*)child( (*it).latin1() ); menu->clear(); menu->insertItem( i18n("&Determine Automatically"), 1 ); @@ -604,10 +604,10 @@ MainWindow::setChannels( const QStringList &channels ) //the id is crucial, since the slot this menu is connected to requires //that information to set the correct channel - //NOTE we subtract 2 in xineEngine because QMenuData doesn't allow negative id + //NOTE we subtract 2 in xineEngine because TQMenuData doesn't allow negative id int id = 2; ++it; - for( QStringList::ConstIterator const end = channels.end(); it != end; ++it, ++id ) + for( TQStringList::ConstIterator const end = channels.end(); it != end; ++it, ++id ) menu->insertItem( *it, id ); menu->insertSeparator(); @@ -620,8 +620,8 @@ MainWindow::setChannels( const QStringList &channels ) void MainWindow::aboutToShowMenu() { - QPopupMenu *menu = (QPopupMenu*)sender(); - QCString name( sender() ? sender()->name() : 0 ); + TQPopupMenu *menu = (TQPopupMenu*)sender(); + TQCString name( sender() ? sender()->name() : 0 ); // uncheck all items first for( uint x = 0; x < menu->count(); ++x ) @@ -639,13 +639,13 @@ MainWindow::aboutToShowMenu() } void -MainWindow::dragEnterEvent( QDragEnterEvent *e ) +MainWindow::dragEnterEvent( TQDragEnterEvent *e ) { e->accept( KURLDrag::canDecode( e ) ); } void -MainWindow::dropEvent( QDropEvent *e ) +MainWindow::dropEvent( TQDropEvent *e ) { KURL::List list; KURLDrag::decode( e, list ); @@ -657,7 +657,7 @@ MainWindow::dropEvent( QDropEvent *e ) } void -MainWindow::keyPressEvent( QKeyEvent *e ) +MainWindow::keyPressEvent( TQKeyEvent *e ) { #define seek( step ) { \ const int new_pos = m_positionSlider->value() step; \ @@ -666,8 +666,8 @@ MainWindow::keyPressEvent( QKeyEvent *e ) switch( e->key() ) { - case Qt::Key_Left: seek( -500 ); break; - case Qt::Key_Right: seek( +500 ); break; + case TQt::Key_Left: seek( -500 ); break; + case TQt::Key_Right: seek( +500 ); break; case Key_Escape: KWin::clearState( winId(), NET::FullScreen ); default: ; } @@ -675,11 +675,11 @@ MainWindow::keyPressEvent( QKeyEvent *e ) #undef seek } -QPopupMenu* +TQPopupMenu* MainWindow::menu( const char *name ) { // KXMLGUI is "really good". - return static_cast<QPopupMenu*>(factory()->container( name, this )); + return static_cast<TQPopupMenu*>(factory()->container( name, this )); } |