~haowenl/vorg-windows

dcf7692ad387b1c7d08d923709593b4c4e5a9dca — Haowen Liu 1 year, 8 months ago f3d5b89
Improve event token handling
M todos.txt => todos.txt +4 -2
@@ 1,2 1,4 @@
1. Remove all direct use of ErrorContentDialog
2. Fix how unsubscribe is handled
\ No newline at end of file
- Support filters
- Add re-generate thumbnail support
- Add dynamic thumbnail count based on video length
- Make repository streamable
\ No newline at end of file

M vorg-windows/BrowseDetailPage.xaml.cpp => vorg-windows/BrowseDetailPage.xaml.cpp +9 -6
@@ 28,8 28,11 @@ BrowseDetailPage::BrowseDetailPage()
BrowseDetailPage::~BrowseDetailPage()
{
    mDetailData.Actors().VectorChanged(mActorsVectorChangedToken);
    mActorsVectorChangedToken = event_token();
    mDetailData.Tags().VectorChanged(mTagsVectorChangedToken);
    mTagsVectorChangedToken = event_token();
    mDetailData.PropertyChanged(mDetailDataPropertyChangedToken);
    mDetailDataPropertyChangedToken = event_token();
}

vorg_windows::VideoDetailData BrowseDetailPage::DetailData() const


@@ 169,22 172,22 @@ void BrowseDetailPage::SaveButton_Click(const Windows::Foundation::IInspectable 
}

void BrowseDetailPage::VideoDataEditor_StudioTextChanged(
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
    const Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
{
    sender.ItemsSource(mApp->CompleteStudios(sender.Text()));
}

void BrowseDetailPage::VideoDataEditor_ActorTextChanged(
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
    const Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
{
    sender.ItemsSource(mApp->CompleteActors(sender.Text()));
}

void BrowseDetailPage::VideoDataEditor_TagTextChanged(
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
    const Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
{
    sender.ItemsSource(mApp->CompleteTags(sender.Text()));
}

M vorg-windows/BrowsePage.xaml.cpp => vorg-windows/BrowsePage.xaml.cpp +7 -0
@@ 29,6 29,7 @@ BrowsePage::~BrowsePage()
    if (galleryPage != nullptr)
    {
        galleryPage.ShowVideoDetail(mShowVideoDetailToken);
        mShowVideoDetailToken = event_token();
        return;
    }



@@ 36,7 37,9 @@ BrowsePage::~BrowsePage()
    if (detailPage != nullptr)
    {
        detailPage.BackFromDetail(mBackFromDetailToken);
        mBackFromDetailToken = event_token();
        detailPage.VideoModified(mVideoModifiedToken);
        mVideoModifiedToken = event_token();
        return;
    }
}


@@ 75,6 78,7 @@ void BrowsePage::BrowseGalleryPage_ShowVideoDetail(const vorg_windows::BrowseGal
    // Unsubscribe from ShowVideoDetail
    vorg_windows::BrowseGalleryPage galleryPage = ContentFrame().Content().as<vorg_windows::BrowseGalleryPage>();
    galleryPage.ShowVideoDetail(mShowVideoDetailToken);
    mShowVideoDetailToken = event_token();

    // Get video detail
    vorg_windows::VideoPreviewData previewData{nullptr};


@@ 100,6 104,9 @@ void BrowsePage::BrowseDetailPage_BackFromDetail(const vorg_windows::BrowseDetai
    // Unsubscribe from BackFromDetail
    vorg_windows::BrowseDetailPage detailPage = ContentFrame().Content().as<vorg_windows::BrowseDetailPage>();
    detailPage.BackFromDetail(mBackFromDetailToken);
    mBackFromDetailToken = event_token();
    detailPage.VideoModified(mVideoModifiedToken);
    mVideoModifiedToken = event_token();

    // Navigate to BrowseGalleryPage
    GoToGallery(true);

M vorg-windows/HoverThumbnailDisplay.xaml.cpp => vorg-windows/HoverThumbnailDisplay.xaml.cpp +1 -0
@@ 23,6 23,7 @@ HoverThumbnailDisplay::HoverThumbnailDisplay()
HoverThumbnailDisplay::~HoverThumbnailDisplay()
{
    mTimer.Tick(mTickToken);
    mTickToken = event_token();
}

Windows::Foundation::Collections::IObservableVector<hstring> HoverThumbnailDisplay::Thumbnails() const

M vorg-windows/ImportEditPage.xaml.cpp => vorg-windows/ImportEditPage.xaml.cpp +6 -6
@@ 39,22 39,22 @@ void ImportEditPage::SubmitButton_Click(const Windows::Foundation::IInspectable 
}

void ImportEditPage::VideoDataEditor_StudioTextChanged(
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
    const Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
{
    sender.ItemsSource(mApp->CompleteStudios(sender.Text()));
}

void ImportEditPage::VideoDataEditor_ActorTextChanged(
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
    const Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
{
    sender.ItemsSource(mApp->CompleteActors(sender.Text()));
}

void ImportEditPage::VideoDataEditor_TagTextChanged(
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const winrt::Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
    const Microsoft::UI::Xaml::Controls::AutoSuggestBox &sender,
    const Microsoft::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs &)
{
    sender.ItemsSource(mApp->CompleteTags(sender.Text()));
}

M vorg-windows/ImportPage.xaml.cpp => vorg-windows/ImportPage.xaml.cpp +20 -0
@@ 29,12 29,31 @@ ImportPage::ImportPage()
        [this](auto &sender, auto &args) { this->ImportSelectionPage_SelectionFinished(sender, args); });
}

ImportPage::~ImportPage()
{
    vorg_windows::ImportSelectionPage selectionPage = ContentFrame().Content().as<vorg_windows::ImportSelectionPage>();
    if (selectionPage != nullptr)
    {
        selectionPage.SelectionFinished(mSelectionFinishedToken);
        mSelectionFinishedToken = event_token();
        return;
    }
    vorg_windows::ImportEditPage editPage = ContentFrame().Content().as<vorg_windows::ImportEditPage>();
    if (editPage != nullptr)
    {
        editPage.EditFinished(mEditFinishedToken);
        mEditFinishedToken = event_token();
        return;
    }
}

void ImportPage::ImportSelectionPage_SelectionFinished(const vorg_windows::ImportSelectionPage &,
                                                       const Windows::Foundation::IInspectable &)
{
    // Remove SelectionFinished handler
    vorg_windows::ImportSelectionPage selectionPage = ContentFrame().Content().as<vorg_windows::ImportSelectionPage>();
    selectionPage.SelectionFinished(mSelectionFinishedToken);
    mSelectionFinishedToken = event_token();

    // Navigate to ImportEditPage
    Microsoft::UI::Xaml::Media::Animation::SlideNavigationTransitionInfo transitionInfo;


@@ 67,6 86,7 @@ void ImportPage::ImportEditPage_EditFinished(const vorg_windows::ImportEditPage 
        // No more file
        // Remove EditFinished handler
        editPage.EditFinished(mEditFinishedToken);
        mEditFinishedToken = event_token();

        // Navigate to ImportSelectionPage
        Microsoft::UI::Xaml::Media::Animation::SlideNavigationTransitionInfo transitionInfo;

M vorg-windows/ImportPage.xaml.h => vorg-windows/ImportPage.xaml.h +1 -0
@@ 9,6 9,7 @@ namespace winrt::vorg_windows::implementation
struct ImportPage : ImportPageT<ImportPage>
{
    ImportPage();
    ~ImportPage();

    void ImportSelectionPage_SelectionFinished(const vorg_windows::ImportSelectionPage &,
                                               const Windows::Foundation::IInspectable &);

M vorg-windows/MainWindow.xaml.cpp => vorg-windows/MainWindow.xaml.cpp +5 -0
@@ 56,6 56,11 @@ MainWindow::MainWindow() : mGalleryData(single_threaded_observable_vector<Window
        landingPage.OpenRepo([this](auto &sender, auto &args) { this->LandingPage_OpenRepo(sender, args); });
}

MainWindow::~MainWindow()
{
    PageCleanup();
}

void MainWindow::NavigationView_ItemInvoked(const Controls::NavigationView &,
                                            const Controls::NavigationViewItemInvokedEventArgs &args)
{

M vorg-windows/MainWindow.xaml.h => vorg-windows/MainWindow.xaml.h +1 -0
@@ 12,6 12,7 @@ namespace winrt::vorg_windows::implementation
struct MainWindow : MainWindowT<MainWindow>
{
    MainWindow();
    ~MainWindow();

    // Handlers
    void NavigationView_ItemInvoked(const Microsoft::UI::Xaml::Controls::NavigationView &sender,