UI: Massive revamp, new features and improvements
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
#include "common/types.h"
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QIcon>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <optional>
|
||||
|
||||
Q_DECLARE_METATYPE(std::optional<bool>);
|
||||
Q_DECLARE_METATYPE(std::function<void()>);
|
||||
|
||||
class ByteStream;
|
||||
|
||||
class QComboBox;
|
||||
@@ -20,8 +19,20 @@ class QVariant;
|
||||
class QWidget;
|
||||
class QUrl;
|
||||
|
||||
enum class ConsoleRegion;
|
||||
enum class DiscRegion : u8;
|
||||
namespace GameDatabase {
|
||||
enum class CompatibilityRating : u32;
|
||||
}
|
||||
namespace GameList {
|
||||
enum class EntryType;
|
||||
}
|
||||
|
||||
namespace QtUtils {
|
||||
|
||||
/// Wheel delta is 120 as in winapi.
|
||||
static constexpr float MOUSE_WHEEL_DELTA = 120.0f;
|
||||
|
||||
/// Creates a horizontal line widget.
|
||||
QFrame* CreateHorizontalLine(QWidget* parent);
|
||||
|
||||
@@ -33,20 +44,9 @@ QWidget* GetRootWidget(QWidget* widget, bool stop_at_window_or_dialog = true);
|
||||
void ResizeColumnsForTableView(QTableView* view, const std::initializer_list<int>& widths);
|
||||
void ResizeColumnsForTreeView(QTreeView* view, const std::initializer_list<int>& widths);
|
||||
|
||||
/// Returns a string identifier for a Qt key ID.
|
||||
QString GetKeyIdentifier(int key);
|
||||
|
||||
/// Returns the integer Qt key ID for an identifier.
|
||||
std::optional<int> GetKeyIdForIdentifier(const QString& key_identifier);
|
||||
|
||||
/// Stringizes a key event.
|
||||
QString KeyEventToString(int key, Qt::KeyboardModifiers mods);
|
||||
|
||||
/// Returns an integer id for a stringized key event. Modifiers are in the upper bits.
|
||||
std::optional<int> ParseKeyString(const QString& key_str);
|
||||
|
||||
/// Returns a key id for a key event, including any modifiers.
|
||||
int KeyEventToInt(int key, Qt::KeyboardModifiers mods);
|
||||
/// Returns a key id for a key event, including any modifiers that we need (e.g. Keypad).
|
||||
/// NOTE: Defined in QtKeyCodes.cpp, not QtUtils.cpp.
|
||||
u32 KeyEventToCode(const QKeyEvent* ev);
|
||||
|
||||
/// Reads a whole stream to a Qt byte array.
|
||||
QByteArray ReadStreamToQByteArray(ByteStream* stream, bool rewind = false);
|
||||
@@ -68,10 +68,27 @@ QVariant GetMSAAModeValue(uint multisamples, bool ssaa);
|
||||
void DecodeMSAAModeValue(const QVariant& userdata, uint* multisamples, bool* ssaa);
|
||||
void FillComboBoxWithMSAAModes(QComboBox* cb);
|
||||
|
||||
/// Fills a combo box with emulation speed options.
|
||||
void FillComboBoxWithEmulationSpeeds(QComboBox* cb);
|
||||
|
||||
/// Prompts for an address in hex.
|
||||
std::optional<unsigned> PromptForAddress(QWidget* parent, const QString& title, const QString& label, bool code);
|
||||
|
||||
} // namespace QtUtils
|
||||
/// Converts a std::string_view to a QString safely.
|
||||
QString StringViewToQString(const std::string_view& str);
|
||||
|
||||
/// Sets a widget to italics if the setting value is inherited.
|
||||
void SetWidgetFontForInheritedSetting(QWidget* widget, bool inherited);
|
||||
|
||||
/// Changes whether a window is resizable.
|
||||
void SetWindowResizeable(QWidget* widget, bool resizeable);
|
||||
|
||||
/// Adjusts the fixed size for a window if it's not resizeable.
|
||||
void ResizePotentiallyFixedSizeWindow(QWidget* widget, int width, int height);
|
||||
|
||||
/// Returns icon for region.
|
||||
QIcon GetIconForRegion(ConsoleRegion region);
|
||||
QIcon GetIconForRegion(DiscRegion region);
|
||||
|
||||
/// Returns icon for entry type.
|
||||
QIcon GetIconForEntryType(GameList::EntryType type);
|
||||
QIcon GetIconForCompatibility(GameDatabase::CompatibilityRating rating);
|
||||
|
||||
} // namespace QtUtils
|
||||
|
||||
Reference in New Issue
Block a user