Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
menuhelper.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef MENUHELPER_H
22 #define MENUHELPER_H
23 
24 #include <QObject>
25 #include <QMenuBar>
26 
27 #include "ui/menu.h"
28 
29 class MenuHelper : public QObject {
30  Q_OBJECT
31 public:
32  void InitializeSharedMenus();
33 
44  void make_new_menu(QMenu* parent);
45 
56  void make_inout_menu(QMenu* parent);
57 
71  void make_clip_functions_menu(QMenu* parent);
72 
85  void make_edit_functions_menu(QMenu* parent, bool objects_are_selected = true);
86 
98  void set_bool_action_checked(QAction* a);
99 
116  void set_int_action_checked(QAction* a, const int& i);
117 
126  void set_button_action_checked(QAction* a);
127 
128  void Retranslate();
129 
130  static Menu *create_submenu(QMenuBar* parent,
131  const QObject *receiver = nullptr,
132  const char *member = nullptr);
133  static Menu* create_submenu(QMenu* parent);
134  static QAction* create_menu_action(QWidget *parent,
135  const char* id,
136  const QObject *receiver = nullptr,
137  const char *member = nullptr,
138  const QKeySequence &shortcut = 0);
139 
140 public slots:
141 
148  void toggle_bool_action();
149 
162 
169  void set_autoscroll();
170 
177  void menu_click_button();
178 
185  void set_timecode_view();
186 
193  void open_recent_from_menu();
194 
202  void create_effect_paste_action(QMenu *menu);
203 
204 private:
205  QAction* new_project_;
206  QAction* new_sequence_;
207  QAction* new_folder_;
208 
209  QAction* set_in_point_;
210  QAction* set_out_point_;
211  QAction* reset_in_point_;
214 
216  QAction* link_unlink_;
217  QAction* enable_disable_;
218  QAction* nest_;
219 
220  QAction* cut_;
221  QAction* copy_;
222  QAction* paste_;
223  QAction* paste_insert_;
224  QAction* duplicate_;
225  QAction* delete_;
226  QAction* ripple_delete_;
227  QAction* split_;
228 
229 private slots:
230 
231 
232 };
233 
234 namespace olive {
238 extern MenuHelper MenuHelper;
239 };
240 
241 #endif // MENUHELPER_H
QAction * nest_
Definition: menuhelper.h:218
void open_recent_from_menu()
Calls open_recent() in Olive::Global using the index from a QAction.
Definition: menuhelper.cpp:263
void set_bool_action_checked(QAction *a)
Sets the checked state of a menu item based on a Boolean variable.
Definition: menuhelper.cpp:142
static QAction * create_menu_action(QWidget *parent, const char *id, const QObject *receiver=nullptr, const char *member=nullptr, const QKeySequence &shortcut=0)
Definition: menuhelper.cpp:307
void create_effect_paste_action(QMenu *menu)
Create a &quot;Paste&quot; action on the specified menu that&#39;s enabled only if the clipboard contains effects...
Definition: menuhelper.cpp:268
void make_clip_functions_menu(QMenu *parent)
Creates a menu of clip functions.
Definition: menuhelper.cpp:118
QAction * enable_disable_
Definition: menuhelper.h:217
void make_inout_menu(QMenu *parent)
Creates a menu of options for working with in/out points.
Definition: menuhelper.cpp:109
QAction * set_out_point_
Definition: menuhelper.h:210
void Retranslate()
Definition: menuhelper.cpp:159
MenuHelper MenuHelper
A global MenuHelper object to assist menu creation throughout Olive.
Definition: menuhelper.cpp:35
QAction * new_sequence_
Definition: menuhelper.h:206
void set_titlesafe_from_menu()
Set Title/Action Safe Area from QAction.
Definition: menuhelper.cpp:190
QAction * new_project_
Definition: menuhelper.h:205
void set_int_action_checked(QAction *a, const int &i)
Sets the checked state of a menu item based on an integer variable.
Definition: menuhelper.cpp:149
void set_button_action_checked(QAction *a)
Sets the checked state of a menu item based on a QPushButton.
Definition: menuhelper.cpp:155
void set_timecode_view()
Sets the current timecode setting.
Definition: menuhelper.cpp:257
QAction * paste_
Definition: menuhelper.h:222
QAction * reset_in_point_
Definition: menuhelper.h:211
void menu_click_button()
Clicks a QPushButton referenced by a QAction when triggered.
Definition: menuhelper.cpp:253
QAction * copy_
Definition: menuhelper.h:221
QAction * add_default_transition_
Definition: menuhelper.h:215
static Menu * create_submenu(QMenuBar *parent, const QObject *receiver=nullptr, const char *member=nullptr)
Definition: menuhelper.cpp:274
QAction * delete_
Definition: menuhelper.h:225
QAction * paste_insert_
Definition: menuhelper.h:223
void InitializeSharedMenus()
Definition: menuhelper.cpp:37
Definition: menu.h:6
void toggle_bool_action()
Sets a QAction&#39;s Boolean reference to the opposite of its current value.
Definition: menuhelper.cpp:183
QAction * ripple_delete_
Definition: menuhelper.h:226
QAction * cut_
Definition: menuhelper.h:220
QAction * set_in_point_
Definition: menuhelper.h:209
void make_edit_functions_menu(QMenu *parent, bool objects_are_selected=true)
Creates standard edit menu (cut, copy, paste, etc.)
Definition: menuhelper.cpp:125
QAction * split_
Definition: menuhelper.h:227
QAction * new_folder_
Definition: menuhelper.h:207
QAction * link_unlink_
Definition: menuhelper.h:216
QAction * duplicate_
Definition: menuhelper.h:224
Definition: menuhelper.h:29
void make_new_menu(QMenu *parent)
Creates a menu of new items that can be created.
Definition: menuhelper.cpp:102
QAction * clear_inout_point
Definition: menuhelper.h:213
QAction * reset_out_point_
Definition: menuhelper.h:212
void set_autoscroll()
Set Autoscroll setting from QAction.
Definition: menuhelper.cpp:248