int OnModulesLoaded(WPARAM wparam, LPARAM lparam) { // register fonts and hotkeys RegisterFontServiceFonts(); RegisterKeyBindings(); g_AddContListMI = (BOOL)db_get_dw(0,MODULENAME,"AddContactMenuItems",1); // register menus CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Notes && Reminders"), 1600000000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "A5E140BC-D697-4689-B75B-8ECFB6FE5931"); mi.flags = CMIF_TCHAR; mi.position = 1600000000; mi.hIcolibItem = iconList[2].hIcolib; mi.name.t = LPGENT("New &Note"); mi.pszService = MODULENAME"/MenuCommandAddNew"; addMenuItem(mi); mi.position = 1600000001; mi.hIcolibItem = iconList[0].hIcolib; mi.name.t = LPGENT("New &Reminder"); mi.pszService = MODULENAME"/MenuCommandNewReminder"; addMenuItem(mi); mi.position = 1600100000; mi.hIcolibItem = iconList[3].hIcolib; mi.name.t = LPGENT("&Show / Hide Notes"); mi.pszService = MODULENAME"/MenuCommandShowHide"; addMenuItem(mi); mi.position = 1600100001; mi.hIcolibItem = iconList[13].hIcolib; mi.name.t = LPGENT("Vie&w Notes"); mi.pszService = MODULENAME"/MenuCommandViewNotes"; addMenuItem(mi); mi.position = 1600100002; mi.hIcolibItem = iconList[1].hIcolib; mi.name.t = LPGENT("&Delete All Notes"); mi.pszService = MODULENAME"/MenuCommandDeleteAll"; addMenuItem(mi); mi.position = 1600100003; mi.hIcolibItem = iconList[11].hIcolib; mi.name.t = LPGENT("&Bring All to Front"); mi.pszService = MODULENAME"/MenuCommandBringAllFront"; addMenuItem(mi); mi.position = 1600200000; mi.hIcolibItem = iconList[6].hIcolib; mi.name.t = LPGENT("&View Reminders"); mi.pszService = MODULENAME"/MenuCommandViewReminders"; addMenuItem(mi); mi.position = 1600200001; mi.hIcolibItem = iconList[5].hIcolib; mi.name.t = LPGENT("D&elete All Reminders"); mi.pszService = MODULENAME"/MenuCommandDeleteReminders"; addMenuItem(mi); // register misc hkOptInit = HookEvent(ME_OPT_INITIALISE, OnOptInitialise); hkTopToolbarInit = HookEvent("TopToolBar/ModuleLoaded", OnTopToolBarInit); UnhookEvent(hkModulesLoaded); // init vars and load all data InitSettings(); CreateMsgWindow(); LoadNotes(TRUE); LoadReminders(); return 0; }
void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const QString &origFilename, bool temporary, bool local) { m_CaptureFile = origFilename; m_CaptureLocal = local; Config().Save(); m_LoadProgress = 0.0f; m_PostloadProgress = 0.0f; // this function call will block until the capture is either loaded, or there's some failure m_Renderer.OpenCapture(captureFile, [this](float p) { m_LoadProgress = p; }); // if the renderer isn't running, we hit a failure case so display an error message if(!m_Renderer.IsRunning()) { QString errmsg = ToQStr(m_Renderer.GetCreateStatus()); QString messageText = tr("%1\nFailed to open capture for replay: %2.\n\n" "Check diagnostic log in Help menu for more details.") .arg(captureFile) .arg(errmsg); RDDialog::critical(NULL, tr("Error opening capture"), messageText); m_LoadInProgress = false; return; } if(!temporary) { AddRecentFile(Config().RecentCaptureFiles, origFilename, 10); Config().Save(); } m_EventID = 0; m_FirstDrawcall = m_LastDrawcall = NULL; // fetch initial data like drawcalls, textures and buffers m_Renderer.BlockInvoke([this](IReplayController *r) { m_FrameInfo = r->GetFrameInfo(); m_APIProps = r->GetAPIProperties(); m_PostloadProgress = 0.2f; m_Drawcalls = r->GetDrawcalls(); AddFakeProfileMarkers(); m_FirstDrawcall = &m_Drawcalls[0]; while(!m_FirstDrawcall->children.empty()) m_FirstDrawcall = &m_FirstDrawcall->children[0]; m_LastDrawcall = &m_Drawcalls.back(); while(!m_LastDrawcall->children.empty()) m_LastDrawcall = &m_LastDrawcall->children.back(); m_PostloadProgress = 0.4f; m_WinSystems = r->GetSupportedWindowSystems(); #if defined(RENDERDOC_PLATFORM_WIN32) m_CurWinSystem = WindowingSystem::Win32; #elif defined(RENDERDOC_PLATFORM_LINUX) m_CurWinSystem = WindowingSystem::Xlib; // prefer XCB, if supported for(WindowingSystem sys : m_WinSystems) { if(sys == WindowingSystem::XCB) { m_CurWinSystem = WindowingSystem::XCB; break; } } if(m_CurWinSystem == WindowingSystem::XCB) m_XCBConnection = QX11Info::connection(); else m_X11Display = QX11Info::display(); #endif m_StructuredFile = &r->GetStructuredFile(); m_ResourceList = r->GetResources(); for(ResourceDescription &res : m_ResourceList) m_Resources[res.resourceId] = &res; m_BufferList = r->GetBuffers(); for(BufferDescription &b : m_BufferList) m_Buffers[b.resourceId] = &b; m_PostloadProgress = 0.8f; m_TextureList = r->GetTextures(); for(TextureDescription &t : m_TextureList) m_Textures[t.resourceId] = &t; m_PostloadProgress = 0.9f; m_CurD3D11PipelineState = &r->GetD3D11PipelineState(); m_CurD3D12PipelineState = &r->GetD3D12PipelineState(); m_CurGLPipelineState = &r->GetGLPipelineState(); m_CurVulkanPipelineState = &r->GetVulkanPipelineState(); m_CurPipelineState.SetStates(m_APIProps, m_CurD3D11PipelineState, m_CurD3D12PipelineState, m_CurGLPipelineState, m_CurVulkanPipelineState); m_UnreadMessageCount = 0; AddMessages(m_FrameInfo.debugMessages); m_PostloadProgress = 1.0f; }); QThread::msleep(20); QDateTime today = QDateTime::currentDateTimeUtc(); QDateTime compare = today.addDays(-21); if(compare > Config().DegradedCapture_LastUpdate && m_APIProps.degraded) { Config().DegradedCapture_LastUpdate = today; RDDialog::critical( NULL, tr("Degraded support of capture"), tr("%1\nThis capture opened with degraded support - " "this could mean missing hardware support caused a fallback to software rendering.\n\n" "This warning will not appear every time this happens, " "check debug errors/warnings window for more details.") .arg(origFilename)); } ICaptureAccess *access = Replay().GetCaptureAccess(); if(access) { int idx = access->FindSectionByType(SectionType::ResourceRenames); if(idx >= 0) { bytebuf buf = access->GetSectionContents(idx); LoadRenames(QString::fromUtf8((const char *)buf.data(), buf.count())); } idx = access->FindSectionByType(SectionType::Bookmarks); if(idx >= 0) { bytebuf buf = access->GetSectionContents(idx); LoadBookmarks(QString::fromUtf8((const char *)buf.data(), buf.count())); } idx = access->FindSectionByType(SectionType::Notes); if(idx >= 0) { bytebuf buf = access->GetSectionContents(idx); LoadNotes(QString::fromUtf8((const char *)buf.data(), buf.count())); } } m_LoadInProgress = false; m_CaptureLoaded = true; }
MainWindow::MainWindow(QWidget *parent) : QDialog(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->fEditor->setAcceptRichText(false); fSimpleNote = 0; ui->fNoteList->setItemDelegate(new ListDelegate(ui->fNoteList)); ui->fTagsComboBox->view()->setItemDelegate(new TagListDelegate(ui->fTagsComboBox)); QList<int> sizes; sizes << 200 << 400; ui->fSplitter->setSizes(sizes); fTimer = new QTimer(this); fTimer->setInterval(5000); fTimer->start(); connect(fTimer, SIGNAL(timeout()), this, SLOT(OnTimeout())); QAction* quitAction = new QAction(tr("Quit"), this); quitAction->setShortcut(QKeySequence("Ctrl+Q")); connect(quitAction, SIGNAL(triggered(bool)), this, SLOT(close())); addAction(quitAction); QAction* addNoteAction = new QAction(tr("New Note"), this); addNoteAction->setIcon(QIcon(":/images/images/add2.png")); addNoteAction->setShortcut(QKeySequence("Ctrl+N")); connect(addNoteAction, SIGNAL(triggered(bool)), this, SLOT(OnAdd())); ui->fNoteList->addAction(addNoteAction); ui->fAddButton->setDefaultAction(addNoteAction); QAction* deleteCurrent = new QAction(tr("Remove"), ui->fNoteList); deleteCurrent->setIcon(QIcon(":/images/images/delete2.png")); connect(deleteCurrent, SIGNAL(triggered(bool)), this, SLOT(RemoveCurrent())); ui->fNoteList->addAction(deleteCurrent); ui->fNoteList->setContextMenuPolicy(Qt::ActionsContextMenu); QAction* syncCurrentAction = new QAction("Sync Current", this); syncCurrentAction->setShortcut(QKeySequence("Ctrl+S")); connect(syncCurrentAction, SIGNAL(triggered(bool)), this, SLOT(SaveCurrent())); addAction(syncCurrentAction); QAction* syncAction = new QAction("Full Sync", this); syncAction->setShortcut(QKeySequence("Ctrl+Shift+S")); connect(syncAction, SIGNAL(triggered(bool)), this, SLOT(FullSync())); addAction(syncAction); QAction* tagsAction = new QAction("Edit Tags", this); tagsAction->setShortcut(QKeySequence("Ctrl+G")); connect(tagsAction, SIGNAL(triggered(bool)), this, SLOT(EditTags())); addAction(tagsAction); QAction* settingsAction = new QAction("Settings...", this); connect(settingsAction, SIGNAL(triggered(bool)), this, SLOT(OnSettings())); addAction(settingsAction); ui->fSettingsButton->addAction(syncCurrentAction); ui->fSettingsButton->addAction(syncAction); ui->fSettingsButton->addAction(settingsAction); ui->fSettingsButton->setPopupMode(QToolButton::InstantPopup); connect(ui->fFavouriteButton, SIGNAL(clicked(bool)), this, SLOT(OnFavourite())); connect(ui->fEditor, SIGNAL(textChanged()), this, SLOT(OnTextChanged())); connect(ui->fSearchEdit, SIGNAL(textChanged(QString)), this, SLOT(OnSearchChanged())); connect(ui->fTagsEdit, SIGNAL(textChanged(QString)), this, SLOT(OnTagsChanged())); connect(ui->fExportButton, SIGNAL(clicked(bool)), this, SLOT(OnExport())); connect(ui->fTagsComboBox, SIGNAL(activated(int)), this, SLOT(OnTagSelected())); connect(ui->fEditor, SIGNAL(OpenNote(QString)), this, SLOT(OpenNote(QString))); fCurrent = -1; fNotes.SetMessageReceiver(this); fSnippets.reset(new SnippetCollection); ui->fEditor->SetSnippets(fSnippets); fNotesModel = new NoteListModel(&fNotes, this); fFilterModel = new NoteSortFilterModel(this); fFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); fFilterModel->setSortCaseSensitivity(Qt::CaseInsensitive); fFilterModel->setSourceModel(fNotesModel); ui->fNoteList->setModel(fFilterModel); connect(ui->fNoteList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(OnSelection(QModelIndex))); LoadNotes(); UpdateNoteList(); ui->fNoteList->setCurrentIndex(fFilterModel->index(0, 0)); ui->fNoteList->setFocus(); RestoreSettings(); SetEditorFont(SettingsDialog::CurrentFont(), SettingsDialog::CurrentTabSize()); }