Changeset 17 for lib/mpdconnection.cpp


Ignore:
Timestamp:
12/30/07 20:55:36 (4 years ago)
Author:
sander
Message:

Lots of updates, the music library is now being showed in the tree view. Though it doesn't actually do anything yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/mpdconnection.cpp

    r11 r17  
    1717} 
    1818 
    19 /*MPDConnection::~MPDConnection() 
    20 { 
    21     qDebug("Closing MPDConnection..."); 
    22 }*/ 
     19MPDConnection::~MPDConnection() 
     20{ 
     21    sock.disconnectFromHost(); 
     22    quit(); 
     23 
     24    while(isRunning()) 
     25        msleep(100); 
     26} 
    2327 
    2428void MPDConnection::run() 
     
    6973 
    7074    if(hostname.isEmpty() || port == 0) { 
    71         qDebug("MPDConnection: no hostname and/or port supplied."); 
     75        qWarning("MPDConnection: no hostname and/or port supplied."); 
    7276        return false; 
    7377    } 
     
    104108            return true; 
    105109        } else { 
    106             qDebug("Couldn't connect"); 
     110            qWarning("Couldn't connect"); 
    107111            return false; 
    108112        } 
     
    152156 */ 
    153157 
     158void MPDConnection::listAllInfo() 
     159{ 
     160    QByteArray *data; 
     161 
     162    sendCommand("listallinfo"); 
     163    data = readFromSocket(); 
     164 
     165    emit musicLibraryUpdated(MPDParseUtils::parseLibraryItems(data)); 
     166 
     167    delete data; 
     168} 
     169 
     170void MPDConnection::lsInfo() 
     171{ 
     172    QByteArray *data; 
     173 
     174    sendCommand("lsinfo"); 
     175    data = readFromSocket(); 
     176 
     177    emit musicLibraryUpdated(MPDParseUtils::parseLibraryItems(data)); 
     178 
     179    delete data; 
     180} 
     181 
     182 
    154183/* 
    155184 * Playlist commands 
     
    369398{ 
    370399    QByteArray *data; 
     400    MPDStatus status; 
    371401 
    372402    sendCommand("status"); 
    373403    data = readFromSocket(); 
    374  
    375     emit statusUpdated(MPDParseUtils::parseStatus(data)); 
     404    MPDParseUtils::parseStatus(data, status); 
     405 
     406    emit statusUpdated(status); 
    376407 
    377408    delete data; 
Note: See TracChangeset for help on using the changeset viewer.