Remove "using namespace" from header files and change std::strings to QStrings.

This commit is contained in:
Daniel Svensson 2006-03-07 14:13:21 +01:00
parent 8fb689d163
commit 24f699beb4
6 changed files with 9 additions and 21 deletions

View file

@ -3,8 +3,6 @@
#include "PixWidget.h" #include "PixWidget.h"
using namespace std;
class Button : public PixWidget class Button : public PixWidget
{ {
Q_OBJECT Q_OBJECT

View file

@ -25,8 +25,6 @@ class MainDisplay;
#include "PlayStatus.h" #include "PlayStatus.h"
#include "MainWindow.h" #include "MainWindow.h"
using namespace std;
class MainDisplay : public SkinDisplay class MainDisplay : public SkinDisplay
{ {
Q_OBJECT Q_OBJECT

View file

@ -20,8 +20,6 @@ class MainWindow;
#include "ShadedDisplay.h" #include "ShadedDisplay.h"
#include "Playlist.h" #include "Playlist.h"
using namespace std;
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT

View file

@ -82,7 +82,7 @@ Skin::BuildPlaylist (void)
} }
void void
Skin::setSkin (QString name) Skin::setSkin (const QString& name)
{ {
m_path = name; m_path = name;
@ -110,7 +110,7 @@ Skin::setSkin (QString name)
} }
QPixmap QPixmap
Skin::getPixmap (QString f, QDir dir) Skin::getPixmap (const QString& file, QDir dir)
{ {
/* check for files in zip and check if file exists */ /* check for files in zip and check if file exists */
@ -120,7 +120,7 @@ Skin::getPixmap (QString f, QDir dir)
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i); QFileInfo fileInfo = list.at(i);
QString fname = fileInfo.fileName().toLower(); QString fname = fileInfo.fileName().toLower();
if (fname.section(".", 0, 0) == f) { if (fname.section(".", 0, 0) == file) {
return QPixmap (fileInfo.filePath()); return QPixmap (fileInfo.filePath());
} }
} }
@ -130,10 +130,9 @@ Skin::getPixmap (QString f, QDir dir)
QPixmap * QPixmap *
Skin::getPixmap (string file) Skin::getPixmap (const QString& file)
{ {
QDir dir; QDir dir;
QString f = QString::fromStdString (file);
dir.setPath (m_path); dir.setPath (m_path);
dir.setFilter (QDir::Files); dir.setFilter (QDir::Files);
@ -142,7 +141,7 @@ Skin::getPixmap (string file)
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i); QFileInfo fileInfo = list.at(i);
QString fname = fileInfo.fileName().toLower(); QString fname = fileInfo.fileName().toLower();
if (fname.section(".", 0, 0) == f) { if (fname.section(".", 0, 0) == file) {
return new QPixmap (fileInfo.filePath()); return new QPixmap (fileInfo.filePath());
} }
} }

11
Skin.h
View file

@ -9,8 +9,6 @@
#include <QHash> #include <QHash>
#include <QDir> #include <QDir>
using namespace std;
class Skin : public QWidget class Skin : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -19,8 +17,8 @@ class Skin : public QWidget
Skin (); Skin ();
~Skin(); ~Skin();
void setSkin (QString name); void setSkin (const QString& name);
static QPixmap getPixmap (QString, QDir); static QPixmap getPixmap (const QString&, QDir);
const QPixmap getItem (uint part) const { return m_items->value(part); } const QPixmap getItem (uint part) const { return m_items->value(part); }
const QPixmap getPls (uint part) const { return m_playlist->value(part); } const QPixmap getPls (uint part) const { return m_playlist->value(part); }
@ -194,8 +192,7 @@ class Skin : public QWidget
private: private:
static Skin *singleton; static Skin *singleton;
QPixmap *Skin::getPixmap (string file); QPixmap *Skin::getPixmap (const QString& file);
void Parse (string file);
void BuildLetterMap (void); void BuildLetterMap (void);
void BuildButtons (void); void BuildButtons (void);
void BuildToggleButtons (void); void BuildToggleButtons (void);
@ -207,7 +204,7 @@ class Skin : public QWidget
void ParsePLEdit (void); void ParsePLEdit (void);
string m_skinname; QString m_skinname;
QString m_path; QString m_path;
QHash<uint, QPixmap> *m_items; QHash<uint, QPixmap> *m_items;

View file

@ -6,8 +6,6 @@ class TitleBar;
#include "PixWidget.h" #include "PixWidget.h"
#include "Button.h" #include "Button.h"
using namespace std;
class TitleBar : public PixWidget class TitleBar : public PixWidget
{ {
Q_OBJECT Q_OBJECT