View Single Post
rooster13's Avatar
Posts: 319 | Thanked: 221 times | Joined on Jan 2010 @ Finland
#45
Originally Posted by nicolai View Post
Hi rooster,

I just looked at my app-search-widget code again, because it seems
only the Name but not the comment entry is localized (translatable).
The comment entry for the browser is
weba_ap_web_browser_thumb
but I can not find any translated text for this name...

nicolai
Hi Nicolai,

I used your Qt settings code and modified it a little to suit my needs. It turned out that your solution was just a little bit faster than mine .
Thank you for the code.

As for the app descriptions. I am dropping it for the time being, because there is not a good enough solution to read them.

I tried to read the descriptions from 'apt-cache show', but that turned out to be too slow and description could not be determined for all packages from the information in the desktop -files. Also I don't want to read those into a file and save them. This is the code I made for reading the descriptions from the package (it contains a nice little trick for piping commands in QProcess, if someone is interested):
Code:
QString Dialog::getComment(QString xTextDomain, QString execPath)
{
    QString retComment = "";
    QStringList execList = execPath.split("/");
    QString execName = execList[execList.length() - 1];
    bool isFound = false;
    QProcess apt;
    apt.start("sh -c \"apt-cache show " + xTextDomain.replace("_", "-") + " | grep 'Description:' | tail -1\"");
    apt.waitForFinished();
    while(apt.canReadLine())
    {
        QString outData = apt.readLine();
        if (outData.startsWith("Description:"))
        {
            //qDebug() << outData;
            QStringList tmpSplit = outData.split(":");
            if (tmpSplit.length() >= 2)
            {
                retComment = tmpSplit[tmpSplit.length() - 1];
                isFound = true;
            }
        }
    }
    apt.close();
    if (!isFound)
    {
        apt.start("sh -c \"apt-cache show " + execName.replace("_", "-") + " | grep 'Description:' | tail -1\"");
        apt.waitForFinished();
        while(apt.canReadLine())
        {
            QString outData = apt.readLine();
            if (outData.startsWith("Description:"))
            {
                //qDebug() << outData;
                QStringList tmpSplit = outData.split(":");
                if (tmpSplit.length() >= 2)
                {
                    retComment = tmpSplit[tmpSplit.length() - 1];
                    isFound = true;
                }
            }
        }
        apt.close();
    }
    return retComment.trimmed();
}
I am still open for new suggestions on getting the app descriptions if somebody has a solution.

Next I will try to implement "Live Search" and fix a minor bug when double clicking on the widgets buttons the list is opened twice or more times.

I have now posted a new version of the deb -file. It actually does not contain any fixes, it is just using Nicolais method of reading desktop -files, which is a little bit faster than mine.

Please test and post bug reports / comments here.
 

The Following User Says Thank You to rooster13 For This Useful Post: