void MyLib::DeletePlayList(int nIndex,BOOL bNotify) { LPCPlayList pl=GetItem(nIndex); if(nIndex == GetSelectedIndex()) { if(nIndex ==GetItemCount() -1) m_IndexSelecting=nIndex-1; NotifyMsg(WM_SELECTED_PL_CHANGED,FALSE,(WPARAM)GetItem(m_IndexSelecting),(LPARAM)m_IndexSelecting); } if(pl->IsAuto()) { delete m_pFileMonitor; m_pFileMonitor=NULL; SetAutoPlaylist(NULL); } m_playLists.erase(m_playLists.begin()+nIndex); NotifyMsg(WM_PL_WILL_DELETED,FALSE,(WPARAM)pl,0); delete pl; if(bNotify) NotifyMsg(WM_SOME_PL_CHANGED,FALSE,0,0); }
BOOL MyLib::play(BOOL bClearPlayQueue) { stop(); if(bClearPlayQueue) ClearPlayQueue(); if(itemToPlay==NULL) { LPCPlayList pl=GetSelectedPL(); if(pl) itemToPlay = pl->GetSelectedItem(); } if( itemToPlay!=NULL && itemToPlay->isValide() && itemToPlay->IsFileExist() && itemToPlay->ScanId3Info(TRUE,TRUE)) { CBasicPlayer* s=CBasicPlayer::shared(); if(!s->stoped()) s->stop(); if(s->open(itemToPlay->GetUrl().c_str())) { itemPlaying=itemToPlay; //itemToPlay=NULL; s->play(); NotifyMsg(WM_NEW_TRACK_STARTED, FALSE, (WPARAM)&itemToPlay, 0); return TRUE; } } return FALSE; }
void CLocalSvrCommunication::StartupServer( ) { bool bRet = localServer.listen( LOCAL_COMM_NAME ); if ( !bRet ) { emit NotifyMsg( localServer.errorString( ) ); } }
LPCPlayListItem MyLib::PopTrackFromPlayQueue() { PlayQueueContainer::iterator i=playQueue.begin(); LPCPlayListItem item=*i; playQueue.erase(i); NotifyMsg(WM_PLAYQUEUE_CHANGED,FALSE,0,0); return item; }
void MyLib::SetSelectedIndex(int i) { if(m_IndexSelecting!=i) { m_IndexSelecting=i; NotifyMsg(WM_SELECTED_PL_CHANGED,FALSE,(WPARAM)GetItem(i),(LPARAM)i); } }
void CLocalSvrCommunication::GetData( ) { QLocalSocket* pSocket = qobject_cast< QLocalSocket* >( sender( ) ); quint64 nDataSize = pSocket->bytesAvailable( ); if ( 0 == nDataSize ) { return; } QByteArray byData = pSocket->readAll( ); QString strMsg( byData ); emit NotifyMsg( strMsg ); }
void MyLib::DeleteFromPlayQueue(LPCPlayListItem item) { for(PlayQueueContainer::iterator i=playQueue.begin(); i!=playQueue.end();) { PlayQueueContainer::iterator k=i; ++i; if(*k == item) { playQueue.erase(k); break; } } NotifyMsg(WM_PLAYQUEUE_CHANGED,FALSE,0,0); }
LPCPlayList MyLib::NewPlaylist(BOOL bNotify,std::tstring playlistname,bool bAutoPL) { LPCPlayList l=new CPlayList(playlistname); m_playLists.push_back(l); if(bAutoPL) l->SetAuto(bAutoPL); int nIndex=GetItemCount()-1; SetSelectedIndex(nIndex); if(bNotify) NotifyMsg(WM_SOME_PL_CHANGED,FALSE,0,0); return l; }
void fileMonitor::Watch() { while(bShouldWatch) { if(::ReadDirectoryChangesW(hDir, myOverLapped.notify,sizeof(myOverLapped.notify), TRUE, FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME, 0,&(myOverLapped.overlapped),0)) { DWORD w=::WaitForSingleObject(myOverLapped.overlapped.hEvent,INFINITE); if (w==WAIT_OBJECT_0){ FILE_NOTIFY_INFORMATION *pNotify=(FILE_NOTIFY_INFORMATION*)myOverLapped.notify; HandleNotify(pNotify); NotifyMsg(WM_FILE_FINDED,FALSE,(WPARAM)pPL,file_finded_end_playlist); } } } hWatch=NULL; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { Singleton( ); ui->setupUi(this); pSettings = CCommonFunction::GetSettings( CommonDataType::CfgSystem ); pTextCodec = CCommonFunction::GetTextCodec( ); pLocalComm = CLocalSvrCommunication::GetInstance( pTextCodec ); connect( pLocalComm, SIGNAL( NotifyMsg( QString ) ), this, SLOT( DisplayMessage( QString ) ) ); pLocalComm->StartupServer( ); g_pLocalCltComm = new CLocalCltCommunication( pTextCodec, this ); g_pLocalCltComm->Connect2Server( ); CNetProcessData::GetCommonParams( ); netServer = CSvrThread::GetInstance( this ); connect( netServer, SIGNAL( Notify( QString ) ), this, SLOT(DisplayMessage( QString ) ) ); netServer->start( ); netServer->StartupUdpServer( true ); netServer->StartupTcpServer( true ); qRegisterMetaType< QAbstractSocket::SocketError >( "QAbstractSocket::SocketError" ); sysTrayIcon = NULL; NotifyIcon( ); Qt::WindowFlags flags = windowFlags( ); flags &= ( ~Qt::WindowMinimizeButtonHint ); setWindowFlags( flags ); //setWindowState( Qt::WindowMinimized ); //close( ); }
void MainWindow::connectland() { connect(Btn_Close, SIGNAL(clicked()), qApp, SLOT(closeAllWindows())); connect(Btn_First_Ignore, SIGNAL(clicked()),this, SLOT(START_IgnorePath())); connect(Btn_First_Ok, SIGNAL(clicked()),this, SLOT(START_SetUpdaterPath())); connect(Btn_First_Search, SIGNAL(clicked()),this, SLOT(START_SearchPathUpdater())); connect(Btn_Item_addfolder, SIGNAL(clicked()),treeWidget, SLOT(AddFolder())); connect(Btn_Item_addfile, SIGNAL(clicked()),treeWidget, SLOT(AddFile())); connect(Btn_Item_remove, SIGNAL(clicked()),treeWidget, SLOT(DeleteSelectedFile())); connect(Btn_Apply_Edit, SIGNAL(clicked()), this, SLOT(Liste_Edit_Apply())); connect(checkBox, SIGNAL(clicked(bool)),treeWidget, SLOT(setFilelevel(bool))); connect(CBoxAfficherMsgBox, SIGNAL(stateChanged(int)), this, SLOT(EnableMsgBox(int))); connect(treeWidget,SIGNAL(TaskToShowInStatusbar(QString)), this, SLOT(Set_Status_Msg(QString))); connect(treeWidget,SIGNAL(TaskToShowGbEdit(bool)), this, SLOT(Liste_Show_Edit(bool))); connect(treeWidget,SIGNAL(TaskToEnableGUI(bool)), this, SLOT(EnableControls(bool))); connect(Btn_Apply, SIGNAL(clicked()), this, SLOT(LaunchGen())); connect(&OXM_Generator,SIGNAL(NotifyErrorMsg(QString)),this,SLOT(ShowMsgError(QString))); connect(&OXM_Generator,SIGNAL(NotifyMsg(QString)),this,SLOT(ShowMsg(QString))); connect(&OXM_Generator,SIGNAL(NotifyProgress(int, int)),this,SLOT(Showprogress(int, int))); connect(treeWidget,SIGNAL(NotifyProgress(int, int)),this,SLOT(Showprogress(int, int))); connect(&OXM_Generator,SIGNAL(finished()),this,SLOT(BuildFinished())); }
void CLocalSvrCommunication::SocketError( QLocalSocket::LocalSocketError ) { QLocalSocket* pSocket = qobject_cast< QLocalSocket* >( sender( ) ); emit NotifyMsg( pSocket->errorString( ) ); }
void MyLib::ClearPlayQueue() { playQueue.clear(); NotifyMsg(WM_PLAYQUEUE_CHANGED,FALSE,0,0); }
//后端插入,前端取出 void MyLib::PushPlayQueue(LPCPlayListItem item) { playQueue.push_back(item); NotifyMsg(WM_PLAYQUEUE_CHANGED,FALSE,0,0); }