0

We had developed an ".app" installer for MAC OSX using C++ / QT. We were facing issues with loadFinished signal being called with false intermittently even while loading html file which is from local file system.

I found some other posts regarding loadFinished signal being called multiple times. In my case, the signal is called only once with false.

Anyone faced this kind of issue? Relying loadProgress signal with the value 100 is fine?

QT - 4.8.2
Mac OS X - 10.7

Code Snippet:-

boost::scoped_ptr<QWebView> m_webViewP;
static const boost::filesystem::path kJSEntryPoint = boost::filesystem::path("web") / boost::filesystem::path("index.html");

QUrl fileURL(QString::fromStdString(ISettingsManager::getInstance()->getJSEntryPoint()));
Log(INFO, "Loading auth page[%s].", qPrintable(fileURL.toString()));
m_webViewP->load(fileURL);
m_webViewP->activateWindow();
m_webViewP->raise();


const std::string SettingsManagerImpl::getJSEntryPoint() const
{
    boost::filesystem::path retPath;

    retPath = getAppDir_();

    retPath /= kJSEntryPoint;
    std::string toRet = retPath.string();
    convertToURL_(toRet);

    return toRet;
}


void SettingsManagerImpl::convertToURL_(std::string &path) const
{
    size_t index = path.find(kBackSlash);
    while (index != std::string::npos)
    {
        path.replace(index, 1, kForwarSlash);
        index = path.find(kBackSlash);
    }

    path = kURLPrefix + path;
}   

boost::filesystem::path SettingsManagerImpl::getAppDir_() const
{
#ifdef _WIN32
    TCHAR pathName[MAX_PATH];
    if (::GetModuleFileName(NULL, pathName, MAX_PATH) == 0)
    {
        SSLog(ERROR, "Error while retrieving app path.");
        return "";
    }

    ::PathRemoveFileSpec(pathName);

    return boost::filesystem::path(pathName);
#else
    NSAutoreleasePool *poolP = [[NSAutoreleasePool alloc] init];

    NSString *pathP = [[NSBundle mainBundle] executablePath];
    pathP = [pathP stringByDeletingLastPathComponent];

    boost::filesystem::path toRet([pathP cStringUsingEncoding:NSASCIIStringEncoding]);

    [poolP drain];
    return toRet;
#endif
}
Engineer
  • 227
  • 2
  • 19
  • You need to provide more information. What version of Qt are you using, maybe it contains a bug related to QWebKit or Mac OS X that affects you. You could also provide some minimal code sample that reproduces unwanted behaviour. – Kamil Klimek Nov 15 '12 at 14:57
  • @KamilKlimek As you suggested Edited the question by providing necessary details like version details & Code snippet. – Engineer Nov 16 '12 at 05:47

0 Answers0