Commit f39ed770 authored by Pino Toscano's avatar Pino Toscano

view1394: initialize OuiDb only when needed

Create the OuiDb (looking up and parsing the OUI file) only in case the
string of a vendor is needed, e.g. when actually showing a device.
parent ddc4fca1
......@@ -58,7 +58,7 @@ int my_reset_handler(raw1394handle_t handle, unsigned int) {
K_PLUGIN_FACTORY(View1394Factory, registerPlugin<View1394>();)
View1394::View1394(QWidget *parent, const QVariantList &) :
KCModule(parent), m_insideRescanBus(false) {
KCModule(parent), m_insideRescanBus(false), m_ouiDb(nullptr) {
setQuickHelp(i18n("<qt>Here you can see some information about "
"your IEEE 1394 configuration. "
"The meaning of the columns:"
......@@ -77,7 +77,6 @@ View1394::View1394(QWidget *parent, const QVariantList &) :
"</ul></qt>"
));
m_ouiDb=new OuiDb();
QVBoxLayout *box=new QVBoxLayout(this);
box->setContentsMargins(0, 0, 0, 0);
m_view=new View1394Widget(this);
......@@ -255,7 +254,7 @@ void View1394::rescanBus() {
}
QStringList nodeContents;
nodeContents << nodeStr << guidStr << local << irmStr << cmStr << isStr << bmStr << pmStr << accStr << speedStr << m_ouiDb->vendor(guid);
nodeContents << nodeStr << guidStr << local << irmStr << cmStr << isStr << bmStr << pmStr << accStr << speedStr << ouiDb()->vendor(guid);
new QTreeWidgetItem(card, nodeContents);
}
......@@ -271,6 +270,12 @@ void View1394::generateBusReset() {
raw1394_reset_bus(*it);
}
OuiDb *View1394::ouiDb() {
if (m_ouiDb==nullptr)
m_ouiDb=new OuiDb();
return m_ouiDb;
}
OuiDb::OuiDb() {
const char *paths[]={
"/var/lib/ieee-data/oui.txt", /* Debian, ieee-data with updates */
......
......@@ -70,6 +70,7 @@ private:
bool m_insideRescanBus;
QTimer m_rescanTimer;
OuiDb *m_ouiDb;
OuiDb *ouiDb();
private Q_SLOTS:
void callRaw1394EventLoop(int fd);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment