Various attempts at improving startup performance
This commit is contained in:
parent
9b40810902
commit
683e16fcdf
|
@ -13,7 +13,7 @@ ReferenceView::ReferenceView(bool sourceView, QWidget* parent) : StdSearchListVi
|
||||||
mSearchStartCol = 1;
|
mSearchStartCol = 1;
|
||||||
|
|
||||||
// Widget container for progress
|
// Widget container for progress
|
||||||
QWidget* progressWidget = new QWidget();
|
QWidget* progressWidget = new QWidget(this);
|
||||||
|
|
||||||
// Create the layout for the progress bars
|
// Create the layout for the progress bars
|
||||||
QHBoxLayout* layoutProgress = new QHBoxLayout();
|
QHBoxLayout* layoutProgress = new QHBoxLayout();
|
||||||
|
|
|
@ -33,7 +33,7 @@ SearchListView::SearchListView(QWidget* parent, AbstractSearchList* abstractSear
|
||||||
listLayout->addWidget(abstractSearchList->searchList());
|
listLayout->addWidget(abstractSearchList->searchList());
|
||||||
|
|
||||||
// Add list placeholder
|
// Add list placeholder
|
||||||
QWidget* listPlaceholder = new QWidget();
|
QWidget* listPlaceholder = new QWidget(this);
|
||||||
listPlaceholder->setLayout(listLayout);
|
listPlaceholder->setLayout(listLayout);
|
||||||
|
|
||||||
barSplitter->addWidget(listPlaceholder);
|
barSplitter->addWidget(listPlaceholder);
|
||||||
|
@ -68,7 +68,7 @@ SearchListView::SearchListView(QWidget* parent, AbstractSearchList* abstractSear
|
||||||
horzLayout->addWidget(mRegexCheckbox);
|
horzLayout->addWidget(mRegexCheckbox);
|
||||||
|
|
||||||
// Add searchbar placeholder
|
// Add searchbar placeholder
|
||||||
QWidget* horzPlaceholder = new QWidget();
|
QWidget* horzPlaceholder = new QWidget(this);
|
||||||
horzPlaceholder->setLayout(horzLayout);
|
horzPlaceholder->setLayout(horzLayout);
|
||||||
|
|
||||||
barSplitter->addWidget(horzPlaceholder);
|
barSplitter->addWidget(horzPlaceholder);
|
||||||
|
|
|
@ -672,7 +672,7 @@ void Configuration::readColors()
|
||||||
//read config
|
//read config
|
||||||
for(int i = 0; i < Colors.size(); i++)
|
for(int i = 0; i < Colors.size(); i++)
|
||||||
{
|
{
|
||||||
QString id = Colors.keys().at(i);
|
const QString & id = Colors.keys().at(i);
|
||||||
Colors[id] = colorFromConfig(id);
|
Colors[id] = colorFromConfig(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ void Configuration::writeColors()
|
||||||
//write config
|
//write config
|
||||||
for(int i = 0; i < Colors.size(); i++)
|
for(int i = 0; i < Colors.size(); i++)
|
||||||
{
|
{
|
||||||
QString id = Colors.keys().at(i);
|
const QString & id = Colors.keys().at(i);
|
||||||
colorToConfig(id, Colors[id]);
|
colorToConfig(id, Colors[id]);
|
||||||
}
|
}
|
||||||
emit colorsUpdated();
|
emit colorsUpdated();
|
||||||
|
@ -694,11 +694,11 @@ void Configuration::readBools()
|
||||||
//read config
|
//read config
|
||||||
for(int i = 0; i < Bools.size(); i++)
|
for(int i = 0; i < Bools.size(); i++)
|
||||||
{
|
{
|
||||||
QString category = Bools.keys().at(i);
|
const QString & category = Bools.keys().at(i);
|
||||||
QMap<QString, bool> & currentBool = Bools[category];
|
QMap<QString, bool> & currentBool = Bools[category];
|
||||||
for(int j = 0; j < currentBool.size(); j++)
|
for(int j = 0; j < currentBool.size(); j++)
|
||||||
{
|
{
|
||||||
QString id = currentBool.keys().at(j);
|
const QString & id = currentBool.keys().at(j);
|
||||||
currentBool[id] = boolFromConfig(category, id);
|
currentBool[id] = boolFromConfig(category, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,11 +709,11 @@ void Configuration::writeBools()
|
||||||
//write config
|
//write config
|
||||||
for(int i = 0; i < Bools.size(); i++)
|
for(int i = 0; i < Bools.size(); i++)
|
||||||
{
|
{
|
||||||
QString category = Bools.keys().at(i);
|
const QString & category = Bools.keys().at(i);
|
||||||
QMap<QString, bool>* currentBool = &Bools[category];
|
QMap<QString, bool>* currentBool = &Bools[category];
|
||||||
for(int j = 0; j < currentBool->size(); j++)
|
for(int j = 0; j < currentBool->size(); j++)
|
||||||
{
|
{
|
||||||
QString id = (*currentBool).keys().at(j);
|
const QString & id = (*currentBool).keys().at(j);
|
||||||
boolToConfig(category, id, (*currentBool)[id]);
|
boolToConfig(category, id, (*currentBool)[id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -725,11 +725,11 @@ void Configuration::readUints()
|
||||||
//read config
|
//read config
|
||||||
for(int i = 0; i < Uints.size(); i++)
|
for(int i = 0; i < Uints.size(); i++)
|
||||||
{
|
{
|
||||||
QString category = Uints.keys().at(i);
|
const QString & category = Uints.keys().at(i);
|
||||||
QMap<QString, duint> & currentUint = Uints[category];
|
QMap<QString, duint> & currentUint = Uints[category];
|
||||||
for(int j = 0; j < currentUint.size(); j++)
|
for(int j = 0; j < currentUint.size(); j++)
|
||||||
{
|
{
|
||||||
QString id = currentUint.keys().at(j);
|
const QString & id = currentUint.keys().at(j);
|
||||||
currentUint[id] = uintFromConfig(category, id);
|
currentUint[id] = uintFromConfig(category, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -743,11 +743,11 @@ void Configuration::writeUints()
|
||||||
//write config
|
//write config
|
||||||
for(int i = 0; i < Uints.size(); i++)
|
for(int i = 0; i < Uints.size(); i++)
|
||||||
{
|
{
|
||||||
QString category = Uints.keys().at(i);
|
const QString & category = Uints.keys().at(i);
|
||||||
QMap<QString, duint>* currentUint = &Uints[category];
|
QMap<QString, duint>* currentUint = &Uints[category];
|
||||||
for(int j = 0; j < currentUint->size(); j++)
|
for(int j = 0; j < currentUint->size(); j++)
|
||||||
{
|
{
|
||||||
QString id = (*currentUint).keys().at(j);
|
const QString & id = (*currentUint).keys().at(j);
|
||||||
|
|
||||||
// Do not save settings to file if saveLoadTabOrder checkbox is Unchecked
|
// Do not save settings to file if saveLoadTabOrder checkbox is Unchecked
|
||||||
if(!bSaveLoadTabOrder && category == "TabOrder" && BridgeSettingGetUint(category.toUtf8().constData(), id.toUtf8().constData(), &setting))
|
if(!bSaveLoadTabOrder && category == "TabOrder" && BridgeSettingGetUint(category.toUtf8().constData(), id.toUtf8().constData(), &setting))
|
||||||
|
@ -764,7 +764,7 @@ void Configuration::readFonts()
|
||||||
//read config
|
//read config
|
||||||
for(int i = 0; i < Fonts.size(); i++)
|
for(int i = 0; i < Fonts.size(); i++)
|
||||||
{
|
{
|
||||||
QString id = Fonts.keys().at(i);
|
const QString & id = Fonts.keys().at(i);
|
||||||
QFont font = fontFromConfig(id);
|
QFont font = fontFromConfig(id);
|
||||||
QFontInfo fontInfo(font);
|
QFontInfo fontInfo(font);
|
||||||
if(id == "Application" || fontInfo.fixedPitch())
|
if(id == "Application" || fontInfo.fixedPitch())
|
||||||
|
@ -777,7 +777,7 @@ void Configuration::writeFonts()
|
||||||
//write config
|
//write config
|
||||||
for(int i = 0; i < Fonts.size(); i++)
|
for(int i = 0; i < Fonts.size(); i++)
|
||||||
{
|
{
|
||||||
QString id = Fonts.keys().at(i);
|
const QString & id = Fonts.keys().at(i);
|
||||||
fontToConfig(id, Fonts[id]);
|
fontToConfig(id, Fonts[id]);
|
||||||
}
|
}
|
||||||
emit fontsUpdated();
|
emit fontsUpdated();
|
||||||
|
@ -1136,7 +1136,7 @@ bool Configuration::shortcutToConfig(const QString & id, const QKeySequence shor
|
||||||
|
|
||||||
void Configuration::registerMenuBuilder(MenuBuilder* menu, size_t count)
|
void Configuration::registerMenuBuilder(MenuBuilder* menu, size_t count)
|
||||||
{
|
{
|
||||||
QString id = menu->getId();
|
const QString & id = menu->getId();
|
||||||
for(const auto & i : NamedMenuBuilders)
|
for(const auto & i : NamedMenuBuilders)
|
||||||
if(i.type == 0 && i.builder->getId() == id)
|
if(i.type == 0 && i.builder->getId() == id)
|
||||||
return; //already exists
|
return; //already exists
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
bool GlobalShortcut;
|
bool GlobalShortcut;
|
||||||
|
|
||||||
Shortcut(QString name = QString(), QString hotkey = QString(), bool global = false)
|
Shortcut(QString name = QString(), QString hotkey = QString(), bool global = false)
|
||||||
: Name(name), Hotkey(hotkey), GlobalShortcut(global) { }
|
: Name(name), Hotkey(hotkey, QKeySequence::PortableText), GlobalShortcut(global) { }
|
||||||
|
|
||||||
Shortcut(std::initializer_list<QString> names, QString hotkey = QString(), bool global = false)
|
Shortcut(std::initializer_list<QString> names, QString hotkey = QString(), bool global = false)
|
||||||
: Shortcut(QStringList(names).join(" -> "), hotkey, global) { }
|
: Shortcut(QStringList(names).join(" -> "), hotkey, global) { }
|
||||||
|
|
|
@ -7,12 +7,16 @@
|
||||||
#include "ComboBoxDialog.h"
|
#include "ComboBoxDialog.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
#include "BrowseDialog.h"
|
#include "BrowseDialog.h"
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
void SetApplicationIcon(WId winId)
|
void SetApplicationIcon(WId winId)
|
||||||
{
|
{
|
||||||
HICON hIcon = LoadIcon(GetModuleHandleW(0), MAKEINTRESOURCE(100));
|
std::thread([winId]
|
||||||
SendMessageW((HWND)winId, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
{
|
||||||
DestroyIcon(hIcon);
|
HICON hIcon = LoadIcon(GetModuleHandleW(0), MAKEINTRESOURCE(100));
|
||||||
|
SendMessageW((HWND)winId, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
||||||
|
DestroyIcon(hIcon);
|
||||||
|
}).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray & ByteReverse(QByteArray & array)
|
QByteArray & ByteReverse(QByteArray & array)
|
||||||
|
@ -39,7 +43,7 @@ QByteArray ByteReverse(QByteArray && array)
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimpleInputBox(QWidget* parent, const QString & title, QString defaultValue, QString & output, const QString & placeholderText, QIcon* icon)
|
bool SimpleInputBox(QWidget* parent, const QString & title, QString defaultValue, QString & output, const QString & placeholderText, const QIcon* icon)
|
||||||
{
|
{
|
||||||
LineEditDialog mEdit(parent);
|
LineEditDialog mEdit(parent);
|
||||||
mEdit.setWindowIcon(icon ? *icon : parent->windowIcon());
|
mEdit.setWindowIcon(icon ? *icon : parent->windowIcon());
|
||||||
|
@ -56,7 +60,7 @@ bool SimpleInputBox(QWidget* parent, const QString & title, QString defaultValue
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimpleChoiceBox(QWidget* parent, const QString & title, QString defaultValue, const QStringList & choices, QString & output, bool editable, const QString & placeholderText, QIcon* icon, int minimumContentsLength)
|
bool SimpleChoiceBox(QWidget* parent, const QString & title, QString defaultValue, const QStringList & choices, QString & output, bool editable, const QString & placeholderText, const QIcon* icon, int minimumContentsLength)
|
||||||
{
|
{
|
||||||
ComboBoxDialog mChoice(parent);
|
ComboBoxDialog mChoice(parent);
|
||||||
mChoice.setWindowIcon(icon ? *icon : parent->windowIcon());
|
mChoice.setWindowIcon(icon ? *icon : parent->windowIcon());
|
||||||
|
|
|
@ -11,8 +11,8 @@ class QByteArray;
|
||||||
void SetApplicationIcon(WId winId);
|
void SetApplicationIcon(WId winId);
|
||||||
QByteArray & ByteReverse(QByteArray & array);
|
QByteArray & ByteReverse(QByteArray & array);
|
||||||
QByteArray ByteReverse(QByteArray && array);
|
QByteArray ByteReverse(QByteArray && array);
|
||||||
bool SimpleInputBox(QWidget* parent, const QString & title, QString defaultValue, QString & output, const QString & placeholderText, QIcon* icon = nullptr);
|
bool SimpleInputBox(QWidget* parent, const QString & title, QString defaultValue, QString & output, const QString & placeholderText, const QIcon* icon = nullptr);
|
||||||
bool SimpleChoiceBox(QWidget* parent, const QString & title, QString defaultValue, const QStringList & choices, QString & output, bool editable, const QString & placeholderText, QIcon* icon = nullptr, int minimumContentsLength = -1);
|
bool SimpleChoiceBox(QWidget* parent, const QString & title, QString defaultValue, const QStringList & choices, QString & output, bool editable, const QString & placeholderText, const QIcon* icon = nullptr, int minimumContentsLength = -1);
|
||||||
void SimpleErrorBox(QWidget* parent, const QString & title, const QString & text);
|
void SimpleErrorBox(QWidget* parent, const QString & title, const QString & text);
|
||||||
void SimpleWarningBox(QWidget* parent, const QString & title, const QString & text);
|
void SimpleWarningBox(QWidget* parent, const QString & title, const QString & text);
|
||||||
void SimpleInfoBox(QWidget* parent, const QString & title, const QString & text);
|
void SimpleInfoBox(QWidget* parent, const QString & title, const QString & text);
|
||||||
|
@ -23,5 +23,12 @@ bool isEaster();
|
||||||
QString couldItBeSeasonal(QString icon);
|
QString couldItBeSeasonal(QString icon);
|
||||||
QIcon getFileIcon(QString file);
|
QIcon getFileIcon(QString file);
|
||||||
|
|
||||||
#define DIcon(file) QIcon(QString(":/icons/images/").append(couldItBeSeasonal(file)))
|
template<int>
|
||||||
|
static const QIcon & DIconHelper(const QString & file)
|
||||||
|
{
|
||||||
|
static QIcon icon(QString(":/icons/images/").append(couldItBeSeasonal(file)));
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DIcon(file) DIconHelper<__LINE__>(file)
|
||||||
#endif // MISCUTIL_H
|
#endif // MISCUTIL_H
|
||||||
|
|
Loading…
Reference in New Issue