mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 20:09:50 +01:00
Adds --search-popup command line option.
This commit is contained in:
parent
8e69104a6a
commit
b0c880d444
@ -57,7 +57,8 @@ const char* CommandlineOptions::kHelpText =
|
||||
" --quiet %24\n"
|
||||
" --verbose %25\n"
|
||||
" --log-levels <levels> %26\n"
|
||||
" --version %27\n";
|
||||
" --version %27\n"
|
||||
" --search-popup %28\n";
|
||||
|
||||
const char* CommandlineOptions::kVersionText =
|
||||
"Clementine %1";
|
||||
@ -74,6 +75,7 @@ CommandlineOptions::CommandlineOptions(int argc, char** argv)
|
||||
play_track_at_(-1),
|
||||
show_osd_(false),
|
||||
toggle_pretty_osd_(false),
|
||||
show_search_popup_(false),
|
||||
stun_test_(StunTestNone),
|
||||
log_levels_(logging::kDefaultLogLevels)
|
||||
{
|
||||
@ -126,6 +128,7 @@ bool CommandlineOptions::Parse() {
|
||||
{"verbose", no_argument, 0, Verbose},
|
||||
{"log-levels", required_argument, 0, LogLevels},
|
||||
{"version", no_argument, 0, Version},
|
||||
{"search-popup", no_argument, 0, SearchPopup},
|
||||
|
||||
{"stun-test", required_argument, 0, 'z'},
|
||||
|
||||
@ -189,6 +192,7 @@ bool CommandlineOptions::Parse() {
|
||||
case Quiet: log_levels_ = "1"; break;
|
||||
case Verbose: log_levels_ = "3"; break;
|
||||
case LogLevels: log_levels_ = QString(optarg); break;
|
||||
case SearchPopup: show_search_popup_ = true; break;
|
||||
case Version: {
|
||||
QString version_text = QString(kVersionText).arg(CLEMENTINE_VERSION_DISPLAY);
|
||||
std::cout << version_text.toLocal8Bit().constData() << std::endl;
|
||||
@ -248,6 +252,7 @@ bool CommandlineOptions::is_empty() const {
|
||||
play_track_at_ == -1 &&
|
||||
show_osd_ == false &&
|
||||
toggle_pretty_osd_ == false &&
|
||||
show_search_popup_ == false &&
|
||||
urls_.isEmpty();
|
||||
}
|
||||
|
||||
@ -284,6 +289,7 @@ QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a) {
|
||||
<< a.seek_by_
|
||||
<< a.play_track_at_
|
||||
<< a.show_osd_
|
||||
<< a.show_search_popup_
|
||||
<< a.urls_
|
||||
<< a.log_levels_
|
||||
<< a.toggle_pretty_osd_;
|
||||
@ -302,6 +308,7 @@ QDataStream& operator>>(QDataStream& s, CommandlineOptions& a) {
|
||||
>> a.seek_by_
|
||||
>> a.play_track_at_
|
||||
>> a.show_osd_
|
||||
>> a.show_search_popup_
|
||||
>> a.urls_
|
||||
>> a.log_levels_
|
||||
>> a.toggle_pretty_osd_;
|
||||
|
@ -66,6 +66,7 @@ class CommandlineOptions {
|
||||
int play_track_at() const { return play_track_at_; }
|
||||
bool show_osd() const { return show_osd_; }
|
||||
bool toggle_pretty_osd() const { return toggle_pretty_osd_; }
|
||||
bool show_search_popup() const { return show_search_popup_; }
|
||||
QList<QUrl> urls() const { return urls_; }
|
||||
QString language() const { return language_; }
|
||||
QString log_levels() const { return log_levels_; }
|
||||
@ -87,7 +88,8 @@ class CommandlineOptions {
|
||||
Quiet,
|
||||
Verbose,
|
||||
LogLevels,
|
||||
Version
|
||||
Version,
|
||||
SearchPopup,
|
||||
};
|
||||
|
||||
QString tr(const char* source_text);
|
||||
@ -109,6 +111,7 @@ class CommandlineOptions {
|
||||
int play_track_at_;
|
||||
bool show_osd_;
|
||||
bool toggle_pretty_osd_;
|
||||
bool show_search_popup_;
|
||||
QString language_;
|
||||
StunTestDirection stun_test_;
|
||||
QString log_levels_;
|
||||
|
@ -1689,6 +1689,9 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
|
||||
|
||||
if (options.toggle_pretty_osd())
|
||||
player_->TogglePrettyOSD();
|
||||
|
||||
if (options.show_search_popup())
|
||||
ShowGlobalSearch();
|
||||
}
|
||||
|
||||
void MainWindow::ForceShowOSD(const Song &song, const bool toggle) {
|
||||
|
Loading…
Reference in New Issue
Block a user