diff options
author | Slávek Banko <[email protected]> | 2013-07-27 16:57:53 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2013-07-27 18:48:46 +0200 |
commit | 7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931 (patch) | |
tree | 4655c7263ca5c64d23d10167cb459dd9cb253815 /src/newstreamosd.cpp | |
parent | 88ea2b6cd4382627fb6efca9cc54825aee881d1e (diff) | |
download | tork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.tar.gz tork-7c2bc4b5ce4fc1a72868aa949e9ec49fbe2e7931.zip |
Initial TQt conversion
Diffstat (limited to 'src/newstreamosd.cpp')
-rw-r--r-- | src/newstreamosd.cpp | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/src/newstreamosd.cpp b/src/newstreamosd.cpp index 4ed437c..6c52760 100644 --- a/src/newstreamosd.cpp +++ b/src/newstreamosd.cpp @@ -47,24 +47,24 @@ #include <kconfig.h> #include <klocale.h> #include <kpopupmenu.h> -#include <qlistview.h> -#include <qlayout.h> -#include <qheader.h> - -#include <qpixmap.h> -#include <qpainter.h> -#include <qapplication.h> -#include <qframe.h> -#include <qtoolbutton.h> +#include <ntqlistview.h> +#include <ntqlayout.h> +#include <ntqheader.h> + +#include <ntqpixmap.h> +#include <ntqpainter.h> +#include <ntqapplication.h> +#include <ntqframe.h> +#include <ntqtoolbutton.h> #include <kapplication.h> #include <kiconloader.h> #include <X11/Xlib.h> -#include <qtooltip.h> //QToolTip::palette() +#include <ntqtooltip.h> //TQToolTip::palette() StreamOSD::StreamOSD( torkView* parent, bool tortraffic, const char* name ) - : QWidget( parent, name, WType_TopLevel | WNoAutoErase | WStyle_Customize | WX11BypassWM | WStyle_StaysOnTop ), + : TQWidget( parent, name, WType_TopLevel | WNoAutoErase | WStyle_Customize | WX11BypassWM | WStyle_StaysOnTop ), m_dirty(true), m_dragging(false), m_screen(0), @@ -95,7 +95,7 @@ StreamOSD::~StreamOSD() -void StreamOSD::setText( const QString& text ) +void StreamOSD::setText( const TQString& text ) { if( m_text != text ) { m_text = text; @@ -114,7 +114,7 @@ void StreamOSD::setProgress( int p ) } -void StreamOSD::setPosition( const QPoint& p ) +void StreamOSD::setPosition( const TQPoint& p ) { m_position = p; reposition(); @@ -135,53 +135,53 @@ void StreamOSD::refresh() void StreamOSD::renderOSD() { - QColor osdcolor = QToolTip::palette().color(QPalette::Active, QColorGroup::Background); + TQColor osdcolor = TQToolTip::palette().color(TQPalette::Active, TQColorGroup::Background); int large = font().pointSize(); int small = font().pointSize() - 1; - QFont f( font().rawName(), small ); + TQFont f( font().rawName(), small ); setFont( f ); - setWFlags( Qt::WX11BypassWM ); + setWFlags( TQt::WX11BypassWM ); setPalette(osdcolor); setPaletteBackgroundColor(osdcolor); //setBackgroundMode( PaletteBase ); - QGridLayout* TabPageLayout = new QGridLayout( this, 3, 8, 11, 6, "TabPageLayout"); + TQGridLayout* TabPageLayout = new TQGridLayout( this, 3, 8, 11, 6, "TabPageLayout"); TabPageLayout->setMargin(2); - QLabel* textLabel = new QLabel( this, "textLabel2" ); + TQLabel* textLabel = new TQLabel( this, "textLabel2" ); textLabel->setText(i18n("<b>Tor Traffic</b>")); - QFont f2( font().rawName(), large ); + TQFont f2( font().rawName(), large ); textLabel->setFont( f2 ); TabPageLayout->addMultiCellWidget( textLabel, 0,0,0,3 ); - changeID = new QToolButton( this,"changeid" ); + changeID = new TQToolButton( this,"changeid" ); changeID->setIconSet( SmallIconSet( "tork_identity" ) ); changeID->setUsesTextLabel(false); - changeID->setMaximumSize(SmallIconSet( "tork_identity" ).iconSize(QIconSet::Small)); + changeID->setMaximumSize(SmallIconSet( "tork_identity" ).iconSize(TQIconSet::Small)); changeID->adjustSize(); TabPageLayout->addWidget(changeID,0,5); - QToolTip::add( changeID, i18n( "Change the 'Exit' used for current traffic.") ); + TQToolTip::add( changeID, i18n( "Change the 'Exit' used for current traffic.") ); - toggleKDE = new QToolButton( this,"konq" ); + toggleKDE = new TQToolButton( this,"konq" ); toggleKDE->setIconSet( SmallIconSet( "tork_konqueroroff" ) ); toggleKDE->setUsesTextLabel(false); - toggleKDE->setMaximumSize(SmallIconSet( "tork_konqueroroff" ).iconSize(QIconSet::Small)); + toggleKDE->setMaximumSize(SmallIconSet( "tork_konqueroroff" ).iconSize(TQIconSet::Small)); toggleKDE->adjustSize(); TabPageLayout->addWidget(toggleKDE,0,6); - QToolTip::add( toggleKDE,i18n("Enable/Disable Konqueror's use of Tor")); + TQToolTip::add( toggleKDE,i18n("Enable/Disable Konqueror's use of Tor")); - QToolButton* hideMonitor = new QToolButton( this,"hide" ); + TQToolButton* hideMonitor = new TQToolButton( this,"hide" ); hideMonitor->setIconSet( SmallIconSet( "cancel" ) ); /* hideMonitor->setTextLabel(i18n( "Hide" )); - hideMonitor->setTextPosition(QToolButton::Right); + hideMonitor->setTextPosition(TQToolButton::Right); hideMonitor->setUsesTextLabel(true);*/ hideMonitor->setUsesTextLabel(false); - hideMonitor->setMaximumSize(SmallIconSet( "cancel" ).iconSize(QIconSet::Small)); + hideMonitor->setMaximumSize(SmallIconSet( "cancel" ).iconSize(TQIconSet::Small)); hideMonitor->adjustSize(); TabPageLayout->addWidget(hideMonitor,0,7); - QToolTip::add( hideMonitor,i18n("Hide this Display.")); + TQToolTip::add( hideMonitor,i18n("Hide this Display.")); - QToolTip::add( this,i18n("This displays all network activity currently being handled by Tor.")); + TQToolTip::add( this,i18n("This displays all network activity currently being handled by Tor.")); connect( hideMonitor, SIGNAL(clicked()), SLOT(slotHideMonitor()) ); @@ -194,28 +194,28 @@ void StreamOSD::renderOSD() // SLOT(slotToggleKDE()) ); - infoList = new QListView( this, "infoList" ); + infoList = new TQListView( this, "infoList" ); infoList->addColumn( "StreamID" ); infoList->addColumn( "Host" ); infoList->addColumn( kapp->iconLoader()->loadIconSet("tork_torsmall", KIcon::Small),"", 24 ); infoList->addColumn( "KB/s" ); infoList->addColumn( "Exit" ); - infoList->setColumnWidthMode(0, QListView::Manual); + infoList->setColumnWidthMode(0, TQListView::Manual); infoList->hideColumn(0); infoList->hideColumn(2); infoList->header()->setResizeEnabled(FALSE, 0); - infoList->setResizeMode( QListView::NoColumn ); - infoList->setHScrollBarMode(QScrollView::AlwaysOff); - infoList->setVScrollBarMode(QScrollView::AlwaysOff); - infoList->setSelectionMode( QListView::Single ); + infoList->setResizeMode( TQListView::NoColumn ); + infoList->setHScrollBarMode(TQScrollView::AlwaysOff); + infoList->setVScrollBarMode(TQScrollView::AlwaysOff); + infoList->setSelectionMode( TQListView::Single ); TabPageLayout->addMultiCellWidget( infoList, 1,1,0,7 ); infoList->setPaletteBackgroundColor(osdcolor); // infoList->header()->hide(); m_graphOut = new StatGraph(this,1,0,"Up"); m_graphIn = new StatGraph(this,1,0,"Down"); - m_graphOut->setReadingColor(Qt::red); - m_graphIn->setReadingColor(Qt::green); + m_graphOut->setReadingColor(TQt::red); + m_graphIn->setReadingColor(TQt::green); /* chart = new Chart(this, m_parent->speedHistoryTx(), m_parent->speedHistoryRx(), m_parent->historyBufferSize(), m_parent->historyPointer(), m_parent->maxSpeed()); TabPageLayout->addMultiCellWidget( chart, 2,2, 0,3 ); chart->setMinimumHeight(10);*/ @@ -224,12 +224,12 @@ void StreamOSD::renderOSD() //infoList->adjustSize(); //frame->update(); - connect( infoList, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); + connect( infoList, SIGNAL( contextMenuRequested(TQListViewItem*,const TQPoint&,int) ), this, SLOT( contextMenuRequested(TQListViewItem*,const TQPoint&,int) ) ); - QPoint point; - QRect rect( point, size() ); + TQPoint point; + TQRect rect( point, size() ); const uint M = fontMetrics().width( 'x' ); @@ -238,19 +238,19 @@ void StreamOSD::renderOSD() { /// apply the mask - static QBitmap mask; + static TQBitmap mask; mask.resize( size() ); - mask.fill( Qt::black ); + mask.fill( TQt::black ); - QPainter p( &mask ); - p.setBrush( Qt::white ); + TQPainter p( &mask ); + p.setBrush( TQt::white ); p.drawRoundRect( rect, xround, yround ); setMask( mask ); } m_osdBuffer.resize( rect.size() ); - QPainter p( &m_osdBuffer ); + TQPainter p( &m_osdBuffer ); p.fillRect( rect, backgroundColor() ); p.setPen( backgroundColor().dark() ); p.drawRoundRect( rect, xround, yround ); @@ -260,60 +260,60 @@ void StreamOSD::renderOSD() void StreamOSD::renderNonTorOSD() { - QColor osdcolor = Qt::green; + TQColor osdcolor = TQt::green; int large = font().pointSize(); int small = font().pointSize() - 1; - QFont f( font().rawName(), small ); + TQFont f( font().rawName(), small ); setFont( f ); - setWFlags( Qt::WX11BypassWM ); + setWFlags( TQt::WX11BypassWM ); setPalette(osdcolor); setPaletteBackgroundColor(osdcolor); //setBackgroundMode( PaletteBase ); - QGridLayout* TabPageLayout = new QGridLayout( this, 3, 8, 11, 6, "TabPageLayout"); + TQGridLayout* TabPageLayout = new TQGridLayout( this, 3, 8, 11, 6, "TabPageLayout"); TabPageLayout->setMargin(2); - QLabel* textLabel = new QLabel( this, "textLabel2" ); + TQLabel* textLabel = new TQLabel( this, "textLabel2" ); textLabel->setText(i18n("<b>Tor Traffic</b>")); - QFont f2( font().rawName(), large ); + TQFont f2( font().rawName(), large ); textLabel->setFont( f2 ); TabPageLayout->addMultiCellWidget( textLabel, 0,0,0,3 ); - QToolButton* hideMonitor = new QToolButton( this,"hide" ); + TQToolButton* hideMonitor = new TQToolButton( this,"hide" ); hideMonitor->setIconSet( SmallIconSet( "cancel" ) ); hideMonitor->setUsesTextLabel(false); - hideMonitor->setMaximumSize(SmallIconSet( "cancel" ).iconSize(QIconSet::Small)); + hideMonitor->setMaximumSize(SmallIconSet( "cancel" ).iconSize(TQIconSet::Small)); hideMonitor->adjustSize(); TabPageLayout->addWidget(hideMonitor,0,7); - QToolTip::add( hideMonitor,i18n("Hide this Display.")); + TQToolTip::add( hideMonitor,i18n("Hide this Display.")); - QToolTip::add( this,i18n("This displays all your system's network activity.")); + TQToolTip::add( this,i18n("This displays all your system's network activity.")); connect( hideMonitor, SIGNAL(clicked()), SLOT(slotHideMonitor()) ); - infoList = new QListView( this, "infoList" ); + infoList = new TQListView( this, "infoList" ); infoList->addColumn( "Program" ); infoList->addColumn( "Host" ); infoList->addColumn( "KB/s" ); - infoList->setColumnWidthMode(0, QListView::Manual); + infoList->setColumnWidthMode(0, TQListView::Manual); infoList->header()->setResizeEnabled(FALSE, 0); - infoList->setResizeMode( QListView::NoColumn ); - infoList->setHScrollBarMode(QScrollView::AlwaysOff); - infoList->setVScrollBarMode(QScrollView::AlwaysOff); - infoList->setSelectionMode( QListView::Single ); + infoList->setResizeMode( TQListView::NoColumn ); + infoList->setHScrollBarMode(TQScrollView::AlwaysOff); + infoList->setVScrollBarMode(TQScrollView::AlwaysOff); + infoList->setSelectionMode( TQListView::Single ); TabPageLayout->addMultiCellWidget( infoList, 1,1,0,7 ); infoList->setPaletteBackgroundColor(osdcolor); m_graphOut = new StatGraph(this,1,0,"Up"); m_graphIn = new StatGraph(this,1,0,"Down"); - m_graphOut->setReadingColor(Qt::red); - m_graphIn->setReadingColor(Qt::green); + m_graphOut->setReadingColor(TQt::red); + m_graphIn->setReadingColor(TQt::green); TabPageLayout->addMultiCellWidget( m_graphOut, 2,2, 0,3 ); TabPageLayout->addMultiCellWidget( m_graphIn, 2, 2, 4,7 ); - QPoint point; - QRect rect( point, size() ); + TQPoint point; + TQRect rect( point, size() ); const uint M = fontMetrics().width( 'x' ); @@ -322,19 +322,19 @@ void StreamOSD::renderNonTorOSD() { /// apply the mask - static QBitmap mask; + static TQBitmap mask; mask.resize( size() ); - mask.fill( Qt::black ); + mask.fill( TQt::black ); - QPainter p( &mask ); - p.setBrush( Qt::white ); + TQPainter p( &mask ); + p.setBrush( TQt::white ); p.drawRoundRect( rect, xround, yround ); setMask( mask ); } m_osdBuffer.resize( rect.size() ); - QPainter p( &m_osdBuffer ); + TQPainter p( &m_osdBuffer ); p.fillRect( rect, backgroundColor() ); p.setPen( backgroundColor().dark() ); p.drawRoundRect( rect, xround, yround ); @@ -345,19 +345,19 @@ void StreamOSD::renderNonTorOSD() void StreamOSD::setScreen( int screen ) { - const int n = QApplication::desktop()->numScreens(); + const int n = TQApplication::desktop()->numScreens(); m_screen = (screen >= n) ? n-1 : screen; reposition(); } -void StreamOSD::reposition( QSize newSize ) +void StreamOSD::reposition( TQSize newSize ) { if( !newSize.isValid() ) newSize = size(); - QPoint newPos = m_position; - const QRect& screen = QApplication::desktop()->screenGeometry( m_screen ); + TQPoint newPos = m_position; + const TQRect& screen = TQApplication::desktop()->screenGeometry( m_screen ); // now to properly resize if put into one of the corners we interpret the position // depending on the quadrant @@ -382,14 +382,14 @@ void StreamOSD::reposition( QSize newSize ) } -void StreamOSD::paintEvent( QPaintEvent* ) +void StreamOSD::paintEvent( TQPaintEvent* ) { bitBlt( this, 0, 0, &m_osdBuffer ); } -void StreamOSD::mousePressEvent( QMouseEvent* e ) +void StreamOSD::mousePressEvent( TQMouseEvent* e ) { m_dragOffset = e->pos(); @@ -405,7 +405,7 @@ void StreamOSD::mousePressEvent( QMouseEvent* e ) } -void StreamOSD::mouseReleaseEvent( QMouseEvent* ) +void StreamOSD::mouseReleaseEvent( TQMouseEvent* ) { if( m_dragging ) { m_dragging = false; @@ -414,16 +414,16 @@ void StreamOSD::mouseReleaseEvent( QMouseEvent* ) } -void StreamOSD::mouseMoveEvent( QMouseEvent* e ) +void StreamOSD::mouseMoveEvent( TQMouseEvent* e ) { if( m_dragging && this == mouseGrabber() ) { // check if the osd has been dragged out of the current screen - int currentScreen = QApplication::desktop()->screenNumber( e->globalPos() ); + int currentScreen = TQApplication::desktop()->screenNumber( e->globalPos() ); if( currentScreen != -1 ) m_screen = currentScreen; - const QRect& screen = QApplication::desktop()->screenGeometry( m_screen ); + const TQRect& screen = TQApplication::desktop()->screenGeometry( m_screen ); // make sure the position is valid m_position = fixupPosition( e->globalPos() - m_dragOffset - screen.topLeft() ); @@ -442,10 +442,10 @@ void StreamOSD::mouseMoveEvent( QMouseEvent* e ) } -QPoint StreamOSD::fixupPosition( const QPoint& pp ) +TQPoint StreamOSD::fixupPosition( const TQPoint& pp ) { - QPoint p(pp); - const QRect& screen = QApplication::desktop()->screenGeometry( m_screen ); + TQPoint p(pp); + const TQRect& screen = TQApplication::desktop()->screenGeometry( m_screen ); int maxY = screen.height() - height() - s_outerMargin; int maxX = screen.width() - width() - s_outerMargin; @@ -467,7 +467,7 @@ QPoint StreamOSD::fixupPosition( const QPoint& pp ) void StreamOSD::readSettings( KConfigBase* c ) { - QString oldGroup = c->group(); + TQString oldGroup = c->group(); if (m_tortraffic) c->setGroup( "TorKOSD Position" ); else @@ -482,7 +482,7 @@ void StreamOSD::readSettings( KConfigBase* c ) void StreamOSD::saveSettings( KConfigBase* c ) { - QString oldGroup = c->group(); + TQString oldGroup = c->group(); if (m_tortraffic) c->setGroup( "TorKOSD Position" ); else @@ -509,10 +509,10 @@ void StreamOSD::slotToggleKDE( ) emit requestToggleKDE(); } -void StreamOSD::contextMenuRequested( QListViewItem *, const QPoint &point, int ) +void StreamOSD::contextMenuRequested( TQListViewItem *, const TQPoint &point, int ) { - QPopupMenu *menu = new QPopupMenu( infoList ); + TQPopupMenu *menu = new TQPopupMenu( infoList ); menu->clear(); menu->insertItem( "Close Stream", this,SLOT(slotCloseStream()) ); @@ -524,7 +524,7 @@ void StreamOSD::contextMenuRequested( QListViewItem *, const QPoint &point, int void StreamOSD::slotCloseStream( ) { - QListViewItemIterator it(infoList, QListViewItemIterator::Selected); + TQListViewItemIterator it(infoList, TQListViewItemIterator::Selected); while ( it.current() ) { if (infoList->isSelected( it.current())) emit closeStream(it.current()->text(0)); |