Changeset 25 for gui/main_window.cpp
- Timestamp:
- 12/31/07 15:06:00 (4 years ago)
- File:
-
- 1 edited
-
gui/main_window.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gui/main_window.cpp
r19 r25 1 1 #include <cmath> 2 2 #include <QtGui> 3 3 4 #include "main_window.h" 5 #include "preferences_dialog.h" 4 6 5 7 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) 6 8 { 9 QSettings settings; 10 7 11 setupUi(this); 8 12 9 //mpd_status = NULL;10 13 slidingVolume = false; 11 14 15 // Start connection thread 12 16 mpd.start(); 13 mpd.setHostname("mediapc"); 14 mpd.setPort(6600); 15 if(!mpd.connectToMPD()) { 16 qDebug("Big trouble! Exiting..."); 17 qApp->quit(); 17 18 // Set connection data 19 mpd.setHostname(settings.value("connection/host").toString()); 20 mpd.setPort(settings.value("connection/port").toInt()); 21 22 while(!mpd.connectToMPD()) { 23 showPreferencesDialog(); 24 25 mpd.setHostname(settings.value("connection/host").toString()); 26 mpd.setPort(settings.value("connection/port").toInt()); 18 27 } 19 28 … … 33 42 34 43 // GUI 44 connect(action_Preferences, SIGNAL(triggered(bool)), this, SLOT(showPreferencesDialog())); 35 45 connect(volumeSlider, SIGNAL(sliderPressed()), this, SLOT(volumeSliderPressed())); 36 46 connect(volumeSlider, SIGNAL(sliderReleased()), this, SLOT(setVolume())); … … 58 68 }*/ 59 69 70 void MainWindow::showPreferencesDialog() 71 { 72 PreferencesDialog pref(this); 73 pref.exec(); 74 } 75 60 76 void MainWindow::volumeSliderPressed() 61 77 { … … 210 226 QModelIndex mappedIndex = libraryProxyModel.mapToSource(index); 211 227 item = static_cast<MusicLibraryItem *>(mappedIndex.internalPointer()); 228 MPDStatus::State curState = mpd_status.state; 212 229 213 230 switch(item->type()) { … … 232 249 if(!files.isEmpty()) { 233 250 mpd.add(files); 234 mpd.startPlayingSong(); 235 } 236 } 251 if(curState != MPDStatus::State_Playing) 252 mpd.startPlayingSong(); 253 } 254 }
Note: See TracChangeset
for help on using the changeset viewer.
