示例#1
0
int QPlayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_MuButton_clicked(); break;
        case 1: on_RemoveButton_clicked(); break;
        case 2: on_pushButton_clicked(); break;
        case 3: on_StyleButton_clicked(); break;
        case 4: on_PrevButton_clicked(); break;
        case 5: on_NextButton_clicked(); break;
        case 6: on_PauseButton_clicked(); break;
        case 7: on_StopButton_clicked(); break;
        case 8: on_PlayButton_clicked(); break;
        case 9: on_AddButton_clicked(); break;
        case 10: addFiles(); break;
        case 11: nextFile(); break;
        case 12: prevFile(); break;
        case 13: aboutToFinish(); break;
        case 14: finished(); break;
        case 15: tick((*reinterpret_cast< qint64(*)>(_a[1]))); break;
        case 16: rndFile(); break;
        case 17: stateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
        case 18: metaStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
        case 19: sourceChanged((*reinterpret_cast< const Phonon::MediaSource(*)>(_a[1]))); break;
        case 20: tableClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 21: setupActions(); break;
        case 22: removeFiles(); break;
        default: ;
        }
        _id -= 23;
    }
    return _id;
}
MusicWidget::MusicWidget(QWidget *parent) :
        QWidget(parent,Qt::FramelessWindowHint | Qt::WindowSystemMenuHint)

{
    mute_state = 0;
    //QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    //setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
    //setGeometry(0,0,480,272);
    /*QPixmap testBackGroundPixmap;
    testBackGroundPixmap.load("image/background3.jpg");
    QPalette palette;
    palette.setBrush(this->backgroundRole(), QBrush(testBackGroundPixmap));
    this->setPalette(palette);*/

    QPixmap pix;
    madpalyerProcess = new QProcess;
    pix.load("image/player_skin.png",0,Qt::AvoidDither|Qt::ThresholdAlphaDither);
    resize(pix.size());
    setMask(pix.mask());
    QPalette palette;
    palette.setColor(QPalette::WindowText,Qt::red);

    volumelabel1=new QLabel(tr("Vol:"),this);
    volumelabel1->setPalette(palette);
    volumelabel1->setGeometry(208,138,48,16);
    volumelabel2=new QLabel(tr("10"),this);
    volumelabel2->setPalette(palette);
    volumelabel2->setGeometry(245,138,48,16);

    timelable = new QLabel(tr("00:00:00"),this);
    timelable->setPalette(palette);
    timelable->setGeometry(85,168,55,17);

    MusicTitleLabe = new QLabel(tr("更新播放列表"),this);
    MusicTitleLabe->setPalette(palette);
    MusicTitleLabe->setGeometry(QRect(110,203,500,17));//setGeometry(QRect(135,208,120,16))

    MusicTime = new QTimer(this);
    connect(MusicTime,SIGNAL(timeout()),this,SLOT(on_Debug()));
    MusicTime->start(1000);

     ArtistPic.load("image/fish.png");



    volume=new QSlider(this);
    volume->setOrientation(Qt::Vertical);
    volume->setRange(0,100);
    volume->setTickInterval(1);
    volume->setValue(10);
    volume->setBackgroundRole(QPalette::Window);
    volume->setGeometry(291,128,15,97);
    connect(volume,SIGNAL(valueChanged(int)),this,SLOT(volume_change(int)));

    mute=new QToolButton(this);
    mute->setIcon(QPixmap("image/Mute.png"));
    mute->setIconSize(QPixmap("image/Mute.png").size());
    mute->setAutoRaise(TRUE);
    mute->setGeometry(QRect(7,171,QPixmap("image/Mute.png").width(),QPixmap("image/Mute.png").height()));
    connect(mute,SIGNAL(clicked()),this,SLOT(mute_on_off()));


    volstatus = new QLabel(tr("停止"),this);
    volstatus->setPalette(palette);
    volstatus->setGeometry(QRect(88,150,51,17));//setGeometry(QRect(135,208,120,16))

///////////////////////////////////////////////////////////////////////////////////////////
    UpdateListButton = new QToolButton(this);
    UpdateListButton->setIcon(QPixmap("image/Update.png"));
    UpdateListButton->setIconSize(QPixmap("image/Update.png").size());
    UpdateListButton->setAutoRaise(TRUE);
    UpdateListButton->setGeometry(QRect(68,104,QPixmap("image/Update.png").width(),QPixmap("image/Update.png").height()));
    connect(UpdateListButton,SIGNAL(clicked()),this,SLOT(on_UpdateListButton_clicked()));

    PrevButton = new QToolButton(this);
    PrevButton->setIcon(QPixmap("image/Prev.png"));
    PrevButton->setIconSize(QPixmap("image/Prev.png").size());
    PrevButton->setAutoRaise(TRUE);
    PrevButton->setGeometry(QRect(106,104,QPixmap("image/Prev.png").width(),QPixmap("image/Prev.png").height()));
    connect(PrevButton,SIGNAL(clicked()),this,SLOT(on_PrevButton_clicked()));

    PlayButton = new QToolButton(this);
    PlayButton->setIcon(QPixmap("image/Play.png"));
    PlayButton->setIconSize(QPixmap("image/Play.png").size());
    PlayButton->setAutoRaise(TRUE);
    PlayButton->setGeometry(QRect(143,104,QPixmap("image/Play.png").width(),QPixmap("image/Play.png").height()));
    connect(PlayButton,SIGNAL(clicked()),this,SLOT(on_PlayButton_clicked()));

    NextSongButton = new QToolButton(this);
    NextSongButton->setIcon(QPixmap("image/Next.png"));
    NextSongButton->setIconSize(QPixmap("image/Next.png").size());
    NextSongButton->setAutoRaise(TRUE);
    NextSongButton->setGeometry(QRect(179,104,QPixmap("image/Next.png").width(),QPixmap("image/Next.png").height()));
    connect(NextSongButton,SIGNAL(clicked()),this,SLOT(on_NextSongButton_clicked()));

    StopButton = new QToolButton(this);
    StopButton->setIcon(QPixmap("image/Stop.png"));
    StopButton->setIconSize(QPixmap("image/Stop.png").size());
    StopButton->setAutoRaise(TRUE);
    StopButton->setGeometry(QRect(216,104,QPixmap("image/Stop.png").width(),QPixmap("image/Stop.png").height()));
    connect(StopButton,SIGNAL(clicked()),this,SLOT(close()));

/////////////////////////////////////////////////////////////////////////////////////////////

    CloseButton = new QToolButton(this);
    CloseButton->setIcon(QPixmap("image/Close.png"));
    CloseButton->setIconSize(QPixmap("image/Close.png").size());
    CloseButton->setAutoRaise(TRUE);
    CloseButton->setGeometry(QRect(264,205,QPixmap("image/Close.png").width(),QPixmap("image/Close.png").height()));
    connect(CloseButton,SIGNAL(clicked()),this,SLOT(on_StopButton_clicked()));
/////////////////////////////////////////////////////////////////////////////////////////////

}