[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src
From: Seb Ruiz <ruiz () kde ! org>
Date: 2008-12-03 10:23:52
Message-ID: 1228299832.335711.3878.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 891942 by seb:
Fix code style, prefix member variables with m_
M +1 -1 dialogs/FilenameLayoutDialog.cpp
M +29 -25 widgets/FilenameLayoutWidget.cpp
M +14 -17 widgets/FilenameLayoutWidget.h
--- trunk/extragear/multimedia/amarok/src/dialogs/FilenameLayoutDialog.cpp \
#891941:891942 @@ -21,7 +21,7 @@
#include <KConfig>
#include <KConfigGroup>
-#include <kstandarddirs.h>
+#include <KStandardDirs>
#include <KColorScheme>
#include <QGridLayout>
--- trunk/extragear/multimedia/amarok/src/widgets/FilenameLayoutWidget.cpp \
#891941:891942 @@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2008 Teo Mrnjavac <teo.mrnjavac@gmail.com> *
+ * (C) 2008 Seb Ruiz <ruiz@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -33,34 +34,32 @@
FilenameLayoutWidget::FilenameLayoutWidget( QWidget *parent )
: QFrame( parent )
, m_tokenCount( 0 ) //how many tokens have I built, need this to assign unique \
IDs
- , m_parsableScheme( "" )
+ , m_parsableScheme( QString() )
{
setAcceptDrops( true );
- layout = new QHBoxLayout;
- layout->setSpacing( 0 ); //this should be coherent when using separators
- setLayout( layout );
- backText = new QLabel( this );
- backText->setText( i18n( "<div align=center><i>Drag tokens here to define a \
filename scheme.</i></div>" ) ); //TODO: when we are out of string freeze remove \
the html from i18n
- backText->setFixedSize( 400, 30 );
- backText->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- backText->setAlignment(Qt::AlignCenter);
- backText->move( 3, 3 );
- layout->setContentsMargins( 3, 3, 3, 3 );
+ m_layout = new QHBoxLayout;
+ m_layout->setSpacing( 0 ); //this should be coherent when using separators
+ setLayout( m_layout );
+ m_infoText = new QLabel( this );
+ m_infoText->setText( i18n( "<div align=center><i>Drag tokens here to define a \
filename scheme.</i></div>" ) ); //TODO: when we are out of string freeze remove the \
html from i18n + m_infoText->setFixedSize( 300, 30 ); //FIXME this is rubbish, \
need to have it automatically fill the parent size + m_infoText->setSizePolicy( \
QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); + \
m_layout->setContentsMargins( 3, 3, 3, 3 ); }
-//Adds a token with caption text at the index-th place in the FilenameLayoutWidget \
bar and computes the parsable scheme currently defined by the FilenameLayoutWidget. \
+// Adds a token with caption text at the index-th place in the +// \
FilenameLayoutWidget bar and computes the parsable scheme +// currently defined by \
the FilenameLayoutWidget. void
FilenameLayoutWidget::addToken( QString text, int index ) //SLOT
{
if( !m_tokenCount )
- {
- backText->hide();
- }
+ m_infoText->hide();
m_tokenCount++;
Token *token = new Token( text, this );
- layout->insertWidget( index, token );
+ m_layout->insertWidget( index, token );
token->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -111,7 +110,7 @@
if ( !childUnder )
return;
- int index = layout->indexOf( childUnder );
+ int index = m_layout->indexOf( childUnder );
if( event->pos().x() < childUnder->pos().x() + childUnder->size().width() / 2 )
addToken( textFromMimeData, index );
@@ -232,7 +231,7 @@
m_tokenCount--;
if( !m_tokenCount )
- backText->show();
+ m_infoText->show();
generateParsableScheme();
emit schemeChanged();
@@ -263,7 +262,7 @@
if( !m_tokenCount )
{
- backText->show();
+ m_infoText->show();
}
drag->exec(Qt::MoveAction | Qt::CopyAction, Qt:: CopyAction);
@@ -277,11 +276,16 @@
{
//with m_parsableScheme
m_parsableScheme = "";
- for( int i = 0; i < layout->count(); ++i)
+ for( int i = 0; i < m_layout->count(); ++i)
{
- //TODO:REWRITE THIS USING PROPER Token::getString();
- QWidget * tempWidget = layout->itemAt(i)->widget();
- QString current = qobject_cast<Token*>( layout->itemAt(i)->widget() \
)->getLabel(); //getting a Token by grabbing a QLayoutItem* at index i and grabbing \
his QWidget. + // TODO: REWRITE THIS USING PROPER Token::getString();
+
+ // getting a Token by grabbing a QLayoutItem* at index i and grabbing his \
QWidget. + Token *token = qobject_cast<Token*>( m_layout->itemAt(i)->widget() \
); + if( !token )
+ continue;
+
+ QString current = token->getLabel();
if( current == i18n( "Track" ) )
m_parsableScheme += "%track";
@@ -381,11 +385,11 @@
{
m_tokenCount = 0;
QLayoutItem *child; //Qt docs suggest this for safe deletion of all the elements \
of a QLayout.
- while ((child = layout->takeAt(0)) != 0)
+ while ((child = m_layout->takeAt(0)) != 0)
{
delete child;
}
- backText->show();
+ m_infoText->show();
emit schemeChanged();
}
--- trunk/extragear/multimedia/amarok/src/widgets/FilenameLayoutWidget.h \
#891941:891942 @@ -23,9 +23,8 @@
#include <QHBoxLayout>
#include <QLabel>
-//Handles the graphical representation of the target filename as a bar that contains \
tokens.
-class FilenameLayoutWidget
- : public QFrame
+// Handles the graphical representation of the target filename as a bar that \
contains tokens. +class FilenameLayoutWidget : public QFrame
{
Q_OBJECT
@@ -40,29 +39,27 @@
void mousePressEvent( QMouseEvent *event );
void dragEnterEvent( QDragEnterEvent *event );
void dragMoveEvent( QDragMoveEvent *event );
- void dropEvent( QDropEvent *event );
+ void dropEvent( QDropEvent *event );
+
+ public slots:
+ void addToken( QString text, int index = 0); //this one needs to be a \
SLOT, connects to TokenListWidget::onDoubleClick. + void inferScheme( QString \
scheme );
+ signals:
+ void schemeChanged();
private:
- //void performDrag();
void performDrag( QMouseEvent *event );
void insertOverChild( Token *childUnder, QString &textFromMimeData, \
QDropEvent *event ); void generateParsableScheme();
-
- QLabel *backText; //text in the back of the empty \
FilenameLayoutWidget
- QHBoxLayout *layout; //main layout that holds the tokens
-
- QPoint m_startPos; //needed for initiating the drag
- unsigned int m_tokenCount;
- QString m_parsableScheme; //a string that TagGuesser will be able to \
use void removeAllTokens();
- public slots:
- void addToken( QString text, int index = 0); //this one needs to be a \
SLOT, connects to TokenListWidget::onDoubleClick.
- void inferScheme( QString scheme );
+ QLabel *m_infoText; // text in the back of the empty \
FilenameLayoutWidget + QHBoxLayout *m_layout; // main layout that \
holds the tokens
- signals:
- void schemeChanged();
+ QPoint m_startPos; // needed for initiating the drag
+ unsigned int m_tokenCount;
+ QString m_parsableScheme; // a string that TagGuesser will be able to \
use };
#endif //FILENAMELAYOUTWIDGET_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic