void JobGeneratorFake::generateJob() { generatorTimer_->start((rand() % 10)*1000); Job* j = new Job(); j->setName(generateTitle()); j->setPrintTime(rand() % 10); int type = rand() % 3; qDebug() << "type " << type; switch (type) { case 0: j->setType(Job::PDF); break; case 1: j->setType(Job::JPG); break; case 2: j->setType(Job::TIFF); break; default: break; } emit jobGenerated(j); //qDebug() << "added job " << list_.size(); }
QModelIndex KNMusicPlaylistManager::copyPlaylist(const QModelIndex &index) { //Check the validation of the index. if(!index.isValid()) { //Ignore the invalid operation. return QModelIndex(); } //Generate the playlist. KNMusicPlaylistModel *model=new KNMusicPlaylistModel(m_workingThread, m_playlistList), //Get the source playlist model. *sourceModel=playlist(index); //Set the copy model title. model->setTitle(generateTitle(sourceModel->title())); //Copy the playlist data. model->appendRows(sourceModel->playlistDetailInfos()); //Allocate a file path. model->allcateFilePath(); //Save the source model. writeModelToFile(sourceModel, sourceModel->filePath()); //Save the copied model. writeModelToFile(model, model->filePath()); //Add the model to the playlist. return m_playlistList->insert(index.row()+1, model); }
QModelIndex KNMusicPlaylistManager::createPlaylist(int playlistPosition) { //Generate the playlist. KNMusicPlaylistModel *model=new KNMusicPlaylistModel(m_workingThread, m_playlistList); //Set the generate the title. model->setTitle(generateTitle()); //Allocate a file path. model->allcateFilePath(); //Add the model to the playlist list, and give back the model index in the //model list model. return playlistPosition<0 || playlistPosition>=m_playlistList->rowCount()? m_playlistList->append(model): m_playlistList->insert(playlistPosition, model); }
LRESULT CContextMenuItemDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CenterWindow(GetParent()); RECT serverSelectorRect = GuiTools::GetDialogItemRect( m_hWnd, IDC_IMAGESERVERPLACEHOLDER); imageServerSelector_ = new CServerSelectorControl(true); imageServerSelector_->Create(m_hWnd, serverSelectorRect); imageServerSelector_->setTitle(TR("Выберите сервер")); imageServerSelector_->ShowWindow( SW_SHOW ); imageServerSelector_->SetWindowPos( 0, serverSelectorRect.left, serverSelectorRect.top, serverSelectorRect.right-serverSelectorRect.left, serverSelectorRect.bottom - serverSelectorRect.top , 0); imageServerSelector_->setServerProfile(Settings.imageServer); SetWindowText(TR("Добавить пункт меню")); TRC(IDC_MENUITEMLABEL, "Название:"); TRC(IDCANCEL, "Отмена"); generateTitle(); ::SetFocus(GetDlgItem(IDC_MENUITEMTITLEEDIT)); return 0; }
LRESULT CContextMenuItemDlg::OnServerSelectControlChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { generateTitle(); return 0; }