Top100
Your Personal Movie List (C++17 CLI + library)
Loading...
Searching...
No Matches
adddialog.h
1// SPDX-License-Identifier: Apache-2.0
2//-------------------------------------------------------------------------------
3// Top100 — Your Personal Movie List
4//
5// File: ui/gtk/adddialog.h
6// Purpose: GTK dialog to search OMDb, preview, and select a movie to add.
7//-------------------------------------------------------------------------------
8#pragma once
9
10#include <gtkmm.h>
11#include <glibmm/refptr.h>
12#include <string>
13
14namespace Gdk { class Pixbuf; }
15
16class Top100GtkAddDialog : public Gtk::Dialog {
17public:
18 Top100GtkAddDialog(Gtk::Window& parent);
19 std::string selected_imdb() const { return selected_imdb_; }
20
21protected:
22 void on_size_allocate(Gtk::Allocation& allocation) override;
23
24private:
25 // UI elements
26 Gtk::Box root_{Gtk::ORIENTATION_VERTICAL};
27 Gtk::Box search_row_{Gtk::ORIENTATION_HORIZONTAL};
28 // Match Qt/KDE wording
29 Gtk::Label lbl_search_{"Search for movie"};
30 Gtk::Entry entry_query_;
31 Gtk::Button btn_search_{"Search"};
32 Gtk::Paned split_{Gtk::ORIENTATION_HORIZONTAL};
33
34 // Results list
35 class Columns : public Gtk::TreeModel::ColumnRecord {
36 public:
37 Columns() { add(display); add(imdb); }
38 Gtk::TreeModelColumn<Glib::ustring> display;
39 Gtk::TreeModelColumn<Glib::ustring> imdb;
40 } columns_;
41 Glib::RefPtr<Gtk::ListStore> store_;
42 Gtk::TreeView view_;
43
44 // Preview panel
45 Gtk::Box preview_{Gtk::ORIENTATION_VERTICAL};
46 Gtk::Label title_;
47 Gtk::Image poster_;
48 Gtk::TextView plot_;
49 Glib::RefPtr<Gdk::Pixbuf> poster_orig_;
50 std::string poster_for_imdb_;
51
52 // State
53 std::string selected_imdb_;
54
55 // Actions
56 void on_search_clicked();
57 void on_selection_changed();
58 void load_poster_async(const std::string& url, const std::string& imdb);
59 void update_poster_scaled();
60};
Definition adddialog.h:16