BOOL LibraryFile::CheckForSubIndexes(SuperGallery *ParentGal, PathName *Path, SGLibType Type, BOOL Updated) { // The directory given had no XaraInfo\index.txt file, maybe it's a sublib, check // For defaults... String_256 DefaultIndex; String_256 IndexDesc; BOOL CanGenerate; BOOL ok = TRUE; // Need to reset the Quiet status before a stream of Library::Init calls ParentLibraryGallery->SetQuietStatus(FALSE); if(GetSubIndexDetails(ParentLibraryGallery, &DefaultIndex, &IndexDesc, &CanGenerate)) { String_256 SubP(Path->GetPath(TRUE)); // "%s\\XaraInfo\\%s" SubP += String_16(_R(IDS_LIBRARIES_XARAINFO_DIRNAME)); SubP += TEXT("\\") + DefaultIndex; PathName SubPath(SubP); if(!SubPath.IsValid()) { ERROR3("LibraryFile::CheckForSubIndexes invalid subpath"); return FALSE; } BOOL Generate = FALSE; BOOL Found = FALSE; // Is there a default sub index ? Found = SGLibOil::FileExists(&SubPath); if(!Found && CanGenerate) { if(Library::RemoteIndexes && GenerateIndexFile::IsDirectoryReadOnly(Path)) { // Check whether there's a 'temporary' index for this directory, and // possibly use that instead of the read only directory... String_256 RemoteLocationOfIndex; BOOL Existing = GenerateIndexFile::CheckForRemote(Path, &RemoteLocationOfIndex); if(Existing) { String_256 SubP(RemoteLocationOfIndex); // %s\\XaraInfo\\%s SGLibOil::AppendSlashIfNotPresent(&SubP); SubP += String_16(_R(IDS_LIBRARIES_XARAINFO_DIRNAME)); SubP += TEXT("\\") + DefaultIndex; PathName TmpSubPath(SubP); Found = SGLibOil::FileExists(&TmpSubPath); // OK, so there's a remote index sitting pretty in the user's temporary // location... Use that and don't bother generating a new one... if(Found) { SubPath.SetPathName(SubP); Path->SetPathName(RemoteLocationOfIndex); } } } if(!Found) { // tell the user that there is no index file, and ask if they want one generating String_256 WarnMsg; String_256 TmpPath(SubPath.GetLocation(FALSE)); LibraryFile::TidyUpSubPath(&TmpPath); WarnMsg.MakeMsg(_R(IDS_LIBRARY_NO_INDEX_FILE_GEN), (TCHAR *)IndexDesc, (TCHAR *)TmpPath); Error::SetError(0, WarnMsg, 0); //INT32 ButtonPressed = InformMessage(0, _R(IDS_NOTHUMBNAILS), _R(IDS_THUMBNAILS), _R(IDS_CANCEL)/*, _R(IDS_HELP)*/); INT32 ButtonPressed = InformMessage(0, _R(IDS_CREATE), _R(IDS_CANCEL)); Error::ClearError(); if(ButtonPressed < 2) { // Generate an index... String_64 Author(PRODUCT_NAME); Generate = GenerateDefaultIndex(&SubPath, Path, &Author, Type, TRUE); ok = TRUE; } else { // Cancel or help clicked ok = FALSE; } } } if(!Found && !CanGenerate) { // tell the user that there is no index file, and give them a cancel... String_256 WarnMsg; String_256 TmpPath(SubPath.GetLocation(FALSE)); LibraryFile::TidyUpSubPath(&TmpPath); WarnMsg.MakeMsg(_R(IDS_LIBRARY_NO_INDEX_FILE), (TCHAR *)IndexDesc, (TCHAR *)TmpPath); Error::SetError(0, WarnMsg, 0); INT32 ButtonPressed = InformWarning(0, _R(IDS_CANCEL), NULL); Error::ClearError(); ok = FALSE; } // Check again... Found = SGLibOil::FileExists(&SubPath); if((Found && ok) || (!Found && Generate && ok)) { String_256 Description256 = Path->GetPath(); AbbreviateName(Description256, 60, TRUE); String_64 Description(Description256); BOOL DoAgain = TRUE; while (DoAgain) { DoAgain = FALSE; // Create the sub lib Library *NewSubLib = new Library; if (NewSubLib != NULL) { String_64 DefIndex64(DefaultIndex); String_256 PathToAdd256 = SubPath.GetLocation(FALSE); TidyUpSubPath(&PathToAdd256); PathName PathToAdd(PathToAdd256); Error::ClearError(); // Create the actual group itself if(NewSubLib->Init(ParentGal, &PathToAdd, &Description, &DefIndex64, Type, Updated)) { Libraries.AddTail(NewSubLib); ok = TRUE; // Keep track of libraries added for redraw purposes... AddNewFolderToScrollRedrawSystem(NewSubLib); } else { delete NewSubLib; NewSubLib = NULL; String_256 WarnMsg; String_256 SmallPath; PathToAdd256.Left(&SmallPath, 150); // "The index for '%s' seems to be invalid and requires updating." WarnMsg.MakeMsg(_R(IDS_LIBRARY_DODGY_INDEX), (TCHAR *)SmallPath); Error::SetError(0, WarnMsg, 0); INT32 Button = InformWarning(0, _R(IDS_GENERATE), _R(IDS_CANCEL)); Error::ClearError(); String_256 IPathToAdd256(PathToAdd256); SGLibOil::AppendSlashIfNotPresent(&IPathToAdd256); IPathToAdd256 += TEXT("indexfle.txt"); // This is just to check we can write ok... PathName IPathToAdd(IPathToAdd256); if(Button == 1) DoAgain = SGLibOil::GenerateClicked(ParentLibraryGallery, &IPathToAdd); if(!DoAgain) ok = FALSE; Error::ClearError(); } } } } } return ok; }
AboutDialog::AboutDialog(QWidget* parent) : QDialog( parent ) { setupUi( this ); setWindowTitle( tr( "About" ) ); setWindowIcon( QPixmap( Skin::getImagePath() + "/icon16.png" ) ); setMinimumSize( width(), height() ); setMaximumSize( width(), height() ); move( 240, 100 ); QString about; about += QString("<center><b>Hydrogen Drum Machine %1 [%2] </b><br>").arg( H2Core::get_version().c_str() ).arg( __DATE__ ); about += tr( "<b>Website</b><br>" ); about += "http://www.hydrogen-music.org<br><br>"; about += tr( "<b>Project page</b><br>"); about += "http://sourceforge.net/projects/hydrogen<br><br>"; about += tr( "<b>Mailing lists</b><br>"); about += "http://lists.sourceforge.net/lists/listinfo/hydrogen-announce<br>"; about += "http://lists.sourceforge.net/lists/listinfo/hydrogen-devel<br>"; aboutTxt->setText( about ); std::vector<Author> authorList; authorList.push_back( Author( "Antonio Piraino (aka Journeyman)", "http://www.storiepvtride.it", "Italian manual" ) ); authorList.push_back( Author( "Artemiy Pavlov (aka Artemio)", "www.artemiolabs.com", "drum kits, demo patterns, web site" ) ); authorList.push_back( Author( "Alexandre Prokoudine", "", "Russian translation" ) ); authorList.push_back( Author( "Ben Powers", "", "docs" ) ); authorList.push_back( Author( "Benjamin Flaming", "", "JACK patches, bug fix" ) ); authorList.push_back( Author( "Carlo Impagliazzo (aka Truijllo)", "", "testing, ideas.." ) ); authorList.push_back( Author( "Chris Mennie", "http://chrismennie.ca/", "MIDI coding" ) ); authorList.push_back( Author( "Chris Wareham", "", "NetBSD patch" ) ); authorList.push_back( Author( "Christian Vorhof", "", "interface design concept" ) ); authorList.push_back( Author( "Daniil Kolpakov", "", "" ) ); authorList.push_back( Author( "Daniel Tonda Castillo", "", "Spanish manual" ) ); authorList.push_back( Author( "Daryl Hanlon","*****@*****.**","Spanish translation" ) ); authorList.push_back( Author( "Dave Allan", "", "manual review" ) ); authorList.push_back( Author( "Dave Fancella", "", "" ) ); authorList.push_back( Author( "Dave Phillips", "", "bug reports, ideas" ) ); authorList.push_back( Author( "Derrick Karpo", "", "patches, testing" ) ); authorList.push_back( Author( "Dmitry Ivanov", "", "" ) ); authorList.push_back( Author( "Ede Wolf", "", "FAQ, testing" ) ); authorList.push_back( Author( "Elizeu Santos-Neto", "", "Portuguese(Brazil) translation" ) ); authorList.push_back( Author( "Emiliano Grilli (aka Emillo)", "www.emillo.net", "drum kits, demo patterns" ) ); authorList.push_back( Author( "Esben Stien", "", "" ) ); authorList.push_back( Author( "Francesco Cabras", "", "patches, testing" ) ); authorList.push_back( Author( "Gabriel M. Beddingfield", "*****@*****.**", "patches, ideas" ) ); authorList.push_back( Author( "Gene", "", "patches, testing" ) ); authorList.push_back( Author( "Greg Bonik","*****@*****.**","pulseaudio coding" ) ); authorList.push_back( Author( "Jakob Lund", "*****@*****.**", "coding" ) ); authorList.push_back( Author( "Jason Schaefer", "*****@*****.**", "patches, lead/lag feature" ) ); authorList.push_back( Author( "Jesse Chappel", "", "JACK patches" ) ); authorList.push_back( Author( "Jérémy Zurcher", "", "coding") ); authorList.push_back( Author( "Jonas Melzer", "", "German manual" ) ); authorList.push_back( Author( "Jonathan Dempsey", "*****@*****.**", "Mac OSX port" ) ); authorList.push_back( Author( "Kevin Dahan (aka Unet)", "", "French translation" ) ); authorList.push_back( Author( "Lee Revell", "", "patches" ) ); authorList.push_back( Author( "Matt Walker", "", "" ) ); authorList.push_back( Author( "Michael Wolkstein", "*****@*****.**", "coding" ) ); authorList.push_back( Author( "Miguel Anxo Bouzada","*****@*****.**","Galician translation" ) ); authorList.push_back( Author( "Nikos Papadopoylos", "", "Greek translation" ) ); authorList.push_back( Author( "Noel Darlow", "", "manual review" ) ); authorList.push_back( Author( "Olivier Humbert", "", "French translation" ) ); authorList.push_back( Author( "Paul Dorman", "", "" ) ); authorList.push_back( Author( "Pawel Piatek (aka Xj)","*****@*****.**","coding, bugfixing" ) ); authorList.push_back( Author( "Pieter Van Isacker (aka aikie)", "", "Dutch manual and translation" ) ); authorList.push_back( Author( "Samuel Mimram", "", "packages" ) ); authorList.push_back( Author( "Sebastian Moors (aka mauser)", "*****@*****.**", "coding" ) ); authorList.push_back( Author( "Sergio Gil Perez de la Manga", "", "Spanish translation" ) ); authorList.push_back( Author( "Simon Donike", "", "German translation" ) ); authorList.push_back( Author( "Thijs Van Severen", "http://audio-and-linux.blogspot.be/", "manual, website, coding" ) ); authorList.push_back( Author( "Torben Hohn", "", "bugfixing, test" ) ); authorList.push_back( Author( "Yamasaki Yutaka", "*****@*****.**", "Japanese translation" ) ); authorList.push_back( Author( "Willie Sippel", "*****@*****.**", "GUI graphics, coding" ) ); QString sAuthors; sAuthors += tr( "<b>Main coder and mantainer:</b><br>" ); sAuthors += "<ul><li><p>Alessandro Cominu (aka Comix) [2001-2008]</li>"; sAuthors += "<li><p>Michael Wolkstein (aka Wolke) [2008-now]</li>"; sAuthors += "<li><p>Sebastian Moors (aka Mauser) [2008-now]</li></ul>"; sAuthors += "<b>Thanks to:</b>"; sAuthors += "<ul>"; for ( uint i = 0; i < authorList.size(); ++i ) { Author a = authorList.at( i ); sAuthors += "<li><p>"; sAuthors += "<i>" + a.m_sName + " - " + a.m_sInfo + "</i>"; sAuthors += "</p></li>"; } sAuthors += "</ul>"; authorsText->setText( sAuthors ); logoLabel->setPixmap( QPixmap( Skin::getImagePath() +"/about/aboutLogo.png" ) ); }
int main() { auto book = make_record(Title("Exploring the boundaries of the universe, a biography."), Author("Your mom")); auto title = get<Title>(book); auto author = get<Author>(book); std::cout << title << " was written by " << author << "." << std::endl; }
int main() { // Initialize Linked List LinkedList<Book> books = LinkedList<Book>(); // Define Data Author author0 = Author("Dan", "Brown"); Book theDavinciCode = Book("The DaVinci Code", author0, 597); Book angelsAndDemons = Book("Angels and Demons", author0, 496); Book deceptionPoint = Book("Deception Point", author0, 752); Book digitalFortress = Book("Digital Fortress", author0, 544); Author author1 = Author("Andy", "Weir"); Book theMartian = Book("The Martian", author1, 369); // Add books to list books.add(deceptionPoint); books.add(theDavinciCode); books.add(theMartian); // Verify each book was added to end of list std::cout << "Initial Set of Books" << "\n"; std::cout << "--------------------------------------------------" << "\n"; std::cout << books.toString(); // Push book to front of list books.push(digitalFortress); // Verify book was pushed to front of list std::cout << "Pushed Book" << "\n"; std::cout << "--------------------------------------------------" << "\n"; std::cout << books.get(0).toString(); // Add book at index books.add(3, angelsAndDemons); // Verify book was added to correct index std::cout << "Set of Books" << "\n"; std::cout << "--------------------------------------------------" << "\n"; std::cout << books.toString(); // Remove first book from list (Digital Fortress) books.remove(0); // Verify book was removed std::cout << "First Book" << "\n"; std::cout << "--------------------------------------------------" << "\n"; std::cout << books.get(0).toString(); // Delete 3rd book (Angels and Demons) books.remove(2); // Verify book was removed std::cout << "Set of Books" << "\n"; std::cout << "--------------------------------------------------" << "\n"; std::cout << books.toString(); // Delete last book (The Martian) books.remove(2); // Verify book was removed std::cout << "Set of Books" << "\n"; std::cout << "--------------------------------------------------" << "\n"; std::cout << books.toString(); return 0; }