Changeset View
Changeset View
Standalone View
Standalone View
src/kded/tabletfinder.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 89 | for (iter = d->tabletList.begin() ; iter != d->tabletList.end() ; ++iter) { | |||
---|---|---|---|---|---|
90 | // lookup device information and button map | 90 | // lookup device information and button map | ||
91 | lookupInformation(*iter); | 91 | lookupInformation(*iter); | ||
92 | 92 | | |||
93 | // empty device name will crash the system, ignore them for now | 93 | // empty device name will crash the system, ignore them for now | ||
94 | if (iter->get(TabletInfo::TabletName).isEmpty()) { | 94 | if (iter->get(TabletInfo::TabletName).isEmpty()) { | ||
95 | continue; | 95 | continue; | ||
96 | } | 96 | } | ||
97 | 97 | | |||
98 | qDebug() << QString::fromLatin1("Tablet '%1' (%2) found.").arg(iter->get(TabletInfo::TabletName)).arg(iter->get(TabletInfo::TabletId)); | 98 | dbgWacom << QString::fromLatin1("Tablet '%1' (%2) found.").arg(iter->get(TabletInfo::TabletName)).arg(iter->get(TabletInfo::TabletId)); | ||
99 | 99 | | |||
100 | // emit tablet added signal | 100 | // emit tablet added signal | ||
101 | emit tabletAdded(*iter); | 101 | emit tabletAdded(*iter); | ||
102 | } | 102 | } | ||
103 | 103 | | |||
104 | return true; | 104 | return true; | ||
105 | } | 105 | } | ||
106 | 106 | | |||
Show All 30 Lines | 135 | if (info.hasDevice(deviceId)) { | |||
137 | TabletInformation tabletInfo = info; | 137 | TabletInformation tabletInfo = info; | ||
138 | lookupInformation(tabletInfo); | 138 | lookupInformation(tabletInfo); | ||
139 | 139 | | |||
140 | // empty device name will crash the system, ignore them for now | 140 | // empty device name will crash the system, ignore them for now | ||
141 | if (tabletInfo.get(TabletInfo::TabletName).isEmpty()) { | 141 | if (tabletInfo.get(TabletInfo::TabletName).isEmpty()) { | ||
142 | continue; | 142 | continue; | ||
143 | } | 143 | } | ||
144 | 144 | | |||
145 | qDebug() << QString::fromLatin1("Tablet '%1' (%2) added.").arg(tabletInfo.get(TabletInfo::TabletName)).arg(tabletInfo.get(TabletInfo::TabletId)); | 145 | dbgWacom << QString::fromLatin1("Tablet '%1' (%2) added.").arg(tabletInfo.get(TabletInfo::TabletName)).arg(tabletInfo.get(TabletInfo::TabletId)); | ||
146 | 146 | | |||
147 | // add tablet to the list of known tablets and emit added signal | 147 | // add tablet to the list of known tablets and emit added signal | ||
148 | d->tabletList.append(tabletInfo); | 148 | d->tabletList.append(tabletInfo); | ||
149 | emit tabletAdded(tabletInfo); | 149 | emit tabletAdded(tabletInfo); | ||
150 | return; | 150 | return; | ||
151 | } | 151 | } | ||
152 | } | 152 | } | ||
153 | } | 153 | } | ||
154 | 154 | | |||
155 | 155 | | |||
156 | 156 | | |||
157 | void TabletFinder::onX11TabletRemoved(int deviceId) | 157 | void TabletFinder::onX11TabletRemoved(int deviceId) | ||
158 | { | 158 | { | ||
159 | Q_D(TabletFinder); | 159 | Q_D(TabletFinder); | ||
160 | 160 | | |||
161 | // check if we know this tablet | 161 | // check if we know this tablet | ||
162 | TabletFinderPrivate::TabletInformationList::iterator iter; | 162 | TabletFinderPrivate::TabletInformationList::iterator iter; | ||
163 | 163 | | |||
164 | for (iter = d->tabletList.begin() ; iter != d->tabletList.end() ; ++iter) { | 164 | for (iter = d->tabletList.begin() ; iter != d->tabletList.end() ; ++iter) { | ||
165 | if (iter->hasDevice(deviceId)) { | 165 | if (iter->hasDevice(deviceId)) { | ||
166 | TabletInformation info = *iter; | 166 | TabletInformation info = *iter; | ||
167 | d->tabletList.erase(iter); | 167 | d->tabletList.erase(iter); | ||
168 | qDebug() << QString::fromLatin1("Removed tablet '%1' (%2).").arg(info.get(TabletInfo::TabletName)).arg(info.get(TabletInfo::TabletId)); | 168 | dbgWacom << QString::fromLatin1("Removed tablet '%1' (%2).").arg(info.get(TabletInfo::TabletName)).arg(info.get(TabletInfo::TabletId)); | ||
169 | emit tabletRemoved(info); | 169 | emit tabletRemoved(info); | ||
170 | return; | 170 | return; | ||
171 | } | 171 | } | ||
172 | } | 172 | } | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | 175 | | |||
176 | 176 | | |||
177 | bool TabletFinder::lookupInformation(TabletInformation& info) | 177 | bool TabletFinder::lookupInformation(TabletInformation& info) | ||
178 | { | 178 | { | ||
179 | // lookup information from our tablet database | 179 | // lookup information from our tablet database | ||
180 | if (!TabletDatabase::instance().lookupTablet(info.get (TabletInfo::TabletId), info)) { | 180 | if (!TabletDatabase::instance().lookupTablet(info.get (TabletInfo::TabletId), info)) { | ||
181 | qDebug() << QString::fromLatin1("Could not find tablet with id '%1' in database.").arg(info.get (TabletInfo::TabletId)); | 181 | dbgWacom << QString::fromLatin1("Could not find tablet with id '%1' in database.").arg(info.get (TabletInfo::TabletId)); | ||
182 | return false; | 182 | return false; | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | // TODO use libwacom to get more tablet information | 185 | // TODO use libwacom to get more tablet information | ||
186 | 186 | | |||
187 | return true; | 187 | return true; | ||
188 | } | 188 | } | ||
189 | |