bool KNMusicLibraryModel::insertMusicRows( int row, const QList<KNMusicDetailInfo> &detailInfos) { //Insert the array to the database. for(int i=detailInfos.size()-1; i>-1; --i) { //Get the detail info. const KNMusicDetailInfo &detailInfo=detailInfos.at(i); //Insert the data to the specific position. m_database->insert(row, generateDataArray(detailInfo)); //Check the image cover image hash. if(!detailInfo.coverImageHash.isEmpty()) { //Increase the new cover image hash. m_hashAlbumArtCounter.insert( detailInfo.coverImageHash, m_hashAlbumArtCounter.value( detailInfo.coverImageHash)+1); } //Add the detail info to category models. addCategoryDetailInfo(detailInfo); } //Check out the database size. if(m_database->size()==1) { //This is the first record, emit the signal. emit libraryNotEmpty(); } //Do the original insert operation. return KNMusicModel::insertMusicRows(row, detailInfos); }
void KNMusicLibraryModel::appendRows( const QList<KNMusicDetailInfo> &detailInfos) { //Append all the data to the databases. for(auto i : detailInfos) { //Append all the detail info to the database. m_database->append(generateDataArray(i)); //Check the image cover image hash. if(!i.coverImageHash.isEmpty()) { //Increase the new cover image hash. m_hashAlbumArtCounter.insert( i.coverImageHash, m_hashAlbumArtCounter.value(i.coverImageHash)+1); } //Add the detail info to category models. addCategoryDetailInfo(i); } //Do the original append operations. KNMusicModel::appendRows(detailInfos); //Check out the row count. if(rowCount()==1) { //This is the first record, emit the signal. emit libraryNotEmpty(); } }
bool KNMusicLibraryModel::replaceRow(int row, const KNMusicDetailInfo &detailInfo) { //Update the category data. updateCategoryDetailInfo(rowDetailInfo(row), detailInfo); //Replace the data in the database. m_database->replace(row, generateDataArray(detailInfo)); //Do the original operation. return KNMusicModel::replaceRow(row, detailInfo); }
bool KNMusicLibraryModel::setData(const QModelIndex &index, const QVariant &value, int role) { //Do the original data set operation. bool result=KNMusicModel::setData(index, value, role); //Update the data in the database. m_database->replace(index.row(), generateDataArray(rowDetailInfo(index.row()))); //Give back the result. return result; }
bool KNMusicLibraryModel::updateModelRow( int row, const KNMusicAnalysisItem &analysisItem) { //Get the previous detail info. const KNMusicDetailInfo &previousDetailInfo=rowDetailInfo(row); //Update the category data. updateCategoryDetailInfo(previousDetailInfo, analysisItem.detailInfo); //Do the original update operation. bool result=KNMusicModel::updateRow(row, analysisItem); //Update the data in the database. m_database->replace(row, generateDataArray(rowDetailInfo(row))); //Give the result back. return result; }
//main function definition int main() { SeedRand(); //seeds the rand() with system time int size=6; struct input* ip = NULL; struct data** dt = NULL; ip=generateArray(size); //input structure is generated and initialized dt=generateDataArray(size); //generates and initializes data structure findMax(dt,size,ip); //calls findMax function printData(dt,size); //printData function called //frees the allocated space from the heap freeallpointers(dt,size,ip); return 0; //successful termination of program }
bool KNMusicLibraryModel::insertRow(int row, const KNMusicDetailInfo &detailInfo) { //Insert the array to the database. m_database->insert(row, generateDataArray(detailInfo)); //Check the image cover image hash. if(!detailInfo.coverImageHash.isEmpty()) { //Increase the new cover image hash. m_hashAlbumArtCounter.insert( detailInfo.coverImageHash, m_hashAlbumArtCounter.value(detailInfo.coverImageHash)+1); } //Add the detail info to category models. addCategoryDetailInfo(detailInfo); //Check out the database size. if(m_database->size()==1) { //This is the first record, emit the signal. emit libraryNotEmpty(); } //Do the original append operation. return KNMusicModel::insertRow(row, detailInfo); }