Skip to content

Commit

Permalink
Improve startup time a bit (hluk#2276)
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk authored Feb 23, 2023
1 parent 968cb64 commit aa829ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
5 changes: 3 additions & 2 deletions qxt/qxtglobalshortcut_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ class QxtX11Data final {
QxtX11Data()
: m_display(nullptr)
{
createFirstWindow();
if ( X11Info::isPlatformX11() )
if ( X11Info::isPlatformX11() ) {
createFirstWindow();
m_display = X11Info::display();
}
}

bool isValid()
Expand Down
9 changes: 2 additions & 7 deletions src/gui/filterlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,10 @@ void FilterLineEdit::loadSettings()
const bool filterCaseSensitive = appConfig.option<Config::filter_case_insensitive>();
m_actionCaseInsensitive->setChecked(filterCaseSensitive);

// KDE has custom icons for this. Notice that icon namings are counter intuitive.
// If these icons are not available we use the freedesktop standard name before
// falling back to a bundled resource.
QIcon icon1 = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
"edit-clear-locationbar-rtl" : "edit-clear-locationbar-ltr",
getIcon("edit-clear", IconXmark));
const QIcon icon1 = getIcon("edit-clear", IconXmark);
setButtonIcon(Right, icon1);

QIcon icon2 = getIcon("edit-find", IconMagnifyingGlass);
const QIcon icon2 = getIcon("edit-find", IconMagnifyingGlass);
setButtonIcon(Left, icon2);

if ( appConfig.option<Config::save_filter_history>() ) {
Expand Down
14 changes: 7 additions & 7 deletions src/scriptable/scriptable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ QJSValue Scriptable::throwError(const QString &errorMessage)
QJSValue throwFn = evaluateStrict(m_engine, QStringLiteral(
"(function(text) {throw new Error(text);})"
));
const auto exc = throwFn.call(QJSValueList() << errorMessage);
const auto exc = throwFn.call({errorMessage});
#if QT_VERSION >= QT_VERSION_CHECK(5,12,0)
m_engine->throwError(QJSValue::GenericError, errorMessage);
return exc;
Expand Down Expand Up @@ -2136,7 +2136,7 @@ QJSValue Scriptable::execute()

if ( m_executeStdoutCallback.isCallable() ) {
const auto arg = toScriptValue(m_executeStdoutLastLine, this);
call( "executeStdoutCallback", &m_executeStdoutCallback, QJSValueList() << arg );
call( "executeStdoutCallback", &m_executeStdoutCallback, {arg} );
}

QJSValue actionResult = m_engine->newObject();
Expand Down Expand Up @@ -2833,7 +2833,7 @@ void Scriptable::onExecuteOutput(const QByteArray &output)
m_executeStdoutLastLine = lines.takeLast();
if ( !lines.isEmpty() ) {
const auto arg = toScriptValue(lines, this);
call( "executeStdoutCallback", &m_executeStdoutCallback, QJSValueList() << arg );
call( "executeStdoutCallback", &m_executeStdoutCallback, {arg} );
}
}
}
Expand Down Expand Up @@ -3239,7 +3239,7 @@ QJSValue Scriptable::eval(const QString &script, const QString &label)
{
m_stack.prepend(QStringLiteral("eval:") + label);
COPYQ_LOG_VERBOSE( QStringLiteral("Stack push: %1").arg(m_stack.join('|')) );
const auto result = m_safeEval.call(QJSValueList() << QJSValue(script));
const auto result = m_safeEval.call({QJSValue(script)});
m_stack.pop_front();
COPYQ_LOG_VERBOSE( QStringLiteral("Stack pop: %1").arg(m_stack.join('|')) );

Expand Down Expand Up @@ -3771,8 +3771,8 @@ void Scriptable::installObject(QObject *fromObj, const QMetaObject *metaObject,
// Allow passing variable number of arguments to scriptable methods
// and handle exceptions.
const auto v = hasByteArrayReturnType
? m_createFnB.call(QJSValueList() << from << name)
: m_createFn.call(QJSValueList() << from << name);
? m_createFnB.call({from, name})
: m_createFn.call({from, name});
if ( v.isError() ) {
log( QStringLiteral("Exception while wrapping %1.%2: %3").arg(fromObj->objectName(), name, v.toString()), LogError );
Q_ASSERT(false);
Expand All @@ -3785,7 +3785,7 @@ void Scriptable::installObject(QObject *fromObj, const QMetaObject *metaObject,
const QMetaProperty prop = metaObject->property(i);
const QLatin1String name( prop.name() );

const auto args = QJSValueList() << name << from;
const QJSValueList args{name, from};
const auto v = m_createProperty.callWithInstance(toObject, args);
if ( v.isError() ) {
log( QStringLiteral("Exception while adding property %1.%2: %3").arg(fromObj->objectName(), name, v.toString()), LogError );
Expand Down

0 comments on commit aa829ff

Please sign in to comment.