DriveManager::DriveManager() { fileWatcher = std::make_shared<QFileSystemWatcher>(); fileWatcher->addPath(mediaFolder); QObject::connect(fileWatcher.get(), SIGNAL(directoryChanged(QString)), SLOT(UpdateDriveList())); }
/* * WndProc for our subclass of the wizard's dialog. We do this to detect * the WM_ACTIVATEAPP message, which we use as a trigger to refresh the * partition info that we display. */ static BOOL CALLBACK WizardDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if ((g_pWiz->GetState() == sidSTEP_EIGHT) && (uMsg == WM_ACTIVATEAPP) && wParam) { UpdateDriveList(); ShowPartitionInfo(); } return CallWindowProc((WNDPROC)Subclass_FindNextHook(hwndDlg, WizardDlgProc), hwndDlg, uMsg, wParam, lParam); }
/* * Event Handler Functions _________________________________________________________________ * */ static void OnInitDialog(HWND hwndDlg) { HOURGLASS hg; hDlg = hwndDlg; hDriveList = GetDlgItem(hDlg, IDC_DRIVE_LIST); g_pWiz->SetButtonText(IDNEXT, IDS_NEXT); g_pWiz->SetDefaultControl(IDNEXT); if (g_CfgData.configPartition == CS_ALREADY_CONFIGURED) { CantMakePartition(IDS_PARTITION_ALREADY_CREATED); return; } // Should this step be disabled? Yes, if this machine is // not configured as a file server. if (!ConfiguredOrConfiguring(g_CfgData.configFS)) { CantMakePartition(IDS_NOT_A_FS_SERVER); EnableStep(g_CfgData.configPartition, FALSE); return; } // Do this in case it was disabled the last time EnableStep(g_CfgData.configPartition); switch (g_CfgData.configPartition) { case CS_DONT_CONFIGURE: SetCheck(hDlg, IDC_DONT_CREATE_PARTITION); EnableDriveListCtrls(FALSE); break; case CS_CONFIGURE: default: SetCheck(hDlg, IDC_CREATE_PARTITION); EnableDriveListCtrls(); break; } Subclass_AddHook(g_pWiz->GetWindow(), WizardDlgProc); SetupDriveList(hDriveList); UpdateDriveList(); ShowPartitionInfo(); if (g_CfgData.bFirstServer) MustMakePartition(); }
void DriveManager::RequestDriveList() { UpdateDriveList(); }