FLHelpWindow::~FLHelpWindow() { history.clear(); QMap < int, QString >::Iterator it = mHistory.begin(); for (; it != mHistory.end(); ++it) history.append(*it); QString historial(AQ_DISKCACHE_DIRPATH + "/.FLhistory"); QFile f(historial); f.open(IO_WriteOnly); QDataStream s(&f); s << history; f.close(); bookmarks.clear(); QMap < int, QString >::Iterator it2 = mBookmarks.begin(); for (; it2 != mBookmarks.end(); ++it2) bookmarks.append(*it2); QString bookmarks(AQ_DISKCACHE_DIRPATH + "/.FLbookmarks"); QFile f2(bookmarks); f2.open(IO_WriteOnly); QDataStream s2(&f2); s2 << bookmarks; f2.close(); }
bool MetaInfo::hasDefaultData() const { return bookmarks().isEmpty() && breakpoints().isEmpty() && (m_outputMethodInfo.method() == OutputMethodInfo::Method::Direct ) && (m_cursorLine == 0) && (m_cursorColumn == 0); }
/*! Read current path and filters from settings and apply it for UI dock */ void FileBrowser::restoreSettings() { if ( mDock ) { mDock->setCurrentPath( path() ); mDock->setCurrentFilePath( filePath() ); mDock->setFilters( filters() ); mDock->setBookmarks( bookmarks() ); } }
void MetaInfo::save( KConfig * conf ) { conf->writeEntry( "Bookmarks", bookmarks() ); conf->writeEntry( "Breakpoints", breakpoints() ); conf->writeEntry( "OutputMethod", toID(outputMethodInfo().method()) ); conf->writePathEntry( "OutputPath", outputMethodInfo().outputFile().prettyURL() ); conf->writeEntry( "OutputPicID", outputMethodInfo().picID() ); conf->writeEntry( "CursorLine", cursorLine() ); conf->writeEntry( "CursorColumn", cursorColumn() ); }
QString BookmarksManager::bookmarkLookup(const QString & url, const QString &name) { QString bookmark; QStringList currentBookmarks = bookmarks(url); for (int i = 0; i < currentBookmarks.count(); i++) { if (bookmarkName(currentBookmarks.at(i)) == name) { bookmark = currentBookmarks.at(i); break; } } return bookmark; }
void BookmarksManager::renameBookmark(const QString &url, const QString &oldName, const QString &newName) { QStringList currentBookmarks = bookmarks(url); for (int i = 0; i < currentBookmarks.count(); i++) { if (bookmarkName(currentBookmarks.at(i)) == oldName) { QString newBookMark = QString("%1:::%2").arg(newName).arg(bookmarkTime(currentBookmarks.at(i))); currentBookmarks.replace(i,newBookMark); writeBookmarks(bookmarkFile(url), currentBookmarks); break; } } }
void FLHelpWindow::readBookmarks() { QString bookmarks(AQ_DISKCACHE_DIRPATH + "/.FLbookmarks"); if (QFile::exists(bookmarks)) { QFile f(bookmarks); f.open(IO_ReadOnly); QDataStream s(&f); s >> bookmarks; f.close(); } }
void BookmarksManager::removeBookmark(const QString &url, const QString &bookmark) { QStringList currentBookmarks = bookmarks(url); if (currentBookmarks.count() > 0) { int indexOfBookmark = currentBookmarks.indexOf(bookmark); if (indexOfBookmark != -1) { currentBookmarks.removeAt(indexOfBookmark); } if (currentBookmarks.count() > 0) { writeBookmarks(bookmarkFile(url), currentBookmarks); } else { removeBookmarks(url); } } }
bool BookmarksManager::hasBookmarks(const MediaItem &mediaItem) { return (bookmarks(mediaItem.url).count() > 0); }
void BookmarksManager::addBookmark(const QString &url, const QString &name, int time) { QStringList currentBookmarks = bookmarks(url); currentBookmarks.append(QString("%1:::%2").arg(name).arg(time)); writeBookmarks(bookmarkFile(url, true), currentBookmarks); }
void Dlg_MemBookmark::ExportJSON() { if ( g_pCurrentGameData->GetGameID() == 0 ) { MessageBox( nullptr, _T("ROM not loaded: please load a ROM first!"), _T("Error!"), MB_OK ); return; } if ( m_vBookmarks.size() == 0) { MessageBox( nullptr, _T("No bookmarks to save: please create a bookmark before attempting to save."), _T("Error!"), MB_OK ); return; } std::string defaultDir = RA_DIR_BOOKMARKS; defaultDir.erase ( 0, 2 ); // Removes the characters (".\\") defaultDir = g_sHomeDir + defaultDir; IFileSaveDialog* pDlg = nullptr; HRESULT hr = CoCreateInstance( CLSID_FileSaveDialog, NULL, CLSCTX_ALL, IID_IFileSaveDialog, reinterpret_cast<void**>( &pDlg ) ); if ( hr == S_OK ) { hr = pDlg->SetFileTypes( ARRAYSIZE( c_rgFileTypes ), c_rgFileTypes ); if ( hr == S_OK ) { char defaultFileName[ 512 ]; sprintf_s ( defaultFileName, 512, "%s-Bookmarks.txt", std::to_string( g_pCurrentGameData->GetGameID() ).c_str() ); hr = pDlg->SetFileName( Widen( defaultFileName ).c_str() ); if ( hr == S_OK ) { PIDLIST_ABSOLUTE pidl; hr = SHParseDisplayName( Widen( defaultDir ).c_str(), NULL, &pidl, SFGAO_FOLDER, 0 ); if ( hr == S_OK ) { IShellItem* pItem = nullptr; SHCreateShellItem( NULL, NULL, pidl, &pItem ); hr = pDlg->SetDefaultFolder( pItem ); if ( hr == S_OK ) { pDlg->SetDefaultExtension( L"txt" ); hr = pDlg->Show( nullptr ); if ( hr == S_OK ) { hr = pDlg->GetResult( &pItem ); if ( hr == S_OK ) { LPWSTR pStr = nullptr; hr = pItem->GetDisplayName( SIGDN_FILESYSPATH, &pStr ); if ( hr == S_OK ) { Document doc; Document::AllocatorType& allocator = doc.GetAllocator(); doc.SetObject(); Value bookmarks( kArrayType ); for ( MemBookmark* bookmark : m_vBookmarks ) { Value item( kObjectType ); char buffer[ 256 ]; sprintf_s( buffer, Narrow( bookmark->Description() ).c_str(), sizeof( buffer ) ); Value s( buffer, allocator ); item.AddMember( "Description", s, allocator ); item.AddMember( "Address", bookmark->Address(), allocator ); item.AddMember( "Type", bookmark->Type(), allocator ); item.AddMember( "Decimal", bookmark->Decimal(), allocator ); bookmarks.PushBack( item, allocator ); } doc.AddMember( "Bookmarks", bookmarks, allocator ); _WriteBufferToFile( Narrow( pStr ), doc ); } pItem->Release(); ILFree( pidl ); } } } } } } pDlg->Release(); } }