comparison demos/browser/webview.d @ 80:85c59c4e5f19

remove QLatin1String and other fixes
author mandel
date Sun, 24 May 2009 15:25:41 +0000
parents 0654fc9bac95
children 5c8c9c5d9ee1
comparison
equal deleted inserted replaced
79:957f549cfc65 80:85c59c4e5f19
151 if (reply.error() == QNetworkReply.NoError) { 151 if (reply.error() == QNetworkReply.NoError) {
152 BrowserApplication.downloadManager().handleUnsupportedContent(reply); 152 BrowserApplication.downloadManager().handleUnsupportedContent(reply);
153 return; 153 return;
154 } 154 }
155 155
156 auto file = new QFile(QLatin1String(":/notfound.html")); 156 auto file = new QFile(":/notfound.html");
157 bool isOpened = file.open(QIODevice.ReadOnly); 157 bool isOpened = file.open(QIODevice.ReadOnly);
158 assert(isOpened); 158 assert(isOpened);
159 string title = Format(tr("Error loading page: {}"), reply.url().toString()); 159 string title = Format(tr("Error loading page: {}"), reply.url().toString());
160 string html = Format(QLatin1String(file.readAll()), 160 string html = Format(file.readAll(),
161 title, 161 title,
162 reply.errorString(), 162 reply.errorString(),
163 reply.url().toString()); 163 reply.url().toString());
164 164
165 QBuffer imageBuffer; 165 QBuffer imageBuffer;
166 imageBuffer.open(QBuffer.ReadWrite); 166 imageBuffer.open(QBuffer.ReadWrite);
167 QIcon icon = view().style().standardIcon(QStyle.SP_MessageBoxWarning, 0, view()); 167 QIcon icon = view().style().standardIcon(QStyle.SP_MessageBoxWarning, 0, view());
168 QPixmap pixmap = icon.pixmap(QSize(32,32)); 168 QPixmap pixmap = icon.pixmap(QSize(32,32));
169 if (pixmap.save(&imageBuffer, "PNG")) { 169 if (pixmap.save(&imageBuffer, "PNG")) {
170 html.replace(QLatin1String("IMAGE_BINARY_DATA_HERE"), 170 html.replace("IMAGE_BINARY_DATA_HERE",
171 QLatin1String(imageBuffer.buffer().toBase64())); 171 imageBuffer.buffer().toBase64());
172 } 172 }
173 173
174 QWebFrame[] frames; 174 QWebFrame[] frames;
175 frames.append(mainFrame()); 175 frames.append(mainFrame());
176 while (!frames.isEmpty()) { 176 while (!frames.isEmpty()) {