summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio8Generator.cxx
blob: 9fd3d5af657b728a4971278f2429d96b6f6f2807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
/*============================================================================
  CMake - Cross Platform Makefile Generator
  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium

  Distributed under the OSI-approved BSD License (the "License");
  see accompanying file Copyright.txt for details.

  This software is distributed WITHOUT ANY WARRANTY; without even the
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the License for more information.
============================================================================*/
#include "windows.h" // this must be first to define GetCurrentDirectory
#include "cmGlobalVisualStudio8Generator.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
#include "cmVisualStudioWCEPlatformParser.h"
#include "cmake.h"
#include "cmGeneratedFileStream.h"
#include "cmSourceFile.h"

static const char vs8generatorName[] = "Visual Studio 8 2005";

class cmGlobalVisualStudio8Generator::Factory
  : public cmGlobalGeneratorFactory
{
public:
  virtual cmGlobalGenerator* CreateGlobalGenerator(
                                              const std::string& name) const {
    if(strncmp(name.c_str(), vs8generatorName,
               sizeof(vs8generatorName) - 1) != 0)
      {
      return 0;
      }

    const char* p = name.c_str() + sizeof(vs8generatorName) - 1;
    if(p[0] == '\0')
      {
      return new cmGlobalVisualStudio8Generator(
        name, "");
      }

    if(p[0] != ' ')
      {
      return 0;
      }

    ++p;

    if(!strcmp(p, "Win64"))
      {
      return new cmGlobalVisualStudio8Generator(
        name, "x64");
      }

    cmVisualStudioWCEPlatformParser parser(p);
    parser.ParseVersion("8.0");
    if (!parser.Found())
      {
      return 0;
      }

    cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator(
      name, p);
    ret->WindowsCEVersion = parser.GetOSVersion();
    return ret;
  }

  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
    entry.Name = vs8generatorName;
    entry.Brief = "Generates Visual Studio 8 2005 project files.";
  }

  virtual void GetGenerators(std::vector<std::string>& names) const {
    names.push_back(vs8generatorName);
    names.push_back(vs8generatorName + std::string(" Win64"));
    cmVisualStudioWCEPlatformParser parser;
    parser.ParseVersion("8.0");
    const std::vector<std::string>& availablePlatforms =
      parser.GetAvailablePlatforms();
    for(std::vector<std::string>::const_iterator i =
        availablePlatforms.begin(); i != availablePlatforms.end(); ++i)
      {
      names.push_back("Visual Studio 8 2005 " + *i);
      }
  }
};

//----------------------------------------------------------------------------
cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
{
  return new Factory;
}

//----------------------------------------------------------------------------
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
  const std::string& name, const std::string& platformName)
  : cmGlobalVisualStudio71Generator(platformName)
{
  this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
  this->Name = name;
}

//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio8Generator::FindDevEnvCommand()
{
  // First look for VCExpress.
  std::string vsxcmd;
  std::string vsxkey =
    "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\";
  vsxkey += this->GetIDEVersion();
  vsxkey += ";InstallDir";
  if(cmSystemTools::ReadRegistryValue(vsxkey.c_str(), vsxcmd,
                                      cmSystemTools::KeyWOW64_32))
    {
    cmSystemTools::ConvertToUnixSlashes(vsxcmd);
    vsxcmd += "/VCExpress.exe";
    return vsxcmd;
    }
  // Now look for devenv.
  return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand();
}

//----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
{
  cmLocalVisualStudio7Generator *lg =
    new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8);
  lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
  lg->SetGlobalGenerator(this);
  return lg;
}

//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator
::EnableLanguage(std::vector<std::string>const &  lang,
                 cmMakefile *mf, bool optional)
{
  this->AddPlatformDefinitions(mf);
  cmGlobalVisualStudio7Generator::EnableLanguage(lang, mf, optional);
}

//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{
  if(this->TargetsWindowsCE())
  {
    mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
      this->WindowsCEVersion.c_str());
  }
}

//----------------------------------------------------------------------------
// ouput standard header for dsw file
void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout)
{
  fout << "Microsoft Visual Studio Solution File, Format Version 9.00\n";
  fout << "# Visual Studio 2005\n";
}

//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator
::GetDocumentation(cmDocumentationEntry& entry)
{
  entry.Name = cmGlobalVisualStudio8Generator::GetActualName();
  entry.Brief = "Generates Visual Studio 8 2005 project files.";
}

//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::Configure()
{
  this->cmGlobalVisualStudio7Generator::Configure();
  this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
}

//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio8Generator::GetUserMacrosDirectory()
{
  // Some VS8 sp0 versions cannot run macros.
  // See http://support.microsoft.com/kb/928209
  const char* vc8sp1Registry =
    "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\"
    "InstalledProducts\\KB926601;";
  const char* vc8exSP1Registry =
    "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\"
    "InstalledProducts\\KB926748;";
  std::string vc8sp1;
  if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) &&
      !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1))
    {
    return "";
    }

  std::string base;
  std::string path;

  // base begins with the VisualStudioProjectsLocation reg value...
  if (cmSystemTools::ReadRegistryValue(
    "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;"
    "VisualStudioProjectsLocation",
    base))
    {
    cmSystemTools::ConvertToUnixSlashes(base);

    // 8.0 macros folder:
    path = base + "/VSMacros80";
    }

  // path is (correctly) still empty if we did not read the base value from
  // the Registry value
  return path;
}

//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase()
{
  return "Software\\Microsoft\\VisualStudio\\8.0\\vsmacros";
}

//----------------------------------------------------------------------------
bool cmGlobalVisualStudio8Generator::AddCheckTarget()
{
  // Add a special target on which all other targets depend that
  // checks the build system and optionally re-runs CMake.
  const char* no_working_directory = 0;
  std::vector<std::string> no_depends;
  std::vector<cmLocalGenerator*> const& generators = this->LocalGenerators;
  cmLocalVisualStudio7Generator* lg =
    static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
  cmMakefile* mf = lg->GetMakefile();

  // Skip the target if no regeneration is to be done.
  if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
    {
    return false;
    }

  std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
  cmCustomCommandLines noCommandLines;
  cmTarget* tgt =
    mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
                          no_working_directory, no_depends,
                          noCommandLines);

  // Organize in the "predefined targets" folder:
  //
  if (this->UseFolderProperty())
    {
    tgt->SetProperty("FOLDER", this->GetPredefinedTargetsFolder());
    }

  // Create a list of all stamp files for this project.
  std::vector<std::string> stamps;
  std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
  stampList += "generate.stamp.list";
  {
  std::string stampListFile =
    generators[0]->GetMakefile()->GetCurrentOutputDirectory();
  stampListFile += "/";
  stampListFile += stampList;
  std::string stampFile;
  cmGeneratedFileStream fout(stampListFile.c_str());
  for(std::vector<cmLocalGenerator*>::const_iterator
        gi = generators.begin(); gi != generators.end(); ++gi)
    {
    stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory();
    stampFile += "/";
    stampFile += cmake::GetCMakeFilesDirectoryPostSlash();
    stampFile += "generate.stamp";
    fout << stampFile << "\n";
    stamps.push_back(stampFile);
    }
  }

  // Add a custom rule to re-run CMake if any input files changed.
  {
  // Collect the input files used to generate all targets in this
  // project.
  std::vector<std::string> listFiles;
  for(unsigned int j = 0; j < generators.size(); ++j)
    {
    cmMakefile* lmf = generators[j]->GetMakefile();
    listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
                     lmf->GetListFiles().end());
    }
  // Sort the list of input files and remove duplicates.
  std::sort(listFiles.begin(), listFiles.end(),
            std::less<std::string>());
  std::vector<std::string>::iterator new_end =
    std::unique(listFiles.begin(), listFiles.end());
  listFiles.erase(new_end, listFiles.end());

  // Create a rule to re-run CMake.
  std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
  stampName += "generate.stamp";
  const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND");
  cmCustomCommandLine commandLine;
  commandLine.push_back(dsprule);
  std::string argH = "-H";
  argH += lg->Convert(mf->GetHomeDirectory(),
                      cmLocalGenerator::START_OUTPUT,
                      cmLocalGenerator::UNCHANGED, true);
  commandLine.push_back(argH);
  std::string argB = "-B";
  argB += lg->Convert(mf->GetHomeOutputDirectory(),
                      cmLocalGenerator::START_OUTPUT,
                      cmLocalGenerator::UNCHANGED, true);
  commandLine.push_back(argB);
  commandLine.push_back("--check-stamp-list");
  commandLine.push_back(stampList.c_str());
  commandLine.push_back("--vs-solution-file");
  commandLine.push_back("\"$(SolutionPath)\"");
  cmCustomCommandLines commandLines;
  commandLines.push_back(commandLine);

  // Add the rule.  Note that we cannot use the CMakeLists.txt
  // file as the main dependency because it would get
  // overwritten by the CreateVCProjBuildRule.
  // (this could be avoided with per-target source files)
  std::string no_main_dependency = "";
  if(cmSourceFile* file =
     mf->AddCustomCommandToOutput(
       stamps, listFiles,
       no_main_dependency, commandLines, "Checking Build System",
       no_working_directory, true))
    {
    tgt->AddSource(file->GetFullPath());
    }
  else
    {
    cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
    }
  }

  return true;
}

//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::Generate()
{
  if(this->AddCheckTarget())
    {
    // All targets depend on the build-system check target.
    for(TargetMap::const_iterator
          ti = this->TotalTargets.begin();
        ti != this->TotalTargets.end(); ++ti)
      {
      if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
        {
        ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
        }
      }
    }

  // Now perform the main generation.
  this->cmGlobalVisualStudio7Generator::Generate();
}

//----------------------------------------------------------------------------
void
cmGlobalVisualStudio8Generator
::WriteSolutionConfigurations(std::ostream& fout)
{
  fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
  for(std::vector<std::string>::iterator i = this->Configurations.begin();
      i != this->Configurations.end(); ++i)
    {
    fout << "\t\t" << *i << "|" << this->GetPlatformName()
         << " = "  << *i << "|" << this->GetPlatformName() << "\n";
    }
  fout << "\tEndGlobalSection\n";
}

//----------------------------------------------------------------------------
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
  std::ostream& fout, const std::string& name, cmTarget::TargetType type,
  const std::set<std::string>& configsPartOfDefaultBuild,
  std::string const& platformMapping)
{
  std::string guid = this->GetGUID(name);
  for(std::vector<std::string>::iterator i = this->Configurations.begin();
      i != this->Configurations.end(); ++i)
    {
    fout << "\t\t{" << guid << "}." << *i
         << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
         << (!platformMapping.empty()?
             platformMapping : this->GetPlatformName())
         << "\n";
      std::set<std::string>::const_iterator
        ci = configsPartOfDefaultBuild.find(*i);
      if(!(ci == configsPartOfDefaultBuild.end()))
      {
      fout << "\t\t{" << guid << "}." << *i
           << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"
           << (!platformMapping.empty()?
               platformMapping : this->GetPlatformName())
           << "\n";
      }
    bool needsDeploy = (type == cmTarget::EXECUTABLE ||
                        type == cmTarget::SHARED_LIBRARY);
    if(this->TargetsWindowsCE() && needsDeploy)
      {
      fout << "\t\t{" << guid << "}." << *i
           << "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
           << (!platformMapping.empty()?
               platformMapping : this->GetPlatformName())
           << "\n";
      }
    }
}

//----------------------------------------------------------------------------
bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
{
  // Skip over the cmGlobalVisualStudioGenerator implementation!
  // We do not need the support that VS <= 7.1 needs.
  return this->cmGlobalGenerator::ComputeTargetDepends();
}

//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
  std::ostream& fout, const std::string&, const char*, cmTarget const& t)
{
  TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
  OrderedTargetDependSet depends(unordered);
  for(OrderedTargetDependSet::const_iterator i = depends.begin();
      i != depends.end(); ++i)
    {
    if((*i)->GetType() == cmTarget::INTERFACE_LIBRARY)
      {
      continue;
      }
    std::string guid = this->GetGUID((*i)->GetName().c_str());
    fout << "\t\t{" << guid << "} = {" << guid << "}\n";
    }
}

//----------------------------------------------------------------------------
bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
  cmTarget& target)
{
  // Look for utility dependencies that magically link.
  for(std::set<std::string>::const_iterator ui =
        target.GetUtilities().begin();
      ui != target.GetUtilities().end(); ++ui)
    {
    if(cmTarget* depTarget = this->FindTarget(ui->c_str()))
      {
      if(depTarget->GetType() != cmTarget::INTERFACE_LIBRARY
          && depTarget->GetProperty("EXTERNAL_MSPROJECT"))
        {
        // This utility dependency names an external .vcproj target.
        // We use LinkLibraryDependencies="true" to link to it without
        // predicting the .lib file location or name.
        return true;
        }
      }
    }
  return false;
}

//----------------------------------------------------------------------------
static cmVS7FlagTable cmVS8ExtraFlagTable[] =
{
  {"CallingConvention", "Gd", "cdecl", "0", 0 },
  {"CallingConvention", "Gr", "fastcall", "1", 0 },
  {"CallingConvention", "Gz", "stdcall", "2", 0 },

  {"Detect64BitPortabilityProblems", "Wp64",
   "Detect 64Bit Portability Problems", "true", 0 },
  {"ErrorReporting", "errorReport:prompt", "Report immediately", "1", 0 },
  {"ErrorReporting", "errorReport:queue", "Queue for next login", "2", 0 },
  // Precompiled header and related options.  Note that the
  // UsePrecompiledHeader entries are marked as "Continue" so that the
  // corresponding PrecompiledHeaderThrough entry can be found.
  {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2",
   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
  {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
   cmVS7FlagTable::UserValueRequired},
  // There is no YX option in the VS8 IDE.

  // Exception handling mode.  If no entries match, it will be FALSE.
  {"ExceptionHandling", "GX", "enable c++ exceptions", "1", 0},
  {"ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0},
  {"ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0},

  {"EnablePREfast", "analyze", "", "true", 0},
  {"EnablePREfast", "analyze-", "", "false", 0},

  // Language options
  {"TreatWChar_tAsBuiltInType", "Zc:wchar_t",
   "wchar_t is a built-in type", "true", 0},
  {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-",
   "wchar_t is not a built-in type", "false", 0},

  {0,0,0,0,0}
};
cmIDEFlagTable const* cmGlobalVisualStudio8Generator::GetExtraFlagTableVS8()
{
  return cmVS8ExtraFlagTable;
}
y("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n"); - QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n"); - QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::addColumn("expectedError"); + QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; + QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; + QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n") << QNetworkReply::RemoteHostClosedError; + QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n") << QNetworkReply::RemoteHostClosedError; + QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; + QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; } void tst_QNetworkReply::ioGetFromHttpStatus100() { QFETCH(QByteArray, dataToSend); + QFETCH(QNetworkReply::NetworkError, expectedError); MiniHttpServer server(dataToSend); server.doClose = true; @@ -2607,7 +2609,7 @@ void tst_QNetworkReply::ioGetFromHttpStatus100() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), request.url()); - QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->error(), expectedError); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QVERIFY(reply->rawHeader("bla").isNull()); } @@ -2615,12 +2617,14 @@ void tst_QNetworkReply::ioGetFromHttpStatus100() void tst_QNetworkReply::ioGetFromHttpNoHeaders_data() { QTest::addColumn("dataToSend"); - QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n"); + QTest::addColumn("expectedError"); + QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n") << QNetworkReply::RemoteHostClosedError; } void tst_QNetworkReply::ioGetFromHttpNoHeaders() { QFETCH(QByteArray, dataToSend); + QFETCH(QNetworkReply::NetworkError, expectedError); MiniHttpServer server(dataToSend); server.doClose = true; @@ -2632,7 +2636,7 @@ void tst_QNetworkReply::ioGetFromHttpNoHeaders() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), request.url()); - QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->error(), expectedError); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); } -- cgit v0.12 From 00cf748fa3d241e52dc0908da90864ea397dab8a Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 3 Jan 2011 15:08:22 +0100 Subject: Fix crash when closing QFontDialog::getFont() dialog Unfortunately, given the large number of ways of showing a QFontDialog, it's possible that we try to close the dialog before its event loop is finished. Setting the Cocoa font panel's isReleaseOnClose property to FALSE ensures the panel is still around when we effectively exit the dialog's event loop. Reviewed-by: Richard Task-number: QTBUG-15666 --- src/gui/dialogs/qfontdialog_mac.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 9c63dfa..e2c0ef5 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -116,6 +116,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin - (void)showModelessPanel; - (void)showWindowModalSheet:(QWidget *)docWidget; - (void)runApplicationModalPanel; +- (BOOL)isAppModal; - (void)changeFont:(id)sender; - (void)changeAttributes:(id)sender; - (BOOL)windowShouldClose:(id)window; @@ -226,6 +227,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active); mAppModal = true; NSWindow *ourPanel = [mStolenContentView window]; + [ourPanel setReleasedWhenClosed:NO]; [NSApp runModalForWindow:ourPanel]; QAbstractEventDispatcher::instance()->interrupt(); @@ -235,6 +237,11 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) mPriv->fontDialog()->reject(); } +- (BOOL)isAppModal +{ + return mAppModal; +} + - (void)showWindowModalSheet:(QWidget *)docWidget { #ifdef QT_MAC_USE_COCOA @@ -485,6 +492,8 @@ void QFontDialogPrivate::closeCocoaFontPanel() QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *theDelegate = static_cast(delegate); NSWindow *ourPanel = [theDelegate actualPanel]; [ourPanel close]; + if ([theDelegate isAppModal]) + [ourPanel release]; [theDelegate cleanUpAfterMyself]; [theDelegate release]; this->delegate = 0; -- cgit v0.12 From 254281dae38b932998eb8014a55177948842b78d Mon Sep 17 00:00:00 2001 From: Joshua Grauman Date: Tue, 4 Jan 2011 11:03:32 +0100 Subject: Add line spacing to QTextBlockFormat, get/set functions, CSS support The patch adds line spacing options to Qt, as in all modern word processors. I primarily checked OpenOffice as a reference for how to position the lines based on the various types of line spacing as well as where to do the page breaks. The following functions were added: void QTextBlockFormat::setLineHeight(qreal height, int heightType) qreal QTextBlockFormat::lineHeight() int QTextBlockFormat::lineHeightType() qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling) Here are the HeightTypes available: QTextBlockFormat::SingleHeight QTextBlockFormat::ProportionalHeight QTextBlockFormat::FixedHeight QTextBlockFormat::AtLeastHeight QTextBlockFormat::LineDistanceHeight The following CSS syntax was added: line-height:150% line-height:40px line-height:normal line-height:40al line-height:40ld Merge-request: 2305 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qcssparser.cpp | 1 + src/gui/text/qcssparser_p.h | 1 + src/gui/text/qtextdocumentlayout.cpp | 38 ++++++++++++++++---- src/gui/text/qtextformat.cpp | 67 ++++++++++++++++++++++++++++++++++++ src/gui/text/qtextformat.h | 35 +++++++++++++++++++ src/gui/text/qtexthtmlparser.cpp | 18 ++++++++++ 6 files changed, 154 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index dafc8e7..edb08ae 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -122,6 +122,7 @@ static const QCssKnownValue properties[NumProperties - 1] = { { "image", QtImage }, { "image-position", QtImageAlignment }, { "left", Left }, + { "line-height", LineHeight }, { "list-style", ListStyle }, { "list-style-type", ListStyleType }, { "margin" , Margin }, diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index ca9688e..6bcbdab 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -180,6 +180,7 @@ enum Property { TextTransform, QtListNumberPrefix, QtListNumberSuffix, + LineHeight, NumProperties }; diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index ff14490..5334ae8 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2506,6 +2506,23 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout fd->currentLayoutStruct = 0; } +static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, const QTextLine &line, qreal scaling, + QFixed *lineAdjustment, QFixed *lineBreakHeight, QFixed *lineHeight) +{ + *lineHeight = QFixed::fromReal(blockFormat.lineHeight(line.height(), scaling)); + if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::AtLeastHeight) { + *lineBreakHeight = *lineHeight; + if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight) + *lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), 0.0)) - ((*lineHeight * 4) / 5); + else + *lineAdjustment = QFixed::fromReal(line.height()) - *lineHeight; + } + else { + *lineBreakHeight = QFixed::fromReal(line.height()); + *lineAdjustment = 0; + } +} + void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosition, const QTextBlockFormat &blockFormat, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat) { @@ -2639,8 +2656,12 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi } - QFixed lineHeight = QFixed::fromReal(line.height()); - if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineHeight > layoutStruct->pageBottom) { + QFixed lineBreakHeight, lineHeight, lineAdjustment; + qreal scaling = (q->paintDevice() && q->paintDevice()->logicalDpiY() != qt_defaultDpi()) ? + qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1; + getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight); + + if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom) { layoutStruct->newPage(); floatMargins(layoutStruct->y, layoutStruct, &left, &right); @@ -2652,7 +2673,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi right -= text_indent; } - line.setPosition(QPointF((left - layoutStruct->x_left).toReal(), (layoutStruct->y - cy).toReal())); + line.setPosition(QPointF((left - layoutStruct->x_left).toReal(), (layoutStruct->y - cy - lineAdjustment).toReal())); layoutStruct->y += lineHeight; layoutStruct->contentsWidth = qMax(layoutStruct->contentsWidth, QFixed::fromReal(line.x() + line.naturalTextWidth()) + totalRightMargin); @@ -2672,11 +2693,16 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi QTextLine line = tl->lineAt(i); layoutStruct->contentsWidth = qMax(layoutStruct->contentsWidth, QFixed::fromReal(line.x() + tl->lineAt(i).naturalTextWidth()) + totalRightMargin); - const QFixed lineHeight = QFixed::fromReal(line.height()); + + QFixed lineBreakHeight, lineHeight, lineAdjustment; + qreal scaling = (q->paintDevice() && q->paintDevice()->logicalDpiY() != qt_defaultDpi()) ? + qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1; + getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight); + if (layoutStruct->pageHeight != QFIXED_MAX) { - if (layoutStruct->absoluteY() + lineHeight > layoutStruct->pageBottom) + if (layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom) layoutStruct->newPage(); - line.setPosition(QPointF(line.position().x(), layoutStruct->y.toReal() - tl->position().y())); + line.setPosition(QPointF(line.position().x(), (layoutStruct->y - lineAdjustment).toReal() - tl->position().y())); } layoutStruct->y += lineHeight; } diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 945b012..719db7a 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -541,6 +541,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) \value TabPositions Specifies the tab positions. The tab positions are structs of QTextOption::Tab which are stored in a QList (internally, in a QList). \value BlockIndent + \value LineHeight + \value LineHeightType \value BlockNonBreakableLines \value BlockTrailingHorizontalRulerWidth The width of a horizontal ruler element. @@ -1856,6 +1858,10 @@ QFont QTextCharFormat::font() const indentation is set with setIndent(), the indentation of the first line with setTextIndent(). + Line spacing is set with setLineHeight() and retreived via lineHeight() + and lineHeightType(). The types of line spacing available are in the + LineHeightTypes enum. + Line breaking can be enabled and disabled with setNonBreakableLines(). The brush used to paint the paragraph's background @@ -1872,6 +1878,22 @@ QFont QTextCharFormat::font() const */ /*! + \since 4.7 + \enum QTextBlockFormat::LineHeightTypes + + This enum describes the various types of line spacing support paragraphs can have. + + \value SingleHeight This is the default line height: single spacing. + \value ProportionalHeight This sets the spacing proportional to the line (in percentage). + For example, set to 200 for double spacing. + \value FixedHeight This sets the line height to a fixed line height (in pixels). + \value AtLeastHeight This sets the minimum line height (in pixels). + \value LineDistanceHeight This adds the specified height between lines (in pixels). + + \sa lineHeight(), lineHeightType(), setLineHeight() +*/ + +/*! \fn QTextBlockFormat::QTextBlockFormat() Constructs a new QTextBlockFormat. @@ -2089,6 +2111,51 @@ QList QTextBlockFormat::tabPositions() const /*! + \fn void QTextBlockFormat::setLineHeight(qreal height, int heightType) + \since 4.7 + + This sets the line height for the paragraph to the value in height + which is dependant on heightType, described by the LineHeightTypes enum. + + \sa LineHeightTypes, lineHeight(), lineHeightType() +*/ + + +/*! + \fn qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling) const + \since 4.7 + + This returns what the height of the lines in the paragraph will be depending + on the given height of the script line and the scaling. The value that is returned + is also dependant on the given LineHeightType of the paragraph as well as the LineHeight + setting that has been set for the paragraph. The scaling is needed for the heights + that include a fixed number of pixels, to scale them appropriately for printing. + + \sa LineHeightTypes, setLineHeight(), lineHeightType() +*/ + + +/*! + \fn qreal QTextBlockFormat::lineHeight() const + \since 4.7 + + This returns the LineHeight property for the paragraph. + + \sa LineHeightTypes, setLineHeight(), lineHeightType() +*/ + + +/*! + \fn qreal QTextBlockFormat::lineHeightType() const + \since 4.7 + + This returns the LineHeightType property of the paragraph. + + \sa LineHeightTypes, setLineHeight(), lineHeight() +*/ + + +/*! \fn void QTextBlockFormat::setNonBreakableLines(bool b) If \a b is true, the lines in the paragraph are treated as diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index bb6e71d..41cc1d9 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -164,6 +164,8 @@ public: TextIndent = 0x1034, TabPositions = 0x1035, BlockIndent = 0x1040, + LineHeight = 0x1048, + LineHeightType = 0x1049, BlockNonBreakableLines = 0x1050, BlockTrailingHorizontalRulerWidth = 0x1060, @@ -531,6 +533,14 @@ inline void QTextCharFormat::setTableCellColumnSpan(int _tableCellColumnSpan) class Q_GUI_EXPORT QTextBlockFormat : public QTextFormat { public: + enum LineHeightTypes { + SingleHeight = 0, + ProportionalHeight = 1, + FixedHeight = 2, + AtLeastHeight = 3, + LineDistanceHeight = 4 + }; + QTextBlockFormat(); bool isValid() const { return isBlockFormat(); } @@ -568,6 +578,14 @@ public: inline int indent() const { return intProperty(BlockIndent); } + inline void setLineHeight(qreal height, int heightType) + { setProperty(LineHeight, height); setProperty(LineHeightType, heightType); } + inline qreal lineHeight(qreal scriptLineHeight, qreal scaling) const; + inline qreal lineHeight() const + { return doubleProperty(LineHeight); } + inline int lineHeightType() const + { return intProperty(LineHeightType); } + inline void setNonBreakableLines(bool b) { setProperty(BlockNonBreakableLines, b); } inline bool nonBreakableLines() const @@ -592,6 +610,23 @@ inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment) inline void QTextBlockFormat::setIndent(int aindent) { setProperty(BlockIndent, aindent); } +inline qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling = 1.0) const +{ + switch(intProperty(LineHeightType)) { + case SingleHeight: + return(scriptLineHeight); + case ProportionalHeight: + return(scriptLineHeight * doubleProperty(LineHeight) / 100.0); + case FixedHeight: + return(doubleProperty(LineHeight) * scaling); + case AtLeastHeight: + return(qMax(scriptLineHeight, doubleProperty(LineHeight) * scaling)); + case LineDistanceHeight: + return(scriptLineHeight + doubleProperty(LineHeight) * scaling); + } + return(0); +} + class Q_GUI_EXPORT QTextListFormat : public QTextFormat { public: diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 5b9ab90..769a509 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1250,6 +1250,24 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector case QCss::QtBlockIndent: blockFormat.setIndent(decl.d->values.first().variant.toInt()); break; + case QCss::LineHeight: { + qreal lineHeight; + if (decl.realValue(&lineHeight, "px")) + blockFormat.setLineHeight(lineHeight, QTextBlockFormat::FixedHeight); + else if (decl.realValue(&lineHeight, "al")) + blockFormat.setLineHeight(lineHeight, QTextBlockFormat::AtLeastHeight); + else if (decl.realValue(&lineHeight, "ld")) + blockFormat.setLineHeight(lineHeight, QTextBlockFormat::LineDistanceHeight); + else { + bool ok; + QString value = decl.d->values.first().toString(); + lineHeight = value.toDouble(&ok); + if (ok) + blockFormat.setLineHeight(lineHeight, QTextBlockFormat::ProportionalHeight); + else + blockFormat.setLineHeight(0, QTextBlockFormat::SingleHeight); + } + break; } case QCss::TextIndent: { qreal indent = 0; if (decl.realValue(&indent, "px")) -- cgit v0.12 From 09b06552f98f8ee8be4d156049a6a37a4abed6bd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 4 Jan 2011 11:09:38 +0100 Subject: Rename QTextBlockFormat::AtLeastHeight -> MinimumHeight Make some alterations to merge request 2305: 1. Rename enum for consistency with other APIs in Qt. 2. Correct documentation with actual version number of features. 3. Remove unstandard css syntax in line-height specification. Reviewed-by: Jiang Jiang --- src/gui/text/qtextdocumentlayout.cpp | 2 +- src/gui/text/qtextformat.cpp | 12 ++++++------ src/gui/text/qtextformat.h | 4 ++-- src/gui/text/qtexthtmlparser.cpp | 8 ++------ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 5334ae8..22c6b8c 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2510,7 +2510,7 @@ static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, cons QFixed *lineAdjustment, QFixed *lineBreakHeight, QFixed *lineHeight) { *lineHeight = QFixed::fromReal(blockFormat.lineHeight(line.height(), scaling)); - if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::AtLeastHeight) { + if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::MinimumHeight) { *lineBreakHeight = *lineHeight; if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight) *lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), 0.0)) - ((*lineHeight * 4) / 5); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 719db7a..b05a830 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -1878,7 +1878,7 @@ QFont QTextCharFormat::font() const */ /*! - \since 4.7 + \since 4.8 \enum QTextBlockFormat::LineHeightTypes This enum describes the various types of line spacing support paragraphs can have. @@ -1887,7 +1887,7 @@ QFont QTextCharFormat::font() const \value ProportionalHeight This sets the spacing proportional to the line (in percentage). For example, set to 200 for double spacing. \value FixedHeight This sets the line height to a fixed line height (in pixels). - \value AtLeastHeight This sets the minimum line height (in pixels). + \value MinimumHeight This sets the minimum line height (in pixels). \value LineDistanceHeight This adds the specified height between lines (in pixels). \sa lineHeight(), lineHeightType(), setLineHeight() @@ -2112,7 +2112,7 @@ QList QTextBlockFormat::tabPositions() const /*! \fn void QTextBlockFormat::setLineHeight(qreal height, int heightType) - \since 4.7 + \since 4.8 This sets the line height for the paragraph to the value in height which is dependant on heightType, described by the LineHeightTypes enum. @@ -2123,7 +2123,7 @@ QList QTextBlockFormat::tabPositions() const /*! \fn qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling) const - \since 4.7 + \since 4.8 This returns what the height of the lines in the paragraph will be depending on the given height of the script line and the scaling. The value that is returned @@ -2137,7 +2137,7 @@ QList QTextBlockFormat::tabPositions() const /*! \fn qreal QTextBlockFormat::lineHeight() const - \since 4.7 + \since 4.8 This returns the LineHeight property for the paragraph. @@ -2147,7 +2147,7 @@ QList QTextBlockFormat::tabPositions() const /*! \fn qreal QTextBlockFormat::lineHeightType() const - \since 4.7 + \since 4.8 This returns the LineHeightType property of the paragraph. diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 41cc1d9..81b053b 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -537,7 +537,7 @@ public: SingleHeight = 0, ProportionalHeight = 1, FixedHeight = 2, - AtLeastHeight = 3, + MinimumHeight = 3, LineDistanceHeight = 4 }; @@ -619,7 +619,7 @@ inline qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling return(scriptLineHeight * doubleProperty(LineHeight) / 100.0); case FixedHeight: return(doubleProperty(LineHeight) * scaling); - case AtLeastHeight: + case MinimumHeight: return(qMax(scriptLineHeight, doubleProperty(LineHeight) * scaling)); case LineDistanceHeight: return(scriptLineHeight + doubleProperty(LineHeight) * scaling); diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 769a509..5d5e2b6 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1252,13 +1252,9 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector break; case QCss::LineHeight: { qreal lineHeight; - if (decl.realValue(&lineHeight, "px")) + if (decl.realValue(&lineHeight, "px")) { blockFormat.setLineHeight(lineHeight, QTextBlockFormat::FixedHeight); - else if (decl.realValue(&lineHeight, "al")) - blockFormat.setLineHeight(lineHeight, QTextBlockFormat::AtLeastHeight); - else if (decl.realValue(&lineHeight, "ld")) - blockFormat.setLineHeight(lineHeight, QTextBlockFormat::LineDistanceHeight); - else { + } else { bool ok; QString value = decl.d->values.first().toString(); lineHeight = value.toDouble(&ok); -- cgit v0.12 From 3753b15e88f2c8220b887f27be79491c4135a291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 6 Dec 2010 16:13:34 +0100 Subject: Added window focus handling to lighthouse The idea is that QPlatformWindows can request focus handling. And when actual focus shifting is done by windowsystem callbacks/events which are sent to QWindowSystemInterface --- src/gui/kernel/qapplication_p.h | 2 ++ src/gui/kernel/qapplication_qpa.cpp | 7 +++++++ src/gui/kernel/qplatformwindow_qpa.cpp | 19 +++++++++++++++++++ src/gui/kernel/qplatformwindow_qpa.h | 1 + src/gui/kernel/qwidget_qpa.cpp | 8 ++------ src/gui/kernel/qwindowsysteminterface_qpa.cpp | 6 ++++++ src/gui/kernel/qwindowsysteminterface_qpa.h | 1 + src/gui/kernel/qwindowsysteminterface_qpa_p.h | 9 +++++++++ src/plugins/platforms/testlite/qtestlitewindow.cpp | 22 ++++++++++++++++++++++ src/plugins/platforms/testlite/qtestlitewindow.h | 3 +++ 10 files changed, 72 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 7b49999..73c4462 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -508,6 +508,8 @@ public: static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e); static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e); + static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e); + static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e); // static void reportScreenCount(int count); diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index ece035c..a587e8e 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -111,6 +111,9 @@ void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate case QWindowSystemInterfacePrivate::Leave: QApplicationPrivate::processLeaveEvent(static_cast(e)); break; + case QWindowSystemInterfacePrivate::ActivatedWindow: + QApplicationPrivate::processActivatedEvent(static_cast(e)); + break; case QWindowSystemInterfacePrivate::Close: QApplicationPrivate::processCloseEvent( static_cast(e)); @@ -823,6 +826,10 @@ void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Leave } +void QApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e) +{ + QApplication::setActiveWindow(e->activated.data()); +} void QApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e) { diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index 29eaa82..b6b6693 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -41,6 +41,7 @@ #include "qplatformwindow_qpa.h" +#include #include class QPlatformWindowPrivate @@ -171,6 +172,24 @@ void QPlatformWindow::setOpacity(qreal level) } /*! + Reimplement to let Qt be able to request activation/focus for a window + + Some window systems will probably not have callbacks for this functionality, + and then calling QWindowSystemInterface::handleWindowActivated(QWidget *w) + would be sufficient. + + If the window system has some event handling/callbacks then call + QWindowSystemInterface::handleWindowActivated(QWidget *w) when the window system + gives the notification. + + Default implementation calls QWindowSystem::handleWindowActivated(QWidget *w) +*/ +void QPlatformWindow::requestActivateWindow() +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +/*! Reimplement to return the glContext associated with the window. */ QPlatformGLContext *QPlatformWindow::glContext() const diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h index 4f6fedc..abc35d1 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -80,6 +80,7 @@ public: virtual void lower(); virtual void setOpacity(qreal level); + virtual void requestActivateWindow(); virtual QPlatformGLContext *glContext() const; protected: diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 617d984..1279e0a 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -379,9 +379,8 @@ QWidget *QWidget::keyboardGrabber() void QWidget::activateWindow() { - // XXX -// qDebug() << "QWidget::activateWindow" << this; - QApplication::setActiveWindow(this); //##### + if (platformWindow()) + platformWindow()->requestActivateWindow(); } void QWidgetPrivate::show_sys() @@ -409,9 +408,6 @@ void QWidgetPrivate::show_sys() } if (window) window->setVisible(true); - - if (q->isWindow() && q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) - q->activateWindow(); //### QWindowSystemInterface should have callback function for when WS actually activates window. } } diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index bb29cbf..b6177b0 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -82,6 +82,12 @@ void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleWindowActivated(QWidget *tlw) +{ + QWindowSystemInterfacePrivate::ActivatedWindowEvent *e = new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) { if (tlw) { diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 1c79f2a..39c2f79 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -83,6 +83,7 @@ public: static void handleCloseEvent(QWidget *w); static void handleEnterEvent(QWidget *w); static void handleLeaveEvent(QWidget *w); + static void handleWindowActivated(QWidget *w); // Changes to the screen static void handleScreenGeometryChange(int screenIndex); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 78e1f33..3491a1a 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -54,6 +54,7 @@ public: GeometryChange, Enter, Leave, + ActivatedWindow, Mouse, Wheel, Key, @@ -102,6 +103,14 @@ public: QWeakPointer leave; }; + class ActivatedWindowEvent : public WindowSystemEvent { + public: + ActivatedWindowEvent(QWidget *activatedWindow) + : WindowSystemEvent(ActivatedWindow), activated(activatedWindow) + { } + QWeakPointer activated; + }; + class UserEvent : public WindowSystemEvent { public: UserEvent(QWidget * w, ulong time, EventType t) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index b52aae9..5f9d387 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -318,6 +318,16 @@ void QTestLiteWindow::handleLeaveEvent() QWindowSystemInterface::handleLeaveEvent(widget()); } +void QTestLiteWindow::handleFocusInEvent() +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +void QTestLiteWindow::handleFocusOutEvent() +{ + QWindowSystemInterface::handleWindowActivated(0); +} + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Key event stuff -- not pretty either @@ -694,6 +704,10 @@ void QTestLiteWindow::paintEvent() surface->flush(widget(), QRect(xpos,ypos,width, height), QPoint()); } +void QTestLiteWindow::requestActivateWindow() +{ + XSetInputFocus(xd->display, x_window, XRevertToParent, CurrentTime); +} void QTestLiteWindow::resizeEvent(XConfigureEvent *e) { @@ -1456,6 +1470,14 @@ bool MyDisplay::handleEvent(XEvent *xe) xw->handleLeaveEvent(); break; + case XFocusIn: + xw->handleFocusInEvent(); + break; + + case XFocusOut: + xw->handleFocusOutEvent(); + break; + default: #ifdef MYX11_DEBUG qDebug() << hex << xe->xany.window << "Other X event" << xe->type; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index dc628f1..69442f1 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -109,10 +109,13 @@ public: void handleCloseEvent(); void handleEnterEvent(); void handleLeaveEvent(); + void handleFocusInEvent(); + void handleFocusOutEvent(); void resizeEvent(XConfigureEvent *configure_event); void paintEvent(); + void requestActivateWindow(); void setGeometry(const QRect &rect); -- cgit v0.12 From f6c5b16768d45f196bab0a2766d4be6027991e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 8 Dec 2010 13:09:36 +0100 Subject: Add function QPlatformScreen::platformScreenForWidget This so there is some logical connection between what screen a widget belongs to --- src/gui/kernel/qdesktopwidget_qpa_p.h | 8 ++++++- src/gui/kernel/qplatformscreen_qpa.cpp | 15 ++++++++++++++ src/gui/kernel/qplatformscreen_qpa.h | 4 ++++ src/gui/kernel/qwidget.cpp | 5 ++--- src/gui/kernel/qwidget_p.h | 5 ++--- src/gui/kernel/qwidget_qpa.cpp | 38 ++++++---------------------------- 6 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget_qpa_p.h b/src/gui/kernel/qdesktopwidget_qpa_p.h index 8bed09d..47ccca2 100644 --- a/src/gui/kernel/qdesktopwidget_qpa_p.h +++ b/src/gui/kernel/qdesktopwidget_qpa_p.h @@ -59,7 +59,13 @@ class QDesktopScreenWidget : public QWidget { Q_OBJECT public: - QDesktopScreenWidget(int screenNumber = -1) { setWindowFlags(Qt::Desktop); setVisible(false); d_func()->screenNumber = screenNumber; } + QDesktopScreenWidget(int screenNumber = -1) + { + setWindowFlags(Qt::Desktop); + setVisible(false); + QTLWExtra *topData = d_func()->topData(); + topData->screenIndex = screenNumber; + } }; class QDesktopWidgetPrivate : public QWidgetPrivate { diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index 5e80ba8..118835f 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -41,7 +41,11 @@ #include "qplatformscreen_qpa.h" #include +#include #include +#include +#include +#include /*! Return the given top level widget for a given position. @@ -77,6 +81,17 @@ QSize QPlatformScreen::physicalSize() const return QSize(width,height); } +Q_GUI_EXPORT extern QWidgetPrivate *qt_widget_private(QWidget *widget); +QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget) +{ + QWidget *window = widget->window(); + QWidgetPrivate *windowPrivate = qt_widget_private(window); + QTLWExtra * topData = windowPrivate->topData(); + QPlatformIntegration *integration = + QApplicationPrivate::platformIntegration(); + return integration->screens()[topData->screenIndex]; +} + /*! \class QPlatformScreen \since 4.8 diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h index 9080489..1f52764 100644 --- a/src/gui/kernel/qplatformscreen_qpa.h +++ b/src/gui/kernel/qplatformscreen_qpa.h @@ -73,6 +73,10 @@ public: //jl: should setDirty be removed. virtual void setDirty(const QRect &) {} virtual QWidget *topLevelAt(const QPoint &point) const; + + //jl: should this function be in QPlatformIntegration + //jl: maybe screenForWidget is a better name? + static QPlatformScreen *platformScreenForWidget(const QWidget *widget); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 16f64ff..6a6a218 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -303,8 +303,6 @@ QWidgetPrivate::QWidgetPrivate(int version) , hasAlienChildren(0) , window_event(0) , qd_hd(0) -#elif defined (Q_WS_QPA) - , screenNumber(0) #endif { if (!qApp) { @@ -1277,7 +1275,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) } #elif defined(Q_WS_QPA) if (desktopWidget) { - int screen = desktopWidget->d_func()->screenNumber; + int screen = desktopWidget->d_func()->topData()->screenIndex; QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); platform->moveToScreen(q, screen); } @@ -1729,6 +1727,7 @@ void QWidgetPrivate::createTLExtra() #if defined(Q_WS_QPA) x->platformWindow = 0; x->platformWindowFormat = QPlatformWindowFormat::defaultFormat(); + x->screenIndex = 0; #endif } } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 6b85391..a0f0ec8 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -233,6 +233,7 @@ struct QTLWExtra { #elif defined(Q_WS_QPA) QPlatformWindow *platformWindow; QPlatformWindowFormat platformWindowFormat; + quint32 screenIndex; // index in qplatformscreenlist #endif }; @@ -885,11 +886,9 @@ public: void updateCursor() const; #endif QScreen* getScreen() const; -#elif defined(Q_WS_QPA) +#elif defined(Q_WS_QPA) // <--------------------------------------------------------- QPA void setMaxWindowState_helper(); void setFullScreenSize_helper(); - - int screenNumber; // screen the widget should be displayed on #ifndef QT_NO_CURSOR void updateCursor() const; #endif diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 1279e0a..24ab8f7 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -53,7 +53,6 @@ #include QT_BEGIN_NAMESPACE -static QPlatformScreen *qt_screenForWidget(const QWidget *w); void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWidget *parentWidget) { @@ -122,7 +121,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } } - QApplicationPrivate::platformIntegration()->moveToScreen(q, screenNumber); + QApplicationPrivate::platformIntegration()->moveToScreen(q, topData()->screenIndex); // qDebug() << "create_sys" << q << q->internalWinId(); } @@ -173,7 +172,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) // programmer specified desktop widget // get the desktop's screen number - targetScreen = newparent->d_func()->screenNumber; + targetScreen = newparent->window()->d_func()->topData()->screenIndex; newparent = 0; } @@ -192,7 +191,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) f |= Qt::Window; if (targetScreen == -1) { if (parent) - targetScreen = qobject_cast(parent)->d_func()->screenNumber; + targetScreen = q->parentWidget()->window()->d_func()->topData()->screenIndex; } } @@ -228,7 +227,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) // move the window to the selected screen if (!newparent && targetScreen != -1) { - screenNumber = targetScreen; + if (maybeTopData()) + maybeTopData()->screenIndex = targetScreen; // only if it is already created if (q->testAttribute(Qt::WA_WState_Created)) { QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); @@ -643,37 +643,11 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) scrollRect(r, dx, dy); } -static QPlatformScreen *qt_screenForWidget(const QWidget *w) -{ - if (!w) - return 0; - QRect frame = w->frameGeometry(); - if (!w->isWindow()) - frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); - const QPoint p = (frame.topLeft() + frame.bottomRight()) / 2; - - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList screens = pi->screens(); - - for (int i = 0; i < screens.size(); ++i) { - if (screens[i]->geometry().contains(p)) - return screens[i]; - } - - // Assume screen zero if we have it. - if (!screens.isEmpty()) - return screens[0]; - else - qWarning("qt_screenForWidget: no screens"); - - return 0; -} - int QWidget::metric(PaintDeviceMetric m) const { Q_D(const QWidget); - QPlatformScreen *screen = qt_screenForWidget(this); + QPlatformScreen *screen = QPlatformScreen::platformScreenForWidget(this); if (!screen) { if (m == PdmDpiX || m == PdmDpiY) return 72; -- cgit v0.12 From 337f75854883fb93e1b4f41e10c79dc7c352f4a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 8 Dec 2010 13:11:30 +0100 Subject: Refactoring of testlite to conform with Lighthouse structure --- src/plugins/platforms/testlite/qglxintegration.cpp | 75 +- src/plugins/platforms/testlite/qglxintegration.h | 18 +- src/plugins/platforms/testlite/qtestlitecursor.cpp | 200 +++++ src/plugins/platforms/testlite/qtestlitecursor.h | 69 ++ .../platforms/testlite/qtestliteintegration.cpp | 65 +- .../platforms/testlite/qtestliteintegration.h | 29 +- src/plugins/platforms/testlite/qtestlitescreen.cpp | 430 ++++++++++ src/plugins/platforms/testlite/qtestlitescreen.h | 103 +++ src/plugins/platforms/testlite/qtestlitewindow.cpp | 871 ++------------------- src/plugins/platforms/testlite/qtestlitewindow.h | 96 +-- .../platforms/testlite/qtestlitewindowsurface.cpp | 34 +- .../platforms/testlite/qtestlitewindowsurface.h | 2 +- src/plugins/platforms/testlite/testlite.pro | 9 +- 13 files changed, 1005 insertions(+), 996 deletions(-) create mode 100644 src/plugins/platforms/testlite/qtestlitecursor.cpp create mode 100644 src/plugins/platforms/testlite/qtestlitecursor.h create mode 100644 src/plugins/platforms/testlite/qtestlitescreen.cpp create mode 100644 src/plugins/platforms/testlite/qtestlitescreen.h diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index a4b7b69..1dffb3e 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -44,6 +44,7 @@ #include #include "qtestlitewindow.h" +#include "qtestlitescreen.h" #include #include @@ -57,9 +58,9 @@ QT_BEGIN_NAMESPACE -QMutex QGLXGLContext::m_defaultSharedContextMutex(QMutex::Recursive); +QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); -QVector QGLXGLContext::buildSpec(const QPlatformWindowFormat &format) +QVector QGLXContext::buildSpec(const QPlatformWindowFormat &format) { QVector spec(48); int i = 0; @@ -111,7 +112,7 @@ QVector QGLXGLContext::buildSpec(const QPlatformWindowFormat &format) return spec; } -GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindowFormat &format) +GLXFBConfig QGLXContext::findConfig(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) { bool reduced = true; GLXFBConfig chosenConfig = 0; @@ -120,7 +121,7 @@ GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindow QVector spec = buildSpec(reducedFormat); int confcount = 0; GLXFBConfig *configs; - configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); + configs = glXChooseFBConfig(screen->display(),screen->xScreenNumber(),spec.constData(),&confcount); if (confcount) { for (int i = 0; i < confcount; i++) { @@ -128,7 +129,7 @@ GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindow // Make sure we try to get an ARGB visual if the format asked for an alpha: if (reducedFormat.alpha()) { int alphaSize; - glXGetFBConfigAttrib(xd->display,configs[i],GLX_ALPHA_SIZE,&alphaSize); + glXGetFBConfigAttrib(screen->display(),configs[i],GLX_ALPHA_SIZE,&alphaSize); if (alphaSize > 0) break; } else { @@ -147,14 +148,14 @@ GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindow return chosenConfig; } -XVisualInfo *QGLXGLContext::findVisualInfo(const MyDisplay *xd, const QPlatformWindowFormat &format) +XVisualInfo *QGLXContext::findVisualInfo(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) { - GLXFBConfig config = QGLXGLContext::findConfig(xd,format); - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(xd->display,config); + GLXFBConfig config = QGLXContext::findConfig(screen,format); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); return visualInfo; } -QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) +QPlatformWindowFormat QGLXContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) { QPlatformWindowFormat format; int redSize = 0; @@ -210,7 +211,7 @@ QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *disp return format; } -QPlatformWindowFormat QGLXGLContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) +QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) { QPlatformWindowFormat retFormat = format; *reduced = true; @@ -235,9 +236,9 @@ QPlatformWindowFormat QGLXGLContext::reducePlatformWindowFormat(const QPlatformW return retFormat; } -QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format) +QGLXContext::QGLXContext(Window window, QTestLiteScreen *screen, const QPlatformWindowFormat &format) : QPlatformGLContext() - , m_xd(xd) + , m_screen(screen) , m_drawable((Drawable)window) , m_context(0) { @@ -246,7 +247,7 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow if (format.useDefaultSharedContext()) { if (!QPlatformGLContext::defaultSharedContext()) { if (m_defaultSharedContextMutex.tryLock()){ - createDefaultSharedContex(xd); + createDefaultSharedContex(screen); m_defaultSharedContextMutex.unlock(); } else { m_defaultSharedContextMutex.lock(); //wait to the the shared context is created @@ -259,32 +260,32 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow } GLXContext shareGlxContext = 0; if (sharePlatformContext) - shareGlxContext = static_cast(sharePlatformContext)->glxContext(); + shareGlxContext = static_cast(sharePlatformContext)->glxContext(); - GLXFBConfig config = findConfig(xd,format); - m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); - m_windowFormat = QGLXGLContext::platformWindowFromGLXFBConfig(xd->display,config,m_context); + GLXFBConfig config = findConfig(screen,format); + m_context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display(),config,m_context); #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; #endif } -QGLXGLContext::QGLXGLContext(MyDisplay *display, Drawable drawable, GLXContext context) - : QPlatformGLContext(), m_xd(display), m_drawable(drawable), m_context(context) +QGLXContext::QGLXContext(QTestLiteScreen *screen, Drawable drawable, GLXContext context) + : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) { } -QGLXGLContext::~QGLXGLContext() +QGLXContext::~QGLXContext() { if (m_context) { qDebug("Destroying GLX context 0x%p", m_context); - glXDestroyContext(m_xd->display, m_context); + glXDestroyContext(m_screen->display(), m_context); } } -void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) +void QGLXContext::createDefaultSharedContex(QTestLiteScreen *screen) { int x = 0; int y = 0; @@ -293,45 +294,45 @@ void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); GLXContext context; - GLXFBConfig config = findConfig(xd,format); + GLXFBConfig config = findConfig(screen,format); if (config) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(xd->display,config); - Colormap cmap = XCreateColormap(xd->display,xd->rootWindow(),visualInfo->visual,AllocNone); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); + Colormap cmap = XCreateColormap(screen->display(),screen->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; a.colormap = cmap; - Window sharedWindow = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, + Window sharedWindow = XCreateWindow(screen->display(), screen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); - context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,0,TRUE); - QPlatformGLContext *sharedContext = new QGLXGLContext(xd,sharedWindow,context); + context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,0,TRUE); + QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); QPlatformGLContext::setDefaultSharedContext(sharedContext); } else { qWarning("Warning no shared context created"); } } -void QGLXGLContext::makeCurrent() +void QGLXContext::makeCurrent() { QPlatformGLContext::makeCurrent(); #ifdef MYX11_DEBUG qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); #endif - glXMakeCurrent(m_xd->display, m_drawable, m_context); + glXMakeCurrent(m_screen->display(), m_drawable, m_context); } -void QGLXGLContext::doneCurrent() +void QGLXContext::doneCurrent() { QPlatformGLContext::doneCurrent(); - glXMakeCurrent(m_xd->display, 0, 0); + glXMakeCurrent(m_screen->display(), 0, 0); } -void QGLXGLContext::swapBuffers() +void QGLXContext::swapBuffers() { - glXSwapBuffers(m_xd->display, m_drawable); + glXSwapBuffers(m_screen->display(), m_drawable); } -void* QGLXGLContext::getProcAddress(const QString& procName) +void* QGLXContext::getProcAddress(const QString& procName) { typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; @@ -340,7 +341,7 @@ void* QGLXGLContext::getProcAddress(const QString& procName) if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QList glxExt = QByteArray(glXGetClientString(m_xd->display, GLX_EXTENSIONS)).split(' '); + QList glxExt = QByteArray(glXGetClientString(m_screen->display(), GLX_EXTENSIONS)).split(' '); if (glxExt.contains("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); @@ -364,7 +365,7 @@ void* QGLXGLContext::getProcAddress(const QString& procName) return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); } -QPlatformWindowFormat QGLXGLContext::platformWindowFormat() const +QPlatformWindowFormat QGLXContext::platformWindowFormat() const { return m_windowFormat; } diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index e17790e..5ae0b2a 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -53,13 +53,11 @@ QT_BEGIN_NAMESPACE -class MyDisplay; - -class QGLXGLContext : public QPlatformGLContext +class QGLXContext : public QPlatformGLContext { public: - QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format); - ~QGLXGLContext(); + QGLXContext(Window window, QTestLiteScreen *xd, const QPlatformWindowFormat &format); + ~QGLXContext(); virtual void makeCurrent(); virtual void doneCurrent(); @@ -70,22 +68,22 @@ public: QPlatformWindowFormat platformWindowFormat() const; - static XVisualInfo *findVisualInfo(const MyDisplay *xd, const QPlatformWindowFormat &format); + static XVisualInfo *findVisualInfo(const QTestLiteScreen *xd, const QPlatformWindowFormat &format); private: - static GLXFBConfig findConfig(const MyDisplay *xd,const QPlatformWindowFormat &format); + static GLXFBConfig findConfig(const QTestLiteScreen *xd,const QPlatformWindowFormat &format); static QVector buildSpec(const QPlatformWindowFormat &format); static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); - MyDisplay *m_xd; + QTestLiteScreen *m_screen; Drawable m_drawable; GLXContext m_context; QPlatformWindowFormat m_windowFormat; - QGLXGLContext (MyDisplay *display, Drawable drawable, GLXContext context); + QGLXContext (QTestLiteScreen *screen, Drawable drawable, GLXContext context); static QMutex m_defaultSharedContextMutex; - static void createDefaultSharedContex(MyDisplay *xd); + static void createDefaultSharedContex(QTestLiteScreen *xd); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitecursor.cpp b/src/plugins/platforms/testlite/qtestlitecursor.cpp new file mode 100644 index 0000000..4f3f0cb --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitecursor.cpp @@ -0,0 +1,200 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitecursor.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitewindow.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +QTestLiteCursor::QTestLiteCursor(QTestLiteScreen *screen) + : QPlatformCursor(screen) +{ +} + +void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) +{ + QTestLiteWindow *w = 0; + if (widget) { + QWidget *window = widget->window(); + w = static_cast(window->platformWindow()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + if (!w) + return; + + int id = cursor->handle(); + if (id == currentCursor) + return; + Cursor c; + if (!cursorMap.contains(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; + } + cursorMap.insert(id, c); + } else { + c = cursorMap.value(id); + } + + w->setCursor(c); +} + +Cursor QTestLiteCursor::createCursorBitmap(QCursor * cursor) +{ + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = testLiteScreen()->rootWindow(); + + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); + + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(testLiteScreen()->display(), cp); + XFreePixmap(testLiteScreen()->display(), mp); + delete[] mapBits; + delete[] maskBits; + + return c; +} + +Cursor QTestLiteCursor::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + +QTestLiteScreen * QTestLiteCursor::testLiteScreen() const +{ + return static_cast(screen); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitecursor.h b/src/plugins/platforms/testlite/qtestlitecursor.h new file mode 100644 index 0000000..15a5b2a --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitecursor.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECURSOR_H +#define QTESTLITECURSOR_H + +#include + +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QTestLiteCursor : QPlatformCursor +{ +public: + QTestLiteCursor(QTestLiteScreen *screen); + + void changeCursor(QCursor * cursor, QWidget * widget); +private: + + Cursor createCursorBitmap(QCursor * cursor); + Cursor createCursorShape(int cshape); + + QTestLiteScreen *testLiteScreen() const; + int currentCursor; + QMap cursorMap; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 68e9051..fc2a89c 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -39,17 +39,14 @@ ** ****************************************************************************/ - - #include "qtestliteintegration.h" #include "qtestlitewindowsurface.h" #include #include -#include - #include "qtestlitewindow.h" #include "qgenericunixfontdatabase.h" +#include "qtestlitescreen.h" #ifndef QT_NO_OPENGL #include @@ -59,50 +56,13 @@ QT_BEGIN_NAMESPACE -class MyCursor : QPlatformCursor -{ -public: - MyCursor(QPlatformScreen *screen) : QPlatformCursor(screen) {} - - void changeCursor(QCursor * cursor, QWidget * widget) { - QTestLiteWindow *w = 0; - if (widget) { - QWidget *window = widget->window(); - w = static_cast(window->platformWindow()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - //qDebug() << "changeCursor" << widget << ws; - if (!w) - return; - - w->setCursor(cursor); - } -}; - QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) : mUseOpenGL(useOpenGL) , mFontDb(new QGenericUnixFontDatabase()) { - xd = new MyDisplay; - mPrimaryScreen = new QTestLiteScreen(); - - mPrimaryScreen->mGeometry = QRect - (0, 0, xd->width, xd->height); - mPrimaryScreen->mDepth = 32; - mPrimaryScreen->mFormat = QImage::Format_RGB32; - mPrimaryScreen->mPhysicalSize = - QSize(xd->physicalWidth, xd->physicalHeight); - mScreens.append(mPrimaryScreen); - - - (void)new MyCursor(mPrimaryScreen); - } QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const @@ -120,21 +80,33 @@ QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) if (mUseOpenGL) return new QGLWindowSurface(widget); #endif - return new QTestLiteWindowSurface(mPrimaryScreen, widget); + return new QTestLiteWindowSurface(widget); } QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { - return new QTestLiteWindow(this, mPrimaryScreen, widget); + return new QTestLiteWindow(widget); } QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const { - QImage img = xd->grabWindow(window, x, y, width, height); - return QPixmap::fromImage(img); + QImage image; + QWidget *widget = QWidget::find(window); + if (widget) { + QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + image = screen->grabWindow(window,x,y,width,height); + } else { + for (int i = 0; i < mScreens.size(); i++) { + QTestLiteScreen *screen = static_cast(mScreens[i]); + if (screen->rootWindow() == window) { + image = screen->grabWindow(window,x,y,width,height); + } + } + } + return QPixmap::fromImage(image); } QPlatformFontDatabase *QTestLiteIntegration::fontDatabase() const @@ -145,7 +117,8 @@ QPlatformFontDatabase *QTestLiteIntegration::fontDatabase() const bool QTestLiteIntegration::hasOpenGL() const { #ifndef QT_NO_OPENGL - return glXQueryExtension(xd->display, 0, 0) != 0; + QTestLiteScreen *screen = static_cast(mScreens.at(0)); + return glXQueryExtension(screen->display(), 0, 0) != 0; #endif return false; } diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 8286ef0..37d09f5 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -42,34 +42,17 @@ #ifndef QGRAPHICSSYSTEM_TESTLITE_H #define QGRAPHICSSYSTEM_TESTLITE_H -#include -#include - //make sure textstream is included before any X11 headers #include -QT_BEGIN_NAMESPACE +#include +#include -class MyDisplay; +#include -class QTestLiteScreen : public QPlatformScreen -{ -public: - QTestLiteScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} - ~QTestLiteScreen() {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } +QT_BEGIN_NAMESPACE -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; -}; +class QTestLiteScreen; class QTestLiteIntegration : public QPlatformIntegration { @@ -88,8 +71,6 @@ public: bool hasOpenGL() const; - MyDisplay *xd; - private: bool mUseOpenGL; QTestLiteScreen *mPrimaryScreen; diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp new file mode 100644 index 0000000..919506e --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -0,0 +1,430 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitescreen.h" + +#include "qtestlitecursor.h" +#include "qtestlitewindow.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + +QTestLiteScreen::QTestLiteScreen() + : mFormat(QImage::Format_RGB32) + , mWmProtocolsAtom(0) + , mWmDeleteWindowAtom(0) +{ + char *display_name = getenv("DISPLAY"); + mDisplay = XOpenDisplay(display_name); + if (!mDisplay) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(mDisplay, true); + + mScreen = DefaultScreen(mDisplay); + int width = DisplayWidth(mDisplay, mScreen); + int height = DisplayHeight(mDisplay, mScreen); + mGeometry = QRect(0,0,width,height); + + int physicalWidth = DisplayWidthMM(mDisplay, mScreen); + int physicalHeight = DisplayHeightMM(mDisplay, mScreen); + mPhysicalSize = QSize(physicalWidth,physicalHeight); + + int xSocketNumber = XConnectionNumber(mDisplay); + + mDepth = DefaultDepth(mDisplay,mScreen); +#ifdef MYX11_DEBUG + qDebug() << "X socket:"<< xSocketNumber; +#endif + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + mWmProtocolsAtom = XInternAtom (mDisplay, "WM_PROTOCOLS", False); + mWmDeleteWindowAtom = XInternAtom (mDisplay, "WM_DELETE_WINDOW", False); + + mWmMotifHintAtom = XInternAtom(mDisplay, "_MOTIF_WM_HINTS\0", False); + + mCursor = new QTestLiteCursor(this); +} + +QTestLiteScreen::~QTestLiteScreen() +{ + delete mCursor; + XCloseDisplay(mDisplay); +} + +#ifdef KeyPress +#undef KeyPress +#endif +#ifdef KeyRelease +#undef KeyRelease +#endif + +//Q_GUI_EXPORT extern Atom wmProtocolsAtom; +//Q_GUI_EXPORT extern Atom wmDeleteWindowAtom; + +bool QTestLiteScreen::handleEvent(XEvent *xe) +{ + int quit = false; + QTestLiteWindow *xw = 0; + QWidget *widget = QWidget::find(xe->xany.window); + if (widget) { + xw = static_cast(widget->platformWindow()); + } + if (!xw) { +#ifdef MYX11_DEBUG + qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; +#endif + return quit; + } + + switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom()) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom()) + xw->handleCloseEvent(); +#ifdef MYX11_DEBUG + qDebug() << "ClientMessage WM_PROTOCOLS" << a; +#endif + } +#ifdef MYX11_DEBUG + else + qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; +#endif + break; + + case Expose: + if (xw) + if (xe->xexpose.count == 0) + xw->paintEvent(); + break; + case ConfigureNotify: + if (xw) + xw->resizeEvent(&xe->xconfigure); + break; + + case ButtonPress: + xw->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + xw->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + break; + + case MotionNotify: + xw->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + break; + + case XKeyPress: + xw->handleKeyEvent(QEvent::KeyPress, &xe->xkey); + break; + + case XKeyRelease: + xw->handleKeyEvent(QEvent::KeyRelease, &xe->xkey); + break; + + case EnterNotify: + xw->handleEnterEvent(); + break; + + case LeaveNotify: + xw->handleLeaveEvent(); + break; + + case XFocusIn: + xw->handleFocusInEvent(); + break; + + case XFocusOut: + xw->handleFocusOutEvent(); + break; + + default: +#ifdef MYX11_DEBUG + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; +#endif + break; + } + return quit; +} + +void QTestLiteScreen::eventDispatcher() +{ + ulong marker = XNextRequest(mDisplay); + // int i = 0; + while (XPending(mDisplay)) { + XEvent event; + XNextEvent(mDisplay, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { + #ifdef MYX11_DEBUG + qDebug() << "potential livelock averted"; + #endif + #if 0 + if (XEventsQueued(mDisplay, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } + #endif + break; + } + } +} + +QImage QTestLiteScreen::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(mDisplay, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + +QTestLiteScreen * QTestLiteScreen::testLiteScreenForWidget(QWidget *widget) +{ + QPlatformScreen *platformScreen = platformScreenForWidget(widget); + return static_cast(platformScreen); +} + +Display * QTestLiteScreen::display() const +{ + return mDisplay; +} + +int QTestLiteScreen::xScreenNumber() const +{ + return mScreen; +} + +Atom QTestLiteScreen::wmProtocolsAtom() const +{ + return mWmProtocolsAtom; +} + +Atom QTestLiteScreen::wmDeleteWindowAtom() const +{ + return mWmDeleteWindowAtom; +} + +void QTestLiteScreen::setWmDeleteWindowAtom(Atom newDeleteWindowAtom) +{ + mWmDeleteWindowAtom = newDeleteWindowAtom; +} + +Atom QTestLiteScreen::atomForMotifWmHints() const +{ + return mWmMotifHintAtom; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h new file mode 100644 index 0000000..f8d9468 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitescreen.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESCREEN_H +#define QTESTLITESCREEN_H + +#include +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QTestLiteCursor; + +class QTestLiteScreen : public QPlatformScreen +{ + Q_OBJECT +public: + QTestLiteScreen(); + + ~QTestLiteScreen(); + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + + Window rootWindow() { return RootWindow(mDisplay, mScreen); } + unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } + unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } + + bool handleEvent(XEvent *xe); + QImage grabWindow(Window window, int x, int y, int w, int h); + + static QTestLiteScreen *testLiteScreenForWidget(QWidget *widget); + + Display *display() const; + int xScreenNumber() const; + + Atom wmProtocolsAtom() const; + Atom wmDeleteWindowAtom() const; + void setWmDeleteWindowAtom(Atom newDeleteWindowAtom); + + Atom atomForMotifWmHints() const; + + +public slots: + void eventDispatcher(); + +private: + QRect mGeometry; + QSize mPhysicalSize; + int mDepth; + QImage::Format mFormat; + QTestLiteCursor *mCursor; + + Display * mDisplay; + int mScreen; + Atom mWmProtocolsAtom; + Atom mWmDeleteWindowAtom; + Atom mWmMotifHintAtom; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 5f9d387..f8f4a5f 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -39,169 +39,81 @@ ** ****************************************************************************/ -#include "qtestliteintegration.h" -#include -#include -#include - #include "qtestlitewindow.h" -#include -#include -#include -#include -#include -#include +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" -#include -#include +#include +#include #include +#include + +#include +#include #ifndef QT_NO_OPENGL #include "qglxintegration.h" #endif -#include -#include - - -#include - -#include - - - -//### remove stuff we don't want from qt_x11_p.h -#undef ATOM -#undef X11 - //#define MYX11_DEBUG QT_BEGIN_NAMESPACE -static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); -static bool seen_badwindow; - - -static Atom wmProtocolsAtom; -static Atom wmDeleteWindowAtom; - -class MyX11CursorNode +QTestLiteWindow::QTestLiteWindow(QWidget *window) + : QPlatformWindow(window) + , mGLContext(0) + , mScreen(QTestLiteScreen::testLiteScreenForWidget(window)) { -public: - MyX11CursorNode(int id, Cursor c) { idValue = id; cursorValue = c; refCount = 1; } - QDateTime expiration() { return t; } - void setExpiration(QDateTime val) { t = val; } - MyX11CursorNode * ante() { return before; } - void setAnte(MyX11CursorNode *node) { before = node; } - MyX11CursorNode * post() { return after; } - void setPost(MyX11CursorNode *node) { after = node; } - Cursor cursor() { return cursorValue; } - int id() { return idValue; } - unsigned int refCount; - -private: - MyX11CursorNode *before; - MyX11CursorNode *after; - QDateTime t; - Cursor cursorValue; - int idValue; - - Display * display; -}; - - - - - -class MyX11Cursors : public QObject -{ - Q_OBJECT -public: - MyX11Cursors(Display * d); - ~MyX11Cursors() { timer.stop(); } - void incrementUseCount(int id); - void decrementUseCount(int id); - void createNode(int id, Cursor c); - bool exists(int id) { return lookupMap.contains(id); } - Cursor cursor(int id); -public slots: - void timeout(); - -private: - void removeNode(MyX11CursorNode *node); - void insertNode(MyX11CursorNode *node); - - // linked list of cursors currently not assigned to any window - MyX11CursorNode *firstExpired; - MyX11CursorNode *lastExpired; - - QHash lookupMap; - QTimer timer; - - Display *display; - - int removalDelay; -}; - - - - - -QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration, - QTestLiteScreen */*screen*/, QWidget *window) - :QPlatformWindow(window), mGLContext(0) -{ - xd = platformIntegration->xd; - xd->windowList.append(this); - { - int x = window->x(); - int y = window->y(); - int w = window->width(); - int h = window->height(); + int x = window->x(); + int y = window->y(); + int w = window->width(); + int h = window->height(); if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { + && QApplicationPrivate + ::platformIntegration()->hasOpenGL() ) { #ifndef QT_NO_OPENGL - XVisualInfo *visualInfo = QGLXGLContext::findVisualInfo(xd,window->platformWindowFormat()); - Colormap cmap = XCreateColormap(xd->display,xd->rootWindow(),visualInfo->visual,AllocNone); + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; a.colormap = cmap; - x_window = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); #endif //QT_NO_OPENGL } else { - x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), x, y, w, h, 0 /*border_width*/, - xd->blackPixel(), xd->whitePixel()); + mScreen->blackPixel(), mScreen->whitePixel()); } #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; #endif - } +// } - width = -1; - height = -1; - xpos = -1; - ypos = -1; +// width = -1; +// height = -1; +// xpos = -1; +// ypos = -1; - XSetWindowBackgroundPixmap(xd->display, x_window, XNone); + XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); - XSelectInput(xd->display, x_window, ExposureMask | KeyPressMask | KeyReleaseMask | + XSelectInput(mScreen->display(), x_window, ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | StructureNotifyMask); gc = createGC(); - XChangeProperty (xd->display, x_window, - wmProtocolsAtom, - XA_ATOM, 32, PropModeAppend, - (unsigned char *) &wmDeleteWindowAtom, 1); - currentCursor = -1; + Atom wmDeleteWindowAtom = mScreen->wmDeleteWindowAtom(); + XChangeProperty (mScreen->display(), x_window, + mScreen->wmProtocolsAtom(), + XA_ATOM, 32, PropModeAppend, + (unsigned char *) &wmDeleteWindowAtom, 1); + mScreen->setWmDeleteWindowAtom(wmDeleteWindowAtom); } @@ -211,19 +123,12 @@ QTestLiteWindow::~QTestLiteWindow() qDebug() << "~QTestLiteWindow" << hex << x_window; #endif delete mGLContext; - XFreeGC(xd->display, gc); - XDestroyWindow(xd->display, x_window); - - xd->windowList.removeAll(this); + XFreeGC(mScreen->display(), gc); + XDestroyWindow(mScreen->display(), x_window); } - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Mouse event stuff - - - - static Qt::MouseButtons translateMouseButtons(int s) { Qt::MouseButtons ret = 0; @@ -236,13 +141,11 @@ static Qt::MouseButtons translateMouseButtons(int s) return ret; } - static Qt::KeyboardModifiers translateModifiers(int s) { const uchar qt_alt_mask = Mod1Mask; const uchar qt_meta_mask = Mod4Mask; - Qt::KeyboardModifiers ret = 0; if (s & ShiftMask) ret |= Qt::ShiftModifier; @@ -328,7 +231,6 @@ void QTestLiteWindow::handleFocusOutEvent() QWindowSystemInterface::handleWindowActivated(0); } - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Key event stuff -- not pretty either // @@ -570,7 +472,6 @@ static const unsigned int keyTbl[] = { 0, 0 }; - static int lookupCode(unsigned int xkeycode) { if (xkeycode >= XK_F1 && xkeycode <= XK_F35) @@ -586,7 +487,6 @@ static int lookupCode(unsigned int xkeycode) return 0; } - static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) { switch (qtcode) { @@ -640,7 +540,7 @@ void QTestLiteWindow::handleKeyEvent(QEvent::Type type, void *ev) void QTestLiteWindow::setGeometry(const QRect &rect) { - XMoveResizeWindow(xd->display, x_window, rect.x(), rect.y(), rect.width(), rect.height()); + XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); QPlatformWindow::setGeometry(rect); } @@ -658,17 +558,17 @@ WId QTestLiteWindow::winId() const void QTestLiteWindow::setParent(const QPlatformWindow *window) { QPoint point = widget()->mapTo(widget()->nativeParentWidget(),QPoint()); - XReparentWindow(xd->display,x_window,window->winId(),point.x(),point.y()); + XReparentWindow(mScreen->display(),x_window,window->winId(),point.x(),point.y()); } void QTestLiteWindow::raise() { - XRaiseWindow(xd->display, x_window); + XRaiseWindow(mScreen->display(), x_window); } void QTestLiteWindow::lower() { - XLowerWindow(xd->display, x_window); + XLowerWindow(mScreen->display(), x_window); } void QTestLiteWindow::setWindowTitle(const QString &title) @@ -680,14 +580,14 @@ void QTestLiteWindow::setWindowTitle(const QString &title) windowName.format = 8; windowName.nitems = ba.length(); - XSetWMName(xd->display, x_window, &windowName); + XSetWMName(mScreen->display(), x_window, &windowName); } GC QTestLiteWindow::createGC() { GC gc; - gc = XCreateGC(xd->display, x_window, 0, 0); + gc = XCreateGC(mScreen->display(), x_window, 0, 0); if (gc < 0) { qWarning("QTestLiteWindow::createGC() could not create GC"); } @@ -701,34 +601,32 @@ void QTestLiteWindow::paintEvent() #endif if (QWindowSurface *surface = widget()->windowSurface()) - surface->flush(widget(), QRect(xpos,ypos,width, height), QPoint()); + surface->flush(widget(), widget()->geometry(), QPoint()); } void QTestLiteWindow::requestActivateWindow() { - XSetInputFocus(xd->display, x_window, XRevertToParent, CurrentTime); + XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); } void QTestLiteWindow::resizeEvent(XConfigureEvent *e) { - if ((e->width != width || e->height != height) && e->x == 0 && e->y == 0) { + int xpos = geometry().x(); + int ypos = geometry().y(); + if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; } else { //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; xpos = e->x; ypos = e->y; } - width = e->width; - height = e->height; - #ifdef MYX11_DEBUG qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; #endif - QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, width, height)); + QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, e->width, e->height)); } - void QTestLiteWindow::mousePressEvent(XButtonEvent *e) { static long prevTime = 0; @@ -752,51 +650,7 @@ void QTestLiteWindow::mousePressEvent(XButtonEvent *e) handleMouseEvent(type, e); } - - -// WindowFlag stuff, lots of copied code from qwidget_x11.cpp... - -//We're hacking here... - - -// MWM support -struct QtMWMHints { - ulong flags, functions, decorations; - long input_mode; - ulong status; -}; - -enum { - MWM_HINTS_FUNCTIONS = (1L << 0), - - MWM_FUNC_ALL = (1L << 0), - MWM_FUNC_RESIZE = (1L << 1), - MWM_FUNC_MOVE = (1L << 2), - MWM_FUNC_MINIMIZE = (1L << 3), - MWM_FUNC_MAXIMIZE = (1L << 4), - MWM_FUNC_CLOSE = (1L << 5), - - MWM_HINTS_DECORATIONS = (1L << 1), - - MWM_DECOR_ALL = (1L << 0), - MWM_DECOR_BORDER = (1L << 1), - MWM_DECOR_RESIZEH = (1L << 2), - MWM_DECOR_TITLE = (1L << 3), - MWM_DECOR_MENU = (1L << 4), - MWM_DECOR_MINIMIZE = (1L << 5), - MWM_DECOR_MAXIMIZE = (1L << 6), - - MWM_HINTS_INPUT_MODE = (1L << 2), - - MWM_INPUT_MODELESS = 0L, - MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, - MWM_INPUT_FULL_APPLICATION_MODAL = 3L -}; - -static Atom mwm_hint_atom = XNone; - -#if 0 -static QtMWMHints GetMWMHints(Display *display, Window window) +QtMWMHints QTestLiteWindow::getMWMHints() const { QtMWMHints mwmhints; @@ -804,10 +658,10 @@ static QtMWMHints GetMWMHints(Display *display, Window window) int format; ulong nitems, bytesLeft; uchar *data = 0; - if ((XGetWindowProperty(display, window, mwm_hint_atom, 0, 5, false, - mwm_hint_atom, &type, &format, &nitems, &bytesLeft, + if ((XGetWindowProperty(mScreen->display(), x_window, mScreen->atomForMotifWmHints(), 0, 5, false, + mScreen->atomForMotifWmHints(), &type, &format, &nitems, &bytesLeft, &data) == Success) - && (type == mwm_hint_atom + && (type == mScreen->atomForMotifWmHints() && format == 32 && nitems >= 5)) { mwmhints = *(reinterpret_cast(data)); @@ -824,15 +678,15 @@ static QtMWMHints GetMWMHints(Display *display, Window window) return mwmhints; } -#endif -static void SetMWMHints(Display *display, Window window, const QtMWMHints &mwmhints) +void QTestLiteWindow::setMWMHints(const QtMWMHints &mwmhints) { if (mwmhints.flags != 0l) { - XChangeProperty(display, window, mwm_hint_atom, mwm_hint_atom, 32, + XChangeProperty(mScreen->display(), x_window, + mScreen->atomForMotifWmHints(), mScreen->atomForMotifWmHints(), 32, PropModeReplace, (unsigned char *) &mwmhints, 5); } else { - XDeleteProperty(display, window, mwm_hint_atom); + XDeleteProperty(mScreen->display(), x_window, mScreen->atomForMotifWmHints()); } } @@ -849,17 +703,11 @@ static inline bool isTransient(const QWidget *w) && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); } - - Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) { // Q_ASSERT(flags & Qt::Window); window_flags = flags; - if (mwm_hint_atom == XNone) { - mwm_hint_atom = XInternAtom(xd->display, "_MOTIF_WM_HINTS\0", False); - } - #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; #endif @@ -878,12 +726,10 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) bool tool = (type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer); - Q_UNUSED(topLevel); Q_UNUSED(dialog); Q_UNUSED(desktop); - bool tooltip = (type == Qt::ToolTip); XSetWindowAttributes wsa; @@ -964,7 +810,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) mwmhints.decorations = 0; } - SetMWMHints(xd->display, x_window, mwmhints); + setMWMHints(mwmhints); //##### only if initializeWindow??? @@ -977,7 +823,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) wsa.override_redirect = True; wsa.save_under = True; - XChangeWindowAttributes(xd->display, x_window, CWOverrideRedirect | CWSaveUnder, + XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, &wsa); } else { #ifdef MYX11_DEBUG @@ -994,38 +840,15 @@ void QTestLiteWindow::setVisible(bool visible) qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif if (visible) - XMapWindow(xd->display, x_window); + XMapWindow(mScreen->display(), x_window); else - XUnmapWindow(xd->display, x_window); + XUnmapWindow(mScreen->display(), x_window); } - -void QTestLiteWindow::setCursor(QCursor * cursor) +void QTestLiteWindow::setCursor(const Cursor &cursor) { - int id = cursor->handle(); - if (id == currentCursor) - return; - Cursor c; - if (!xd->cursors->exists(id)) { - if (cursor->shape() == Qt::BitmapCursor) - c = createCursorBitmap(cursor); - else - c = createCursorShape(cursor->shape()); - if (!c) { - return; - } - xd->cursors->createNode(id, c); - } else { - xd->cursors->incrementUseCount(id); - c = xd->cursors->cursor(id); - } - - if (currentCursor != -1) - xd->cursors->decrementUseCount(currentCursor); - currentCursor = id; - - XDefineCursor(xd->display, x_window, c); - XFlush(xd->display); + XDefineCursor(mScreen->display(), x_window, cursor); + XFlush(mScreen->display()); } QPlatformGLContext *QTestLiteWindow::glContext() const @@ -1035,574 +858,20 @@ QPlatformGLContext *QTestLiteWindow::glContext() const if (!mGLContext) { QTestLiteWindow *that = const_cast(this); #ifndef QT_NO_OPENGL - that->mGLContext = new QGLXGLContext(x_window, xd,widget()->platformWindowFormat()); + that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); #endif } return mGLContext; } -Cursor QTestLiteWindow::createCursorBitmap(QCursor * cursor) -{ - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - QPoint spot = cursor->hotSpot(); - Window rootwin = x_window; - - QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); - QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - - int width = cursor->bitmap()->width(); - int height = cursor->bitmap()->height(); - int bytesPerLine = mapImage.bytesPerLine(); - int destLineSize = width / 8; - if (width % 8) - destLineSize++; - - const uchar * map = mapImage.bits(); - const uchar * mask = maskImage.bits(); - - char * mapBits = new char[height * destLineSize]; - char * maskBits = new char[height * destLineSize]; - for (int i = 0; i < height; i++) { - memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); - memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); - } - - Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(xd->display, cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(xd->display, cp); - XFreePixmap(xd->display, mp); - delete[] mapBits; - delete[] maskBits; - - return c; -} - -Cursor QTestLiteWindow::createCursorShape(int cshape) -{ - Cursor cursor = 0; - - if (cshape < 0 || cshape > Qt::LastCursor) - return 0; - - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(xd->display, XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(xd->display, XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(xd->display, XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(xd->display, XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(xd->display, XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(xd->display, XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; - - default: //default cursor for all the rest - break; - } - return cursor; -} - - -MyX11Cursors::MyX11Cursors(Display * d) : firstExpired(0), lastExpired(0), display(d), removalDelay(3) -{ - connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); -} - -void MyX11Cursors::insertNode(MyX11CursorNode * node) +Window QTestLiteWindow::xWindow() const { - QDateTime now = QDateTime::currentDateTime(); - QDateTime timeout = now.addSecs(removalDelay); - node->setExpiration(timeout); - node->setPost(0); - if (lastExpired) { - lastExpired->setPost(node); - node->setAnte(lastExpired); - } - lastExpired = node; - if (!firstExpired) { - firstExpired = node; - node->setAnte(0); - int interval = removalDelay * 1000; - timer.setInterval(interval); - timer.start(); - } -} - -void MyX11Cursors::removeNode(MyX11CursorNode * node) -{ - MyX11CursorNode *pre = node->ante(); - MyX11CursorNode *post = node->post(); - if (pre) - pre->setPost(post); - if (post) - post->setAnte(pre); - if (node == lastExpired) - lastExpired = pre; - if (node == firstExpired) { - firstExpired = post; - if (!firstExpired) { - timer.stop(); - return; - } - int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; - timer.stop(); - timer.setInterval(interval); - timer.start(); - } -} - -void MyX11Cursors::incrementUseCount(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - if (!node->refCount) - removeNode(node); - node->refCount++; -} - -void MyX11Cursors::decrementUseCount(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - node->refCount--; - if (!node->refCount) - insertNode(node); -} - -void MyX11Cursors::createNode(int id, Cursor c) -{ - MyX11CursorNode * node = new MyX11CursorNode(id, c); - lookupMap.insert(id, node); -} - -void MyX11Cursors::timeout() -{ - MyX11CursorNode * node; - node = firstExpired; - QDateTime now = QDateTime::currentDateTime(); - while (node && now.secsTo(node->expiration()) < 1) { - Cursor c = node->cursor(); - int id = node->id(); - lookupMap.take(id); - MyX11CursorNode * tmp = node; - node = node->post(); - if (node) - node->setAnte(0); - delete tmp; - XFreeCursor(display, c); - } - firstExpired = node; - if (node == 0) { - timer.stop(); - lastExpired = 0; - } - else { - int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; - timer.setInterval(interval); - timer.start(); - } -} - -Cursor MyX11Cursors::cursor(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - return node->cursor(); -} - - - -/******************************************************************** - -MyDisplay class - perhaps better placed in qplatformintegration_testlite? - -*********************************************************************/ - -//### copied from qapplication_x11.cpp - -static int qt_x_errhandler(Display *dpy, XErrorEvent *err) -{ - -qDebug() << "qt_x_errhandler" << err->error_code; - - switch (err->error_code) { - case BadAtom: -#if 0 - if (err->request_code == 20 /* X_GetProperty */ - && (err->resourceid == XA_RESOURCE_MANAGER - || err->resourceid == XA_RGB_DEFAULT_MAP - || err->resourceid == ATOM(_NET_SUPPORTED) - || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) - || err->resourceid == ATOM(XdndProxy) - || err->resourceid == ATOM(XdndAware)) - - - ) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } -#endif - qDebug() << "BadAtom"; - break; - - case BadWindow: - if (err->request_code == 2 /* X_ChangeWindowAttributes */ - || err->request_code == 38 /* X_QueryPointer */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } - } - seen_badwindow = true; - if (err->request_code == 25 /* X_SendEvent */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } -#if 0 - if (X11->xdndHandleBadwindow()) { - qDebug("xdndHandleBadwindow returned true"); - return 0; - } -#endif - } -#if 0 - if (X11->ignore_badwindow) - return 0; -#endif - break; - - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - - default: -#if 0 //!defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) - && err->minor_code == 3 /* X_OpenDevice */) { - return 0; - } -#endif - break; - } - - char errstr[256]; - XGetErrorText( dpy, err->error_code, errstr, 256 ); - char buffer[256]; - char request_str[256]; - qsnprintf(buffer, 256, "%d", err->request_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); - if (err->request_code < 128) { - // X error for a normal protocol request - qWarning( "X Error: %s %d\n" - " Major opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - request_str, - err->resourceid ); - } else { - // X error for an extension request - const char *extensionName = 0; -#if 0 - if (err->request_code == X11->xrender_major) - extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) - extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) - extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) - extensionName = "MIT-SHM"; -#endif - char minor_str[256]; - if (extensionName) { - qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); - } else { - extensionName = "Uknown extension"; - qsnprintf(minor_str, 256, "Unknown request"); - } - qWarning( "X Error: %s %d\n" - " Extension: %d (%s)\n" - " Minor opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - extensionName, - err->minor_code, - minor_str, - err->resourceid ); - } - - // ### we really should distinguish between severe, non-severe and - // ### application specific errors - - return 0; -} - - -#ifdef KeyPress -#undef KeyPress -#endif -#ifdef KeyRelease -#undef KeyRelease -#endif - -bool MyDisplay::handleEvent(XEvent *xe) -{ - //qDebug() << "handleEvent" << xe->xany.type << xe->xany.window; - int quit = false; - QTestLiteWindow *xw = 0; - foreach (QTestLiteWindow *w, windowList) { - if (w->winId() == xe->xany.window) { - xw = w; - break; - } - } - if (!xw) { -#ifdef MYX11_DEBUG - qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; -#endif - return quit; - } - - switch (xe->type) { - - case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { - Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom) - xw->handleCloseEvent(); -#ifdef MYX11_DEBUG - qDebug() << "ClientMessage WM_PROTOCOLS" << a; -#endif - } -#ifdef MYX11_DEBUG - else - qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; -#endif - break; - - case Expose: - if (xw) - if (xe->xexpose.count == 0) - xw->paintEvent(); - break; - case ConfigureNotify: - if (xw) - xw->resizeEvent(&xe->xconfigure); - break; - - case ButtonPress: - xw->mousePressEvent(&xe->xbutton); - break; - - case ButtonRelease: - xw->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); - break; - - case MotionNotify: - xw->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); - break; - - case XKeyPress: - xw->handleKeyEvent(QEvent::KeyPress, &xe->xkey); - break; - - case XKeyRelease: - xw->handleKeyEvent(QEvent::KeyRelease, &xe->xkey); - break; - - case EnterNotify: - xw->handleEnterEvent(); - break; - - case LeaveNotify: - xw->handleLeaveEvent(); - break; - - case XFocusIn: - xw->handleFocusInEvent(); - break; - - case XFocusOut: - xw->handleFocusOutEvent(); - break; - - default: -#ifdef MYX11_DEBUG - qDebug() << hex << xe->xany.window << "Other X event" << xe->type; -#endif - break; - } - return quit; -}; - - - -MyDisplay::MyDisplay() -{ - char *display_name = getenv("DISPLAY"); - display = XOpenDisplay(display_name); - if (!display) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } - -#ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (display); - Q_ASSERT(MIT_SHM_extension_supported == True); -#endif - original_x_errhandler = XSetErrorHandler(qt_x_errhandler); - - if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(display, true); - - screen = DefaultScreen(display); - width = DisplayWidth(display, screen); - height = DisplayHeight(display, screen); - physicalWidth = DisplayWidthMM(display, screen); - physicalHeight = DisplayHeightMM(display, screen); - - int xSocketNumber = XConnectionNumber(display); -#ifdef MYX11_DEBUG - qDebug() << "X socket:"<< xSocketNumber; -#endif - QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); - connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - - wmProtocolsAtom = XInternAtom (display, "WM_PROTOCOLS", False); - wmDeleteWindowAtom = XInternAtom (display, "WM_DELETE_WINDOW", False); - - cursors = new MyX11Cursors(display); -} - - -MyDisplay::~MyDisplay() -{ - XCloseDisplay(display); -} - - -void MyDisplay::eventDispatcher() -{ -// qDebug() << "eventDispatcher"; - - - ulong marker = XNextRequest(display); -// int i = 0; - while (XPending(display)) { - XEvent event; - XNextEvent(display, &event); - /* done = */ - handleEvent(&event); - - if (event.xany.serial >= marker) { -#ifdef MYX11_DEBUG - qDebug() << "potential livelock averted"; -#endif -#if 0 - if (XEventsQueued(display, QueuedAfterFlush)) { - qDebug() << " with events queued"; - QTimer::singleShot(0, this, SLOT(eventDispatcher())); - } -#endif - break; - } - } + return x_window; } - -QImage MyDisplay::grabWindow(Window window, int x, int y, int w, int h) +GC QTestLiteWindow::graphicsContext() const { - if (w == 0 || h ==0) - return QImage(); - - //WinId 0 means the desktop widget - if (!window) - window = rootWindow(); - - XWindowAttributes window_attr; - if (!XGetWindowAttributes(display, window, &window_attr)) - return QImage(); - - if (w < 0) - w = window_attr.width - x; - if (h < 0) - h = window_attr.height - y; - - // Ideally, we should also limit ourselves to the screen area, but the Qt docs say - // that it's "unsafe" to go outside the screen, so we can ignore that problem. - - //We're definitely not optimizing for speed... - XImage *xi = XGetImage(display, window, x, y, w, h, AllPlanes, ZPixmap); - - if (!xi) - return QImage(); - - //taking a copy to make sure we have ownership -- not fast - QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); - - XDestroyImage(xi); - - return result; + return gc; } - - - - - - QT_END_NAMESPACE -#include "qtestlitewindow.moc" diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 69442f1..8e9f6fd 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -42,63 +42,51 @@ #ifndef QTESTLITEWINDOW_H #define QTESTLITEWINDOW_H +#include "qtestliteintegration.h" + #include -#include +#include #include #include -#include -#include - -#include - -#include -#include - - - -class QTestLiteIntegration; -class QTestLiteScreen; -class QTestLiteWindowSurface; -class MyX11Cursors; -class QTestLiteWindow; -class MyDisplay : public QObject -{ - Q_OBJECT; -public: - MyDisplay(); - ~MyDisplay(); +struct QtMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; - Window rootWindow() { return RootWindow(display, screen); } - unsigned long blackPixel() { return BlackPixel(display, screen); } - unsigned long whitePixel() { return WhitePixel(display, screen); } +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), - bool handleEvent(XEvent *xe); - QImage grabWindow(Window window, int x, int y, int w, int h); + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), -public slots: - void eventDispatcher(); + MWM_HINTS_DECORATIONS = (1L << 1), -public: //### - Display * display; - int screen; - int width, height; - int physicalWidth; - int physicalHeight; + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), - QList windowList; + MWM_HINTS_INPUT_MODE = (1L << 2), - MyX11Cursors * cursors; + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L }; -struct MyShmImageInfo; - class QTestLiteWindow : public QPlatformWindow { public: - QTestLiteWindow(const QTestLiteIntegration *platformIntegration, - QTestLiteScreen *screen, QWidget *window); + QTestLiteWindow(QWidget *window); ~QTestLiteWindow(); @@ -128,33 +116,29 @@ public: void lower(); void setWindowTitle(const QString &title); - void setCursor(QCursor * cursor); + void setCursor(const Cursor &cursor); QPlatformGLContext *glContext() const; + Window xWindow() const; + GC graphicsContext() const; + +protected: + void setMWMHints(const QtMWMHints &mwmhints); + QtMWMHints getMWMHints() const; + private: - int xpos, ypos; - int width, height; Window x_window; GC gc; GC createGC(); - Cursor createCursorShape(int cshape); - Cursor createCursorBitmap(QCursor * cursor); - - int currentCursor; - - MyDisplay *xd; + QPlatformGLContext *mGLContext; QTestLiteScreen *mScreen; Qt::WindowFlags window_flags; - QPlatformGLContext *mGLContext; - - friend class QTestLiteWindowSurface; // x_window, gc and windowSurface -}; - - + Atom m_mwm_hint_atom; +}; #endif diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp index b3232c8..ced964a 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -46,6 +46,7 @@ #include #include "qtestlitewindow.h" +#include "qtestlitescreen.h" # include # include @@ -65,8 +66,6 @@ struct MyShmImageInfo { Display *display; }; -//void QTestLiteWindowSurface::flush() - #ifndef DONT_USE_MIT_SHM void MyShmImageInfo::destroy() @@ -80,20 +79,21 @@ void MyShmImageInfo::destroy() void QTestLiteWindowSurface::resizeShmImage(int width, int height) { - MyDisplay *xd = xw->xd; #ifdef DONT_USE_MIT_SHM shm_img = QImage(width, height, QImage::Format_RGB32); #else + + QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(window()); if (image_info) image_info->destroy(); else - image_info = new MyShmImageInfo(xd->display); + image_info = new MyShmImageInfo(screen->display()); - Visual *visual = DefaultVisual(xd->display, xd->screen); + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, + XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, &image_info->shminfo, width, height); @@ -105,7 +105,7 @@ void QTestLiteWindowSurface::resizeShmImage(int width, int height) image_info->image = image; - Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); + Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); Q_ASSERT(shm_attach_status == True); @@ -126,7 +126,7 @@ QSize QTestLiteWindowSurface::bufferSize() const return shm_img.size(); } -QTestLiteWindowSurface::QTestLiteWindowSurface (QTestLiteScreen */*screen*/, QWidget *window) +QTestLiteWindowSurface::QTestLiteWindowSurface (QWidget *window) : QWindowSurface(window), painted(false), image_info(0) { @@ -151,29 +151,27 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const Q_UNUSED(region); Q_UNUSED(offset); - // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; - if (!painted) return; - MyDisplay *xd = xw->xd; - GC gc = xw->gc; - Window window = xw->x_window; + QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + GC gc = xw->graphicsContext(); + Window window = xw->xWindow(); #ifdef DONT_USE_MIT_SHM // just convert the image every time... if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(xd->display, xd->screen); + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); QImage image = shm_img; //img.convertToFormat( - XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, + XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, 0, (char *) image.scanLine(0), image.width(), image.height(), 32, image.bytesPerLine()); int x = 0; int y = 0; - /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); + /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); xi->data = 0; // QImage owns these bits XDestroyImage(xi); @@ -187,11 +185,11 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const // We could set send_event to true, and then use the ShmCompletion to synchronize, // but let's do like Qt/11 and just use XSync - XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, + XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, x, y, image_info->image->width, image_info->image->height, /*send_event*/ False); - XSync(xd->display, False); + XSync(screen->display(), False); } #endif } diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.h b/src/plugins/platforms/testlite/qtestlitewindowsurface.h index 915e7fe..ca900e5 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.h +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.h @@ -55,7 +55,7 @@ class MyShmImageInfo; class QTestLiteWindowSurface : public QWindowSurface { public: - QTestLiteWindowSurface (QTestLiteScreen *screen, QWidget *window); + QTestLiteWindowSurface (QWidget *window); ~QTestLiteWindowSurface(); QPaintDevice *paintDevice(); diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index 05bd384..ef977bf 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -7,13 +7,16 @@ SOURCES = \ main.cpp \ qtestliteintegration.cpp \ qtestlitewindowsurface.cpp \ - qtestlitewindow.cpp + qtestlitewindow.cpp \ + qtestlitecursor.cpp \ + qtestlitescreen.cpp HEADERS = \ qtestliteintegration.h \ qtestlitewindowsurface.h \ - qtestlitewindow.h - + qtestlitewindow.h \ + qtestlitecursor.h \ + qtestlitescreen.h LIBS += -lX11 -lXext -- cgit v0.12 From dd72b151b500838475f2ec40695449a37acd3922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 9 Dec 2010 09:00:02 +0100 Subject: Remove Lighthouse specific code in QGLWidget constructor truth to be told, I can't remember why I decided that it was a good idea to have the code there. But clearly now I don't think so anymore. Such initialisation should happen in qgl_qpa.cpp chooseContext. If we tear down the window and the context then that has to be solved elsewhere. --- src/opengl/opengl.pro.user.2.1pre1 | 83 ++++++++++++++++++++++++++++++++++++++ src/opengl/qgl.cpp | 34 ---------------- src/opengl/qgl_qpa.cpp | 5 --- 3 files changed, 83 insertions(+), 39 deletions(-) create mode 100644 src/opengl/opengl.pro.user.2.1pre1 diff --git a/src/opengl/opengl.pro.user.2.1pre1 b/src/opengl/opengl.pro.user.2.1pre1 new file mode 100644 index 0000000..0c38724 --- /dev/null +++ b/src/opengl/opengl.pro.user.2.1pre1 @@ -0,0 +1,83 @@ + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + UTF-8 + + + + ProjectExplorer.Project.Target.0 + + Desktop + Qt4ProjectManager.Target.DesktopTarget + 0 + 0 + + + qmake + QtProjectManager.QMakeBuildStep + + QMAKE_ABSOLUTE_SOURCE_PATH=/home/jlind/dev/qt/lighthouse-master/src/opengl + + + + Make + Qt4ProjectManager.MakeStep + false + + -j9 + + + + 2 + + Make + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + /home/jlind/builds/master-lighthouse/src/opengl + 23 + 0 + true + + 1 + + headers + Qt4ProjectManager.Qt4RunConfiguration + 2 + + ../../../../../builds/master-lighthouse/include/QtOpenGL/headers.pri + false + false + + false + false + + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 4 + + diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e9e8880..dac00dc 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3772,24 +3772,7 @@ QGLWidget::QGLWidget(QWidget *parent, const QGLWidget* shareWidget, Qt::WindowFl setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(true); // for compatibility -#ifdef Q_WS_QPA - QPlatformWindowFormat platformFormat = QGLFormat::toPlatformWindowFormat(QGLFormat::defaultFormat()); - platformFormat.setUseDefaultSharedContext(false); - if (shareWidget && shareWidget->d_func()->glcx) { - QPlatformGLContext *sharedPlatformContext = shareWidget->d_func()->glcx->d_func()->platformContext; - platformFormat.setSharedContext(sharedPlatformContext); - } - setPlatformWindowFormat(platformFormat); - winId(); // create window; - QGLContext *glContext = 0; - if (platformWindow()) - glContext = QGLContext::fromPlatformGLContext(platformWindow()->glContext()); - if (glContext){ - d->init(glContext,shareWidget); - } -#else d->init(new QGLContext(QGLFormat::defaultFormat(), this), shareWidget); -#endif } @@ -3829,24 +3812,7 @@ QGLWidget::QGLWidget(const QGLFormat &format, QWidget *parent, const QGLWidget* setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(true); // for compatibility -#ifdef Q_WS_QPA - QPlatformWindowFormat platformFormat = QGLFormat::toPlatformWindowFormat(format); - platformFormat.setUseDefaultSharedContext(false); - if (shareWidget && shareWidget->d_func()->glcx) { - QPlatformGLContext *sharedPlatformContext = shareWidget->d_func()->glcx->d_func()->platformContext; - platformFormat.setSharedContext(sharedPlatformContext); - } - setPlatformWindowFormat(platformFormat); - winId(); // create window; - QGLContext *glContext = 0; - if (platformWindow()) - glContext = QGLContext::fromPlatformGLContext(platformWindow()->glContext()); - if (glContext){ - d->init(glContext,shareWidget); - } -#else d->init(new QGLContext(format, this), shareWidget); -#endif } /*! diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 415e915..52eb57f 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -325,11 +325,6 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { Q_D(QGLWidget); - if (e->type() == QEvent::WinIdChange) { - if (platformWindow()) { - d->glcx = QGLContext::fromPlatformGLContext(platformWindow()->glContext()); - } - } return QWidget::event(e); } -- cgit v0.12 From 90de48493be283b9afb249f6a0fd8dbd8958517d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 10 Dec 2010 16:43:16 +0100 Subject: Handle the QWidgetPrivate::mapper structure Dont have widgets without a valid winId there --- src/gui/kernel/qwidget_qpa.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 24ab8f7..560c9cd 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -768,6 +768,7 @@ void QWidgetPrivate::deleteTLSysExtra() context->deleteQGLContext(); } } + setWinId(0); delete extra->topextra->platformWindow; extra->topextra->platformWindow = 0; extra->topextra->backingStore.destroy(); -- cgit v0.12 From d0414bd582190e205aa698f5cb24f1c6909d8222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 10 Dec 2010 16:44:44 +0100 Subject: Dont do backingStore.destroy in deleteTLSysExtra It is done by QWidgetPrivate::deleteExtra() --- src/gui/kernel/qwidget_qpa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 560c9cd..dce23a3 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -771,7 +771,6 @@ void QWidgetPrivate::deleteTLSysExtra() setWinId(0); delete extra->topextra->platformWindow; extra->topextra->platformWindow = 0; - extra->topextra->backingStore.destroy(); } } -- cgit v0.12 From e90cb6992e35ed4b9c2aae85edb8d787c24a8a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 14 Dec 2010 17:08:55 +0100 Subject: Fix gstreamer phonon build on X11 I added an x11{ } clause in the pro file for the plugin. But as it turnes out the x11 clause is defined in gui.pro so it is not available for use in any other pro or pri files. Also fixed a missing !qpa in qttest_p4.prf --- mkspecs/features/qttest_p4.prf | 2 +- src/plugins/phonon/gstreamer/gstreamer.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qttest_p4.prf b/mkspecs/features/qttest_p4.prf index 2ee148b..26f4b35 100644 --- a/mkspecs/features/qttest_p4.prf +++ b/mkspecs/features/qttest_p4.prf @@ -2,7 +2,7 @@ isEmpty(TEMPLATE):TEMPLATE=app CONFIG += qt warn_on console depend_includepath testcase # x11 is not defined by configure (the following line is copied from gui.pro) -!win32:!embedded:!mac:!symbian:CONFIG += x11 +!win32:!embedded:!qpa:!mac:!symbian:CONFIG += x11 qtAddLibrary(QtTest) diff --git a/src/plugins/phonon/gstreamer/gstreamer.pro b/src/plugins/phonon/gstreamer/gstreamer.pro index 02e0848..c0d2604 100644 --- a/src/plugins/phonon/gstreamer/gstreamer.pro +++ b/src/plugins/phonon/gstreamer/gstreamer.pro @@ -58,7 +58,7 @@ SOURCES += $$PHONON_GSTREAMER_DIR/abstractrenderer.cpp \ $$PHONON_GSTREAMER_DIR/volumefadereffect.cpp \ $$PHONON_GSTREAMER_DIR/widgetrenderer.cpp -x11 { +!qpa:!embedded{ HEADERS += $$PHONON_GSTREAMER_DIR/x11renderer.h SOURCES += $$PHONON_GSTREAMER_DIR/x11renderer.cpp } -- cgit v0.12 From a7fc0e8bad3bd020ece5fa70f0462bcaf59b3d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 14 Dec 2010 17:15:44 +0100 Subject: Fix nativechild widget position in Lighthouse --- src/gui/kernel/qwidget_qpa.cpp | 16 ++++++---------- src/plugins/platforms/testlite/qtestlitewindow.cpp | 11 ++++++----- src/plugins/platforms/testlite/qtestlitewindow.h | 3 --- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index dce23a3..001810e 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -162,7 +162,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); - // QWidget *oldParent = q->parentWidget(); Qt::WindowFlags oldFlags = data.window_flags; int targetScreen = -1; @@ -214,13 +213,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) data.window_flags = window->setWindowFlags(data.window_flags); } - // Reparenting child to toplevel - if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { - //qDebug() << "setParent_sys() change to toplevel"; - q->create(); //### too early: this ought to happen at show() time - } - - if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) q->setAttribute(Qt::WA_WState_Hidden); q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); @@ -396,7 +388,11 @@ void QWidgetPrivate::show_sys() QPlatformWindow *window = q->platformWindow(); if (window) { - const QRect geomRect = q->geometry(); + QRect geomRect = q->geometry(); + if (!q->isWindow()) { + QPoint topLeftOfWindow = q->mapTo(q->nativeParentWidget(),QPoint()); + geomRect.moveTopLeft(topLeftOfWindow); + } const QRect windowRect = window->geometry(); if (windowRect != geomRect) { window->setGeometry(geomRect); @@ -591,7 +587,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isVisible()) { if (q->platformWindow()) { if (q->isWindow()) { - q->platformWindow()->setGeometry(q->frameGeometry()); + q->platformWindow()->setGeometry(q->geometry()); } else { QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size())); diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index f8f4a5f..5446615 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -71,8 +71,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) int h = window->height(); if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate - ::platformIntegration()->hasOpenGL() ) { + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { #ifndef QT_NO_OPENGL XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); @@ -117,6 +116,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) } + QTestLiteWindow::~QTestLiteWindow() { #ifdef MYX11_DEBUG @@ -557,8 +557,8 @@ WId QTestLiteWindow::winId() const void QTestLiteWindow::setParent(const QPlatformWindow *window) { - QPoint point = widget()->mapTo(widget()->nativeParentWidget(),QPoint()); - XReparentWindow(mScreen->display(),x_window,window->winId(),point.x(),point.y()); + QPoint topLeft = geometry().topLeft(); + XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); } void QTestLiteWindow::raise() @@ -624,7 +624,8 @@ void QTestLiteWindow::resizeEvent(XConfigureEvent *e) qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; #endif - QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, e->width, e->height)); + QRect newRect(xpos, ypos, e->width, e->height); + QWindowSystemInterface::handleGeometryChange(widget(), newRect); } void QTestLiteWindow::mousePressEvent(XButtonEvent *e) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 8e9f6fd..7e990ee 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -136,9 +136,6 @@ private: QPlatformGLContext *mGLContext; QTestLiteScreen *mScreen; Qt::WindowFlags window_flags; - - Atom m_mwm_hint_atom; - }; #endif -- cgit v0.12 From fc79d664af9fe3396badac8d1829623118e827fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 17 Dec 2010 07:58:43 +0100 Subject: Remove current cursor optimization It was broken since it didn't take care of the initial cursor. --- src/plugins/platforms/testlite/qtestlitecursor.cpp | 3 +-- src/plugins/platforms/testlite/qtestlitecursor.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitecursor.cpp b/src/plugins/platforms/testlite/qtestlitecursor.cpp index 4f3f0cb..e9e6eb7 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.cpp +++ b/src/plugins/platforms/testlite/qtestlitecursor.cpp @@ -71,8 +71,7 @@ void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) return; int id = cursor->handle(); - if (id == currentCursor) - return; + Cursor c; if (!cursorMap.contains(id)) { if (cursor->shape() == Qt::BitmapCursor) diff --git a/src/plugins/platforms/testlite/qtestlitecursor.h b/src/plugins/platforms/testlite/qtestlitecursor.h index 15a5b2a..bb3549e 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.h +++ b/src/plugins/platforms/testlite/qtestlitecursor.h @@ -60,7 +60,6 @@ private: Cursor createCursorShape(int cshape); QTestLiteScreen *testLiteScreen() const; - int currentCursor; QMap cursorMap; }; -- cgit v0.12 From 683263e4010e3e1797221edb73d91471aea7b93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 17 Dec 2010 08:02:04 +0100 Subject: Refactored the keyboard event handling in testlite --- .../platforms/testlite/qtestlitekeyboard.cpp | 943 +++++++++++++++++++++ src/plugins/platforms/testlite/qtestlitekeyboard.h | 35 + src/plugins/platforms/testlite/qtestlitescreen.cpp | 11 +- src/plugins/platforms/testlite/qtestlitescreen.h | 3 + src/plugins/platforms/testlite/qtestlitewindow.cpp | 329 +------ src/plugins/platforms/testlite/qtestlitewindow.h | 1 - src/plugins/platforms/testlite/testlite.pro | 6 +- 7 files changed, 997 insertions(+), 331 deletions(-) create mode 100644 src/plugins/platforms/testlite/qtestlitekeyboard.cpp create mode 100644 src/plugins/platforms/testlite/qtestlitekeyboard.h diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp new file mode 100644 index 0000000..c18de59 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -0,0 +1,943 @@ +#include "qtestlitekeyboard.h" + +#include "qtestlitescreen.h" + +#include + +#include + +#ifndef XK_ISO_Left_Tab +#define XK_ISO_Left_Tab 0xFE20 +#endif + +#ifndef XK_dead_hook +#define XK_dead_hook 0xFE61 +#endif + +#ifndef XK_dead_horn +#define XK_dead_horn 0xFE62 +#endif + +#ifndef XK_Codeinput +#define XK_Codeinput 0xFF37 +#endif + +#ifndef XK_Kanji_Bangou +#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ +#endif + +// Fix old X libraries +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + +// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special +// multimedia keys. They are included here as not every system has them. +#define XF86XK_MonBrightnessUp 0x1008FF02 +#define XF86XK_MonBrightnessDown 0x1008FF03 +#define XF86XK_KbdLightOnOff 0x1008FF04 +#define XF86XK_KbdBrightnessUp 0x1008FF05 +#define XF86XK_KbdBrightnessDown 0x1008FF06 +#define XF86XK_Standby 0x1008FF10 +#define XF86XK_AudioLowerVolume 0x1008FF11 +#define XF86XK_AudioMute 0x1008FF12 +#define XF86XK_AudioRaiseVolume 0x1008FF13 +#define XF86XK_AudioPlay 0x1008FF14 +#define XF86XK_AudioStop 0x1008FF15 +#define XF86XK_AudioPrev 0x1008FF16 +#define XF86XK_AudioNext 0x1008FF17 +#define XF86XK_HomePage 0x1008FF18 +#define XF86XK_Mail 0x1008FF19 +#define XF86XK_Start 0x1008FF1A +#define XF86XK_Search 0x1008FF1B +#define XF86XK_AudioRecord 0x1008FF1C +#define XF86XK_Calculator 0x1008FF1D +#define XF86XK_Memo 0x1008FF1E +#define XF86XK_ToDoList 0x1008FF1F +#define XF86XK_Calendar 0x1008FF20 +#define XF86XK_PowerDown 0x1008FF21 +#define XF86XK_ContrastAdjust 0x1008FF22 +#define XF86XK_Back 0x1008FF26 +#define XF86XK_Forward 0x1008FF27 +#define XF86XK_Stop 0x1008FF28 +#define XF86XK_Refresh 0x1008FF29 +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F +#define XF86XK_Favorites 0x1008FF30 +#define XF86XK_AudioPause 0x1008FF31 +#define XF86XK_AudioMedia 0x1008FF32 +#define XF86XK_MyComputer 0x1008FF33 +#define XF86XK_LightBulb 0x1008FF35 +#define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +#define XF86XK_Finance 0x1008FF3C +#define XF86XK_Community 0x1008FF3D +#define XF86XK_AudioRewind 0x1008FF3E +#define XF86XK_BackForward 0x1008FF3F +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F +#define XF86XK_ApplicationLeft 0x1008FF50 +#define XF86XK_ApplicationRight 0x1008FF51 +#define XF86XK_Book 0x1008FF52 +#define XF86XK_CD 0x1008FF53 +#define XF86XK_Calculater 0x1008FF54 +#define XF86XK_Clear 0x1008FF55 +#define XF86XK_ClearGrab 0x1008FE21 +#define XF86XK_Close 0x1008FF56 +#define XF86XK_Copy 0x1008FF57 +#define XF86XK_Cut 0x1008FF58 +#define XF86XK_Display 0x1008FF59 +#define XF86XK_DOS 0x1008FF5A +#define XF86XK_Documents 0x1008FF5B +#define XF86XK_Excel 0x1008FF5C +#define XF86XK_Explorer 0x1008FF5D +#define XF86XK_Game 0x1008FF5E +#define XF86XK_Go 0x1008FF5F +#define XF86XK_iTouch 0x1008FF60 +#define XF86XK_LogOff 0x1008FF61 +#define XF86XK_Market 0x1008FF62 +#define XF86XK_Meeting 0x1008FF63 +#define XF86XK_MenuKB 0x1008FF65 +#define XF86XK_MenuPB 0x1008FF66 +#define XF86XK_MySites 0x1008FF67 +#define XF86XK_News 0x1008FF69 +#define XF86XK_OfficeHome 0x1008FF6A +#define XF86XK_Option 0x1008FF6C +#define XF86XK_Paste 0x1008FF6D +#define XF86XK_Phone 0x1008FF6E +#define XF86XK_Reply 0x1008FF72 +#define XF86XK_Reload 0x1008FF73 +#define XF86XK_RotateWindows 0x1008FF74 +#define XF86XK_RotationPB 0x1008FF75 +#define XF86XK_RotationKB 0x1008FF76 +#define XF86XK_Save 0x1008FF77 +#define XF86XK_Send 0x1008FF7B +#define XF86XK_Spell 0x1008FF7C +#define XF86XK_SplitScreen 0x1008FF7D +#define XF86XK_Support 0x1008FF7E +#define XF86XK_TaskPane 0x1008FF7F +#define XF86XK_Terminal 0x1008FF80 +#define XF86XK_Tools 0x1008FF81 +#define XF86XK_Travel 0x1008FF82 +#define XF86XK_Video 0x1008FF87 +#define XF86XK_Word 0x1008FF89 +#define XF86XK_Xfer 0x1008FF8A +#define XF86XK_ZoomIn 0x1008FF8B +#define XF86XK_ZoomOut 0x1008FF8C +#define XF86XK_Away 0x1008FF8D +#define XF86XK_Messenger 0x1008FF8E +#define XF86XK_WebCam 0x1008FF8F +#define XF86XK_MailForward 0x1008FF90 +#define XF86XK_Pictures 0x1008FF91 +#define XF86XK_Music 0x1008FF92 +#define XF86XK_Battery 0x1008FF93 +#define XF86XK_Bluetooth 0x1008FF94 +#define XF86XK_WLAN 0x1008FF95 +#define XF86XK_UWB 0x1008FF96 +#define XF86XK_AudioForward 0x1008FF97 +#define XF86XK_AudioRepeat 0x1008FF98 +#define XF86XK_AudioRandomPlay 0x1008FF99 +#define XF86XK_Subtitle 0x1008FF9A +#define XF86XK_AudioCycleTrack 0x1008FF9B +#define XF86XK_Time 0x1008FF9F +#define XF86XK_Select 0x1008FFA0 +#define XF86XK_View 0x1008FFA1 +#define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Suspend 0x1008FFA7 +#define XF86XK_Hibernate 0x1008FFA8 + + +// end of XF86keysyms.h + +// Special keys used by Qtopia, mapped into the X11 private keypad range. +#define QTOPIAXK_Select 0x11000601 +#define QTOPIAXK_Yes 0x11000602 +#define QTOPIAXK_No 0x11000603 +#define QTOPIAXK_Cancel 0x11000604 +#define QTOPIAXK_Printer 0x11000605 +#define QTOPIAXK_Execute 0x11000606 +#define QTOPIAXK_Sleep 0x11000607 +#define QTOPIAXK_Play 0x11000608 +#define QTOPIAXK_Zoom 0x11000609 +#define QTOPIAXK_Context1 0x1100060A +#define QTOPIAXK_Context2 0x1100060B +#define QTOPIAXK_Context3 0x1100060C +#define QTOPIAXK_Context4 0x1100060D +#define QTOPIAXK_Call 0x1100060E +#define QTOPIAXK_Hangup 0x1100060F +#define QTOPIAXK_Flip 0x11000610 + +// keyboard mapping table +static const unsigned int KeyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + + // Special keys from X.org - This include multimedia keys, + // wireless/bluetooth/uwb keys, special launcher keys, etc. + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Memo, Qt::Key_Memo, + XF86XK_ToDoList, Qt::Key_ToDoList, + XF86XK_Calendar, Qt::Key_Calendar, + XF86XK_PowerDown, Qt::Key_PowerDown, + XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, + XF86XK_Standby, Qt::Key_Standby, + XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, + XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, + XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XF86XK_PowerOff, Qt::Key_PowerOff, + XF86XK_WakeUp, Qt::Key_WakeUp, + XF86XK_Eject, Qt::Key_Eject, + XF86XK_ScreenSaver, Qt::Key_ScreenSaver, + XF86XK_WWW, Qt::Key_WWW, + XF86XK_Sleep, Qt::Key_Sleep, + XF86XK_LightBulb, Qt::Key_LightBulb, + XF86XK_Shop, Qt::Key_Shop, + XF86XK_History, Qt::Key_History, + XF86XK_AddFavorite, Qt::Key_AddFavorite, + XF86XK_HotLinks, Qt::Key_HotLinks, + XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, + XF86XK_Finance, Qt::Key_Finance, + XF86XK_Community, Qt::Key_Community, + XF86XK_AudioRewind, Qt::Key_AudioRewind, + XF86XK_BackForward, Qt::Key_BackForward, + XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, + XF86XK_ApplicationRight, Qt::Key_ApplicationRight, + XF86XK_Book, Qt::Key_Book, + XF86XK_CD, Qt::Key_CD, + XF86XK_Calculater, Qt::Key_Calculator, + XF86XK_Clear, Qt::Key_Clear, + XF86XK_ClearGrab, Qt::Key_ClearGrab, + XF86XK_Close, Qt::Key_Close, + XF86XK_Copy, Qt::Key_Copy, + XF86XK_Cut, Qt::Key_Cut, + XF86XK_Display, Qt::Key_Display, + XF86XK_DOS, Qt::Key_DOS, + XF86XK_Documents, Qt::Key_Documents, + XF86XK_Excel, Qt::Key_Excel, + XF86XK_Explorer, Qt::Key_Explorer, + XF86XK_Game, Qt::Key_Game, + XF86XK_Go, Qt::Key_Go, + XF86XK_iTouch, Qt::Key_iTouch, + XF86XK_LogOff, Qt::Key_LogOff, + XF86XK_Market, Qt::Key_Market, + XF86XK_Meeting, Qt::Key_Meeting, + XF86XK_MenuKB, Qt::Key_MenuKB, + XF86XK_MenuPB, Qt::Key_MenuPB, + XF86XK_MySites, Qt::Key_MySites, + XF86XK_News, Qt::Key_News, + XF86XK_OfficeHome, Qt::Key_OfficeHome, + XF86XK_Option, Qt::Key_Option, + XF86XK_Paste, Qt::Key_Paste, + XF86XK_Phone, Qt::Key_Phone, + XF86XK_Reply, Qt::Key_Reply, + XF86XK_Reload, Qt::Key_Reload, + XF86XK_RotateWindows, Qt::Key_RotateWindows, + XF86XK_RotationPB, Qt::Key_RotationPB, + XF86XK_RotationKB, Qt::Key_RotationKB, + XF86XK_Save, Qt::Key_Save, + XF86XK_Send, Qt::Key_Send, + XF86XK_Spell, Qt::Key_Spell, + XF86XK_SplitScreen, Qt::Key_SplitScreen, + XF86XK_Support, Qt::Key_Support, + XF86XK_TaskPane, Qt::Key_TaskPane, + XF86XK_Terminal, Qt::Key_Terminal, + XF86XK_Tools, Qt::Key_Tools, + XF86XK_Travel, Qt::Key_Travel, + XF86XK_Video, Qt::Key_Video, + XF86XK_Word, Qt::Key_Word, + XF86XK_Xfer, Qt::Key_Xfer, + XF86XK_ZoomIn, Qt::Key_ZoomIn, + XF86XK_ZoomOut, Qt::Key_ZoomOut, + XF86XK_Away, Qt::Key_Away, + XF86XK_Messenger, Qt::Key_Messenger, + XF86XK_WebCam, Qt::Key_WebCam, + XF86XK_MailForward, Qt::Key_MailForward, + XF86XK_Pictures, Qt::Key_Pictures, + XF86XK_Music, Qt::Key_Music, + XF86XK_Battery, Qt::Key_Battery, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_WLAN, Qt::Key_WLAN, + XF86XK_UWB, Qt::Key_UWB, + XF86XK_AudioForward, Qt::Key_AudioForward, + XF86XK_AudioRepeat, Qt::Key_AudioRepeat, + XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, + XF86XK_Subtitle, Qt::Key_Subtitle, + XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, + XF86XK_Time, Qt::Key_Time, + XF86XK_Select, Qt::Key_Select, + XF86XK_View, Qt::Key_View, + XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_Suspend, Qt::Key_Suspend, + XF86XK_Hibernate, Qt::Key_Hibernate, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, + XF86XK_LaunchE, Qt::Key_LaunchG, + XF86XK_LaunchF, Qt::Key_LaunchH, + + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, + + 0, 0 +}; + +static const unsigned short katakanaKeysymsToUnicode[] = { + 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, + 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, + 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, + 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, + 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, + 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, + 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, + 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C +}; + +static const unsigned short cyrillicKeysymsToUnicode[] = { + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; + +static const unsigned short greekKeysymsToUnicode[] = { + 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short technicalKeysymsToUnicode[] = { + 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, + 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, + 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, + 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, + 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 +}; + +static const unsigned short specialKeysymsToUnicode[] = { + 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, + 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, + 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, + 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short publishingKeysymsToUnicode[] = { + 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, + 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, + 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, + 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, + 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, + 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, + 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, + 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 +}; + +static const unsigned short aplKeysymsToUnicode[] = { + 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, + 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, + 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, + 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, + 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short koreanKeysymsToUnicode[] = { + 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, + 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, + 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, + 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, + 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, + 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, + 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, + 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 +}; + +static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) +{ + switch (byte3) { + case 0x04: + // katakana + if (byte4 > 0xa0 && byte4 < 0xe0) + return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); + else if (byte4 == 0x7e) + return QChar(0x203e); // Overline + break; + case 0x06: + // russian, use lookup table + if (byte4 > 0xa0) + return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x07: + // greek + if (byte4 > 0xa0) + return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x08: + // technical + if (byte4 > 0xa0) + return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x09: + // special + if (byte4 >= 0xe0) + return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); + break; + case 0x0a: + // publishing + if (byte4 > 0xa0) + return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0b: + // APL + if (byte4 > 0xa0) + return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0e: + // Korean + if (byte4 > 0xa0) + return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); + break; + default: + break; + } + return QChar(0x0); +} + +Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) +{ + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & m_alt_mask) + ret |= Qt::AltModifier; + if (s & m_meta_mask) + ret |= Qt::MetaModifier; + if (s & m_mode_switch_mask) + ret |= Qt::GroupSwitchModifier; + return ret; +} + +void QTestLiteKeyboard::setMask(KeySym sym, uint mask) +{ + if (m_alt_mask == 0 + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Alt_L || sym == XK_Alt_R)) { + m_alt_mask = mask; + } + if (m_meta_mask == 0 + && m_alt_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Meta_L || sym == XK_Meta_R)) { + m_meta_mask = mask; + } + if (m_super_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_hyper_mask != mask + && (sym == XK_Super_L || sym == XK_Super_R)) { + m_super_mask = mask; + } + if (m_hyper_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { + m_hyper_mask = mask; + } + if (m_mode_switch_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && sym == XK_Mode_switch) { + m_mode_switch_mask = mask; + } + if (m_num_lock_mask == 0 + && sym == XK_Num_Lock) { + m_num_lock_mask = mask; + } +} + +int QTestLiteKeyboard::translateKeySym(uint key) const +{ + int code = -1; + int i = 0; // any other keys + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + if (m_meta_mask) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; +} + +QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count) +{ + // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars + + QTextCodec *mapper = QTextCodec::codecForLocale(); + QChar converted; + + if (/*count == 0 &&*/ keysym < 0xff00) { + unsigned char byte3 = (unsigned char)(keysym >> 8); + int mib = -1; + switch(byte3) { + case 0: // Latin 1 + case 1: // Latin 2 + case 2: //latin 3 + case 3: // latin4 + mib = byte3 + 4; break; + case 5: // arabic + mib = 82; break; + case 12: // Hebrew + mib = 85; break; + case 13: // Thai + mib = 2259; break; + case 4: // kana + case 6: // cyrillic + case 7: // greek + case 8: // technical, no mapping here at the moment + case 9: // Special + case 10: // Publishing + case 11: // APL + case 14: // Korean, no mapping + mib = -1; // manual conversion + mapper= 0; +#if !defined(QT_NO_XIM) + converted = keysymToUnicode(byte3, keysym & 0xff); +#endif + case 0x20: + // currency symbols + if (keysym >= 0x20a0 && keysym <= 0x20ac) { + mib = -1; // manual conversion + mapper = 0; + converted = (uint)keysym; + } + break; + default: + break; + } + if (mib != -1) { + mapper = QTextCodec::codecForMib(mib); + if (chars.isEmpty()) + chars.resize(1); + chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later + count++; + } + } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { + converted = (ushort) (keysym - 0x1000000); + mapper = 0; + } + if (count < (int)chars.size()-1) + chars[count] = '\0'; + + QString text; + if (!mapper && converted.unicode() != 0x0) { + text = converted; + } else if (!chars.isEmpty()) { + // convert chars (8bit) to text (unicode). + if (mapper) + text = mapper->toUnicode(chars.data(), count, 0); + if (text.isEmpty()) { + // no mapper, or codec couldn't convert to unicode (this + // can happen when running in the C locale or with no LANG + // set). try converting from latin-1 + text = QString::fromLatin1(chars); + } + } + + modifiers = translateModifiers(xmodifiers); + + // Commentary in X11/keysymdef says that X codes match ASCII, so it + // is safe to use the locale functions to process X codes in ISO8859-1. + // + // This is mainly for compatibility - applications should not use the + // Qt keycodes between 128 and 255, but should rather use the + // QKeyEvent::text(). + // + if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { + // upper-case key, if known + code = isprint((int)keysym) ? toupper((int)keysym) : 0; + } else if (keysym >= XK_F1 && keysym <= XK_F35) { + // function keys + code = Qt::Key_F1 + ((int)keysym - XK_F1); + } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { + if (keysym >= XK_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XK_KP_0); + } else { + code = translateKeySym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = translateKeySym(keysym); + + if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab, QShortcutMap knows about it + // and will handle it. + code = Qt::Key_Backtab; + text = QString(); + } + } + + return text; +} + +QTestLiteKeyboard::QTestLiteKeyboard(QTestLiteScreen *screen) + : m_screen(screen) + , m_alt_mask(0) + , m_super_mask(0) + , m_hyper_mask(0) + , m_meta_mask(0) +{ + changeLayout(); +} + +void QTestLiteKeyboard::changeLayout() +{ + XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); + for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { + const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; + if (mask == 0) { + // key is not bound to a modifier + continue; + } + + for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { + KeySym keySym = XkbKeySym(xkbDesc, i, j); + if (keySym == NoSymbol) + continue; + setMask(keySym, mask); + } + } + XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); + +} + +void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +{ + int qtcode = 0; + Qt::KeyboardModifiers modifiers; + QByteArray chars; + chars.resize(513); + int count = 1; + KeySym keySym; + count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); + QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text); +} diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h new file mode 100644 index 0000000..65ead16 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.h @@ -0,0 +1,35 @@ +#ifndef QTESTLITEKEYBOARD_H +#define QTESTLITEKEYBOARD_H + +#include "qtestliteintegration.h" + +class QTestLiteKeyboard +{ +public: + QTestLiteKeyboard(QTestLiteScreen *screen); + + void changeLayout(); + + void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); + + Qt::KeyboardModifiers translateModifiers(int s); + +private: + + void setMask(KeySym sym, uint mask); + int translateKeySym(uint key) const; + QString translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count); + + QTestLiteScreen *m_screen; + + uint m_alt_mask; + uint m_super_mask; + uint m_hyper_mask; + uint m_meta_mask; + uint m_mode_switch_mask; + uint m_num_lock_mask; +}; + +#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp index 919506e..c0f696d 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -43,6 +43,7 @@ #include "qtestlitecursor.h" #include "qtestlitewindow.h" +#include "qtestlitekeyboard.h" #include #include @@ -226,6 +227,7 @@ QTestLiteScreen::QTestLiteScreen() mWmMotifHintAtom = XInternAtom(mDisplay, "_MOTIF_WM_HINTS\0", False); mCursor = new QTestLiteCursor(this); + mKeyboard = new QTestLiteKeyboard(this); } QTestLiteScreen::~QTestLiteScreen() @@ -299,11 +301,11 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) break; case XKeyPress: - xw->handleKeyEvent(QEvent::KeyPress, &xe->xkey); + mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); break; case XKeyRelease: - xw->handleKeyEvent(QEvent::KeyRelease, &xe->xkey); + mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); break; case EnterNotify: @@ -427,4 +429,9 @@ Atom QTestLiteScreen::atomForMotifWmHints() const return mWmMotifHintAtom; } +QTestLiteKeyboard * QTestLiteScreen::keyboard() const +{ + return mKeyboard; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h index f8d9468..9a1a510 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.h +++ b/src/plugins/platforms/testlite/qtestlitescreen.h @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE class QTestLiteCursor; +class QTestLiteKeyboard; class QTestLiteScreen : public QPlatformScreen { @@ -80,6 +81,7 @@ public: Atom atomForMotifWmHints() const; + QTestLiteKeyboard *keyboard() const; public slots: void eventDispatcher(); @@ -90,6 +92,7 @@ private: int mDepth; QImage::Format mFormat; QTestLiteCursor *mCursor; + QTestLiteKeyboard *mKeyboard; Display * mDisplay; int mScreen; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 5446615..42f2302 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -43,6 +43,7 @@ #include "qtestliteintegration.h" #include "qtestlitescreen.h" +#include "qtestlitekeyboard.h" #include #include @@ -141,26 +142,7 @@ static Qt::MouseButtons translateMouseButtons(int s) return ret; } -static Qt::KeyboardModifiers translateModifiers(int s) -{ - const uchar qt_alt_mask = Mod1Mask; - const uchar qt_meta_mask = Mod4Mask; - - Qt::KeyboardModifiers ret = 0; - if (s & ShiftMask) - ret |= Qt::ShiftModifier; - if (s & ControlMask) - ret |= Qt::ControlModifier; - if (s & qt_alt_mask) - ret |= Qt::AltModifier; - if (s & qt_meta_mask) - ret |= Qt::MetaModifier; -#if 0 - if (s & qt_mode_switch_mask) - ret |= Qt::GroupSwitchModifier; -#endif - return ret; -} + void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) { @@ -168,7 +150,7 @@ void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) Qt::MouseButton button = Qt::NoButton; Qt::MouseButtons buttons = translateMouseButtons(e->state); - Qt::KeyboardModifiers modifiers = translateModifiers(e->state); + Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); if (type != QEvent::MouseMove) { switch (e->button) { case Button1: button = Qt::LeftButton; break; @@ -231,312 +213,7 @@ void QTestLiteWindow::handleFocusOutEvent() QWindowSystemInterface::handleWindowActivated(0); } -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Key event stuff -- not pretty either -// -// What we want to do is to port Robert's keytable code properly - -// keyboard mapping table -static const unsigned int keyTbl[] = { - - // misc keys - - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq - 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq - - // cursor movement - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - // modifiers - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab - 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) - 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) - - // numeric and function keypad keys - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - //XK_KP_F1, Qt::Key_F1, - //XK_KP_F2, Qt::Key_F2, - //XK_KP_F3, Qt::Key_F3, - //XK_KP_F4, Qt::Key_F4, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - // International input method support keys - - // International & multi-key character composition - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - // Misc Functions - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - // Japanese keyboard support - XK_Kanji, Qt::Key_Kanji, - XK_Muhenkan, Qt::Key_Muhenkan, - //XK_Henkan_Mode, Qt::Key_Henkan_Mode, - XK_Henkan_Mode, Qt::Key_Henkan, - XK_Henkan, Qt::Key_Henkan, - XK_Romaji, Qt::Key_Romaji, - XK_Hiragana, Qt::Key_Hiragana, - XK_Katakana, Qt::Key_Katakana, - XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, - XK_Zenkaku, Qt::Key_Zenkaku, - XK_Hankaku, Qt::Key_Hankaku, - XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, - XK_Touroku, Qt::Key_Touroku, - XK_Massyo, Qt::Key_Massyo, - XK_Kana_Lock, Qt::Key_Kana_Lock, - XK_Kana_Shift, Qt::Key_Kana_Shift, - XK_Eisu_Shift, Qt::Key_Eisu_Shift, - XK_Eisu_toggle, Qt::Key_Eisu_toggle, - //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, - //XK_Zen_Koho, Qt::Key_Zen_Koho, - //XK_Mae_Koho, Qt::Key_Mae_Koho, - XK_Kanji_Bangou, Qt::Key_Codeinput, - XK_Zen_Koho, Qt::Key_MultipleCandidate, - XK_Mae_Koho, Qt::Key_PreviousCandidate, - -#ifdef XK_KOREAN - // Korean keyboard support - XK_Hangul, Qt::Key_Hangul, - XK_Hangul_Start, Qt::Key_Hangul_Start, - XK_Hangul_End, Qt::Key_Hangul_End, - XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, - XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, - XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, - //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, - XK_Hangul_Codeinput, Qt::Key_Codeinput, - XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, - XK_Hangul_Banja, Qt::Key_Hangul_Banja, - XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, - XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, - //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, - //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, - //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, - XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, - XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, - XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, - XK_Hangul_Special, Qt::Key_Hangul_Special, - //XK_Hangul_switch, Qt::Key_Hangul_switch, - XK_Hangul_switch, Qt::Key_Mode_switch, -#endif // XK_KOREAN - - // dead keys - XK_dead_grave, Qt::Key_Dead_Grave, - XK_dead_acute, Qt::Key_Dead_Acute, - XK_dead_circumflex, Qt::Key_Dead_Circumflex, - XK_dead_tilde, Qt::Key_Dead_Tilde, - XK_dead_macron, Qt::Key_Dead_Macron, - XK_dead_breve, Qt::Key_Dead_Breve, - XK_dead_abovedot, Qt::Key_Dead_Abovedot, - XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, - XK_dead_abovering, Qt::Key_Dead_Abovering, - XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, - XK_dead_caron, Qt::Key_Dead_Caron, - XK_dead_cedilla, Qt::Key_Dead_Cedilla, - XK_dead_ogonek, Qt::Key_Dead_Ogonek, - XK_dead_iota, Qt::Key_Dead_Iota, - XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, - XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, - XK_dead_belowdot, Qt::Key_Dead_Belowdot, - XK_dead_hook, Qt::Key_Dead_Hook, - XK_dead_horn, Qt::Key_Dead_Horn, - -#if 0 - // Special multimedia keys - // currently only tested with MS internet keyboard - - // browsing keys - XF86XK_Back, Qt::Key_Back, - XF86XK_Forward, Qt::Key_Forward, - XF86XK_Stop, Qt::Key_Stop, - XF86XK_Refresh, Qt::Key_Refresh, - XF86XK_Favorites, Qt::Key_Favorites, - XF86XK_AudioMedia, Qt::Key_LaunchMedia, - XF86XK_OpenURL, Qt::Key_OpenUrl, - XF86XK_HomePage, Qt::Key_HomePage, - XF86XK_Search, Qt::Key_Search, - - // media keys - XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, - XF86XK_AudioMute, Qt::Key_VolumeMute, - XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, - XF86XK_AudioPlay, Qt::Key_MediaPlay, - XF86XK_AudioStop, Qt::Key_MediaStop, - XF86XK_AudioPrev, Qt::Key_MediaPrevious, - XF86XK_AudioNext, Qt::Key_MediaNext, - XF86XK_AudioRecord, Qt::Key_MediaRecord, - - // launch keys - XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, - XF86XK_Calculator, Qt::Key_Launch1, - XF86XK_Standby, Qt::Key_Standby, - - XF86XK_Launch0, Qt::Key_Launch2, - XF86XK_Launch1, Qt::Key_Launch3, - XF86XK_Launch2, Qt::Key_Launch4, - XF86XK_Launch3, Qt::Key_Launch5, - XF86XK_Launch4, Qt::Key_Launch6, - XF86XK_Launch5, Qt::Key_Launch7, - XF86XK_Launch6, Qt::Key_Launch8, - XF86XK_Launch7, Qt::Key_Launch9, - XF86XK_Launch8, Qt::Key_LaunchA, - XF86XK_Launch9, Qt::Key_LaunchB, - XF86XK_LaunchA, Qt::Key_LaunchC, - XF86XK_LaunchB, Qt::Key_LaunchD, - XF86XK_LaunchC, Qt::Key_LaunchE, - XF86XK_LaunchD, Qt::Key_LaunchF, -#endif - -#if 0 - // Qtopia keys - QTOPIAXK_Select, Qt::Key_Select, - QTOPIAXK_Yes, Qt::Key_Yes, - QTOPIAXK_No, Qt::Key_No, - QTOPIAXK_Cancel, Qt::Key_Cancel, - QTOPIAXK_Printer, Qt::Key_Printer, - QTOPIAXK_Execute, Qt::Key_Execute, - QTOPIAXK_Sleep, Qt::Key_Sleep, - QTOPIAXK_Play, Qt::Key_Play, - QTOPIAXK_Zoom, Qt::Key_Zoom, - QTOPIAXK_Context1, Qt::Key_Context1, - QTOPIAXK_Context2, Qt::Key_Context2, - QTOPIAXK_Context3, Qt::Key_Context3, - QTOPIAXK_Context4, Qt::Key_Context4, - QTOPIAXK_Call, Qt::Key_Call, - QTOPIAXK_Hangup, Qt::Key_Hangup, - QTOPIAXK_Flip, Qt::Key_Flip, -#endif - 0, 0 -}; - -static int lookupCode(unsigned int xkeycode) -{ - if (xkeycode >= XK_F1 && xkeycode <= XK_F35) - return Qt::Key_F1 + (int(xkeycode) - XK_F1); - - const unsigned int *p = keyTbl; - while (*p) { - if (*p == xkeycode) - return *++p; - p += 2; - } - - return 0; -} - -static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) -{ - switch (qtcode) { - case Qt::Key_Control: - return Qt::ControlModifier; - case Qt::Key_Alt: - return Qt::AltModifier; - case Qt::Key_Shift: - return Qt::ShiftModifier; - case Qt::Key_Meta: - return Qt::MetaModifier; - default: - return Qt::NoModifier; - } -} - -void QTestLiteWindow::handleKeyEvent(QEvent::Type type, void *ev) -{ - XKeyEvent *e = static_cast(ev); - - KeySym keySym; - QByteArray chars; - chars.resize(513); - int count = XLookupString(e, chars.data(), chars.size(), &keySym, 0); - Q_UNUSED(count); -// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; -// if (count) -// qDebug() << hex << int(chars[0]) << "String:" << chars; - - Qt::KeyboardModifiers modifiers = translateModifiers(e->state); - - int qtcode = lookupCode(keySym); -// qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; - - //X11 specifies state *before*, Qt expects state *after* the event - - modifiers ^= modifierFromKeyCode(qtcode); - - if (qtcode) { - QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers); - } else if (chars[0]) { - int qtcode = chars.toUpper()[0]; //Not exactly right... - if (modifiers & Qt::ControlModifier && qtcode < ' ') - qtcode = chars[0] + '@'; - QWindowSystemInterface::handleKeyEvent(0, e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); - } else { - qWarning() << "unknown X keycode" << hex << e->keycode << keySym; - } -} void QTestLiteWindow::setGeometry(const QRect &rect) { diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 7e990ee..35ba677 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -93,7 +93,6 @@ public: void mousePressEvent(XButtonEvent*); void handleMouseEvent(QEvent::Type, XButtonEvent *ev); - void handleKeyEvent(QEvent::Type, void *); void handleCloseEvent(); void handleEnterEvent(); void handleLeaveEvent(); diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index ef977bf..d2f2562 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -9,14 +9,16 @@ SOURCES = \ qtestlitewindowsurface.cpp \ qtestlitewindow.cpp \ qtestlitecursor.cpp \ - qtestlitescreen.cpp + qtestlitescreen.cpp \ + qtestlitekeyboard.cpp HEADERS = \ qtestliteintegration.h \ qtestlitewindowsurface.h \ qtestlitewindow.h \ qtestlitecursor.h \ - qtestlitescreen.h + qtestlitescreen.h \ + qtestlitekeyboard.h LIBS += -lX11 -lXext -- cgit v0.12 From 91a438cad2139ae33f8a18c8ca8f81a41795ebe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 17 Dec 2010 08:51:53 +0100 Subject: Add basic mouse context menues to lighthouse --- src/gui/kernel/qapplication_qpa.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index a587e8e..a164c2d 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -735,7 +735,15 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse cursor.data()->pointerEvent(ev); } + int oldOpenPopupCount = openPopupCount; QApplication::sendSpontaneousEvent(mouseWidget, &ev); + +#ifndef QT_NO_CONTEXTMENU + if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { + QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, modifiers); + QApplication::sendSpontaneousEvent(mouseWidget, &e); + } +#endif // QT_NO_CONTEXTMENU } -- cgit v0.12 From d79b18d59cc39396f4993a294f24cfb804be728f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 20 Dec 2010 10:24:48 +0100 Subject: Make TestLite show windows in correct position --- src/plugins/platforms/testlite/qtestlitewindow.cpp | 28 +++++++++++++++++++--- src/plugins/platforms/testlite/qtestlitewindow.h | 2 ++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 42f2302..6f9ad58 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -517,10 +517,13 @@ void QTestLiteWindow::setVisible(bool visible) #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif - if (visible) - XMapWindow(mScreen->display(), x_window); - else + if (visible) { + //ensure that the window is viewed in correct position. + doSizeHints(); + XMapWindow(mScreen->display(), x_window); + } else { XUnmapWindow(mScreen->display(), x_window); + } } void QTestLiteWindow::setCursor(const Cursor &cursor) @@ -552,4 +555,23 @@ GC QTestLiteWindow::graphicsContext() const return gc; } +void QTestLiteWindow::doSizeHints() +{ + Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); + XSizeHints s; + s.flags = 0; + QRect g = geometry(); + s.x = g.x(); + s.y = g.y(); + s.width = g.width(); + s.height = g.height(); + s.flags |= USPosition; + s.flags |= PPosition; + s.flags |= USSize; + s.flags |= PSize; + s.flags |= PWinGravity; + s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; + XSetWMNormalHints(mScreen->display(), x_window, &s); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 35ba677..4b952dc 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -126,6 +126,8 @@ protected: void setMWMHints(const QtMWMHints &mwmhints); QtMWMHints getMWMHints() const; + void doSizeHints(); + private: Window x_window; GC gc; -- cgit v0.12 From a7fbc64969168fef3285901e383a044692bebfd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 20 Dec 2010 10:36:00 +0100 Subject: Lighthouse: fix keyboard problem in testlite --- src/plugins/platforms/testlite/qtestlitekeyboard.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp index c18de59..be7a686 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -834,7 +834,7 @@ QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, if (chars.isEmpty()) chars.resize(1); chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later - count++; + count = 1; } } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { converted = (ushort) (keysym - 0x1000000); @@ -935,9 +935,9 @@ void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyE Qt::KeyboardModifiers modifiers; QByteArray chars; chars.resize(513); - int count = 1; + int count = 0; KeySym keySym; count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text); + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); } -- cgit v0.12 From f03d9c91d7576974d1a156749c1e159468f2451a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 28 Dec 2010 15:26:19 +0100 Subject: Initial support for WS specific clipboard support in Lighthouse default implementation in QPlatformIntegration still supports in process copy/paste --- src/gui/kernel/kernel.pri | 6 +- src/gui/kernel/qclipboard_qpa.cpp | 82 ++++------------------ src/gui/kernel/qdnd_p.h | 2 +- src/gui/kernel/qplatformclipboard_qpa.cpp | 101 ++++++++++++++++++++++++++++ src/gui/kernel/qplatformclipboard_qpa.h | 70 +++++++++++++++++++ src/gui/kernel/qplatformintegration_qpa.cpp | 18 +++++ src/gui/kernel/qplatformintegration_qpa.h | 4 +- 7 files changed, 209 insertions(+), 74 deletions(-) create mode 100644 src/gui/kernel/qplatformclipboard_qpa.cpp create mode 100644 src/gui/kernel/qplatformclipboard_qpa.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 4261e93..0ff3d88 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -222,7 +222,8 @@ qpa { kernel/qplatformglcontext_qpa.h \ kernel/qdesktopwidget_qpa_p.h \ kernel/qplatformeventloopintegration_qpa.h \ - kernel/qplatformcursor_qpa.h + kernel/qplatformcursor_qpa.h \ + kernel/qplatformclipboard_qpa.h SOURCES += \ kernel/qapplication_qpa.cpp \ @@ -244,7 +245,8 @@ qpa { kernel/qplatformwindowformat_qpa.cpp \ kernel/qplatformeventloopintegration_qpa.cpp \ kernel/qplatformglcontext_qpa.cpp \ - kernel/qplatformcursor_qpa.cpp + kernel/qplatformcursor_qpa.cpp \ + kernel/qplatformclipboard_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp index 92b9e83..b8ce60e 100644 --- a/src/gui/kernel/qclipboard_qpa.cpp +++ b/src/gui/kernel/qclipboard_qpa.cpp @@ -44,73 +44,16 @@ #ifndef QT_NO_CLIPBOARD #include "qmimedata.h" -#include "qapplication.h" +#include "private/qapplication_p.h" +#include "qplatformclipboard_qpa.h" QT_BEGIN_NAMESPACE QT_USE_NAMESPACE - -class QClipboardData -{ -public: - QClipboardData(); - ~QClipboardData(); - - void setSource(QMimeData* s) - { - if (s == src) - return; - delete src; - src = s; - } - QMimeData* source() - { return src; } - - void clear(); - -private: - QMimeData* src; -}; - -QClipboardData::QClipboardData() -{ - src = 0; -} - -QClipboardData::~QClipboardData() -{ - delete src; -} - -void QClipboardData::clear() -{ - delete src; - src = 0; -} - - -static QClipboardData *internalCbData = 0; - -static void cleanupClipboardData() -{ - delete internalCbData; - internalCbData = 0; -} - -static QClipboardData *clipboardData() -{ - if (internalCbData == 0) { - internalCbData = new QClipboardData; - qAddPostRoutine(cleanupClipboardData); - } - return internalCbData; -} - - void QClipboard::clear(Mode mode) { - setText(QString(), mode); + setMimeData(0,mode); } @@ -121,26 +64,25 @@ bool QClipboard::event(QEvent *e) const QMimeData* QClipboard::mimeData(Mode mode) const { - if (mode != Clipboard) return 0; - - QClipboardData *d = clipboardData(); - return d->source(); + QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard(); + if (!clipboard->supportsMode(mode)) return 0; + return clipboard->mimeData(mode); } void QClipboard::setMimeData(QMimeData* src, Mode mode) { - if (mode != Clipboard) return; - - QClipboardData *d = clipboardData(); + QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard(); + if (!clipboard->supportsMode(mode)) return; - d->setSource(src); + clipboard->setMimeData(src,mode); - emitChanged(QClipboard::Clipboard); + emitChanged(mode); } bool QClipboard::supportsMode(Mode mode) const { - return (mode == Clipboard); + QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard(); + return clipboard->supportsMode(mode); } bool QClipboard::ownsMode(Mode mode) const diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index 598a9de..7b23630 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -76,7 +76,7 @@ class QEventLoop; #if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD)) -class QInternalMimeData : public QMimeData +class Q_GUI_EXPORT QInternalMimeData : public QMimeData { Q_OBJECT public: diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp new file mode 100644 index 0000000..fff4e19 --- /dev/null +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qplatformclipboard_qpa.h" + +QT_BEGIN_NAMESPACE + +class QClipboardData +{ +public: + QClipboardData(); + ~QClipboardData(); + + void setSource(QMimeData* s) + { + if (s == src) + return; + delete src; + src = s; + } + QMimeData* source() + { return src; } + +private: + QMimeData* src; +}; + +QClipboardData::QClipboardData() +{ + src = 0; +} + +QClipboardData::~QClipboardData() +{ + delete src; +} + +Q_GLOBAL_STATIC(QClipboardData,q_clipboardData); + +QPlatformClipboard::~QPlatformClipboard() +{ + +} + +const QMimeData *QPlatformClipboard::mimeData(QClipboard::Mode mode) const +{ + //we know its clipboard + Q_UNUSED(mode); + return q_clipboardData()->source(); +} + +void QPlatformClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + //we know its clipboard + Q_UNUSED(mode); + q_clipboardData()->setSource(data); +} + +bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const +{ + return mode == QClipboard::Clipboard; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h new file mode 100644 index 0000000..3f7bfbb --- /dev/null +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMCLIPBOARD_QPA_H +#define QPLATFORMCLIPBOARD_QPA_H + +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QPlatformClipboard +{ +public: + virtual ~QPlatformClipboard(); + + virtual const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard ) const; + virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); + virtual bool supportsMode(QClipboard::Mode mode) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif //QPLATFORMCLIPBOARD_QPA_H diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 9b6e590..0cac57d 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -42,6 +42,7 @@ #include "qplatformintegration_qpa.h" #include +#include QT_BEGIN_NAMESPACE @@ -94,6 +95,23 @@ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const } /*! + Accessor for the platform integrations clipboard. + + Default implementation returns a default QPlatformClipboard. + + \sa QPlatformClipboard + +*/ +QPlatformClipboard *QPlatformIntegration::clipboard() const +{ + static QPlatformClipboard *clipboard = 0; + if (!clipboard) { + clipboard = new QPlatformClipboard; + } + return clipboard; +} + +/*! \class QPlatformIntegration \since 4.8 \internal diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index f01b4f4..7050245 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -59,6 +59,7 @@ class QBlittable; class QWidget; class QPlatformEventLoopIntegration; class QPlatformFontDatabase; +class QPlatformClipboard; class Q_GUI_EXPORT QPlatformIntegration { @@ -76,8 +77,9 @@ public: virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; -//Fontdatabase integration. +//Deeper window system integrations virtual QPlatformFontDatabase *fontDatabase() const; + virtual QPlatformClipboard *clipboard() const; // Experimental in mainthread eventloop integration // This should only be used if it is only possible to do window system event processing in -- cgit v0.12 From 1097310a4ff0bda0f3c5a0204c42ed40035e6dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 28 Dec 2010 15:27:52 +0100 Subject: Fix keyboard when using modifiers for testlite --- src/plugins/platforms/testlite/qtestlitekeyboard.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp index be7a686..93d21b3 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -929,15 +929,32 @@ void QTestLiteKeyboard::changeLayout() } +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) { int qtcode = 0; - Qt::KeyboardModifiers modifiers; + Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); QByteArray chars; chars.resize(513); int count = 0; KeySym keySym; count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); + modifiers ^= modifierFromKeyCode(qtcode); QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); } -- cgit v0.12 From c33402ff531c1667305907963c221b88dd168691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 28 Dec 2010 15:44:47 +0100 Subject: Copy/Paste in testlite and also added QTestLiteStaticInfo which is a class to resolve atoms etc. --- .../platforms/testlite/qtestliteclipboard.cpp | 519 +++++++++++++++++++++ .../platforms/testlite/qtestliteclipboard.h | 52 +++ .../platforms/testlite/qtestliteintegration.cpp | 13 + .../platforms/testlite/qtestliteintegration.h | 4 +- src/plugins/platforms/testlite/qtestlitemime.cpp | 362 ++++++++++++++ src/plugins/platforms/testlite/qtestlitemime.h | 42 ++ src/plugins/platforms/testlite/qtestlitescreen.cpp | 133 ++++-- src/plugins/platforms/testlite/qtestlitescreen.h | 16 +- .../platforms/testlite/qtestlitestaticinfo.cpp | 417 +++++++++++++++++ .../platforms/testlite/qtestlitestaticinfo.h | 371 +++++++++++++++ src/plugins/platforms/testlite/qtestlitewindow.cpp | 36 +- src/plugins/platforms/testlite/testlite.pro | 10 +- 12 files changed, 1899 insertions(+), 76 deletions(-) create mode 100644 src/plugins/platforms/testlite/qtestliteclipboard.cpp create mode 100644 src/plugins/platforms/testlite/qtestliteclipboard.h create mode 100644 src/plugins/platforms/testlite/qtestlitemime.cpp create mode 100644 src/plugins/platforms/testlite/qtestlitemime.h create mode 100644 src/plugins/platforms/testlite/qtestlitestaticinfo.cpp create mode 100644 src/plugins/platforms/testlite/qtestlitestaticinfo.h diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp new file mode 100644 index 0000000..fdd6d30 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestliteclipboard.cpp @@ -0,0 +1,519 @@ +#include "qtestliteclipboard.h" + +#include "qtestlitescreen.h" +#include "qtestlitemime.h" + +#include + +#include + +const int QTestLiteClipboard::clipboard_timeout = 5000; + +QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) + : QPlatformClipboard() + , m_screen(screen) + , m_xClipboard(0) + , m_clientClipboard(0) + , m_xSelection(0) + , m_clientSelection(0) + , m_requestor(XNone) + , m_owner(XNone) +{ +} + +const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard) { + if (!m_xClipboard) { + QTestLiteClipboard *that = const_cast(this); + that->m_xClipboard = new QTestLiteMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD)); + if (clipboardOwner == owner()) { + return m_clientClipboard; + } else { + return m_xClipboard; + } + } + return 0; +} + +void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + Atom modeAtom; + QMimeData **d; + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + d = &m_clientSelection; + break; + + case QClipboard::Clipboard: + modeAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD); + d = &m_clientClipboard; + break; + + default: + qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); + return; + } + + Window newOwner; + + if (! data) { // no data, clear clipboard contents + newOwner = XNone; + } else { + newOwner = owner(); + + *d = data; + } + + XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); + + if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { +// qWarning("QClipboard::setData: Cannot set X11 selection owner for %s", +// xdndAtomToString(atom).data()); + *d = 0; + return; + } + +} + +QTestLiteScreen * QTestLiteClipboard::screen() const +{ + return m_screen; +} + +Window QTestLiteClipboard::requestor() const +{ + if (!m_requestor) { + int x = 0, y = 0, w = 3, h = 3; + QTestLiteClipboard *that = const_cast(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setRequestor(window); + } + return m_requestor; +} + +void QTestLiteClipboard::setRequestor(Window window) +{ + if (m_requestor != XNone) { + XDestroyWindow(m_screen->display(),m_requestor); + } + m_requestor = window; +} + +Window QTestLiteClipboard::owner() const +{ + if (!m_owner) { + int x = 0, y = 0, w = 3, h = 3; + QTestLiteClipboard *that = const_cast(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setOwner(window); + } + return m_owner; +} + +void QTestLiteClipboard::setOwner(Window window) +{ + if (m_owner != XNone){ + XDestroyWindow(m_screen->display(),m_owner); + } + m_owner = window; +} + +Atom QTestLiteClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +{ + QVector types; + QStringList formats = QInternalMimeData::formatsHelper(d); + for (int i = 0; i < formats.size(); ++i) { + QList atoms = QTestLiteMime::xdndMimeAtomsForFormat(screen()->display(),formats.at(i)); + for (int j = 0; j < atoms.size(); ++j) { + if (!types.contains(atoms.at(j))) + types.append(atoms.at(j)); + } + } + types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TARGETS)); + types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::MULTIPLE)); + types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TIMESTAMP)); + types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::SAVE_TARGETS)); + + XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, + PropModeReplace, (uchar *) types.data(), types.size()); + return property; +} + +Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +{ + Atom atomFormat = target; + int dataFormat = 0; + QByteArray data; + + QString fmt = QTestLiteMime::xdndMimeAtomToString(screen()->display(), target); + if (fmt.isEmpty()) { // Not a MIME type we have + qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); + return XNone; + } + qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); + + if (QTestLiteMime::xdndMimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + + // don't allow INCR transfers when using MULTIPLE or to + // Motif clients (since Motif doesn't support INCR) + static Atom motif_clip_temporary = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIP_TEMPORARY); + bool allow_incr = property != motif_clip_temporary; + + // X_ChangeProperty protocol request is 24 bytes + const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; + if (data.size() > increment && allow_incr) { + long bytes = data.size(); + XChangeProperty(screen()->display(), window, property, + QTestLiteStaticInfo::atom(QTestLiteStaticInfo::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + +// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); + qDebug() << "not implemented INCRT just YET!"; + return property; + } + + // make sure we can perform the XChangeProperty in a single request + if (data.size() > increment) + return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? + int dataSize = data.size() / (dataFormat / 8); + // use a single request to transfer data + XChangeProperty(screen()->display(), window, property, atomFormat, + dataFormat, PropModeReplace, (uchar *) data.data(), + dataSize); + } + return property; +} + +void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) +{ + XSelectionRequestEvent *req = &xevent->xselectionrequest; + + if (requestor() && req->requestor == requestor()) { + qDebug() << "This should be caught before"; + return; + } + + XEvent event; + event.xselection.type = SelectionNotify; + event.xselection.display = req->display; + event.xselection.requestor = req->requestor; + event.xselection.selection = req->selection; + event.xselection.target = req->target; + event.xselection.property = XNone; + event.xselection.time = req->time; + + QMimeData *d; + if (req->selection == XA_PRIMARY) { + d = m_clientSelection; + } else if (req->selection == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD)) { + d = m_clientClipboard; + } else { + qWarning("QClipboard: Unknown selection '%lx'", req->selection); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + if (!d) { + qWarning("QClipboard: Cannot transfer data, no data available"); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + Atom xa_targets = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TARGETS); + Atom xa_multiple = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::MULTIPLE); + Atom xa_timestamp = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TIMESTAMP); + + struct AtomPair { Atom target; Atom property; } *multi = 0; + Atom multi_type = XNone; + int multi_format = 0; + int nmulti = 0; + int imulti = -1; + bool multi_writeback = false; + + if (req->target == xa_multiple) { + QByteArray multi_data; + if (req->property == XNone + || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, + 0, &multi_type, &multi_format) + || multi_format != 32) { + // MULTIPLE property not formatted correctly + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + nmulti = multi_data.size()/sizeof(*multi); + multi = new AtomPair[nmulti]; + memcpy(multi,multi_data.data(),multi_data.size()); + imulti = 0; + } + + for (; imulti < nmulti; ++imulti) { + Atom target; + Atom property; + + if (multi) { + target = multi[imulti].target; + property = multi[imulti].property; + } else { + target = req->target; + property = req->property; + if (property == XNone) // obsolete client + property = target; + } + + Atom ret = XNone; + if (target == XNone || property == XNone) { + ; + } else if (target == xa_timestamp) { +// if (d->timestamp != CurrentTime) { + XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, + PropModeReplace, CurrentTime, 1); + ret = property; +// } else { +// qWarning("QClipboard: Invalid data timestamp"); +// } + } else if (target == xa_targets) { + ret = sendTargetsSelection(d, req->requestor, property); + } else { + ret = sendSelection(d, target, req->requestor, property); + } + + if (nmulti > 0) { + if (ret == XNone) { + multi[imulti].property = XNone; + multi_writeback = true; + } + } else { + event.xselection.property = ret; + break; + } + } + + if (nmulti > 0) { + if (multi_writeback) { + // according to ICCCM 2.6.2 says to put None back + // into the original property on the requestor window + XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, + PropModeReplace, (uchar *) multi, nmulti * 2); + } + + delete [] multi; + event.xselection.property = req->property; + } + + // send selection notify to requestor + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); +} + +static inline int maxSelectionIncr(Display *dpy) +{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } + +bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +{ + int maxsize = maxSelectionIncr(screen()->display()); + ulong bytes_left; // bytes_after + ulong length; // nitems + uchar *data; + Atom dummy_type; + int dummy_format; + int r; + + if (!type) // allow null args + type = &dummy_type; + if (!format) + format = &dummy_format; + + // Don't read anything, just get the size of the property data + r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, + AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) { + buffer->resize(0); + return false; + } + XFree((char*)data); + + int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; + + switch (*format) { + case 8: + default: + format_inc = sizeof(char) / 1; + break; + + case 16: + format_inc = sizeof(short) / 2; + proplen *= sizeof(short) / 2; + break; + + case 32: + format_inc = sizeof(long) / 4; + proplen *= sizeof(long) / 4; + break; + } + + int newSize = proplen; + buffer->resize(newSize); + + bool ok = (buffer->size() == newSize); + + if (ok && newSize) { + // could allocate buffer + + while (bytes_left) { + // more to read... + + r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, + False, AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) + break; + + offset += length / (32 / *format); + length *= format_inc * (*format) / 8; + + // Here we check if we get a buffer overflow and tries to + // recover -- this shouldn't normally happen, but it doesn't + // hurt to be defensive + if ((int)(buffer_offset + length) > buffer->size()) { + length = buffer->size() - buffer_offset; + + // escape loop + bytes_left = 0; + } + + memcpy(buffer->data() + buffer_offset, data, length); + buffer_offset += length; + + XFree((char*)data); + } + + if (*format == 8 && *type == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) { + // convert COMPOUND_TEXT to a multibyte string + XTextProperty textprop; + textprop.encoding = *type; + textprop.format = *format; + textprop.nitems = buffer_offset; + textprop.value = (unsigned char *) buffer->data(); + + char **list_ret = 0; + int count; + if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, + &count) == Success && count && list_ret) { + offset = buffer_offset = strlen(list_ret[0]); + buffer->resize(offset); + memcpy(buffer->data(), list_ret[0], offset); + } + if (list_ret) XFreeStringList(list_ret); + } + } + + // correct size, not 0-term. + if (size) + *size = buffer_offset; + + if (deleteProperty) + XDeleteProperty(screen()->display(), win, property); + + XFlush(screen()->display()); + + return ok; +} + +QByteArray QTestLiteClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +{ + XEvent event; + + QByteArray buf; + QByteArray tmp_buf; + bool alloc_error = false; + int length; + int offset = 0; + + if (nbytes > 0) { + // Reserve buffer + zero-terminator (for text data) + // We want to complete the INCR transfer even if we cannot + // allocate more memory + buf.resize(nbytes+1); + alloc_error = buf.size() != nbytes+1; + } + + for (;;) { + XFlush(screen()->display()); + if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) + break; + if (event.xproperty.atom != property || + event.xproperty.state != PropertyNewValue) + continue; + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (length == 0) { // no more data, we're done + if (nullterm) { + buf.resize(offset+1); + buf[offset] = '\0'; + } else { + buf.resize(offset); + } + return buf; + } else if (!alloc_error) { + if (offset+length > (int)buf.size()) { + buf.resize(offset+length+65535); + if (buf.size() != offset+length+65535) { + alloc_error = true; + length = buf.size() - offset; + } + } + memcpy(buf.data()+offset, tmp_buf.constData(), length); + tmp_buf.resize(0); + offset += length; + } + } else { + break; + } + } + + // timed out ... create a new requestor window, otherwise the requestor + // could consider next request to be still part of this timed out request + setRequestor(0); + + return QByteArray(); +} + +QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +{ + QByteArray buf; + + Window win = requestor(); + + XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events + + XDeleteProperty(screen()->display(), win, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION), win, CurrentTime); + XSync(screen()->display(), false); + + XEvent xevent; + if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || + xevent.xselection.property == XNone) { + return buf; + } + + Atom type; + XSelectInput(screen()->display(), win, PropertyChangeMask); + + if (clipboardReadProperty(win, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::INCR)) { + int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; + buf = clipboardReadIncrementalProperty(win, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION), nbytes, false); + } + } + + XSelectInput(screen()->display(), win, NoEventMask); + + + return buf; +} diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.h b/src/plugins/platforms/testlite/qtestliteclipboard.h new file mode 100644 index 0000000..31e42b7 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestliteclipboard.h @@ -0,0 +1,52 @@ +#ifndef QTESTLITECLIPBOARD_H +#define QTESTLITECLIPBOARD_H + +#include +#include "qtestlitestaticinfo.h" + +class QTestLiteScreen; +class QTestLiteMime; +class QTestLiteClipboard : public QPlatformClipboard +{ +public: + QTestLiteClipboard(QTestLiteScreen *screen); + + const QMimeData *mimeData(QClipboard::Mode mode) const; + void setMimeData(QMimeData *data, QClipboard::Mode mode); + + QTestLiteScreen *screen() const; + + Window requestor() const; + void setRequestor(Window window); + + Window owner() const; + + void handleSelectionRequest(XEvent *event); + + bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; + QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); + + QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); + +private: + void setOwner(Window window); + + Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); + Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); + + QTestLiteScreen *m_screen; + + QTestLiteMime *m_xClipboard; + QMimeData *m_clientClipboard; + + QTestLiteMime *m_xSelection; + QMimeData *m_clientSelection; + + Window m_requestor; + Window m_owner; + + static const int clipboard_timeout; + +}; + +#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index fc2a89c..537e22a 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -47,6 +47,7 @@ #include "qtestlitewindow.h" #include "qgenericunixfontdatabase.h" #include "qtestlitescreen.h" +#include "qtestliteclipboard.h" #ifndef QT_NO_OPENGL #include @@ -60,6 +61,7 @@ QT_BEGIN_NAMESPACE QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) : mUseOpenGL(useOpenGL) , mFontDb(new QGenericUnixFontDatabase()) + , mClipboard(0) { mPrimaryScreen = new QTestLiteScreen(); mScreens.append(mPrimaryScreen); @@ -114,6 +116,16 @@ QPlatformFontDatabase *QTestLiteIntegration::fontDatabase() const return mFontDb; } +QPlatformClipboard * QTestLiteIntegration::clipboard() const +{ + //Use lazy init since clipboard needs QTestliteScreen + if (!mClipboard) { + QTestLiteIntegration *that = const_cast(this); + that->mClipboard = new QTestLiteClipboard(mPrimaryScreen); + } + return mClipboard; +} + bool QTestLiteIntegration::hasOpenGL() const { #ifndef QT_NO_OPENGL @@ -123,4 +135,5 @@ bool QTestLiteIntegration::hasOpenGL() const return false; } + QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 37d09f5..320cf00 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -48,7 +48,7 @@ #include #include -#include +#include "qtestlitestaticinfo.h" QT_BEGIN_NAMESPACE @@ -68,6 +68,7 @@ public: QList screens() const { return mScreens; } QPlatformFontDatabase *fontDatabase() const; + QPlatformClipboard *clipboard() const; bool hasOpenGL() const; @@ -76,6 +77,7 @@ private: QTestLiteScreen *mPrimaryScreen; QList mScreens; QPlatformFontDatabase *mFontDb; + QPlatformClipboard *mClipboard; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp new file mode 100644 index 0000000..6261383 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitemime.cpp @@ -0,0 +1,362 @@ +#include "qtestlitemime.h" + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include + +QTestLiteMime::QTestLiteMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard) + : QInternalMimeData(), m_clipboard(clipboard) +{ + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + break; + + case QClipboard::Clipboard: + modeAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD); + break; + + default: + qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); + break; + } +} + +QTestLiteMime::~QTestLiteMime() +{ +} + +bool QTestLiteMime::empty() const +{ + Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + + return win == XNone; +} + +QStringList QTestLiteMime::formats_sys() const +{ + if (empty()) + return QStringList(); + + if (!formatList.count()) { + // get the list of targets from the current clipboard owner - we do this + // once so that multiple calls to this function don't require multiple + // server round trips... + + format_atoms = m_clipboard->getDataInFormat(modeAtom,QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TARGETS)); + + if (format_atoms.size() > 0) { + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + + for (int i = 0; i < size; ++i) { + if (targets[i] == 0) + continue; + + QStringList formatsForAtom = xdndMimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + for (int j = 0; j < formatsForAtom.size(); ++j) { + if (!formatList.contains(formatsForAtom.at(j))) + formatList.append(formatsForAtom.at(j)); + } + } + } + } + + return formatList; +} + +bool QTestLiteMime::hasFormat_sys(const QString &format) const +{ + QStringList list = formats(); + return list.contains(format); +} + +QVariant QTestLiteMime::retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const +{ + if (fmt.isEmpty() || empty()) + return QByteArray(); + + (void)formats(); // trigger update of format list + + QList atoms; + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + for (int i = 0; i < size; ++i) + atoms.append(targets[i]); + + QByteArray encoding; + Atom fmtatom = xdndMimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + + if (fmtatom == 0) + return QVariant(); + + return xdndMimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); +} + + +QString QTestLiteMime::xdndMimeAtomToString(Display *display, Atom a) +{ + if (!a) return 0; + + if (a == XA_STRING || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)) { + return "text/plain"; // some Xdnd clients are dumb + } + char *atom = XGetAtomName(display, a); + QString result = QString::fromLatin1(atom); + XFree(atom); + return result; +} + +Atom QTestLiteMime::xdndMimeStringToAtom(Display *display, const QString &mimeType) +{ + if (mimeType.isEmpty()) + return 0; + return XInternAtom(display, mimeType.toLatin1().constData(), False); +} + +QStringList QTestLiteMime::xdndMimeFormatsForAtom(Display *display, Atom a) +{ + QStringList formats; + if (a) { + QString atomName = xdndMimeAtomToString(display, a); + formats.append(atomName); + + // special cases for string type + if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING) + || a == XA_STRING + || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) + || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + formats.append(QLatin1String("text/plain")); + + // special cases for uris + if (atomName == QLatin1String("text/x-moz-url")) + formats.append(QLatin1String("text/uri-list")); + + // special case for images + if (a == XA_PIXMAP) + formats.append(QLatin1String("image/ppm")); + } + return formats; +} + +bool QTestLiteMime::xdndMimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +{ + bool ret = false; + *atomFormat = a; + *dataFormat = 8; + QString atomName = xdndMimeAtomToString(display, a); + if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + if (atomName == QLatin1String("application/x-color")) + *dataFormat = 16; + ret = true; + } else { + if ((a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING) + || a == XA_STRING + || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) + || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { + if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)){ + *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); + ret = true; + } else if (a == XA_STRING) { + *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + ret = true; + } else if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) + || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) { + // the ICCCM states that TEXT and COMPOUND_TEXT are in the + // encoding of choice, so we choose the encoding of the locale + QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + char *list[] = { strData.data(), NULL }; + + XICCEncodingStyle style = (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + ? XCompoundTextStyle : XStdICCTextStyle; + XTextProperty textprop; + if (list[0] != NULL + && XmbTextListToTextProperty(display, list, 1, style, + &textprop) == Success) { + *atomFormat = textprop.encoding; + *dataFormat = textprop.format; + *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); + ret = true; + + XFree(textprop.value); + } + } + } else if (atomName == QLatin1String("text/x-moz-url") && + QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { + QByteArray uri = QInternalMimeData::renderDataHelper( + QLatin1String("text/uri-list"), mimeData).split('\n').first(); + QString mozUri = QString::fromLatin1(uri, uri.size()); + mozUri += QLatin1Char('\n'); + *data = QByteArray(reinterpret_cast(mozUri.utf16()), mozUri.length() * 2); + ret = true; + } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { + QPixmap pm = qvariant_cast(mimeData->imageData()); + if (a == XA_BITMAP && pm.depth() != 1) { + QImage img = pm.toImage(); + img = img.convertToFormat(QImage::Format_MonoLSB); + pm = QPixmap::fromImage(img); + } +// QDragManager *dm = QDragManager::self(); +// if (dm) { +// Pixmap handle = pm.handle(); +// *data = QByteArray((const char *) &handle, sizeof(Pixmap)); +// dm->xdndMimeTransferedPixmap[dm->xdndMimeTransferedPixmapIndex] = pm; +// dm->xdndMimeTransferedPixmapIndex = +// (dm->xdndMimeTransferedPixmapIndex + 1) % 2; +// ret = true; +// } + } + } + return ret && data != 0; +} + +QList QTestLiteMime::xdndMimeAtomsForFormat(Display *display, const QString &format) +{ + QList atoms; + atoms.append(xdndMimeStringToAtom(display, format)); + + // special cases for strings + if (format == QLatin1String("text/plain")) { + atoms.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)); + atoms.append(XA_STRING); + atoms.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT)); + atoms.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)); + } + + // special cases for uris + if (format == QLatin1String("text/uri-list")) { + atoms.append(xdndMimeStringToAtom(display,QLatin1String("text/x-moz-url"))); + } + + //special cases for images + if (format == QLatin1String("image/ppm")) + atoms.append(XA_PIXMAP); + if (format == QLatin1String("image/pbm")) + atoms.append(XA_BITMAP); + + return atoms; +} + +QVariant QTestLiteMime::xdndMimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +{ + QString atomName = xdndMimeAtomToString(display,a); + if (atomName == format) + return data; + + if (!encoding.isEmpty() + && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { + + if (requestedType == QVariant::String) { + QTextCodec *codec = QTextCodec::codecForName(encoding); + if (codec) + return codec->toUnicode(data); + } + + return data; + } + + // special cases for string types + if (format == QLatin1String("text/plain")) { + if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)) + return QString::fromUtf8(data); + if (a == XA_STRING) + return QString::fromLatin1(data); + if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) + || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + // #### might be wrong for COMPUND_TEXT + return QString::fromLocal8Bit(data, data.size()); + } + + // special case for uri types + if (format == QLatin1String("text/uri-list")) { + if (atomName == QLatin1String("text/x-moz-url")) { + // we expect this as utf16 + // the first part is a url that should only contain ascci char + // so it should be safe to check that the second char is 0 + // to verify that it is utf16 + if (data.size() > 1 && data.at(1) == 0) + return QString::fromRawData((const QChar *)data.constData(), + data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); + } + } + + // special cas for images + if (format == QLatin1String("image/ppm")) { + if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { +// Pixmap xpm = *((Pixmap*)data.data()); +// if (!xpm) +// return QByteArray(); +// QPixmap qpm = QPixmap::fromX11Pixmap(xpm); +// QImageWriter imageWriter; +// imageWriter.setFormat("PPMRAW"); +// QImage imageToWrite = qpm.toImage(); +// QBuffer buf; +// buf.open(QIODevice::WriteOnly); +// imageWriter.setDevice(&buf); +// imageWriter.write(imageToWrite); +// return buf.buffer(); + return QVariant(); + } + } + return QVariant(); +} + +Atom QTestLiteMime::xdndMimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) +{ + requestedEncoding->clear(); + + // find matches for string types + if (format == QLatin1String("text/plain")) { + if (atoms.contains(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING))) + return QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING); + if (atoms.contains(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT))) + return QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT); + if (atoms.contains(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT))) + return QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT); + if (atoms.contains(XA_STRING)) + return XA_STRING; + } + + // find matches for uri types + if (format == QLatin1String("text/uri-list")) { + Atom a = xdndMimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + a = xdndMimeStringToAtom(display,QLatin1String("text/x-moz-url")); + if (a && atoms.contains(a)) + return a; + } + + // find match for image + if (format == QLatin1String("image/ppm")) { + if (atoms.contains(XA_PIXMAP)) + return XA_PIXMAP; + } + + // for string/text requests try to use a format with a well-defined charset + // first to avoid encoding problems + if (requestedType == QVariant::String + && format.startsWith(QLatin1String("text/")) + && !format.contains(QLatin1String("charset="))) { + + QString formatWithCharset = format; + formatWithCharset.append(QLatin1String(";charset=utf-8")); + + Atom a = xdndMimeStringToAtom(display,formatWithCharset); + if (a && atoms.contains(a)) { + *requestedEncoding = "utf-8"; + return a; + } + } + + Atom a = xdndMimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + + return 0; +} diff --git a/src/plugins/platforms/testlite/qtestlitemime.h b/src/plugins/platforms/testlite/qtestlitemime.h new file mode 100644 index 0000000..e5ed7b0 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitemime.h @@ -0,0 +1,42 @@ +#ifndef QTESTLITEMIME_H +#define QTESTLITEMIME_H + +#include <private/qdnd_p.h> + +#include <QtGui/QClipboard> + +#include "qtestliteintegration.h" +#include "qtestliteclipboard.h" + +class QTestLiteMime : public QInternalMimeData { + Q_OBJECT +public: + QTestLiteMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard); + ~QTestLiteMime(); + bool empty() const; + + static QList<Atom> xdndMimeAtomsForFormat(Display *display, const QString &format); + static QString xdndMimeAtomToString(Display *display, Atom a); + static bool xdndMimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); + static QStringList xdndMimeFormatsForAtom(Display *display, Atom a); + static Atom xdndMimeStringToAtom(Display *display, const QString &mimeType); + + static QVariant xdndMimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); + static Atom xdndMimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); + + +protected: + virtual bool hasFormat_sys(const QString &mimetype) const; + virtual QStringList formats_sys() const; + + QVariant retrieveData_sys(const QString &mimetype, QVariant::Type type) const; + + +private: + QTestLiteClipboard *m_clipboard; + Atom modeAtom; + mutable QStringList formatList; + mutable QByteArray format_atoms; +}; + +#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp index c0f696d..2ae7028 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -44,9 +44,16 @@ #include "qtestlitecursor.h" #include "qtestlitewindow.h" #include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" +#include "qtestliteclipboard.h" #include <QtCore/QDebug> #include <QtCore/QSocketNotifier> +#include <QtCore/QElapsedTimer> + +#include <private/qapplication_p.h> + +#include <X11/extensions/Xfixes.h> QT_BEGIN_NAMESPACE @@ -183,11 +190,10 @@ qDebug() << "qt_x_errhandler" << err->error_code; QTestLiteScreen::QTestLiteScreen() : mFormat(QImage::Format_RGB32) - , mWmProtocolsAtom(0) - , mWmDeleteWindowAtom(0) { char *display_name = getenv("DISPLAY"); mDisplay = XOpenDisplay(display_name); + mDisplayName = QString::fromLocal8Bit(display_name); if (!mDisplay) { fprintf(stderr, "Cannot connect to X server: %s\n", display_name); @@ -204,6 +210,7 @@ QTestLiteScreen::QTestLiteScreen() XSynchronize(mDisplay, true); mScreen = DefaultScreen(mDisplay); + XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); int width = DisplayWidth(mDisplay, mScreen); int height = DisplayHeight(mDisplay, mScreen); mGeometry = QRect(0,0,width,height); @@ -221,11 +228,6 @@ QTestLiteScreen::QTestLiteScreen() QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - mWmProtocolsAtom = XInternAtom (mDisplay, "WM_PROTOCOLS", False); - mWmDeleteWindowAtom = XInternAtom (mDisplay, "WM_DELETE_WINDOW", False); - - mWmMotifHintAtom = XInternAtom(mDisplay, "_MOTIF_WM_HINTS\0", False); - mCursor = new QTestLiteCursor(this); mKeyboard = new QTestLiteKeyboard(this); } @@ -243,9 +245,6 @@ QTestLiteScreen::~QTestLiteScreen() #undef KeyRelease #endif -//Q_GUI_EXPORT extern Atom wmProtocolsAtom; -//Q_GUI_EXPORT extern Atom wmDeleteWindowAtom; - bool QTestLiteScreen::handleEvent(XEvent *xe) { int quit = false; @@ -254,28 +253,17 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) if (widget) { xw = static_cast<QTestLiteWindow *>(widget->platformWindow()); } - if (!xw) { -#ifdef MYX11_DEBUG - qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; -#endif - return quit; - } + Atom wmProtocolsAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_DELETE_WINDOW); switch (xe->type) { case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom()) { + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom()) + if (a == wmDeleteWindowAtom) xw->handleCloseEvent(); -#ifdef MYX11_DEBUG - qDebug() << "ClientMessage WM_PROTOCOLS" << a; -#endif } -#ifdef MYX11_DEBUG - else - qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; -#endif break; case Expose: @@ -289,15 +277,18 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) break; case ButtonPress: - xw->mousePressEvent(&xe->xbutton); + if (xw) + xw->mousePressEvent(&xe->xbutton); break; case ButtonRelease: - xw->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + if (xw) + xw->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); break; case MotionNotify: - xw->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + if (xw) + xw->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); break; case XKeyPress: @@ -309,20 +300,39 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) break; case EnterNotify: - xw->handleEnterEvent(); + if (xw) + xw->handleEnterEvent(); break; case LeaveNotify: - xw->handleLeaveEvent(); + if (xw) + xw->handleLeaveEvent(); break; case XFocusIn: - xw->handleFocusInEvent(); + if (xw) + xw->handleFocusInEvent(); break; case XFocusOut: - xw->handleFocusOutEvent(); + if (xw) + xw->handleFocusOutEvent(); + break; + + case PropertyNotify: + break; + + case SelectionClear: + qDebug() << "Selection Clear!!!"; + break; + case SelectionRequest: + handleSelectionRequest(xe); break; + case SelectionNotify: + qDebug() << "Selection Notify!!!!"; + + break; + default: #ifdef MYX11_DEBUG @@ -330,9 +340,43 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) #endif break; } + return quit; } +static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) +{ + Atom clipboard = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD); + return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY + || e->xselectionrequest.selection == clipboard)) + || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY + || e->xselectionclear.selection == clipboard))); +} + +bool QTestLiteScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +{ + QElapsedTimer timer; + timer.start(); + do { + if (XCheckTypedWindowEvent(mDisplay,win,type,event)) + return true; + + // process other clipboard events, since someone is probably requesting data from us + XEvent e; + if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) + handleEvent(&e); + + XFlush(mDisplay); + + // sleep 50 ms, so we don't use up CPU cycles all the time. + struct timeval usleep_tv; + usleep_tv.tv_sec = 0; + usleep_tv.tv_usec = 50000; + select(0, 0, 0, 0, &usleep_tv); + } while (timer.elapsed() < timeout); + return false; +} + void QTestLiteScreen::eventDispatcher() { ulong marker = XNextRequest(mDisplay); @@ -409,29 +453,16 @@ int QTestLiteScreen::xScreenNumber() const return mScreen; } -Atom QTestLiteScreen::wmProtocolsAtom() const -{ - return mWmProtocolsAtom; -} - -Atom QTestLiteScreen::wmDeleteWindowAtom() const -{ - return mWmDeleteWindowAtom; -} - -void QTestLiteScreen::setWmDeleteWindowAtom(Atom newDeleteWindowAtom) -{ - mWmDeleteWindowAtom = newDeleteWindowAtom; -} - -Atom QTestLiteScreen::atomForMotifWmHints() const +QTestLiteKeyboard * QTestLiteScreen::keyboard() const { - return mWmMotifHintAtom; + return mKeyboard; } -QTestLiteKeyboard * QTestLiteScreen::keyboard() const +void QTestLiteScreen::handleSelectionRequest(XEvent *event) { - return mKeyboard; + QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QTestLiteClipboard *clipboard = static_cast<QTestLiteClipboard *>(integration->clipboard()); + clipboard->handleSelectionRequest(event); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h index 9a1a510..860a67c 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.h +++ b/src/plugins/platforms/testlite/qtestlitescreen.h @@ -58,6 +58,8 @@ public: ~QTestLiteScreen(); + QString displayName() const { return mDisplayName; } + QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } QImage::Format format() const { return mFormat; } @@ -68,6 +70,8 @@ public: unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } bool handleEvent(XEvent *xe); + bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); + QImage grabWindow(Window window, int x, int y, int w, int h); static QTestLiteScreen *testLiteScreenForWidget(QWidget *widget); @@ -75,18 +79,15 @@ public: Display *display() const; int xScreenNumber() const; - Atom wmProtocolsAtom() const; - Atom wmDeleteWindowAtom() const; - void setWmDeleteWindowAtom(Atom newDeleteWindowAtom); - - Atom atomForMotifWmHints() const; - QTestLiteKeyboard *keyboard() const; public slots: void eventDispatcher(); private: + + void handleSelectionRequest(XEvent *event); + QString mDisplayName; QRect mGeometry; QSize mPhysicalSize; int mDepth; @@ -96,9 +97,6 @@ private: Display * mDisplay; int mScreen; - Atom mWmProtocolsAtom; - Atom mWmDeleteWindowAtom; - Atom mWmMotifHintAtom; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp new file mode 100644 index 0000000..20d73a2 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp @@ -0,0 +1,417 @@ +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <qplatformdefs.h> + +#include <QtGui/private/qapplication_p.h> +#include <QtCore/QBuffer> +#include <QtCore/QLibrary> + +#include <QDebug> + +#ifndef QT_NO_XFIXES +#include <X11/extensions/Xfixes.h> +#endif // QT_NO_XFIXES + +static const char * x11_atomnames = { + // window-manager <-> client protocols + "WM_PROTOCOLS\0" + "WM_DELETE_WINDOW\0" + "WM_TAKE_FOCUS\0" + "_NET_WM_PING\0" + "_NET_WM_CONTEXT_HELP\0" + "_NET_WM_SYNC_REQUEST\0" + "_NET_WM_SYNC_REQUEST_COUNTER\0" + + // ICCCM window state + "WM_STATE\0" + "WM_CHANGE_STATE\0" + + // Session management + "WM_CLIENT_LEADER\0" + "WM_WINDOW_ROLE\0" + "SM_CLIENT_ID\0" + + // Clipboard + "CLIPBOARD\0" + "INCR\0" + "TARGETS\0" + "MULTIPLE\0" + "TIMESTAMP\0" + "SAVE_TARGETS\0" + "CLIP_TEMPORARY\0" + "_QT_SELECTION\0" + "_QT_CLIPBOARD_SENTINEL\0" + "_QT_SELECTION_SENTINEL\0" + "CLIPBOARD_MANAGER\0" + + "RESOURCE_MANAGER\0" + + "_XSETROOT_ID\0" + + "_QT_SCROLL_DONE\0" + "_QT_INPUT_ENCODING\0" + + "_MOTIF_WM_HINTS\0" + + "DTWM_IS_RUNNING\0" + "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" + "_SGI_DESKS_MANAGER\0" + + // EWMH (aka NETWM) + "_NET_SUPPORTED\0" + "_NET_VIRTUAL_ROOTS\0" + "_NET_WORKAREA\0" + + "_NET_MOVERESIZE_WINDOW\0" + "_NET_WM_MOVERESIZE\0" + + "_NET_WM_NAME\0" + "_NET_WM_ICON_NAME\0" + "_NET_WM_ICON\0" + + "_NET_WM_PID\0" + + "_NET_WM_WINDOW_OPACITY\0" + + "_NET_WM_STATE\0" + "_NET_WM_STATE_ABOVE\0" + "_NET_WM_STATE_BELOW\0" + "_NET_WM_STATE_FULLSCREEN\0" + "_NET_WM_STATE_MAXIMIZED_HORZ\0" + "_NET_WM_STATE_MAXIMIZED_VERT\0" + "_NET_WM_STATE_MODAL\0" + "_NET_WM_STATE_STAYS_ON_TOP\0" + "_NET_WM_STATE_DEMANDS_ATTENTION\0" + + "_NET_WM_USER_TIME\0" + "_NET_WM_USER_TIME_WINDOW\0" + "_NET_WM_FULL_PLACEMENT\0" + + "_NET_WM_WINDOW_TYPE\0" + "_NET_WM_WINDOW_TYPE_DESKTOP\0" + "_NET_WM_WINDOW_TYPE_DOCK\0" + "_NET_WM_WINDOW_TYPE_TOOLBAR\0" + "_NET_WM_WINDOW_TYPE_MENU\0" + "_NET_WM_WINDOW_TYPE_UTILITY\0" + "_NET_WM_WINDOW_TYPE_SPLASH\0" + "_NET_WM_WINDOW_TYPE_DIALOG\0" + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" + "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" + "_NET_WM_WINDOW_TYPE_TOOLTIP\0" + "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" + "_NET_WM_WINDOW_TYPE_COMBO\0" + "_NET_WM_WINDOW_TYPE_DND\0" + "_NET_WM_WINDOW_TYPE_NORMAL\0" + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" + + "_KDE_NET_WM_FRAME_STRUT\0" + + "_NET_STARTUP_INFO\0" + "_NET_STARTUP_INFO_BEGIN\0" + + "_NET_SUPPORTING_WM_CHECK\0" + + "_NET_WM_CM_S0\0" + + "_NET_SYSTEM_TRAY_VISUAL\0" + + "_NET_ACTIVE_WINDOW\0" + + // Property formats + "COMPOUND_TEXT\0" + "TEXT\0" + "UTF8_STRING\0" + + // xdnd + "XdndEnter\0" + "XdndPosition\0" + "XdndStatus\0" + "XdndLeave\0" + "XdndDrop\0" + "XdndFinished\0" + "XdndTypeList\0" + "XdndActionList\0" + + "XdndSelection\0" + + "XdndAware\0" + "XdndProxy\0" + + "XdndActionCopy\0" + "XdndActionLink\0" + "XdndActionMove\0" + "XdndActionPrivate\0" + + // Motif DND + "_MOTIF_DRAG_AND_DROP_MESSAGE\0" + "_MOTIF_DRAG_INITIATOR_INFO\0" + "_MOTIF_DRAG_RECEIVER_INFO\0" + "_MOTIF_DRAG_WINDOW\0" + "_MOTIF_DRAG_TARGETS\0" + + "XmTRANSFER_SUCCESS\0" + "XmTRANSFER_FAILURE\0" + + // Xkb + "_XKB_RULES_NAMES\0" + + // XEMBED + "_XEMBED\0" + "_XEMBED_INFO\0" + + // Wacom old. (before version 0.10) + "Wacom Stylus\0" + "Wacom Cursor\0" + "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" +}; + +/*! + \internal + Try to resolve a \a symbol from \a library with the version specified + by \a vernum. + + Note that, in the case of the Xfixes library, \a vernum is not the same as + \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes + version. +*/ +static void* qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) +{ + QList<int> versions; + // we try to load in the following order: + // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) + if (vernum != -1) + versions << vernum; + versions << -1; + if (vernum != -1) { + for(int i = highestVernum; i > vernum; --i) + versions << i; + } + Q_FOREACH(int version, versions) { + QLatin1String libName(library); + QLibrary xfixesLib(libName, version); + void *ptr = xfixesLib.resolve(symbol); + if (ptr) + return ptr; + } + return 0; +} + +# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ + (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); +# define XFIXES_LOAD_V1(symbol) \ + XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) +# define XFIXES_LOAD_V2(symbol) \ + XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) + + +class QTestLiteStaticInfoPrivate +{ +public: + QTestLiteStaticInfoPrivate() + : use_xfixes(false) + , xfixes_major(0) + , xfixes_eventbase(0) + , xfixes_errorbase(0) + { + QTestLiteScreen *screen = qobject_cast<QTestLiteScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); + Q_ASSERT(screen); + + initializeAllAtoms(screen); + initializeSupportedAtoms(screen); + + resolveXFixes(screen); + } + + bool isSupportedByWM(Atom atom) + { + if (!m_supportedAtoms) + return false; + + bool supported = false; + int i = 0; + while (m_supportedAtoms[i] != 0) { + if (m_supportedAtoms[i++] == atom) { + supported = true; + break; + } + } + + return supported; + } + + Atom atom(QTestLiteStaticInfo::X11Atom atom) + { + return m_allAtoms[atom]; + } + + bool useXFixes() const { return use_xfixes; } + + int xFixesEventBase() const {return xfixes_eventbase; } + + PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const + { + return ptrXFixesSelectSelectionInput; + } + +private: + + void initializeAllAtoms(QTestLiteScreen *screen) { + const char *names[QTestLiteStaticInfo::NAtoms]; + const char *ptr = x11_atomnames; + + int i = 0; + while (*ptr) { + names[i++] = ptr; + while (*ptr) + ++ptr; + ++ptr; + } + + Q_ASSERT(i == QTestLiteStaticInfo::NPredefinedAtoms); + + QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); + settings_atom_name += XDisplayName(qPrintable(screen->displayName())); + names[i++] = settings_atom_name; + + Q_ASSERT(i == QTestLiteStaticInfo::NAtoms); + #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) + XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); + #else + for (i = 0; i < QTestLiteStaticInfo::NAtoms; ++i) + m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); + #endif + } + + void initializeSupportedAtoms(QTestLiteScreen *screen) + { + Atom type; + int format; + long offset = 0; + unsigned long nitems, after; + unsigned char *data = 0; + + int e = XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QTestLiteStaticInfo::_NET_SUPPORTED), 0, 0, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + if (data) + XFree(data); + + if (e == Success && type == XA_ATOM && format == 32) { + QBuffer ts; + ts.open(QIODevice::WriteOnly); + + while (after > 0) { + XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QTestLiteStaticInfo::_NET_SUPPORTED), offset, 1024, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + + if (type == XA_ATOM && format == 32) { + ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); + offset += nitems; + } else + after = 0; + if (data) + XFree(data); + } + + // compute nitems + QByteArray buffer(ts.buffer()); + nitems = buffer.size() / sizeof(Atom); + m_supportedAtoms = new Atom[nitems + 1]; + Atom *a = (Atom *) buffer.data(); + uint i; + for (i = 0; i < nitems; i++) + m_supportedAtoms[i] = a[i]; + m_supportedAtoms[nitems] = 0; + + } + } + + void resolveXFixes(QTestLiteScreen *screen) + { +#ifndef QT_NO_XFIXES + // See if Xfixes is supported on the connected display + if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, + &xfixes_eventbase, &xfixes_errorbase)) { + ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); + ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); + ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); + ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); + + if(ptrXFixesQueryExtension && ptrXFixesQueryVersion + && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, + &xfixes_errorbase)) { + // Xfixes is supported. + // Note: the XFixes protocol version is negotiated using QueryVersion. + // We supply the highest version we support, the X server replies with + // the highest version it supports, but no higher than the version we + // asked for. The version sent back is the protocol version the X server + // will use to talk us. If this call is removed, the behavior of the + // X server when it receives an XFixes request is undefined. + int major = 3; + int minor = 0; + ptrXFixesQueryVersion(screen->display(), &major, &minor); + use_xfixes = (major >= 1); + xfixes_major = major; + } + } +#endif // QT_NO_XFIXES + + } + + Atom *m_supportedAtoms; + Atom m_allAtoms[QTestLiteStaticInfo::NAtoms]; + +#ifndef QT_NO_XFIXES + PtrXFixesQueryExtension ptrXFixesQueryExtension; + PtrXFixesQueryVersion ptrXFixesQueryVersion; + PtrXFixesSetCursorName ptrXFixesSetCursorName; + PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; +#endif + + bool use_xfixes; + int xfixes_major; + int xfixes_eventbase; + int xfixes_errorbase; + +}; +Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); + + +Atom QTestLiteStaticInfo::atom(QTestLiteStaticInfo::X11Atom atom) +{ + return qTestLiteStaticInfoPrivate()->atom(atom); +} + +bool QTestLiteStaticInfo::isSupportedByWM(Atom atom) +{ + return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); +} + +bool QTestLiteStaticInfo::useXFixes() +{ + return qTestLiteStaticInfoPrivate()->useXFixes(); +} + +int QTestLiteStaticInfo::xFixesEventBase() +{ + return qTestLiteStaticInfoPrivate()->xFixesEventBase(); +} + +#ifndef QT_NO_XFIXES +PtrXFixesSelectSelectionInput QTestLiteStaticInfo::xFixesSelectSelectionInput() +{ + qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); + if (!qTestLiteStaticInfoPrivate()->useXFixes()) + return 0; + + return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); +} +#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.h b/src/plugins/platforms/testlite/qtestlitestaticinfo.h new file mode 100644 index 0000000..ed0f7bd --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.h @@ -0,0 +1,371 @@ +#ifndef QTESTLITESTATICINFO_H +#define QTESTLITESTATICINFO_H + +#include <QtCore/QTextStream> +#include <QtCore/QDataStream> +#include <QtCore/QMetaType> +#include <QtCore/QVariant> + +#if defined(_XLIB_H_) // crude hack, but... +#error "cannot include <X11/Xlib.h> before this file" +#endif +#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback +#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback +#define XSetIMValues qt_XSetIMValues +#include <X11/Xlib.h> +#undef XRegisterIMInstantiateCallback +#undef XUnregisterIMInstantiateCallback +#undef XSetIMValues + +#include <X11/Xutil.h> +#include <X11/Xos.h> +#ifdef index +# undef index +#endif +#ifdef rindex +# undef rindex +#endif +#ifdef Q_OS_VXWORS +# ifdef open +# undef open +# endif +# ifdef getpid +# undef getpid +# endif +#endif // Q_OS_VXWORKS +#include <X11/Xatom.h> + +//#define QT_NO_SHAPE +#ifdef QT_NO_SHAPE +# define XShapeCombineRegion(a,b,c,d,e,f,g) +# define XShapeCombineMask(a,b,c,d,e,f,g) +#else +# include <X11/extensions/shape.h> +#endif // QT_NO_SHAPE + + +#if !defined (QT_NO_TABLET) +# include <X11/extensions/XInput.h> +#if defined (Q_OS_IRIX) +# include <X11/extensions/SGIMisc.h> +# include <wacom.h> +#endif +#endif // QT_NO_TABLET + + +// #define QT_NO_XINERAMA +#ifndef QT_NO_XINERAMA +// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). +extern "C" { +# include <X11/extensions/Xinerama.h> +} +#endif // QT_NO_XINERAMA + +// #define QT_NO_XRANDR +#ifndef QT_NO_XRANDR +# include <X11/extensions/Xrandr.h> +#endif // QT_NO_XRANDR + +// #define QT_NO_XRENDER +#ifndef QT_NO_XRENDER +# include <X11/extensions/Xrender.h> +#endif // QT_NO_XRENDER + +#ifndef QT_NO_XSYNC +extern "C" { +# include "X11/extensions/sync.h" +} +#endif + +// #define QT_NO_XKB +#ifndef QT_NO_XKB +# include <X11/XKBlib.h> +#endif // QT_NO_XKB + + +#if !defined(XlibSpecificationRelease) +# define X11R4 +typedef char *XPointer; +#else +# undef X11R4 +#endif + +#ifndef QT_NO_XFIXES +typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); +typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); +typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); +typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); +#endif // QT_NO_XFIXES + +#ifndef QT_NO_XCURSOR +#include <X11/Xcursor/Xcursor.h> +typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); +#endif // QT_NO_XCURSOR + +#ifndef QT_NO_XINERAMA +typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); +typedef Bool (*PtrXineramaIsActive)(Display *dpy); +typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); +#endif // QT_NO_XINERAMA + +#ifndef QT_NO_XRANDR +typedef void (*PtrXRRSelectInput)(Display *, Window, int); +typedef int (*PtrXRRUpdateConfiguration)(XEvent *); +typedef int (*PtrXRRRootToScreen)(Display *, Window); +typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); +#endif // QT_NO_XRANDR + +#ifndef QT_NO_XINPUT +typedef int (*PtrXCloseDevice)(Display *, XDevice *); +typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); +typedef XDevice* (*PtrXOpenDevice)(Display *, XID); +typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); +typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); +#endif // QT_NO_XINPUT + +/* + * Solaris patch 108652-47 and higher fixes crases in + * XRegisterIMInstantiateCallback, but the function doesn't seem to + * work. + * + * Instead, we disabled R6 input, and open the input method + * immediately at application start. + */ + +//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback +//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. +//######### Many old X11R6 header files lack XSetIMValues. +//######### Therefore, we have to declare these functions ourselves. + +extern "C" Bool XRegisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +extern "C" Bool XUnregisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +#ifndef X11R4 +# include <X11/Xlocale.h> +#endif // X11R4 + + +#ifndef QT_NO_MITSHM +# include <X11/extensions/XShm.h> +#endif // QT_NO_MITSHM + +// rename a couple of X defines to get rid of name clashes +// resolve the conflict between X11's FocusIn and QEvent::FocusIn +enum { + XFocusOut = FocusOut, + XFocusIn = FocusIn, + XKeyPress = KeyPress, + XKeyRelease = KeyRelease, + XNone = None, + XRevertToParent = RevertToParent, + XGrayScale = GrayScale, + XCursorShape = CursorShape +}; +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + + +class QTestLiteStaticInfo +{ +public: + enum X11Atom { + // window-manager <-> client protocols + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + _NET_WM_PING, + _NET_WM_CONTEXT_HELP, + _NET_WM_SYNC_REQUEST, + _NET_WM_SYNC_REQUEST_COUNTER, + + // ICCCM window state + WM_STATE, + WM_CHANGE_STATE, + + // Session management + WM_CLIENT_LEADER, + WM_WINDOW_ROLE, + SM_CLIENT_ID, + + // Clipboard + CLIPBOARD, + INCR, + TARGETS, + MULTIPLE, + TIMESTAMP, + SAVE_TARGETS, + CLIP_TEMPORARY, + _QT_SELECTION, + _QT_CLIPBOARD_SENTINEL, + _QT_SELECTION_SENTINEL, + CLIPBOARD_MANAGER, + + RESOURCE_MANAGER, + + _XSETROOT_ID, + + _QT_SCROLL_DONE, + _QT_INPUT_ENCODING, + + _MOTIF_WM_HINTS, + + DTWM_IS_RUNNING, + ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, + _SGI_DESKS_MANAGER, + + // EWMH (aka NETWM) + _NET_SUPPORTED, + _NET_VIRTUAL_ROOTS, + _NET_WORKAREA, + + _NET_MOVERESIZE_WINDOW, + _NET_WM_MOVERESIZE, + + _NET_WM_NAME, + _NET_WM_ICON_NAME, + _NET_WM_ICON, + + _NET_WM_PID, + + _NET_WM_WINDOW_OPACITY, + + _NET_WM_STATE, + _NET_WM_STATE_ABOVE, + _NET_WM_STATE_BELOW, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_HORZ, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MODAL, + _NET_WM_STATE_STAYS_ON_TOP, + _NET_WM_STATE_DEMANDS_ATTENTION, + + _NET_WM_USER_TIME, + _NET_WM_USER_TIME_WINDOW, + _NET_WM_FULL_PLACEMENT, + + _NET_WM_WINDOW_TYPE, + _NET_WM_WINDOW_TYPE_DESKTOP, + _NET_WM_WINDOW_TYPE_DOCK, + _NET_WM_WINDOW_TYPE_TOOLBAR, + _NET_WM_WINDOW_TYPE_MENU, + _NET_WM_WINDOW_TYPE_UTILITY, + _NET_WM_WINDOW_TYPE_SPLASH, + _NET_WM_WINDOW_TYPE_DIALOG, + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + _NET_WM_WINDOW_TYPE_POPUP_MENU, + _NET_WM_WINDOW_TYPE_TOOLTIP, + _NET_WM_WINDOW_TYPE_NOTIFICATION, + _NET_WM_WINDOW_TYPE_COMBO, + _NET_WM_WINDOW_TYPE_DND, + _NET_WM_WINDOW_TYPE_NORMAL, + _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + + _KDE_NET_WM_FRAME_STRUT, + + _NET_STARTUP_INFO, + _NET_STARTUP_INFO_BEGIN, + + _NET_SUPPORTING_WM_CHECK, + + _NET_WM_CM_S0, + + _NET_SYSTEM_TRAY_VISUAL, + + _NET_ACTIVE_WINDOW, + + // Property formats + COMPOUND_TEXT, + TEXT, + UTF8_STRING, + + // Xdnd + XdndEnter, + XdndPosition, + XdndStatus, + XdndLeave, + XdndDrop, + XdndFinished, + XdndTypelist, + XdndActionList, + + XdndSelection, + + XdndAware, + XdndProxy, + + XdndActionCopy, + XdndActionLink, + XdndActionMove, + XdndActionPrivate, + + // Motif DND + _MOTIF_DRAG_AND_DROP_MESSAGE, + _MOTIF_DRAG_INITIATOR_INFO, + _MOTIF_DRAG_RECEIVER_INFO, + _MOTIF_DRAG_WINDOW, + _MOTIF_DRAG_TARGETS, + + XmTRANSFER_SUCCESS, + XmTRANSFER_FAILURE, + + // Xkb + _XKB_RULES_NAMES, + + // XEMBED + _XEMBED, + _XEMBED_INFO, + + XWacomStylus, + XWacomCursor, + XWacomEraser, + + XTabletStylus, + XTabletEraser, + + NPredefinedAtoms, + + _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, + NAtoms + }; + + static Atom atom(X11Atom atom); + static bool isSupportedByWM(Atom atom); + + static bool useXFixes(); + static int xFixesEventBase(); + + #ifndef QT_NO_XFIXES + static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); + #endif //QT_NO_XFIXES + + + +}; + +#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 6f9ad58..71232ac 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -44,6 +44,7 @@ #include "qtestliteintegration.h" #include "qtestlitescreen.h" #include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" #include <QtGui/QWindowSystemInterface> #include <QSocketNotifier> @@ -101,19 +102,26 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); - XSelectInput(mScreen->display(), x_window, ExposureMask | KeyPressMask | KeyReleaseMask | + XSelectInput(mScreen->display(), x_window, + ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask | - PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PropertyChangeMask | StructureNotifyMask); gc = createGC(); - Atom wmDeleteWindowAtom = mScreen->wmDeleteWindowAtom(); - XChangeProperty (mScreen->display(), x_window, - mScreen->wmProtocolsAtom(), - XA_ATOM, 32, PropModeAppend, - (unsigned char *) &wmDeleteWindowAtom, 1); - mScreen->setWmDeleteWindowAtom(wmDeleteWindowAtom); + Atom protocols[5]; + int n = 0; + protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_NET_WM_PING); // support _NET_WM_PING protocol +#ifndef QT_NO_XSYNC + protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol +#endif // QT_NO_XSYNC + if (window->windowFlags() & Qt::WindowContextHelpButtonHint) + protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_NET_WM_CONTEXT_HELP); + XSetWMProtocols(mScreen->display(), x_window, protocols, n); } @@ -336,10 +344,11 @@ QtMWMHints QTestLiteWindow::getMWMHints() const int format; ulong nitems, bytesLeft; uchar *data = 0; - if ((XGetWindowProperty(mScreen->display(), x_window, mScreen->atomForMotifWmHints(), 0, 5, false, - mScreen->atomForMotifWmHints(), &type, &format, &nitems, &bytesLeft, + Atom atomForMotifWmHints = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_MOTIF_WM_HINTS); + if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, + atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, &data) == Success) - && (type == mScreen->atomForMotifWmHints() + && (type == atomForMotifWmHints && format == 32 && nitems >= 5)) { mwmhints = *(reinterpret_cast<QtMWMHints *>(data)); @@ -359,12 +368,13 @@ QtMWMHints QTestLiteWindow::getMWMHints() const void QTestLiteWindow::setMWMHints(const QtMWMHints &mwmhints) { + Atom atomForMotifWmHints = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_MOTIF_WM_HINTS); if (mwmhints.flags != 0l) { XChangeProperty(mScreen->display(), x_window, - mScreen->atomForMotifWmHints(), mScreen->atomForMotifWmHints(), 32, + atomForMotifWmHints, atomForMotifWmHints, 32, PropModeReplace, (unsigned char *) &mwmhints, 5); } else { - XDeleteProperty(mScreen->display(), x_window, mScreen->atomForMotifWmHints()); + XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); } } diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index d2f2562..9f8075c 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -10,7 +10,10 @@ SOURCES = \ qtestlitewindow.cpp \ qtestlitecursor.cpp \ qtestlitescreen.cpp \ - qtestlitekeyboard.cpp + qtestlitekeyboard.cpp \ + qtestliteclipboard.cpp \ + qtestlitemime.cpp \ + qtestlitestaticinfo.cpp HEADERS = \ qtestliteintegration.h \ @@ -18,7 +21,10 @@ HEADERS = \ qtestlitewindow.h \ qtestlitecursor.h \ qtestlitescreen.h \ - qtestlitekeyboard.h + qtestlitekeyboard.h \ + qtestliteclipboard.h \ + qtestlitemime.h \ + qtestlitestaticinfo.h LIBS += -lX11 -lXext -- cgit v0.12 From afc9371b68d7db91c0874b3923a376224656e4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 3 Jan 2011 16:28:29 +0100 Subject: Renamed QTestLiteStaticInfo to QTestLiteStatic --- .../platforms/testlite/qtestliteclipboard.cpp | 38 +++++------ src/plugins/platforms/testlite/qtestlitemime.cpp | 46 ++++++------- src/plugins/platforms/testlite/qtestlitescreen.cpp | 8 +-- .../platforms/testlite/qtestlitestaticinfo.cpp | 79 ++++++++++++++++++---- .../platforms/testlite/qtestlitestaticinfo.h | 3 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 14 ++-- 6 files changed, 121 insertions(+), 67 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp index fdd6d30..9e1b387 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.cpp +++ b/src/plugins/platforms/testlite/qtestliteclipboard.cpp @@ -28,7 +28,7 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const QTestLiteClipboard *that = const_cast<QTestLiteClipboard *>(this); that->m_xClipboard = new QTestLiteMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD)); + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)); if (clipboardOwner == owner()) { return m_clientClipboard; } else { @@ -49,7 +49,7 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) break; case QClipboard::Clipboard: - modeAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD); + modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); d = &m_clientClipboard; break; @@ -131,16 +131,16 @@ Atom QTestLiteClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom QVector<Atom> types; QStringList formats = QInternalMimeData::formatsHelper(d); for (int i = 0; i < formats.size(); ++i) { - QList<Atom> atoms = QTestLiteMime::xdndMimeAtomsForFormat(screen()->display(),formats.at(i)); + QList<Atom> atoms = QTestLiteMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); } } - types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TARGETS)); - types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::MULTIPLE)); - types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TIMESTAMP)); - types.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::SAVE_TARGETS)); + types.append(QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); + types.append(QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE)); + types.append(QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP)); + types.append(QTestLiteStatic::atom(QTestLiteStatic::SAVE_TARGETS)); XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, PropModeReplace, (uchar *) types.data(), types.size()); @@ -164,7 +164,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIP_TEMPORARY); + static Atom motif_clip_temporary = QTestLiteStatic::atom(QTestLiteStatic::CLIP_TEMPORARY); bool allow_incr = property != motif_clip_temporary; // X_ChangeProperty protocol request is 24 bytes @@ -172,7 +172,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, if (data.size() > increment && allow_incr) { long bytes = data.size(); XChangeProperty(screen()->display(), window, property, - QTestLiteStaticInfo::atom(QTestLiteStaticInfo::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + QTestLiteStatic::atom(QTestLiteStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); // (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); qDebug() << "not implemented INCRT just YET!"; @@ -212,7 +212,7 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) QMimeData *d; if (req->selection == XA_PRIMARY) { d = m_clientSelection; - } else if (req->selection == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD)) { + } else if (req->selection == QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)) { d = m_clientClipboard; } else { qWarning("QClipboard: Unknown selection '%lx'", req->selection); @@ -226,9 +226,9 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) return; } - Atom xa_targets = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TARGETS); - Atom xa_multiple = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::MULTIPLE); - Atom xa_timestamp = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TIMESTAMP); + Atom xa_targets = QTestLiteStatic::atom(QTestLiteStatic::TARGETS); + Atom xa_multiple = QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE); + Atom xa_timestamp = QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP); struct AtomPair { Atom target; Atom property; } *multi = 0; Atom multi_type = XNone; @@ -394,7 +394,7 @@ bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool d XFree((char*)data); } - if (*format == 8 && *type == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) { + if (*format == 8 && *type == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { // convert COMPOUND_TEXT to a multibyte string XTextProperty textprop; textprop.encoding = *type; @@ -492,8 +492,8 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - XDeleteProperty(screen()->display(), win, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION), win, CurrentTime); + XDeleteProperty(screen()->display(), win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), win, CurrentTime); XSync(screen()->display(), false); XEvent xevent; @@ -505,10 +505,10 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) Atom type; XSelectInput(screen()->display(), win, PropertyChangeMask); - if (clipboardReadProperty(win, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::INCR)) { + if (clipboardReadProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QTestLiteStatic::atom(QTestLiteStatic::INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_QT_SELECTION), nbytes, false); + buf = clipboardReadIncrementalProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), nbytes, false); } } diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp index 6261383..6a08b8c 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.cpp +++ b/src/plugins/platforms/testlite/qtestlitemime.cpp @@ -99,7 +99,7 @@ QString QTestLiteMime::xdndMimeAtomToString(Display *display, Atom a) { if (!a) return 0; - if (a == XA_STRING || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)) { + if (a == XA_STRING || a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) { return "text/plain"; // some Xdnd clients are dumb } char *atom = XGetAtomName(display, a); @@ -123,10 +123,10 @@ QStringList QTestLiteMime::xdndMimeFormatsForAtom(Display *display, Atom a) formats.append(atomName); // special cases for string type - if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING) + if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) - || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) + || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) formats.append(QLatin1String("text/plain")); // special cases for uris @@ -152,27 +152,27 @@ bool QTestLiteMime::xdndMimeDataForAtom(Display *display, Atom a, QMimeData *mim *dataFormat = 16; ret = true; } else { - if ((a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING) + if ((a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) - || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) + || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)){ + if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)){ *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); ret = true; } else if (a == XA_STRING) { *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); ret = true; - } else if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) - || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) { + } else if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) + || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { // the ICCCM states that TEXT and COMPOUND_TEXT are in the // encoding of choice, so we choose the encoding of the locale QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); char *list[] = { strData.data(), NULL }; - XICCEncodingStyle style = (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + XICCEncodingStyle style = (a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) ? XCompoundTextStyle : XStdICCTextStyle; XTextProperty textprop; if (list[0] != NULL @@ -222,10 +222,10 @@ QList<Atom> QTestLiteMime::xdndMimeAtomsForFormat(Display *display, const QStrin // special cases for strings if (format == QLatin1String("text/plain")) { - atoms.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)); + atoms.append(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)); atoms.append(XA_STRING); - atoms.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT)); - atoms.append(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)); + atoms.append(QTestLiteStatic::atom(QTestLiteStatic::TEXT)); + atoms.append(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)); } // special cases for uris @@ -262,12 +262,12 @@ QVariant QTestLiteMime::xdndMimeConvertToFormat(Display *display, Atom a, const // special cases for string types if (format == QLatin1String("text/plain")) { - if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING)) + if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) return QString::fromUtf8(data); if (a == XA_STRING) return QString::fromLatin1(data); - if (a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT) - || a == QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT)) + if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) + || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) // #### might be wrong for COMPUND_TEXT return QString::fromLocal8Bit(data, data.size()); } @@ -312,12 +312,12 @@ Atom QTestLiteMime::xdndMimeAtomForFormat(Display *display, const QString &forma // find matches for string types if (format == QLatin1String("text/plain")) { - if (atoms.contains(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING))) - return QTestLiteStaticInfo::atom(QTestLiteStaticInfo::UTF8_STRING); - if (atoms.contains(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT))) - return QTestLiteStaticInfo::atom(QTestLiteStaticInfo::COMPOUND_TEXT); - if (atoms.contains(QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT))) - return QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TEXT); + if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING))) + return QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING); + if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT))) + return QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT); + if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::TEXT))) + return QTestLiteStatic::atom(QTestLiteStatic::TEXT); if (atoms.contains(XA_STRING)) return XA_STRING; } diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp index 2ae7028..82dab9a 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -248,14 +248,14 @@ QTestLiteScreen::~QTestLiteScreen() bool QTestLiteScreen::handleEvent(XEvent *xe) { int quit = false; - QTestLiteWindow *xw = 0; + QTestLiteWindow *platformWindow = 0; QWidget *widget = QWidget::find(xe->xany.window); if (widget) { xw = static_cast<QTestLiteWindow *>(widget->platformWindow()); } - Atom wmProtocolsAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_DELETE_WINDOW); + Atom wmProtocolsAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); switch (xe->type) { case ClientMessage: @@ -346,7 +346,7 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) { - Atom clipboard = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD); + Atom clipboard = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY || e->xselectionrequest.selection == clipboard)) || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp index 20d73a2..875ac9e 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp @@ -246,7 +246,7 @@ public: return supported; } - Atom atom(QTestLiteStaticInfo::X11Atom atom) + Atom atom(QTestLiteStatic::X11Atom atom) { return m_allAtoms[atom]; } @@ -260,10 +260,58 @@ public: return ptrXFixesSelectSelectionInput; } + QImage qimageFromXImage(XImage *xi) + { + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (xi->depth == 24) + format = QImage::Format_RGB32; + else if (xi->depth == 16) + format = QImage::Format_RGB16; + + QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) + { + for (int i=0; i < image.height(); i++) { + if (xi->depth == 16) { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + } else { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + } + } + } + + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < xi->height; ++y) { + for (int x = 0; x < xi->width; ++x) + p[x] |= 0xff000000; + p += xi->bytes_per_line / 4; + } + } + + return image; + } + + private: void initializeAllAtoms(QTestLiteScreen *screen) { - const char *names[QTestLiteStaticInfo::NAtoms]; + const char *names[QTestLiteStatic::NAtoms]; const char *ptr = x11_atomnames; int i = 0; @@ -274,17 +322,17 @@ private: ++ptr; } - Q_ASSERT(i == QTestLiteStaticInfo::NPredefinedAtoms); + Q_ASSERT(i == QTestLiteStatic::NPredefinedAtoms); QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); settings_atom_name += XDisplayName(qPrintable(screen->displayName())); names[i++] = settings_atom_name; - Q_ASSERT(i == QTestLiteStaticInfo::NAtoms); + Q_ASSERT(i == QTestLiteStatic::NAtoms); #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); #else - for (i = 0; i < QTestLiteStaticInfo::NAtoms; ++i) + for (i = 0; i < QTestLiteStatic::NAtoms; ++i) m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); #endif } @@ -298,7 +346,7 @@ private: unsigned char *data = 0; int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStaticInfo::_NET_SUPPORTED), 0, 0, + this->atom(QTestLiteStatic::_NET_SUPPORTED), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) XFree(data); @@ -309,7 +357,7 @@ private: while (after > 0) { XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStaticInfo::_NET_SUPPORTED), offset, 1024, + this->atom(QTestLiteStatic::_NET_SUPPORTED), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (type == XA_ATOM && format == 32) { @@ -367,7 +415,7 @@ private: } Atom *m_supportedAtoms; - Atom m_allAtoms[QTestLiteStaticInfo::NAtoms]; + Atom m_allAtoms[QTestLiteStatic::NAtoms]; #ifndef QT_NO_XFIXES PtrXFixesQueryExtension ptrXFixesQueryExtension; @@ -385,28 +433,28 @@ private: Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); -Atom QTestLiteStaticInfo::atom(QTestLiteStaticInfo::X11Atom atom) +Atom QTestLiteStatic::atom(QTestLiteStatic::X11Atom atom) { return qTestLiteStaticInfoPrivate()->atom(atom); } -bool QTestLiteStaticInfo::isSupportedByWM(Atom atom) +bool QTestLiteStatic::isSupportedByWM(Atom atom) { return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); } -bool QTestLiteStaticInfo::useXFixes() +bool QTestLiteStatic::useXFixes() { return qTestLiteStaticInfoPrivate()->useXFixes(); } -int QTestLiteStaticInfo::xFixesEventBase() +int QTestLiteStatic::xFixesEventBase() { return qTestLiteStaticInfoPrivate()->xFixesEventBase(); } #ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QTestLiteStaticInfo::xFixesSelectSelectionInput() +PtrXFixesSelectSelectionInput QTestLiteStatic::xFixesSelectSelectionInput() { qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); if (!qTestLiteStaticInfoPrivate()->useXFixes()) @@ -414,4 +462,9 @@ PtrXFixesSelectSelectionInput QTestLiteStaticInfo::xFixesSelectSelectionInput() return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); } + +QImage QTestLiteStatic::qimageFromXImage(XImage *xi) +{ + return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); +} #endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.h b/src/plugins/platforms/testlite/qtestlitestaticinfo.h index ed0f7bd..328de60 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.h +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.h @@ -190,7 +190,7 @@ enum { #endif -class QTestLiteStaticInfo +class QTestLiteStatic { public: enum X11Atom { @@ -364,6 +364,7 @@ public: static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); #endif //QT_NO_XFIXES + static QImage qimageFromXImage(XImage *xi); }; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 71232ac..e8d40d7 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -113,14 +113,14 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) Atom protocols[5]; int n = 0; - protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_NET_WM_PING); // support _NET_WM_PING protocol + protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_PING); // support _NET_WM_PING protocol #ifndef QT_NO_XSYNC - protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol + protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol #endif // QT_NO_XSYNC if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_NET_WM_CONTEXT_HELP); + protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_CONTEXT_HELP); XSetWMProtocols(mScreen->display(), x_window, protocols, n); } @@ -344,7 +344,7 @@ QtMWMHints QTestLiteWindow::getMWMHints() const int format; ulong nitems, bytesLeft; uchar *data = 0; - Atom atomForMotifWmHints = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, &data) == Success) @@ -368,7 +368,7 @@ QtMWMHints QTestLiteWindow::getMWMHints() const void QTestLiteWindow::setMWMHints(const QtMWMHints &mwmhints) { - Atom atomForMotifWmHints = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); if (mwmhints.flags != 0l) { XChangeProperty(mScreen->display(), x_window, atomForMotifWmHints, atomForMotifWmHints, 32, -- cgit v0.12 From 6138bcd3543ac605731c9626191e7914f0995858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 3 Jan 2011 16:30:32 +0100 Subject: Renamed variable name in TestLite event handling --- src/plugins/platforms/testlite/qtestlitescreen.cpp | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp index 82dab9a..c211ee6 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -251,7 +251,7 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) QTestLiteWindow *platformWindow = 0; QWidget *widget = QWidget::find(xe->xany.window); if (widget) { - xw = static_cast<QTestLiteWindow *>(widget->platformWindow()); + platformWindow = static_cast<QTestLiteWindow *>(widget->platformWindow()); } Atom wmProtocolsAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_PROTOCOLS); @@ -262,33 +262,33 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { Atom a = xe->xclient.data.l[0]; if (a == wmDeleteWindowAtom) - xw->handleCloseEvent(); + platformWindow->handleCloseEvent(); } break; case Expose: - if (xw) + if (platformWindow) if (xe->xexpose.count == 0) - xw->paintEvent(); + platformWindow->paintEvent(); break; case ConfigureNotify: - if (xw) - xw->resizeEvent(&xe->xconfigure); + if (platformWindow) + platformWindow->resizeEvent(&xe->xconfigure); break; case ButtonPress: - if (xw) - xw->mousePressEvent(&xe->xbutton); + if (platformWindow) + platformWindow->mousePressEvent(&xe->xbutton); break; case ButtonRelease: - if (xw) - xw->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); break; case MotionNotify: - if (xw) - xw->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); break; case XKeyPress: @@ -300,23 +300,23 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) break; case EnterNotify: - if (xw) - xw->handleEnterEvent(); + if (platformWindow) + platformWindow->handleEnterEvent(); break; case LeaveNotify: - if (xw) - xw->handleLeaveEvent(); + if (platformWindow) + platformWindow->handleLeaveEvent(); break; case XFocusIn: - if (xw) - xw->handleFocusInEvent(); + if (platformWindow) + platformWindow->handleFocusInEvent(); break; case XFocusOut: - if (xw) - xw->handleFocusOutEvent(); + if (platformWindow) + platformWindow->handleFocusOutEvent(); break; case PropertyNotify: -- cgit v0.12 From 0ceed999bbf25d19b3ded8a1b300cf0c6129f775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 3 Jan 2011 16:31:44 +0100 Subject: Create clearer sepperation between TestLiteMime and QTestliteClipboard --- .../platforms/testlite/qtestliteclipboard.cpp | 130 +++++++++++++++- .../platforms/testlite/qtestliteclipboard.h | 7 +- src/plugins/platforms/testlite/qtestlitemime.cpp | 173 ++++++--------------- src/plugins/platforms/testlite/qtestlitemime.h | 32 +--- 4 files changed, 181 insertions(+), 161 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp index 9e1b387..25c16ea 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.cpp +++ b/src/plugins/platforms/testlite/qtestliteclipboard.cpp @@ -7,6 +7,104 @@ #include <QtCore/QDebug> +class QTestLiteClipboardMime : public QTestLiteMime +{ + Q_OBJECT +public: + QTestLiteClipboardMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard) + : QTestLiteMime() + , m_clipboard(clipboard) + { + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + break; + + case QClipboard::Clipboard: + modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + break; + + default: + qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); + break; + } + } + +protected: + QStringList formats_sys() const + { + if (empty()) + return QStringList(); + + if (!formatList.count()) { + QTestLiteClipboardMime *that = const_cast<QTestLiteClipboardMime *>(this); + // get the list of targets from the current clipboard owner - we do this + // once so that multiple calls to this function don't require multiple + // server round trips... + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); + + if (format_atoms.size() > 0) { + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + + for (int i = 0; i < size; ++i) { + if (targets[i] == 0) + continue; + + QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + for (int j = 0; j < formatsForAtom.size(); ++j) { + if (!formatList.contains(formatsForAtom.at(j))) + that->formatList.append(formatsForAtom.at(j)); + } + } + } + } + + return formatList; + } + + bool hasFormat_sys(const QString &format) const + { + QStringList list = formats(); + return list.contains(format); + } + + QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const + { + if (fmt.isEmpty() || empty()) + return QByteArray(); + + (void)formats(); // trigger update of format list + + QList<Atom> atoms; + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + for (int i = 0; i < size; ++i) + atoms.append(targets[i]); + + QByteArray encoding; + Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + + if (fmtatom == 0) + return QVariant(); + + return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); + } +private: + bool empty() const + { + Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + + return win == XNone; + } + + + Atom modeAtom; + QTestLiteClipboard *m_clipboard; + QStringList formatList; + QByteArray format_atoms; +}; + const int QTestLiteClipboard::clipboard_timeout = 5000; QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) @@ -26,7 +124,7 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const if (mode == QClipboard::Clipboard) { if (!m_xClipboard) { QTestLiteClipboard *that = const_cast<QTestLiteClipboard *>(this); - that->m_xClipboard = new QTestLiteMime(mode,that); + that->m_xClipboard = new QTestLiteClipboardMime(mode,that); } Window clipboardOwner = XGetSelectionOwner(screen()->display(),QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)); if (clipboardOwner == owner()) { @@ -34,6 +132,17 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const } else { return m_xClipboard; } + } else if (mode == QClipboard::Selection) { + if (!m_xSelection) { + QTestLiteClipboard *that = const_cast<QTestLiteClipboard *>(this); + that->m_xSelection = new QTestLiteClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); + if (clipboardOwner == owner()) { + return m_clientSelection; + } else { + return m_xSelection; + } } return 0; } @@ -71,14 +180,19 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { -// qWarning("QClipboard::setData: Cannot set X11 selection owner for %s", -// xdndAtomToString(atom).data()); - *d = 0; - return; + qWarning("QClipboard::setData: Cannot set X11 selection owner"); } } +bool QTestLiteClipboard::supportsMode(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) + return true; + return false; +} + + QTestLiteScreen * QTestLiteClipboard::screen() const { return m_screen; @@ -153,14 +267,14 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, int dataFormat = 0; QByteArray data; - QString fmt = QTestLiteMime::xdndMimeAtomToString(screen()->display(), target); + QString fmt = QTestLiteMime::mimeAtomToString(screen()->display(), target); if (fmt.isEmpty()) { // Not a MIME type we have qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); return XNone; } qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - if (QTestLiteMime::xdndMimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + if (QTestLiteMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) @@ -517,3 +631,5 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) return buf; } + +#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.h b/src/plugins/platforms/testlite/qtestliteclipboard.h index 31e42b7..22d3734 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.h +++ b/src/plugins/platforms/testlite/qtestliteclipboard.h @@ -5,7 +5,6 @@ #include "qtestlitestaticinfo.h" class QTestLiteScreen; -class QTestLiteMime; class QTestLiteClipboard : public QPlatformClipboard { public: @@ -14,6 +13,8 @@ public: const QMimeData *mimeData(QClipboard::Mode mode) const; void setMimeData(QMimeData *data, QClipboard::Mode mode); + bool supportsMode(QClipboard::Mode mode) const; + QTestLiteScreen *screen() const; Window requestor() const; @@ -36,10 +37,10 @@ private: QTestLiteScreen *m_screen; - QTestLiteMime *m_xClipboard; + QMimeData *m_xClipboard; QMimeData *m_clientClipboard; - QTestLiteMime *m_xSelection; + QMimeData *m_xSelection; QMimeData *m_clientSelection; Window m_requestor; diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp index 6a08b8c..32cacce 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.cpp +++ b/src/plugins/platforms/testlite/qtestlitemime.cpp @@ -4,98 +4,21 @@ #include "qtestlitescreen.h" #include <QtCore/QTextCodec> +#include <QtGui/QImageWriter> +#include <QtCore/QBuffer> -QTestLiteMime::QTestLiteMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard) - : QInternalMimeData(), m_clipboard(clipboard) -{ - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - break; - - case QClipboard::Clipboard: - modeAtom = QTestLiteStaticInfo::atom(QTestLiteStaticInfo::CLIPBOARD); - break; - - default: - qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); - break; - } -} +QTestLiteMime::QTestLiteMime() + : QInternalMimeData() +{ } QTestLiteMime::~QTestLiteMime() -{ -} +{} -bool QTestLiteMime::empty() const -{ - Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); - - return win == XNone; -} -QStringList QTestLiteMime::formats_sys() const -{ - if (empty()) - return QStringList(); - if (!formatList.count()) { - // get the list of targets from the current clipboard owner - we do this - // once so that multiple calls to this function don't require multiple - // server round trips... - format_atoms = m_clipboard->getDataInFormat(modeAtom,QTestLiteStaticInfo::atom(QTestLiteStaticInfo::TARGETS)); - if (format_atoms.size() > 0) { - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - - for (int i = 0; i < size; ++i) { - if (targets[i] == 0) - continue; - - QStringList formatsForAtom = xdndMimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); - for (int j = 0; j < formatsForAtom.size(); ++j) { - if (!formatList.contains(formatsForAtom.at(j))) - formatList.append(formatsForAtom.at(j)); - } - } - } - } - - return formatList; -} - -bool QTestLiteMime::hasFormat_sys(const QString &format) const -{ - QStringList list = formats(); - return list.contains(format); -} - -QVariant QTestLiteMime::retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const -{ - if (fmt.isEmpty() || empty()) - return QByteArray(); - - (void)formats(); // trigger update of format list - - QList<Atom> atoms; - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - for (int i = 0; i < size; ++i) - atoms.append(targets[i]); - - QByteArray encoding; - Atom fmtatom = xdndMimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); - - if (fmtatom == 0) - return QVariant(); - - return xdndMimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); -} - - -QString QTestLiteMime::xdndMimeAtomToString(Display *display, Atom a) +QString QTestLiteMime::mimeAtomToString(Display *display, Atom a) { if (!a) return 0; @@ -108,18 +31,18 @@ QString QTestLiteMime::xdndMimeAtomToString(Display *display, Atom a) return result; } -Atom QTestLiteMime::xdndMimeStringToAtom(Display *display, const QString &mimeType) +Atom QTestLiteMime::mimeStringToAtom(Display *display, const QString &mimeType) { if (mimeType.isEmpty()) return 0; return XInternAtom(display, mimeType.toLatin1().constData(), False); } -QStringList QTestLiteMime::xdndMimeFormatsForAtom(Display *display, Atom a) +QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) { QStringList formats; if (a) { - QString atomName = xdndMimeAtomToString(display, a); + QString atomName = mimeAtomToString(display, a); formats.append(atomName); // special cases for string type @@ -140,12 +63,12 @@ QStringList QTestLiteMime::xdndMimeFormatsForAtom(Display *display, Atom a) return formats; } -bool QTestLiteMime::xdndMimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) { bool ret = false; *atomFormat = a; *dataFormat = 8; - QString atomName = xdndMimeAtomToString(display, a); + QString atomName = mimeAtomToString(display, a); if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { *data = QInternalMimeData::renderDataHelper(atomName, mimeData); if (atomName == QLatin1String("application/x-color")) @@ -195,30 +118,16 @@ bool QTestLiteMime::xdndMimeDataForAtom(Display *display, Atom a, QMimeData *mim *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); ret = true; } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { - QPixmap pm = qvariant_cast<QPixmap>(mimeData->imageData()); - if (a == XA_BITMAP && pm.depth() != 1) { - QImage img = pm.toImage(); - img = img.convertToFormat(QImage::Format_MonoLSB); - pm = QPixmap::fromImage(img); - } -// QDragManager *dm = QDragManager::self(); -// if (dm) { -// Pixmap handle = pm.handle(); -// *data = QByteArray((const char *) &handle, sizeof(Pixmap)); -// dm->xdndMimeTransferedPixmap[dm->xdndMimeTransferedPixmapIndex] = pm; -// dm->xdndMimeTransferedPixmapIndex = -// (dm->xdndMimeTransferedPixmapIndex + 1) % 2; -// ret = true; -// } + ret = true; } } return ret && data != 0; } -QList<Atom> QTestLiteMime::xdndMimeAtomsForFormat(Display *display, const QString &format) +QList<Atom> QTestLiteMime::mimeAtomsForFormat(Display *display, const QString &format) { QList<Atom> atoms; - atoms.append(xdndMimeStringToAtom(display, format)); + atoms.append(mimeStringToAtom(display, format)); // special cases for strings if (format == QLatin1String("text/plain")) { @@ -230,7 +139,7 @@ QList<Atom> QTestLiteMime::xdndMimeAtomsForFormat(Display *display, const QStrin // special cases for uris if (format == QLatin1String("text/uri-list")) { - atoms.append(xdndMimeStringToAtom(display,QLatin1String("text/x-moz-url"))); + atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); } //special cases for images @@ -242,9 +151,9 @@ QList<Atom> QTestLiteMime::xdndMimeAtomsForFormat(Display *display, const QStrin return atoms; } -QVariant QTestLiteMime::xdndMimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) { - QString atomName = xdndMimeAtomToString(display,a); + QString atomName = mimeAtomToString(display,a); if (atomName == format) return data; @@ -288,25 +197,35 @@ QVariant QTestLiteMime::xdndMimeConvertToFormat(Display *display, Atom a, const // special cas for images if (format == QLatin1String("image/ppm")) { if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { -// Pixmap xpm = *((Pixmap*)data.data()); -// if (!xpm) -// return QByteArray(); -// QPixmap qpm = QPixmap::fromX11Pixmap(xpm); -// QImageWriter imageWriter; -// imageWriter.setFormat("PPMRAW"); -// QImage imageToWrite = qpm.toImage(); -// QBuffer buf; -// buf.open(QIODevice::WriteOnly); -// imageWriter.setDevice(&buf); -// imageWriter.write(imageToWrite); -// return buf.buffer(); - return QVariant(); + Pixmap xpm = *((Pixmap*)data.data()); + if (!xpm) + return QByteArray(); + Window root; + int x; + int y; + uint width; + uint height; + uint border_width; + uint depth; + + XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); + XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); + QImage qimg = QTestLiteStatic::qimageFromXImage(ximg); + XDestroyImage(ximg); + + QImageWriter imageWriter; + imageWriter.setFormat("PPMRAW"); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + imageWriter.setDevice(&buf); + imageWriter.write(qimg); + return buf.buffer(); } } return QVariant(); } -Atom QTestLiteMime::xdndMimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) +Atom QTestLiteMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) { requestedEncoding->clear(); @@ -324,10 +243,10 @@ Atom QTestLiteMime::xdndMimeAtomForFormat(Display *display, const QString &forma // find matches for uri types if (format == QLatin1String("text/uri-list")) { - Atom a = xdndMimeStringToAtom(display,format); + Atom a = mimeStringToAtom(display,format); if (a && atoms.contains(a)) return a; - a = xdndMimeStringToAtom(display,QLatin1String("text/x-moz-url")); + a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); if (a && atoms.contains(a)) return a; } @@ -347,14 +266,14 @@ Atom QTestLiteMime::xdndMimeAtomForFormat(Display *display, const QString &forma QString formatWithCharset = format; formatWithCharset.append(QLatin1String(";charset=utf-8")); - Atom a = xdndMimeStringToAtom(display,formatWithCharset); + Atom a = mimeStringToAtom(display,formatWithCharset); if (a && atoms.contains(a)) { *requestedEncoding = "utf-8"; return a; } } - Atom a = xdndMimeStringToAtom(display,format); + Atom a = mimeStringToAtom(display,format); if (a && atoms.contains(a)) return a; diff --git a/src/plugins/platforms/testlite/qtestlitemime.h b/src/plugins/platforms/testlite/qtestlitemime.h index e5ed7b0..449bbf3 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.h +++ b/src/plugins/platforms/testlite/qtestlitemime.h @@ -11,32 +11,16 @@ class QTestLiteMime : public QInternalMimeData { Q_OBJECT public: - QTestLiteMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard); + QTestLiteMime(); ~QTestLiteMime(); - bool empty() const; - static QList<Atom> xdndMimeAtomsForFormat(Display *display, const QString &format); - static QString xdndMimeAtomToString(Display *display, Atom a); - static bool xdndMimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); - static QStringList xdndMimeFormatsForAtom(Display *display, Atom a); - static Atom xdndMimeStringToAtom(Display *display, const QString &mimeType); - - static QVariant xdndMimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); - static Atom xdndMimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); - - -protected: - virtual bool hasFormat_sys(const QString &mimetype) const; - virtual QStringList formats_sys() const; - - QVariant retrieveData_sys(const QString &mimetype, QVariant::Type type) const; - - -private: - QTestLiteClipboard *m_clipboard; - Atom modeAtom; - mutable QStringList formatList; - mutable QByteArray format_atoms; + static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); + static QString mimeAtomToString(Display *display, Atom a); + static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); + static QStringList mimeFormatsForAtom(Display *display, Atom a); + static Atom mimeStringToAtom(Display *display, const QString &mimeType); + static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); + static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); }; #endif // QTESTLITEMIME_H -- cgit v0.12 From 06568ff89c48dee8aab278b8b0538c331aa84595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 6 Dec 2010 16:05:55 +0100 Subject: Add styleHint to fallback api for fontdatabases in Lighthouse --- src/gui/text/qfont_qpa.cpp | 2 +- src/gui/text/qfontdatabase_qpa.cpp | 12 ++++++---- src/gui/text/qplatformfontdatabase_qpa.cpp | 3 ++- src/gui/text/qplatformfontdatabase_qpa.h | 2 +- .../fontconfig/qfontconfigdatabase.cpp | 27 +++++++++++++++++++++- .../fontdatabases/fontconfig/qfontconfigdatabase.h | 2 +- 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp index 5fed18b..7b09b59 100644 --- a/src/gui/text/qfont_qpa.cpp +++ b/src/gui/text/qfont_qpa.cpp @@ -90,7 +90,7 @@ QString QFont::defaultFamily() const familyName = QString::fromLatin1("helvetica"); } - QStringList list = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QUnicodeTables::Common); + QStringList list = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QFont::StyleHint(d->request.styleHint),QUnicodeTables::Common); if (list.size()) { familyName = list.at(0); } diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index e54093c..e6d99c6 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -80,9 +80,9 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou size->handle = handle; } -static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QUnicodeTables::Script &script) +static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) { - QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,script); + QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); QFontDatabasePrivate *db = privateDb(); QStringList::iterator i; @@ -177,7 +177,11 @@ QFontEngine *loadEngine(int script, const QFontDef &request, && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) { if (family && !family->askedForFallback) { - family->fallbackFamilies = fallbackFamilies(family->name,QFont::Style(style->key.style),QUnicodeTables::Script(script)); + QFont::Style fontStyle = QFont::Style(style->key.style); + QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); + if (styleHint == QFont::AnyStyle && request.fixedPitch) + styleHint = QFont::TypeWriter; + family->fallbackFamilies = fallbackFamilies(family->name,fontStyle,styleHint,QUnicodeTables::Script(script)); family->askedForFallback = true; } @@ -287,7 +291,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, if (!engine) { if (!request.family.isEmpty()) { - QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QUnicodeTables::Script(script)); + QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QFont::StyleHint(request.styleHint),QUnicodeTables::Script(script)); for (int i = 0; i < fallbacks.size(); i++) { QFontDef def = request; def.family = fallbacks.at(i); diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index d6dff41..afe762a 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -221,10 +221,11 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, QUnicode /*! */ -QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const +QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const { Q_UNUSED(family); Q_UNUSED(style); + Q_UNUSED(styleHint); Q_UNUSED(script); return QStringList(); } diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h index aa465ab..a1faea9 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.h +++ b/src/gui/text/qplatformfontdatabase_qpa.h @@ -88,7 +88,7 @@ class Q_GUI_EXPORT QPlatformFontDatabase public: virtual void populateFontDatabase(); virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); - virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; + virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const; virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); virtual void releaseHandle(void *handle); diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 92f30fc..9b9be07 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -274,6 +274,25 @@ static const char *openType[] = { "nko " // N'Ko }; +static const char *getFcFamilyForStyleHint(const QFont::StyleHint style) +{ + const char *stylehint = 0; + switch (style) { + case QFont::SansSerif: + stylehint = "sans-serif"; + break; + case QFont::Serif: + stylehint = "serif"; + break; + case QFont::TypeWriter: + stylehint = "monospace"; + break; + default: + break; + } + return stylehint; +} + void QFontconfigDatabase::populateFontDatabase() { FcFontSet *fonts; @@ -522,7 +541,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables:: return engine; } -QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const +QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const { QStringList fallbackFamilies; FcPattern *pattern = FcPatternCreate(); @@ -550,6 +569,12 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const FcLangSetDestroy(ls); } + const char *stylehint = getFcFamilyForStyleHint(styleHint); + if (stylehint) { + value.u.s = (const FcChar8 *)stylehint; + FcPatternAddWeak(pattern, FC_FAMILY, value, FcTrue); + } + FcConfigSubstitute(0, pattern, FcMatchPattern); FcConfigSubstitute(0, pattern, FcMatchFont); diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h index 33382dc..cf62b88 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h @@ -50,7 +50,7 @@ class QFontconfigDatabase : public QBasicUnixFontDatabase public: void populateFontDatabase(); QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); - QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; + QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const; }; #endif // QFONTCONFIGDATABASE_H -- cgit v0.12 From 7a54885b1df9baf793374e3cb9fdf8be93ee7c80 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Date: Tue, 4 Jan 2011 15:35:58 +0100 Subject: Fix regression in text rendering in OpenGL2 engine Change 532115bcaa370af827a5cbad017b272842c5aacf introduced a regression by fixing a typo in the QT_OPENGL_ES_2 macro. This caused a broken and untested code path to be used in the GLES2 case. Since the QImage scanlines are 32 bit aligned, QImage::width() cannot be used when copying the data. Rather than pass in bytesPerLine() to the GL function, I opted to revert to the proven behavior, where the pad bytes are never read by GL but each scanline is copied separately, to avoid further regressions on different hardware. This also seems like the more correct approach, as the pad bytes should ideally not be copied into the cache texture. Reviewed-by: Samuel --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 1b879c3..ad1bf31 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -293,9 +293,6 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) if (mask.format() == QImage::Format_RGB32) { glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits()); } else { -#ifdef QT_OPENGL_ES_2 - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits()); -#else // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista // and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a @@ -307,7 +304,6 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) for (int i = 0; i < maskHeight; ++i) glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); -#endif } } -- cgit v0.12 From bc1e4e5bc898519c073b710f64c7a7da54062099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Wed, 5 Jan 2011 12:36:58 +0100 Subject: Compile on OS X. --- mkspecs/common/mac/qplatformdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/mac/qplatformdefs.h b/mkspecs/common/mac/qplatformdefs.h index 99d64ef..5d1f99a 100644 --- a/mkspecs/common/mac/qplatformdefs.h +++ b/mkspecs/common/mac/qplatformdefs.h @@ -75,7 +75,7 @@ #include <net/if.h> #endif -#include "../common/posix/qplatformdefs.h" +#include "../posix/qplatformdefs.h" #undef QT_OPEN_LARGEFILE #undef QT_SOCKLEN_T -- cgit v0.12 From 4c15dbb1eddb7bb3f3b72508be865feb97679d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Wed, 5 Jan 2011 14:02:58 +0100 Subject: Build on Mac OS X. --- src/plugins/platforms/testlite/testlite.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index 9f8075c..eb196c3 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -28,6 +28,10 @@ HEADERS = \ LIBS += -lX11 -lXext +mac { + LIBS += -L/usr/X11/lib -lz -framework Carbon +} + include (../fontdatabases/genericunix/genericunix.pri) contains(QT_CONFIG, opengl) { -- cgit v0.12 From 4836d809f5dc3fc9e978ef630c0e5c8847c171a7 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil <prasanth.ullattil@nokia.com> Date: Wed, 5 Jan 2011 15:19:07 +0100 Subject: Add support for QMetaType::QVariant in ActiveQt Previously when we convert the typename "QVariant" to QVaraint::Type, it returns QVariant::Invalid. From Qt 4.7 onwards, it will return QVariant::UserType. Task-number: QTBUG-15157 Reviewed-by: Martin Petersson --- src/activeqt/container/qaxbase.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 7692749..c29eac6 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -1671,12 +1671,11 @@ private: QVariant::Type vartype = QVariant::nameToType(prop.type); switch(vartype) { case QVariant::Invalid: + case QVariant::UserType: if (prop.type == "QVariant") { prop.typeId |= 0xff << 24; break; } - // fall through - case QVariant::UserType: if (QMetaType::type(prop.type) == -1) qWarning("QAxBase: Unsupported property type: %s", prop.type.data()); break; -- cgit v0.12 From 0c07af230d016aab6e416ae57594189ab9953101 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Fri, 19 Nov 2010 15:24:35 +0100 Subject: cookie jar code: enhance security by keeping track of effective TLDs The problem was the following: According to the cookie RFC, domains must have at least one dot in their name for setting a cookie (e.g. domain example.com can set a cookie for ".example.com" but not for ".com"). The problem is: Following this rule, one could still set "supercookies" for e.g. ".co.uk". The solution is to generate a table from http://publicsuffix.org which maintains a list of all "effective" TLDs like e.g. ".co.uk". Reviewed-by: Olivier Goffart Task-number: QTBUG-14706 --- src/network/access/access.pri | 1 + src/network/access/qnetworkcookiejar.cpp | 63 +- src/network/access/qnetworkcookiejar_p.h | 3 + src/network/access/qnetworkcookiejartlds_p.h | 6479 ++++++++++++++++++++ src/network/access/qnetworkcookiejartlds_p.h.INFO | 17 + .../qnetworkcookiejar/tst_qnetworkcookiejar.cpp | 104 + .../cookiejar-generateTLDs.pro | 9 + util/network/cookiejar-generateTLDs/main.cpp | 161 + 8 files changed, 6825 insertions(+), 12 deletions(-) create mode 100644 src/network/access/qnetworkcookiejartlds_p.h create mode 100644 src/network/access/qnetworkcookiejartlds_p.h.INFO create mode 100644 util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro create mode 100644 util/network/cookiejar-generateTLDs/main.cpp diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 6a0cd32..ce79b06 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -23,6 +23,7 @@ HEADERS += \ access/qnetworkcookie_p.h \ access/qnetworkcookiejar.h \ access/qnetworkcookiejar_p.h \ + access/qnetworkcookiejartlds_p.h \ access/qnetworkrequest.h \ access/qnetworkrequest_p.h \ access/qnetworkreply.h \ diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 0b3a918..9cbeafe 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qnetworkcookiejar.h" +#include "qnetworkcookiejartlds_p.h" #include "qnetworkcookiejar_p.h" #include "QtNetwork/qnetworkcookie.h" @@ -157,7 +158,8 @@ static inline bool isParentDomain(QString domain, QString reference) jar. Default values for path and domain are taken from the \a url object. - Returns true if one or more cookes are set for url otherwise false. + Returns true if one or more cookies are set for \a url, + otherwise false. If a cookie already exists in the cookie jar, it will be overridden by those in \a cookieList. @@ -208,16 +210,14 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis QString domain = cookie.domain(); if (!(isParentDomain(domain, defaultDomain) - || isParentDomain(defaultDomain, domain))) { - continue; // not accepted - } - - // reject if domain is like ".com" - // (i.e., reject if domain does not contain embedded dots, see RFC 2109 section 4.3.2) - // this is just a rudimentary check and does not cover all cases - if (domain.lastIndexOf(QLatin1Char('.')) == 0) - continue; // not accepted - + || isParentDomain(defaultDomain, domain))) + continue; // not accepted + + // the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2 + // redundant; the "leading dot" rule has been relaxed anyway, see above + // we remove the leading dot for this check + if (QNetworkCookieJarPrivate::isEffectiveTLD(domain.remove(0, 1))) + continue; // not accepted } QList<QNetworkCookie>::Iterator it = d->allCookies.begin(), @@ -250,7 +250,7 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis If more than one cookie with the same name is found, but with differing paths, the one with longer path is returned before the one with shorter path. In other words, this function returns - cookies sorted by path length. + cookies sorted decreasingly by path length. The default QNetworkCookieJar class implements only a very basic security policy (it makes sure that the cookies' domain and path @@ -304,4 +304,43 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const return result; } +bool QNetworkCookieJarPrivate::isEffectiveTLD(const QString &domain) +{ + // for domain 'foo.bar.com': + // 1. return if TLD table contains 'foo.bar.com' + if (containsTLDEntry(domain)) + return true; + + if (domain.contains(QLatin1Char('.'))) { + int count = domain.size() - domain.indexOf(QLatin1Char('.')); + QString wildCardDomain; + wildCardDomain.reserve(count + 1); + wildCardDomain.append(QLatin1Char('*')); + wildCardDomain.append(domain.right(count)); + // 2. if table contains '*.bar.com', + // test if table contains '!foo.bar.com' + if (containsTLDEntry(wildCardDomain)) { + QString exceptionDomain; + exceptionDomain.reserve(domain.size() + 1); + exceptionDomain.append(QLatin1Char('!')); + exceptionDomain.append(domain); + return (! containsTLDEntry(exceptionDomain)); + } + } + return false; +} + +bool QNetworkCookieJarPrivate::containsTLDEntry(const QString &entry) +{ + int index = qHash(entry) % tldCount; + int currentDomainIndex = tldIndices[index]; + while (currentDomainIndex < tldIndices[index+1]) { + QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex); + if (currentEntry == entry) + return true; + currentDomainIndex += qstrlen(tldData + currentDomainIndex) + 1; // +1 for the ending \0 + } + return false; +} + QT_END_NAMESPACE diff --git a/src/network/access/qnetworkcookiejar_p.h b/src/network/access/qnetworkcookiejar_p.h index 5802115..74870be 100644 --- a/src/network/access/qnetworkcookiejar_p.h +++ b/src/network/access/qnetworkcookiejar_p.h @@ -63,6 +63,9 @@ class QNetworkCookieJarPrivate: public QObjectPrivate public: QList<QNetworkCookie> allCookies; + static bool Q_AUTOTEST_EXPORT isEffectiveTLD(const QString &domain); + static bool containsTLDEntry(const QString &entry); + Q_DECLARE_PUBLIC(QNetworkCookieJar) }; diff --git a/src/network/access/qnetworkcookiejartlds_p.h b/src/network/access/qnetworkcookiejartlds_p.h new file mode 100644 index 0000000..fc1c75f --- /dev/null +++ b/src/network/access/qnetworkcookiejartlds_p.h @@ -0,0 +1,6479 @@ +// Version: MPL 1.1/GPL 2.0/LGPL 2.1 +// +// The contents of this file are subject to the Mozilla Public License Version +// 1.1 (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the +// License. +// +// The Original Code is the Public Suffix List. +// +// The Initial Developer of the Original Code is +// Jo Hermans <jo.hermans@gmail.com>. +// Portions created by the Initial Developer are Copyright (C) 2007 +// the Initial Developer. All Rights Reserved. +// +// Contributor(s): +// Ruben Arakelyan <ruben@wackomenace.co.uk> +// Gervase Markham <gerv@gerv.net> +// Pamela Greene <pamg.bugs@gmail.com> +// David Triendl <david@triendl.name> +// Jothan Frakes <jothan@gmail.com> +// The kind representatives of many TLD registries +// +// Alternatively, the contents of this file may be used under the terms of +// either the GNU General Public License Version 2 or later (the "GPL"), or +// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +// in which case the provisions of the GPL or the LGPL are applicable instead +// of those above. If you wish to allow use of your version of this file only +// under the terms of either the GPL or the LGPL, and not to allow others to +// use your version of this file under the terms of the MPL, indicate your +// decision by deleting the provisions above and replace them with the notice +// and other provisions required by the GPL or the LGPL. If you do not delete +// the provisions above, a recipient may use your version of this file under +// the terms of any one of the MPL, the GPL or the LGPL. +// + +#ifndef QNETWORKCOOKIEJARTLD_P_H +#define QNETWORKCOOKIEJARTLD_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the Network Access framework. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +// note to maintainer: +// this file should be updated before each release -> +// for instructions see the program at +// util/network/cookiejar-generateTLDs + +static const quint16 tldCount = 3949; +static const quint16 tldIndices[] = { +0, +7, +14, +14, +20, +51, +61, +93, +100, +100, +116, +159, +167, +180, +180, +193, +234, +234, +234, +255, +255, +255, +280, +280, +287, +287, +295, +303, +313, +326, +326, +380, +393, +413, +419, +419, +419, +424, +438, +438, +469, +515, +515, +515, +534, +534, +557, +557, +557, +557, +572, +572, +572, +579, +587, +597, +612, +612, +624, +636, +648, +662, +687, +709, +714, +740, +766, +789, +789, +805, +805, +810, +815, +815, +824, +824, +831, +857, +869, +891, +891, +916, +916, +916, +927, +934, +964, +971, +987, +987, +987, +1008, +1008, +1016, +1016, +1030, +1030, +1052, +1075, +1075, +1082, +1087, +1115, +1135, +1135, +1135, +1172, +1178, +1178, +1178, +1202, +1207, +1220, +1220, +1266, +1266, +1266, +1266, +1272, +1290, +1316, +1316, +1332, +1332, +1339, +1339, +1352, +1352, +1389, +1389, +1408, +1415, +1437, +1444, +1489, +1489, +1502, +1502, +1512, +1518, +1539, +1555, +1562, +1584, +1598, +1607, +1607, +1607, +1632, +1652, +1652, +1658, +1658, +1675, +1682, +1709, +1733, +1748, +1776, +1783, +1783, +1790, +1797, +1826, +1850, +1850, +1856, +1880, +1887, +1901, +1921, +1947, +1961, +1967, +1967, +1967, +1972, +1986, +1986, +1986, +2009, +2029, +2029, +2047, +2061, +2075, +2075, +2075, +2075, +2075, +2075, +2082, +2082, +2124, +2124, +2129, +2162, +2162, +2162, +2236, +2256, +2263, +2276, +2283, +2313, +2313, +2347, +2380, +2387, +2387, +2387, +2431, +2438, +2445, +2452, +2459, +2459, +2469, +2490, +2516, +2527, +2540, +2540, +2586, +2610, +2630, +2630, +2653, +2660, +2669, +2693, +2693, +2710, +2710, +2719, +2719, +2734, +2740, +2740, +2753, +2753, +2763, +2770, +2775, +2782, +2789, +2802, +2820, +2827, +2827, +2841, +2855, +2855, +2865, +2872, +2884, +2884, +2919, +2937, +2955, +2962, +3012, +3042, +3073, +3083, +3083, +3100, +3105, +3112, +3131, +3131, +3166, +3180, +3187, +3194, +3211, +3218, +3223, +3233, +3249, +3259, +3268, +3314, +3314, +3324, +3324, +3336, +3336, +3336, +3336, +3350, +3363, +3376, +3398, +3416, +3445, +3464, +3488, +3488, +3497, +3545, +3552, +3552, +3552, +3566, +3573, +3573, +3573, +3581, +3581, +3603, +3603, +3615, +3621, +3621, +3683, +3683, +3710, +3710, +3716, +3716, +3748, +3770, +3791, +3803, +3810, +3817, +3833, +3846, +3846, +3852, +3876, +3876, +3882, +3903, +3910, +3939, +3939, +3939, +3947, +3962, +3962, +3981, +3994, +4021, +4030, +4042, +4085, +4085, +4096, +4096, +4104, +4123, +4123, +4123, +4143, +4154, +4164, +4194, +4194, +4194, +4205, +4205, +4222, +4238, +4301, +4309, +4322, +4331, +4331, +4331, +4331, +4331, +4347, +4365, +4375, +4375, +4385, +4398, +4412, +4430, +4430, +4437, +4447, +4463, +4472, +4472, +4472, +4484, +4484, +4484, +4484, +4484, +4490, +4490, +4511, +4511, +4522, +4522, +4522, +4522, +4528, +4528, +4534, +4551, +4551, +4551, +4564, +4583, +4583, +4611, +4611, +4611, +4622, +4622, +4649, +4668, +4677, +4692, +4692, +4692, +4705, +4723, +4723, +4723, +4729, +4729, +4743, +4743, +4750, +4750, +4763, +4770, +4776, +4776, +4776, +4793, +4811, +4811, +4811, +4821, +4821, +4841, +4857, +4891, +4897, +4903, +4903, +4903, +4919, +4935, +4942, +4958, +4958, +4975, +4975, +4975, +4985, +4985, +5020, +5032, +5032, +5040, +5053, +5068, +5079, +5079, +5101, +5115, +5115, +5135, +5154, +5161, +5161, +5168, +5168, +5184, +5210, +5210, +5238, +5255, +5278, +5285, +5308, +5318, +5327, +5327, +5333, +5333, +5340, +5348, +5355, +5366, +5377, +5384, +5408, +5415, +5422, +5435, +5442, +5482, +5482, +5482, +5482, +5498, +5527, +5534, +5541, +5572, +5572, +5572, +5579, +5591, +5602, +5602, +5621, +5621, +5646, +5664, +5671, +5671, +5681, +5696, +5707, +5716, +5716, +5723, +5723, +5732, +5742, +5742, +5763, +5770, +5776, +5790, +5790, +5797, +5806, +5816, +5832, +5882, +5882, +5882, +5882, +5893, +5934, +5934, +5965, +5965, +5980, +5980, +5980, +5980, +6007, +6017, +6034, +6051, +6065, +6075, +6075, +6091, +6097, +6097, +6109, +6109, +6109, +6122, +6147, +6168, +6168, +6191, +6191, +6191, +6191, +6191, +6198, +6217, +6224, +6224, +6231, +6245, +6252, +6252, +6270, +6270, +6284, +6305, +6315, +6322, +6322, +6322, +6329, +6329, +6329, +6353, +6361, +6361, +6375, +6391, +6405, +6405, +6415, +6431, +6431, +6431, +6431, +6458, +6475, +6475, +6475, +6482, +6489, +6496, +6496, +6503, +6520, +6520, +6520, +6527, +6527, +6544, +6561, +6573, +6573, +6580, +6580, +6587, +6587, +6592, +6592, +6592, +6592, +6599, +6599, +6612, +6633, +6649, +6649, +6669, +6676, +6683, +6683, +6713, +6720, +6727, +6736, +6736, +6746, +6770, +6807, +6814, +6827, +6846, +6846, +6864, +6864, +6864, +6864, +6881, +6888, +6888, +6888, +6914, +6935, +6935, +6935, +6953, +6959, +6966, +6983, +6983, +6983, +7013, +7023, +7023, +7023, +7023, +7037, +7044, +7058, +7079, +7086, +7123, +7134, +7155, +7168, +7178, +7203, +7227, +7236, +7258, +7265, +7274, +7274, +7303, +7303, +7314, +7314, +7345, +7352, +7367, +7377, +7388, +7388, +7402, +7402, +7409, +7421, +7421, +7467, +7484, +7484, +7484, +7491, +7532, +7532, +7539, +7546, +7546, +7553, +7573, +7573, +7573, +7580, +7587, +7594, +7594, +7594, +7606, +7606, +7637, +7637, +7637, +7664, +7664, +7664, +7677, +7684, +7701, +7723, +7723, +7723, +7723, +7734, +7734, +7734, +7748, +7748, +7748, +7748, +7759, +7759, +7775, +7775, +7782, +7789, +7817, +7824, +7831, +7836, +7865, +7865, +7876, +7901, +7901, +7908, +7918, +7938, +7945, +7945, +7957, +7964, +7979, +7986, +7994, +8007, +8007, +8014, +8021, +8061, +8061, +8071, +8088, +8131, +8138, +8153, +8160, +8160, +8160, +8175, +8183, +8197, +8211, +8211, +8211, +8243, +8243, +8243, +8243, +8259, +8259, +8259, +8259, +8259, +8266, +8275, +8281, +8281, +8281, +8281, +8288, +8288, +8309, +8309, +8309, +8330, +8330, +8330, +8330, +8337, +8343, +8343, +8360, +8370, +8370, +8380, +8380, +8386, +8386, +8397, +8415, +8415, +8428, +8454, +8460, +8475, +8492, +8526, +8554, +8554, +8583, +8583, +8583, +8598, +8607, +8617, +8617, +8642, +8652, +8652, +8652, +8662, +8688, +8688, +8704, +8704, +8747, +8765, +8775, +8783, +8811, +8835, +8835, +8835, +8850, +8859, +8884, +8910, +8919, +8952, +8978, +8978, +8991, +8991, +8991, +8999, +8999, +8999, +9030, +9030, +9030, +9030, +9030, +9041, +9048, +9048, +9054, +9054, +9054, +9086, +9108, +9108, +9119, +9119, +9130, +9144, +9152, +9161, +9174, +9194, +9207, +9207, +9207, +9232, +9242, +9242, +9271, +9290, +9308, +9308, +9308, +9308, +9320, +9333, +9343, +9356, +9379, +9379, +9379, +9395, +9395, +9406, +9419, +9419, +9419, +9419, +9450, +9485, +9485, +9497, +9497, +9505, +9517, +9528, +9528, +9551, +9564, +9586, +9586, +9608, +9608, +9626, +9626, +9626, +9653, +9653, +9681, +9681, +9681, +9698, +9698, +9698, +9714, +9729, +9737, +9737, +9765, +9765, +9765, +9765, +9765, +9825, +9844, +9866, +9880, +9880, +9880, +9880, +9886, +9895, +9895, +9895, +9895, +9895, +9913, +9913, +9924, +9958, +9958, +9967, +9975, +9975, +9975, +9981, +9998, +9998, +9998, +10012, +10036, +10036, +10066, +10079, +10097, +10121, +10133, +10142, +10142, +10142, +10156, +10173, +10173, +10173, +10196, +10205, +10205, +10205, +10205, +10218, +10234, +10240, +10240, +10240, +10264, +10273, +10286, +10286, +10286, +10286, +10299, +10299, +10309, +10309, +10339, +10358, +10358, +10374, +10374, +10390, +10390, +10413, +10413, +10439, +10461, +10467, +10467, +10467, +10492, +10492, +10501, +10528, +10528, +10528, +10539, +10583, +10583, +10583, +10613, +10613, +10619, +10628, +10645, +10645, +10645, +10650, +10671, +10687, +10709, +10709, +10709, +10709, +10709, +10727, +10727, +10727, +10727, +10733, +10733, +10768, +10768, +10773, +10780, +10788, +10788, +10797, +10797, +10835, +10835, +10845, +10852, +10861, +10861, +10861, +10861, +10861, +10861, +10861, +10875, +10888, +10907, +10907, +10907, +10920, +10920, +10932, +10946, +10977, +10977, +10997, +11008, +11037, +11059, +11059, +11059, +11067, +11067, +11067, +11067, +11067, +11077, +11091, +11102, +11102, +11112, +11125, +11129, +11129, +11154, +11154, +11154, +11164, +11164, +11189, +11189, +11189, +11189, +11189, +11196, +11196, +11227, +11238, +11247, +11256, +11265, +11265, +11286, +11307, +11330, +11337, +11378, +11378, +11389, +11413, +11454, +11469, +11475, +11475, +11475, +11475, +11503, +11503, +11503, +11503, +11534, +11534, +11550, +11550, +11557, +11557, +11557, +11557, +11574, +11585, +11585, +11603, +11626, +11643, +11643, +11643, +11643, +11663, +11663, +11682, +11696, +11696, +11696, +11696, +11706, +11706, +11706, +11706, +11723, +11723, +11757, +11757, +11773, +11795, +11813, +11836, +11836, +11883, +11903, +11952, +11965, +11965, +11984, +11997, +12008, +12008, +12008, +12024, +12043, +12065, +12071, +12099, +12129, +12140, +12140, +12146, +12161, +12161, +12161, +12161, +12167, +12167, +12180, +12186, +12208, +12226, +12243, +12243, +12252, +12252, +12274, +12289, +12302, +12302, +12313, +12313, +12313, +12313, +12358, +12358, +12358, +12369, +12375, +12391, +12391, +12391, +12391, +12405, +12410, +12416, +12416, +12436, +12436, +12436, +12443, +12443, +12462, +12477, +12492, +12492, +12503, +12519, +12525, +12531, +12571, +12571, +12591, +12591, +12601, +12641, +12641, +12641, +12657, +12657, +12657, +12699, +12699, +12699, +12712, +12728, +12744, +12761, +12769, +12782, +12793, +12823, +12836, +12851, +12863, +12890, +12900, +12900, +12900, +12910, +12910, +12924, +12924, +12924, +12924, +12924, +12952, +12984, +13003, +13038, +13038, +13056, +13056, +13056, +13056, +13074, +13081, +13093, +13103, +13103, +13112, +13119, +13132, +13132, +13132, +13141, +13151, +13183, +13193, +13206, +13206, +13206, +13236, +13252, +13267, +13267, +13294, +13307, +13307, +13307, +13343, +13349, +13349, +13349, +13375, +13375, +13375, +13384, +13384, +13384, +13393, +13393, +13393, +13402, +13414, +13425, +13445, +13467, +13485, +13499, +13509, +13528, +13528, +13549, +13549, +13559, +13570, +13570, +13570, +13570, +13598, +13637, +13647, +13647, +13661, +13673, +13682, +13687, +13694, +13694, +13720, +13733, +13742, +13748, +13771, +13795, +13795, +13814, +13821, +13821, +13855, +13862, +13862, +13862, +13874, +13874, +13897, +13909, +13909, +13947, +13947, +13952, +13952, +13970, +13979, +13979, +13979, +14008, +14049, +14049, +14049, +14049, +14049, +14049, +14060, +14083, +14083, +14091, +14101, +14101, +14101, +14101, +14118, +14136, +14195, +14195, +14195, +14213, +14213, +14232, +14232, +14253, +14253, +14258, +14275, +14275, +14304, +14311, +14311, +14318, +14318, +14318, +14318, +14318, +14318, +14325, +14325, +14345, +14345, +14379, +14389, +14422, +14422, +14422, +14422, +14435, +14441, +14441, +14460, +14460, +14471, +14471, +14481, +14495, +14495, +14495, +14502, +14502, +14502, +14502, +14524, +14533, +14541, +14552, +14552, +14552, +14552, +14563, +14563, +14568, +14568, +14585, +14595, +14602, +14628, +14628, +14645, +14672, +14678, +14697, +14697, +14734, +14757, +14764, +14771, +14771, +14771, +14796, +14815, +14822, +14845, +14861, +14861, +14861, +14873, +14873, +14873, +14902, +14920, +14920, +14926, +14926, +14926, +14941, +14949, +14949, +14949, +14949, +14949, +14960, +14960, +14971, +14971, +14998, +15003, +15003, +15003, +15013, +15013, +15027, +15027, +15027, +15043, +15053, +15063, +15074, +15083, +15093, +15093, +15121, +15121, +15128, +15128, +15144, +15144, +15144, +15144, +15165, +15170, +15170, +15170, +15170, +15170, +15170, +15170, +15186, +15206, +15206, +15206, +15224, +15236, +15236, +15252, +15258, +15258, +15258, +15258, +15264, +15277, +15288, +15307, +15307, +15318, +15328, +15328, +15334, +15334, +15363, +15399, +15399, +15422, +15438, +15447, +15447, +15456, +15456, +15456, +15495, +15495, +15495, +15495, +15511, +15511, +15530, +15557, +15566, +15582, +15590, +15590, +15604, +15604, +15625, +15635, +15655, +15655, +15655, +15655, +15655, +15665, +15675, +15675, +15675, +15675, +15675, +15682, +15682, +15682, +15694, +15719, +15749, +15749, +15794, +15794, +15837, +15854, +15854, +15861, +15861, +15861, +15861, +15884, +15900, +15911, +15931, +15931, +15931, +15931, +15931, +15963, +15963, +15996, +16006, +16013, +16024, +16034, +16049, +16049, +16049, +16059, +16059, +16059, +16059, +16059, +16059, +16059, +16064, +16075, +16104, +16104, +16117, +16124, +16124, +16124, +16124, +16130, +16145, +16159, +16190, +16193, +16196, +16210, +16224, +16243, +16255, +16261, +16280, +16283, +16292, +16295, +16295, +16301, +16304, +16322, +16325, +16328, +16349, +16355, +16382, +16408, +16414, +16414, +16414, +16458, +16477, +16480, +16485, +16488, +16514, +16520, +16530, +16530, +16546, +16562, +16597, +16603, +16622, +16622, +16646, +16669, +16672, +16715, +16715, +16715, +16718, +16718, +16727, +16733, +16752, +16770, +16787, +16794, +16810, +16827, +16840, +16850, +16876, +16901, +16901, +16901, +16916, +16919, +16926, +16943, +16972, +16978, +16978, +16978, +16981, +17008, +17008, +17016, +17053, +17053, +17053, +17053, +17072, +17086, +17105, +17139, +17153, +17162, +17162, +17177, +17177, +17177, +17177, +17195, +17218, +17221, +17221, +17237, +17276, +17276, +17300, +17319, +17339, +17357, +17370, +17383, +17400, +17407, +17419, +17439, +17439, +17449, +17465, +17475, +17504, +17527, +17527, +17534, +17548, +17564, +17564, +17598, +17598, +17601, +17630, +17649, +17669, +17669, +17679, +17686, +17757, +17776, +17796, +17810, +17840, +17840, +17877, +17884, +17884, +17911, +17936, +17970, +17980, +17995, +17995, +18008, +18011, +18036, +18075, +18097, +18097, +18104, +18115, +18115, +18129, +18134, +18141, +18141, +18157, +18180, +18190, +18217, +18224, +18252, +18284, +18284, +18296, +18299, +18312, +18322, +18338, +18348, +18348, +18363, +18372, +18387, +18387, +18390, +18402, +18445, +18445, +18445, +18466, +18479, +18479, +18498, +18508, +18511, +18511, +18511, +18511, +18511, +18526, +18558, +18586, +18622, +18643, +18670, +18686, +18710, +18720, +18739, +18739, +18742, +18745, +18771, +18774, +18777, +18791, +18813, +18816, +18822, +18839, +18845, +18851, +18854, +18878, +18881, +18896, +18896, +18899, +18926, +18937, +18940, +18953, +18963, +19010, +19010, +19017, +19046, +19060, +19060, +19087, +19095, +19101, +19101, +19128, +19146, +19157, +19157, +19188, +19198, +19205, +19223, +19230, +19255, +19280, +19280, +19283, +19292, +19301, +19320, +19323, +19323, +19341, +19341, +19365, +19378, +19381, +19394, +19423, +19433, +19440, +19466, +19490, +19490, +19490, +19497, +19504, +19511, +19511, +19518, +19545, +19568, +19575, +19575, +19583, +19586, +19592, +19592, +19609, +19622, +19629, +19641, +19641, +19656, +19673, +19700, +19723, +19733, +19746, +19759, +19769, +19782, +19789, +19795, +19831, +19834, +19841, +19851, +19854, +19880, +19895, +19898, +19898, +19911, +19922, +19950, +20020, +20030, +20059, +20062, +20089, +20107, +20151, +20154, +20175, +20205, +20208, +20229, +20229, +20255, +20261, +20261, +20283, +20335, +20362, +20385, +20392, +20392, +20392, +20392, +20418, +20418, +20418, +20418, +20443, +20446, +20446, +20452, +20452, +20467, +20467, +20489, +20489, +20498, +20525, +20554, +20560, +20575, +20589, +20589, +20589, +20614, +20652, +20659, +20659, +20668, +20679, +20679, +20679, +20685, +20685, +20685, +20685, +20685, +20685, +20696, +20733, +20760, +20766, +20769, +20792, +20792, +20792, +20792, +20813, +20813, +20813, +20813, +20826, +20826, +20846, +20862, +20880, +20887, +20901, +20908, +20933, +20938, +20958, +20969, +20978, +20978, +20978, +20985, +20985, +20985, +21000, +21010, +21010, +21014, +21026, +21033, +21041, +21041, +21051, +21051, +21064, +21071, +21113, +21120, +21120, +21127, +21134, +21142, +21164, +21164, +21164, +21188, +21195, +21208, +21215, +21226, +21226, +21226, +21238, +21249, +21255, +21255, +21265, +21279, +21296, +21301, +21315, +21321, +21331, +21331, +21331, +21337, +21343, +21343, +21351, +21351, +21361, +21368, +21383, +21383, +21389, +21413, +21437, +21449, +21462, +21478, +21506, +21534, +21546, +21546, +21557, +21580, +21595, +21595, +21595, +21595, +21626, +21626, +21646, +21670, +21676, +21688, +21688, +21716, +21731, +21762, +21762, +21762, +21762, +21762, +21783, +21789, +21799, +21828, +21828, +21837, +21845, +21868, +21874, +21874, +21880, +21880, +21889, +21901, +21910, +21941, +21941, +21959, +21959, +21959, +21966, +21966, +21972, +21972, +21995, +22011, +22043, +22043, +22051, +22051, +22060, +22060, +22060, +22074, +22086, +22086, +22099, +22099, +22120, +22120, +22134, +22144, +22150, +22158, +22164, +22164, +22171, +22199, +22210, +22210, +22210, +22220, +22228, +22228, +22239, +22261, +22304, +22304, +22312, +22349, +22349, +22349, +22357, +22381, +22381, +22390, +22390, +22390, +22390, +22402, +22413, +22413, +22422, +22422, +22445, +22445, +22445, +22456, +22456, +22469, +22479, +22501, +22512, +22528, +22528, +22528, +22528, +22528, +22528, +22528, +22540, +22540, +22546, +22546, +22546, +22546, +22569, +22591, +22591, +22591, +22591, +22610, +22655, +22655, +22667, +22667, +22677, +22677, +22692, +22692, +22702, +22702, +22702, +22717, +22736, +22750, +22755, +22780, +22785, +22822, +22844, +22859, +22871, +22909, +22949, +22962, +22973, +22979, +22988, +23007, +23027, +23035, +23072, +23082, +23082, +23109, +23116, +23130, +23158, +23166, +23166, +23172, +23177, +23189, +23219, +23219, +23250, +23273, +23281, +23281, +23281, +23281, +23281, +23287, +23287, +23299, +23305, +23315, +23315, +23321, +23328, +23334, +23355, +23355, +23355, +23355, +23355, +23366, +23390, +23396, +23396, +23396, +23396, +23402, +23418, +23424, +23424, +23438, +23446, +23446, +23446, +23500, +23525, +23569, +23592, +23592, +23592, +23605, +23614, +23614, +23614, +23627, +23633, +23657, +23673, +23673, +23673, +23689, +23689, +23701, +23701, +23701, +23713, +23713, +23713, +23738, +23758, +23775, +23775, +23794, +23794, +23803, +23803, +23803, +23803, +23813, +23826, +23845, +23845, +23845, +23845, +23872, +23872, +23872, +23888, +23888, +23900, +23900, +23906, +23906, +23906, +23906, +23906, +23924, +23924, +23924, +23930, +23930, +23939, +23949, +23971, +23971, +23971, +24000, +24012, +24042, +24042, +24042, +24042, +24042, +24070, +24076, +24094, +24094, +24094, +24123, +24123, +24123, +24134, +24150, +24150, +24150, +24150, +24150, +24150, +24155, +24179, +24179, +24189, +24189, +24189, +24198, +24198, +24218, +24218, +24218, +24234, +24251, +24257, +24276, +24305, +24321, +24321, +24321, +24334, +24334, +24334, +24349, +24356, +24361, +24372, +24372, +24372, +24388, +24396, +24396, +24402, +24410, +24410, +24428, +24428, +24450, +24450, +24467, +24485, +24495, +24495, +24495, +24507, +24507, +24514, +24531, +24531, +24531, +24531, +24531, +24537, +24537, +24558, +24572, +24584, +24584, +24601, +24601, +24607, +24615, +24615, +24632, +24632, +24632, +24632, +24661, +24676, +24676, +24724, +24751, +24751, +24774, +24774, +24783, +24793, +24793, +24793, +24813, +24819, +24819, +24826, +24826, +24842, +24858, +24872, +24872, +24890, +24890, +24890, +24890, +24890, +24890, +24890, +24890, +24890, +24906, +24906, +24917, +24928, +24947, +24947, +24947, +24947, +24947, +24947, +24947, +24947, +24947, +24963, +24983, +24991, +24991, +24991, +24991, +24991, +24991, +24991, +24991, +25007, +25007, +25007, +25007, +25007, +25007, +25007, +25030, +25040, +25040, +25040, +25040, +25040, +25059, +25097, +25132, +25149, +25159, +25169, +25169, +25169, +25192, +25192, +25192, +25192, +25205, +25205, +25216, +25221, +25221, +25233, +25233, +25240, +25250, +25256, +25273, +25273, +25303, +25321, +25321, +25321, +25333, +25333, +25333, +25333, +25370, +25370, +25402, +25418, +25418, +25439, +25439, +25454, +25454, +25454, +25463, +25477, +25526, +25526, +25526, +25526, +25545, +25562, +25572, +25572, +25582, +25582, +25582, +25597, +25610, +25634, +25641, +25641, +25641, +25668, +25668, +25675, +25707, +25727, +25727, +25741, +25756, +25756, +25779, +25811, +25811, +25811, +25817, +25817, +25817, +25827, +25827, +25827, +25827, +25827, +25836, +25836, +25836, +25836, +25850, +25850, +25860, +25884, +25901, +25922, +25936, +25946, +25969, +25969, +25969, +25969, +25975, +25975, +25987, +25987, +26065, +26065, +26065, +26084, +26084, +26103, +26128, +26141, +26151, +26169, +26169, +26169, +26180, +26191, +26191, +26191, +26197, +26197, +26205, +26211, +26235, +26235, +26235, +26235, +26235, +26235, +26245, +26245, +26259, +26259, +26259, +26259, +26284, +26284, +26325, +26325, +26355, +26364, +26364, +26402, +26418, +26418, +26425, +26432, +26432, +26454, +26504, +26513, +26525, +26525, +26525, +26525, +26525, +26545, +26545, +26571, +26590, +26597, +26597, +26597, +26597, +26597, +26639, +26648, +26659, +26666, +26672, +26672, +26672, +26672, +26672, +26694, +26701, +26701, +26701, +26724, +26724, +26746, +26753, +26774, +26774, +26774, +26774, +26806, +26824, +26824, +26830, +26852, +26882, +26882, +26889, +26889, +26889, +26889, +26889, +26889, +26903, +26911, +26918, +26918, +26928, +26948, +26948, +26970, +26970, +26985, +26996, +27045, +27045, +27058, +27058, +27068, +27068, +27104, +27155, +27155, +27155, +27155, +27155, +27172, +27172, +27172, +27172, +27189, +27195, +27195, +27223, +27223, +27223, +27223, +27244, +27290, +27322, +27332, +27364, +27371, +27371, +27371, +27401, +27401, +27417, +27417, +27431, +27470, +27470, +27470, +27470, +27484, +27484, +27484, +27484, +27484, +27496, +27496, +27515, +27515, +27543, +27560, +27576, +27604, +27622, +27631, +27631, +27638, +27649, +27672, +27682, +27682, +27682, +27707, +27717, +27724, +27732, +27755, +27755, +27755, +27768, +27768, +27783, +27789, +27799, +27799, +27799, +27818, +27826, +27838, +27848, +27848, +27848, +27855, +27862, +27862, +27896, +27921, +27921, +27943, +27954, +27954, +27976, +27976, +27976, +27985, +28002, +28012, +28019, +28034, +28034, +28046, +28068, +28097, +28122, +28122, +28131, +28137, +28151, +28151, +28172, +28190, +28196, +28211, +28211, +28264, +28273, +28286, +28324, +28324, +28324, +28354, +28354, +28361, +28397, +28417, +28417, +28424, +28435, +28461, +28461, +28470, +28483, +28483, +28483, +28483, +28483, +28483, +28483, +28515, +28531, +28531, +28549, +28575, +28575, +28575, +28582, +28599, +28615, +28630, +28630, +28672, +28711, +28723, +28723, +28731, +28752, +28752, +28752, +28763, +28763, +28775, +28775, +28775, +28775, +28775, +28775, +28805, +28814, +28830, +28861, +28882, +28882, +28902, +28918, +28937, +28952, +28959, +28998, +29009, +29009, +29009, +29009, +29019, +29019, +29019, +29019, +29019, +29057, +29069, +29076, +29076, +29076, +29076, +29076, +29082, +29082, +29082, +29117, +29117, +29117, +29117, +29134, +29134, +29159, +29159, +29185, +29185, +29196, +29196, +29242, +29248, +29256, +29280, +29301, +29307, +29307, +29307, +29314, +29314, +29338, +29356, +29367, +29367, +29381, +29391, +29399, +29399, +29414, +29434, +29434, +29441, +29473, +29484, +29503, +29520, +29520, +29548, +29565, +29572, +29572, +29572, +29572, +29572, +29597, +29597, +29620, +29655, +29660, +29660, +29660, +29667, +29674, +29688, +29698, +29705, +29728, +29740, +29740, +29761, +29761, +29767, +29780, +29787, +29794, +29794, +29807, +29820, +29820, +29820, +29820, +29832, +29844, +29855, +29855, +29855, +29867, +29867, +29867, +29867, +29881, +29881, +29905, +29905, +29905, +29923, +29923, +29948, +29948, +29948, +29976, +29986, +29996, +29996, +30030, +30030, +30054, +30054, +30070, +30070, +30070, +30077, +30077, +30087, +30107, +30107, +30115, +30141, +30178, +30178, +30201, +30201, +30201, +30207, +30229, +30239, +30254, +30268, +30277, +30311, +30323, +30323, +30331, +30331, +30331, +30331, +30331, +30353, +30365, +30374, +30374, +30374, +30380, +30380, +30380, +30380, +30410, +30410, +30410, +30443, +30443, +30453, +30462, +30472, +30472, +30472, +30472, +30472, +30472, +30489, +30500, +30500, +30500, +30532, +30532, +30553, +30577, +30599, +30599, +30609, +30640, +30640, +30640, +30664, +30676, +30676, +30676, +30692, +30719, +30728, +30728, +30742, +30742, +30749, +30749, +30760, +30770, +30770, +30783, +30783, +30783, +30804, +30847, +30847, +30847, +30847, +30857, +30857, +30857, +30857, +30875, +30875, +30895, +30895, +30921, +30926, +30926, +30926, +30945, +30945, +30945, +30945, +30959, +30959, +30959, +30959, +30972, +30972, +30984, +31011, +31011, +31048, +31056, +31056, +31070, +31077, +31077, +31110, +31110, +31115, +31122, +31139, +31159, +31159, +31165, +31171, +31171, +31197, +31204, +31211, +31211, +31221, +31228, +31228, +31245, +31245, +31245, +31252, +31265, +31265, +31265, +31265, +31294, +31305, +31320, +31333, +31333, +31333, +31343, +31350, +31357, +31369, +31369, +31379, +31385, +31391, +31407, +31407, +31407, +31423, +31423, +31423, +31434, +31454, +31470, +31511, +31521, +31521, +31521, +31542, +31582, +31582, +31597, +31597, +31597, +31614, +31623, +31645, +31645, +31661, +31661, +31669, +31669, +31676, +31676, +31706, +31720, +31726, +31743, +31785, +31804, +31817, +31817, +31835, +31846, +31863, +31885, +31885, +31896, +31907, +31907, +31907, +31922, +31922, +31929, +31929, +31929, +31936, +31943, +31949, +31949, +31949, +31959, +32006, +32024, +32031, +32031, +32038, +32063, +32095, +32095, +32105, +32105, +32105, +32105, +32105, +32125, +32134, +32140, +32176, +32185, +32195, +32195, +32195, +32195, +32202, +32202, +32218, +32236, +32259, +32294, +32300, +32305, +32305, +32305, +32323, +32337, +32352, +32359, +32374, +32381, +32388, +32388, +32388, +32402, +32402, +32402, +32402, +32418, +32428, +32428, +32428, +32450, +32450, +32450, +32462, +32467, +32480, +32480, +32480, +32487, +32502, +32509, +32525, +32560, +32570, +32583, +32597, +32623, +32637, +32644, +32667, +32707, +32725, +32725, +32747, +32747, +32751, +32758, +32789, +32807, +32824, +32824, +32824, +32824, +32843, +32843, +32850, +32876, +32908, +32915, +32946, +32965, +32965, +32982, +33002, +33009, +33029, +33064, +33084, +33098, +33098, +33098, +33098, +33110, +33110, +33151, +33158, +33180, +33198, +33205, +33227, +33227, +33237, +33237, +33253, +33258, +33277, +33292, +33315, +33315, +33333, +33348, +33348, +33348, +33348, +33348, +33348, +33348, +33355, +33355, +33355, +33390, +33408, +33423, +33437, +33452, +33458, +33465, +33480, +33480, +33487, +33494, +33504, +33511, +33551, +33551, +33558, +33589, +33595, +33595, +33602, +33627, +33644, +33668, +33668, +33668, +33676, +33676, +33716, +33728, +33747, +33747, +33769, +33775, +33789, +33803, +33803, +33810, +33810, +33810, +33820, +33820, +33820, +33820, +33843, +33843, +33843, +33879, +33889, +33889, +33889, +33903, +33917, +33931, +33959, +33993, +34000, +34014, +34037, +34043, +34055, +34055, +34077, +34083, +34090, +34099, +34099, +34115, +34115, +34133, +34140, +34167, +34172, +34184, +34221, +34245, +34252, +34252, +34259, +34318, +34318, +34325, +34325, +34352, +34400, +34415, +34422, +34422, +34431, +34438, +34445, +34445, +34473, +34473, +34489, +34489, +34489, +34489, +34499, +34499, +34499, +34516, +34536, +34551, +34564, +34580, +34580, +34580, +34589, +34589, +34589, +34613, +34648, +34648, +34648, +34655, +34664, +34681, +34681, +34698, +34698, +34720, +34736, +34749, +34749, +34765, +34778, +34785, +34795, +34819, +34819, +34829, +34841, +34848, +34854, +34854, +34854, +34878, +34894, +34894, +34900, +34917, +34934, +34940, +34970, +34998, +34998, +35004, +35004, +35012, +35012, +35012, +35020, +35020, +35032, +35038, +35062, +35062, +35062, +35068, +35068, +35082, +35092, +35096, +35107, +35118, +35134, +35155, +35155, +35166, +35178, +35178, +35195, +35201, +35201, +35201, +35226, +35226, +35226, +35226, +35256, +35262, +35272, +35280, +35299, +35332, +35354, +35354, +35354, +35370, +35386, +35417, +35417, +35460, +35473, +35478, +35495, +35504, +35504, +35518, +35552, +35589, +35624, +35624, +35637, +35637, +35643, +35643, +35669, +35682, +35695, +35702, +35709, +35709, +35726, +35739, +35749, +35756, +35756, +35778, +35803, +35810, +35829, +35883, +35899, +35905, +35911, +35911, +35923, +35947, +35954, +35980, +35987, +36034, +36052, +36063, +36095, +36106, +36106, +36113, +36120, +36140, +36140, +36153, +36160, +36160, +36167, +36203, +36203, +36218, +36218, +36225, +36253, +36259, +36284, +36296, +36310, +36324, +36331, +36344, +36367, +36367, +36367, +36412, +36412, +36422, +36463, +36463, +36463, +36479, +36490, +36513, +36520, +36520, +36527, +36527, +36527, +36540, +36574, +36594, +36594, +36605, +36621, +36621, +36641, +36641, +36641, +36659, +36682, +36682, +36682, +36682, +36705, +36705, +36705, +36720, +36720, +36755, +36755, +36771, +36771, +36771, +36788, +36806, +36835, +36845, +36875, +36875, +36903, +36921, +36928, +36928, +36940, +36940, +36940, +36966, +36966, +36973, +36983, +36998, +37004, +37014, +37024, +37024, +37032, +37038, +37038, +37061, +37074, +37074, +37091, +37098, +37105, +37105, +37133, +37141, +37141, +37148, +37191, +37191, +37197, +37197, +37210, +37224, +37224, +37231, +37250, +37257, +37273, +37273, +37280, +37287, +37294, +37300, +37307, +37330, +37348, +37348, +37359, +37359, +37359, +37377, +37392, +37398, +37412, +37431, +37469, +37486, +37508, +37517, +37535, +37535, +37542, +37542, +37549, +37549, +37549, +37549, +37556, +37576, +37576, +37583, +37590, +37597, +37604, +37604, +37621, +37635, +37676, +37676, +37704, +37711, +37728, +37728, +37737, +37737, +37737, +37750, +37757, +37778, +37785, +37785, +37819, +37826, +37833, +37843, +37850, +37869, +37914, +37921, +37935, +37942, +37949, +37982, +38013, +38013, +38013, +38023, +38057, +38077, +38097, +38110, +38117, +38123, +38133, +38133, +38133, +38140, +38140, +38148, +38159, +38179, +38192, +38205, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38218, +38225, +38225, +38230, +38246, +38258, +38280, +38287, +38294, +38294, +38294, +38301, +38318, +38318, +38340, +38371, +38371, +38384, +38420, +38440, +38453, +38481, +38506, +38522, +38534, +38559, +38559, +38559, +38564, +38564, +38581, +38604, +38604, +38611, +38620, +38626, +38635, +38635, +38635, +38666, +38674, +38688, +38693, +38710, +38722, +38722, +38722, +38729, +38734, +38752, +38792, +38818, +38825, +38861, +38902, +38934, +38949, +38949, +38960, +38969, +38985, +38985, +38996, +39013, +39024, +39024, +39032, +39061, +39074, +39089, +39123, +39123, +39123, +39140, +39161, +39180, +39206, +39215, +39254, +39261, +39277, +39284, +39314, +39314, +39330, +39340, +39340, +39371, +39371, +39392, +39430, +39430, +39437, +39444, +39461, +39468, +39468, +39485, +39517, +39524, +39538, +39543, +39548, +39555, +39581, +39588, +39588, +39609, +39609, +39616, +39652, +39670, +39677, +39677, +39684, +39691, +39702, +39717, +39717, +39717, +39724, +39749, +39760, +39766, +39775, +39791, +39791, +39814, +39827, +39827, +39837, +39859}; + +static const char tldData[] = { +"com.cn\0" +"com.co\0" +"hb.cn\0" +"med.br\0conf.lv\0wallonie.museum\0" +"namsos.no\0" +"\xe7\xb6\xb2\xe7\xbb\x9c.hk\0farmers.museum\0rel.pl\0" +"com.cu\0" +"military.museum\0" +"*.jm\0convent.museum\0cymru.museum\0malvik.no\0" +"univ.sn\0" +"gliding.aero\0" +"wodzislaw.pl\0" +"com.dm\0!pref.iwate.jp\0tran\xc3\xb8y.no\0pila.pl\0" +"mb.it\0*.ke\0lib.ri.us\0" +"com.ec\0*.kh\0tr\xc3\xb8gstad.no\0" +"com.ee\0" +"mobi.gp\0" +"gran.no\0" +"wa.gov.au\0" +"com.dz\0kg.kr\0" +"zoological.museum\0gjerstad.no\0haugesund.no\0kharkov.ua\0" +"walbrzych.pl\0" +"civilization.museum\0" +"ha.no\0" +"*.kw\0" +"med.ec\0com.es\0" +"med.ee\0otago.museum\0svelvik.no\0" +"art.ht\0amber.museum\0elvendrell.museum\0rost.no\0" +"jx.cn\0gratangen.no\0" +"association.aero\0ca.it\0" +"zaporizhzhe.ua\0" +"com.fr\0" +"szex.hu\0" +"e-burg.ru\0" +"com.ge\0bokn.no\0" +"mordovia.ru\0" +"com.gh\0*.mm\0" +"com.gi\0z.se\0" +"cahcesuolo.no\0" +"hurdal.no\0joshkar-ola.ru\0" +"cadaques.museum\0ma.us\0" +"a.bg\0" +"com.gn\0bozen.it\0tambov.ru\0" +"*.gifu.jp\0*.tokyo.jp\0*.mt\0" +"com.gp\0travel\0cc.tx.us\0" +"com.gr\0hemne.no\0" +"*.ni\0" +"*.mz\0" +"cc.il.us\0" +"com.gy\0" +"zj.cn\0oksnes.no\0museum.tt\0" +"com.hk\0*.np\0" +"rc.it\0baseball.museum\0" +"com.hn\0exhibition.museum\0" +"h\xc3\xa1""bmer.no\0" +"com.hr\0" +"fg.it\0stathelle.no\0defense.tn\0" +"com.ht\0" +"qld.gov.au\0*.nz\0" +"davvenj\xc3\xa1rga.no\0*.om\0" +"vang.no\0" +"*.kumamoto.jp\0" +"vercelli.it\0usenet.pl\0" +"com.io\0stalbans.museum\0" +"com.iq\0" +"*.pg\0" +"com.is\0klabu.no\0skiptvet.no\0" +"med.ht\0field.museum\0" +"gr.it\0gj\xc3\xb8vik.no\0tromsa.no\0lib.mi.us\0" +"ca.na\0" +"hagebostad.no\0k12.ma.us\0" +"*.qa\0" +"*.niigata.jp\0" +"monzaebrianza.it\0com.jo\0comunica\xc3\xa7\xc3\xb5""es.museum\0" +"gr.jp\0" +"ballangen.no\0*.py\0" +"scienceandindustry.museum\0" +"nuoro.it\0com.kg\0" +"com.ki\0" +"im.it\0idv.tw\0" +"*.akita.jp\0com.km\0r\xc3\xb8ros.no\0sopot.pl\0" +"!pref.yamanashi.jp\0" +"com.kp\0" +"!pref.kochi.jp\0com.la\0" +"com.lb\0" +"com.lc\0stjordalshalsen.no\0sigdal.no\0cc.nm.us\0" +"samnanger.no\0" +"drobak.no\0" +"vt.it\0" +"catering.aero\0com.ky\0" +"com.kz\0cc.ca.us\0" +"com.lk\0" +"grosseto.it\0mosvik.no\0" +"namsskogan.no\0" +"loten.no\0" +"chirurgiens-dentistes.fr\0" +"com.lr\0bremanger.no\0" +"gs.cn\0" +"com.lv\0lib.co.us\0" +"com.mg\0" +"passenger-association.aero\0" +"com.ly\0yekaterinburg.ru\0" +"vladivostok.ru\0" +"com.mk\0beeldengeluid.museum\0" +"com.ml\0" +"art.pl\0" +"com.mo\0" +"britishcolumbia.museum\0tx.us\0" +"com.na\0sakhalin.ru\0*.sv\0" +"mc.it\0" +"amsterdam.museum\0udm.ru\0" +"com.mu\0" +"com.mv\0com.nf\0" +"com.mw\0com.ng\0il.us\0" +"geometre-expert.fr\0com.mx\0" +"med.ly\0com.my\0" +"ag.it\0" +"*.tr\0" +"!pref.oita.jp\0" +"hoyanger.no\0skedsmo.no\0" +"com.nr\0turystyka.pl\0" +"koebenhavn.museum\0" +"quebec.museum\0" +"stord.no\0*.uk\0" +"act.au\0" +"br.it\0cb.it\0gyeonggi.kr\0jobs.tt\0lib.hi.us\0" +"*.ve\0" +"*.saga.jp\0wildlife.museum\0com.pa\0" +"monzabrianza.it\0sciencehistory.museum\0stange.no\0oskol.ru\0principe.st\0*.uy\0" +"plaza.museum\0com.pe\0" +"com.pf\0" +"eigersund.no\0" +"com.ph\0" +"manx.museum\0marylhurst.museum\0" +"md.ci\0pi.it\0schweiz.museum\0com.pk\0" +"grp.lk\0fr\xc3\xb8ya.no\0com.pl\0press.se\0" +"us.com\0" +"b.bg\0cremona.it\0communication.museum\0art.sn\0" +"med.pa\0" +"com.pr\0" +"com.ps\0" +"com.pt\0" +"k12.in.us\0" +"ah.cn\0bahcavuotna.no\0" +"sondrio.it\0arkhangelsk.ru\0" +"cargo.aero\0" +"council.aero\0" +"museum.mv\0hattfjelldal.no\0spydeberg.no\0med.pl\0" +"niepce.museum\0museum.mw\0" +"anthropology.museum\0" +"pharmacien.fr\0smola.no\0" +"fin.ec\0" +"selbu.no\0" +"workinggroup.aero\0nm.us\0" +"museum.no\0com.re\0" +"cc.vt.us\0" +"village.museum\0" +"ca.us\0" +"*.sapporo.jp\0" +"teramo.it\0" +"com.ro\0" +"*.ye\0" +"com.sa\0" +"com.sb\0" +"so.it\0com.sc\0" +"jolster.no\0com.sd\0" +"com.ru\0" +"com.rw\0com.sg\0" +"sydney.museum\0" +"sa.edu.au\0" +"tom.ru\0" +"com.sl\0*.za\0" +"\xe7\xbd\x91\xe7\xb5\xa1.hk\0naturbruksgymn.se\0com.sn\0" +"assedic.fr\0com.so\0" +"!pref.mie.jp\0*.yu\0" +"med.sa\0" +"newspaper.museum\0holmestrand.no\0dnepropetrovsk.ua\0" +"christiansburg.museum\0roan.no\0" +"pesaro-urbino.it\0med.sd\0com.st\0" +"s\xc3\xb8gne.no\0" +"nuernberg.museum\0" +"*.zm\0" +"com.sy\0" +"*.nagano.jp\0com.tj\0" +"nt.gov.au\0news.hu\0paderborn.museum\0" +"boston.museum\0" +"com.tn\0" +"com.to\0" +"broadcast.museum\0" +"com.ua\0" +"*.zw\0" +"baikal.ru\0" +"bykle.no\0com.tt\0" +"verdal.no\0" +"roros.no\0" +"fi.cr\0carboniaiglesias.it\0chuvashia.ru\0com.tw\0" +"k12.ca.us\0" +"eidsvoll.no\0" +"*.ishikawa.jp\0" +"dolls.museum\0" +"naval.museum\0" +"karasjok.no\0tysvar.no\0" +"bielawa.pl\0com.vc\0" +"svalbard.no\0deatnu.no\0rnd.ru\0" +"grandrapids.museum\0" +"bauern.museum\0k12.pr.us\0" +"press.ma\0" +"*.kagawa.jp\0fribourg.museum\0przeworsk.pl\0com.vi\0" +"com.uz\0" +"babia-gora.pl\0" +"com.vn\0" +"med.pro\0" +"suedtirol.it\0kursk.ru\0" +"bonn.museum\0" +"lt.it\0" +"design.aero\0microlight.aero\0americanantiques.museum\0meland.no\0" +"insurance.aero\0aarborte.no\0" +"kh.ua\0" +"macerata.it\0architecture.museum\0" +"rovigo.it\0rawa-maz.pl\0" +"store.nf\0levanger.no\0" +"b\xc3\xa1jddar.no\0" +"not.br\0" +"com.ws\0" +"!pref.kagawa.jp\0" +"!omanpost.om\0" +"vt.us\0" +"gs.ah.no\0vladikavkaz.ru\0" +"no.it\0" +"in.na\0szkola.pl\0a.se\0" +"aid.pl\0" +"workshop.museum\0vegarshei.no\0" +"sund.no\0" +"bs.it\0flora.no\0" +"agriculture.museum\0" +"koeln.museum\0" +"minnesota.museum\0k12.il.us\0" +"froya.no\0" +"aeroport.fr\0" +"davvenjarga.no\0zgora.pl\0ivano-frankivsk.ua\0" +"*.gunma.jp\0" +"amot.no\0" +"mus.br\0chungbuk.kr\0" +"ggf.br\0lorenskog.no\0" +"jeonbuk.kr\0" +"k12.vi.us\0" +"c.bg\0sande.more-og-romsdal.no\0" +"perugia.it\0" +"massa-carrara.it\0" +"michigan.museum\0" +"archaeology.museum\0mosj\xc3\xb8""en.no\0czest.pl\0koenig.ru\0\xe0\xb6\xbd\xe0\xb6\x82\xe0\xb6\x9a\xe0\xb7\x8f\0" +"mobi.tt\0" +"kraanghke.no\0" +"cc.in.us\0" +"re.it\0lib.vt.us\0" +"dell-ogliastra.it\0" +"s\xc3\xb8mna.no\0" +"k12.wv.us\0" +"gok.pk\0fh.se\0" +"luzern.museum\0" +"fi.it\0swidnica.pl\0" +"cbg.ru\0" +"latina.it\0" +"vibovalentia.it\0" +"modum.no\0" +"safety.aero\0" +"sp.it\0" +"science.museum\0ah.no\0" +"norddal.no\0" +"cc.na\0" +"re.kr\0" +"dielddanuorri.no\0" +"force.museum\0" +"torino.it\0cc.md.us\0" +"artanddesign.museum\0pisz.pl\0" +"olsztyn.pl\0" +"unsa.ba\0rade.no\0vinnica.ua\0" +"in.rs\0astrakhan.ru\0" +"sogne.no\0" +"homebuilt.aero\0" +"polkowice.pl\0" +"hole.no\0health.vn\0" +"fj.cn\0" +"davvesiida.no\0" +"vic.au\0" +"kongsberg.no\0" +"pub.sa\0" +"vv.it\0" +"!pref.tottori.jp\0" +"*.sendai.jp\0in.th\0" +"lib.pa.us\0" +"chiropractic.museum\0" +"mobi.na\0aca.pro\0" +"konyvelo.hu\0sciencecenters.museum\0" +"he.cn\0" +"in.ua\0" +"!city.nagoya.jp\0" +"muenchen.museum\0" +"psi.br\0" +"maryland.museum\0" +"!statecouncil.om\0" +"tr\xc3\xa6na.no\0" +"!pref.yamagata.jp\0jewishart.museum\0" +"lu.it\0me.it\0" +"chel.ru\0" +"tatarstan.ru\0" +"adult.ht\0in.us\0" +"kafjord.no\0" +"\xd7\x99\xd7\xa8\xd7\x95\xd7\xa9\xd7\x9c\xd7\x99\xd7\x9d.museum\0" +"net.ac\0k12.ec\0" +"net.ae\0bashkiria.ru\0" +"net.af\0!omantel.om\0" +"net.ag\0" +"net.ai\0" +"!pref.toyama.jp\0" +"net.al\0timekeeping.museum\0" +"net.an\0design.museum\0fin.tn\0" +"ethnology.museum\0" +"perso.ht\0asker.no\0b.se\0" +"net.ba\0" +"net.bb\0flanders.museum\0" +"mincom.tn\0" +"frana.no\0" +"bt.it\0" +"net.bh\0" +"auto.pl\0" +"net.az\0" +"treviso.it\0" +"war.museum\0" +"net.bm\0" +"langevag.no\0m\xc3\xa5lselv.no\0" +"net.bo\0" +"gol.no\0" +"folkebibl.no\0" +"net.br\0" +"net.bs\0troandin.no\0saotome.st\0lib.tn.us\0" +"md.us\0k12.ut.us\0" +"d.bg\0cambridge.museum\0\xc3\xa5s.no\0" +"net.ci\0" +"net.bz\0" +"sch.ae\0undersea.museum\0odda.no\0" +"net.cn\0" +"net.co\0c.la\0" +"gliwice.pl\0" +"aurskog-h\xc3\xb8land.no\0" +"andria-trani-barletta.it\0" +"net.cu\0loab\xc3\xa1t.no\0" +"rep.kp\0" +"\xe7\xbb\x84\xe7\xb9\x94.hk\0" +"gallery.museum\0" +"\xc3\xb8rland.no\0" +"store.ro\0" +"net.dm\0" +"somna.no\0" +"hemnes.no\0" +"ringebu.no\0k12.ky.us\0" +"net.ec\0" +"dn.ua\0" +"tarnobrzeg.pl\0" +"soc.lk\0" +"romsa.no\0" +"bamble.no\0" +"net.dz\0lutsk.ua\0" +"barlettatraniandria.it\0ta.it\0countryestate.museum\0" +"kaszuby.pl\0" +"*.yamaguchi.jp\0cranbrook.museum\0store.st\0" +"southcarolina.museum\0lib.md.us\0" +"textile.museum\0" +"cheltenham.museum\0hurum.no\0" +"*.oita.jp\0" +"shop.ht\0cc.me.us\0" +"shop.hu\0turin.it\0" +"louvre.museum\0" +"k12.ar.us\0" +"consulting.aero\0" +"gv.ao\0" +"sauherad.no\0" +"gv.at\0net.ge\0" +"ostre-toten.no\0lib.ok.us\0" +"net.gg\0pilots.museum\0" +"2000.hu\0geology.museum\0" +"net.gn\0" +"mazowsze.pl\0bir.ru\0" +"net.gp\0" +"net.gr\0" +"oxford.museum\0" +"per.la\0" +"eastafrica.museum\0" +"meeres.museum\0" +"net.gy\0*.shizuoka.jp\0" +"\xe5\x95\x86\xe6\xa5\xad.tw\0" +"net.hk\0" +"net.hn\0" +"philadelphiaarea.museum\0" +"osen.no\0" +"net.ht\0net.id\0" +"fundacio.museum\0" +"j\xc3\xb8rpeland.no\0" +"\xe6\x95\x99\xe8\x82\xb2.hk\0" +"divtasvuodna.no\0" +"student.aero\0sch.gg\0net.im\0" +"\xe7\xbd\x91\xe7\xbb\x9c.cn\0net.in\0" +"net.iq\0" +"net.ir\0" +"net.is\0" +"net.je\0" +"kepno.pl\0lapy.pl\0" +"per.nf\0" +"gov\0*.shimane.jp\0" +"artcenter.museum\0" +"k\xc3\xa5""fjord.no\0" +"net.jo\0" +"eu.int\0" +"c.se\0" +"net.kg\0" +"ce.it\0net.ki\0" +"sch.id\0os.hedmark.no\0" +"columbus.museum\0" +"arteducation.museum\0" +"net.kn\0" +"kr.com\0" +"net.la\0bushey.museum\0cc.gu.us\0" +"net.lb\0" +"net.lc\0" +"gs.bu.no\0" +"e164.arpa\0" +"chieti.it\0labour.museum\0" +"sch.ir\0creation.museum\0krodsherad.no\0" +"net.ky\0" +"net.kz\0me.us\0" +"e.bg\0sch.je\0net.lk\0" +"zlg.br\0suwalki.pl\0" +"\xe5\x80\x8b\xe4\xba\xba.hk\0net.ma\0" +"net.lr\0" +"sch.jo\0notaires.km\0net.me\0" +"net.lv\0karate.museum\0" +"net.ly\0karm\xc3\xb8y.no\0" +"rg.it\0" +"net.mk\0" +"net.ml\0evenes.no\0" +"ngo.lk\0net.mo\0egyptian.museum\0" +"marine.ru\0" +"realestate.pl\0" +"net.mu\0" +"net.mv\0net.nf\0" +"net.mw\0net.ng\0gda.pl\0" +"net.mx\0" +"freemasonry.museum\0net.my\0enebakk.no\0" +"karlsoy.no\0" +"\xe7\xbd\x91\xe7\xbb\x9c.hk\0\xc3\xb8rskog.no\0" +"randaberg.no\0" +"club.aero\0" +"certification.aero\0sr.it\0" +"center.museum\0so.gov.pl\0" +"caa.aero\0" +"sch.lk\0tvedestrand.no\0" +"net.nr\0" +"luroy.no\0" +"aukra.no\0s\xc3\xa1lat.no\0lib.me.us\0" +"ddr.museum\0" +"york.museum\0stryn.no\0k12.nm.us\0" +"per.sg\0" +"judaica.museum\0" +"verona.it\0" +"agdenes.no\0" +"cng.br\0sch.ly\0" +"net.pa\0" +"author.aero\0" +"naturalhistory.museum\0steiermark.museum\0bu.no\0" +"sn\xc3\xa5sa.no\0net.pe\0" +"net.ph\0" +"savannahga.museum\0batsfjord.no\0lib.oh.us\0" +"net.pk\0" +"net.pl\0" +"net.pn\0" +"washingtondc.museum\0" +"net.pr\0" +"net.ps\0" +"net.pt\0" +"nordkapp.no\0" +"emergency.aero\0krokstadelva.no\0" +"satx.museum\0ngo.ph\0omsk.ru\0" +"texas.museum\0" +"ngo.pl\0" +"mantova.it\0gu.us\0" +"!pref.shiga.jp\0isa.us\0" +"usa.museum\0" +"gb.net\0k12.vi\0" +"iveland.no\0" +"tempio-olbia.it\0" +"net.sa\0" +"net.sb\0" +"works.aero\0net.sc\0komvux.se\0" +"net.sd\0" +"net.ru\0" +"0.bg\0" +"forlicesena.it\0net.rw\0net.sg\0" +"klodzko.pl\0" +"detroit.museum\0wegrow.pl\0" +"net.sl\0" +"glogow.pl\0" +"store.bb\0air.museum\0" +"net.so\0" +"katowice.pl\0" +"nsk.ru\0" +"pisa.it\0eid.no\0" +"net.st\0" +"film.hu\0" +"tuva.ru\0d.se\0" +"net.th\0" +"net.sy\0" +"viterbo.it\0tsaritsyn.ru\0perso.sn\0net.tj\0" +"lib.gu.us\0" +"plc.co.im\0sec.ps\0" +"r\xc3\xa1hkker\xc3\xa1vju.no\0kazimierz-dolny.pl\0net.tn\0" +"net.to\0" +"veterinaire.km\0" +"net.ua\0" +"info.ht\0net.tt\0" +"info.hu\0" +"exchange.aero\0" +"sch.sa\0net.tw\0" +"andriatranibarletta.it\0perso.tn\0" +"f.bg\0malselv.no\0" +"net.vc\0" +"trana.no\0" +"ns.ca\0" +"net.vi\0" +"lucca.it\0oristano.it\0" +"usarts.museum\0net.vn\0" +"gon.pk\0" +"pl.ua\0" +"eastcoast.museum\0" +"novara.it\0" +"k12.ks.us\0" +"dp.ua\0" +"nesseby.no\0" +"!pref.wakayama.jp\0" +"repbody.aero\0" +"jamison.museum\0lugansk.ua\0" +"ss.it\0" +"alessandria.it\0" +"hadsel.no\0net.ws\0" +"\xe0\xae\x9a\xe0\xae\xbf\xe0\xae\x99\xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x82\xe0\xae\xb0\xe0\xaf\x8d\0" +"veterinaire.fr\0leirfjord.no\0" +"massacarrara.it\0north.museum\0" +"project.museum\0" +"other.nf\0" +"k12.nh.us\0" +"mat.br\0artgallery.museum\0" +"sr.gov.pl\0" +"gamvik.no\0" +"info.ec\0lancashire.museum\0" +"fm.br\0ltd.co.im\0" +"americana.museum\0southwest.museum\0cc.ak.us\0" +"enna.it\0lunner.no\0" +"v\xc3\xa5gan.no\0" +"mari.ru\0" +"accident-investigation.aero\0" +"sor-aurdal.no\0lib.ny.us\0" +"novosibirsk.ru\0" +"bjugn.no\0" +"n\xc3\xa6r\xc3\xb8y.no\0ostrowwlkp.pl\0" +"info.bb\0foundation.museum\0" +"brand.se\0" +"info.at\0!pref.akita.jp\0l\xc3\xb8ten.no\0" +"coal.museum\0miners.museum\0" +"glass.museum\0" +"info.az\0" +"frog.museum\0szczytno.pl\0nov.ru\0" +"sunndal.no\0" +"gen.in\0" +"gx.cn\0" +"web.co\0*.mie.jp\0hobol.no\0\xe5\x8f\xb0\xe6\xb9\xbe\0" +"logistics.aero\0plo.ps\0" +"erotika.hu\0" +"torsken.no\0" +"exeter.museum\0" +"info.co\0" +"selje.no\0" +"storfjord.no\0" +"barum.no\0lind\xc3\xa5s.no\0" +"leasing.aero\0" +"championship.aero\0fst.br\0" +"lierne.no\0" +"!gobiernoelectronico.ar\0""1.bg\0" +"corporation.museum\0" +"al.it\0*.miyagi.jp\0" +"*.aomori.jp\0" +"\xd8\xa7\xd9\x84\xd8\xa7\xd8\xb1\xd8\xaf\xd9\x86\0" +"amursk.ru\0" +"vestvagoy.no\0" +"\xd8\xa7\xdb\x8c\xd8\xb1\xd8\xa7\xd9\x86.ir\0cc.fl.us\0" +"os.hordaland.no\0" +"pistoia.it\0" +"tver.ru\0e.se\0" +"res.in\0*.yamagata.jp\0syzran.ru\0" +"capebreton.museum\0sandnessj\xc3\xb8""en.no\0" +"ternopil.ua\0" +"shop.pl\0" +"tank.museum\0" +"m\xc3\xa5s\xc3\xb8y.no\0" +"potenza.it\0time.museum\0" +"mjondalen.no\0" +"eng.br\0nedre-eiker.no\0" +"air-surveillance.aero\0" +"nt.au\0am.br\0pn.it\0" +"oystre-slidre.no\0ug.gov.pl\0" +"g.bg\0nesodden.no\0vologda.ru\0" +"parma.it\0tula.ru\0" +"*.nara.jp\0ak.us\0" +"nt.ca\0konin.pl\0" +"kiev.ua\0" +"skierv\xc3\xa1.no\0vestre-toten.no\0" +"ri.it\0botanical.museum\0farsund.no\0veg\xc3\xa5rshei.no\0dagestan.ru\0" +"ind.br\0k-uralsk.ru\0" +"rahkkeravju.no\0cmw.ru\0" +"canada.museum\0" +"fm.it\0" +"cc.wi.us\0" +"web.id\0aver\xc3\xb8y.no\0" +"dudinka.ru\0" +"baghdad.museum\0fitjar.no\0grane.no\0" +"gs.fm.no\0" +"sumy.ua\0" +"al.no\0" +"westfalen.museum\0" +"oregon.museum\0" +"bruxelles.museum\0elk.pl\0" +"planetarium.museum\0sn\xc3\xa5""ase.no\0" +"s\xc3\xb8rreisa.no\0" +"gs.st.no\0skien.no\0" +"bible.museum\0ivanovo.ru\0" +"avellino.it\0" +"tgory.pl\0" +"family.museum\0" +"ppg.br\0k12.as.us\0" +"trader.aero\0gorlice.pl\0" +"cc.al.us\0" +"ogliastra.it\0" +"is.it\0lib.nv.us\0" +"dr.na\0" +"media.hu\0nesna.no\0fl.us\0" +"uri.arpa\0" +"bjerkreim.no\0" +"charter.aero\0" +"genova.it\0" +"it.ao\0botany.museum\0hapmir.no\0" +"educational.museum\0" +"helsinki.museum\0" +"memorial.museum\0" +"web.lk\0pharmacy.museum\0" +"aircraft.aero\0appspot.com\0" +"ferrara.it\0beskidy.pl\0" +"hi.cn\0" +"taxi.aero\0flekkefjord.no\0" +"varoy.no\0" +"ragusa.it\0ambulance.museum\0" +"can.museum\0" +"*.osaka.jp\0isleofman.museum\0fm.no\0warmia.pl\0" +"educator.aero\0asmatart.museum\0" +"mi.it\0" +"kutno.pl\0" +"skedsmokorset.no\0" +"2.bg\0" +"*.kagoshima.jp\0km.ua\0" +"!city.sendai.jp\0" +"web.nf\0st.no\0cc.ri.us\0" +"reggiocalabria.it\0" +"wi.us\0" +"ancona.it\0newjersey.museum\0nnov.ru\0" +"f.se\0" +"ind.in\0" +"info.vn\0" +"andoy.no\0" +"ch.it\0fredrikstad.no\0guovdageaidnu.no\0" +"fjaler.no\0" +"sa.com\0" +"gs.nt.no\0" +"masfjorden.no\0" +"pordenone.it\0" +"po.it\0basel.museum\0" +"chambagri.fr\0" +"h.bg\0web.pk\0" +"london.museum\0" +"sciencecenter.museum\0\xe0\xb9\x84\xe0\xb8\x97\xe0\xb8\xa2\0" +"unbi.ba\0augustow.pl\0" +"wolomin.pl\0" +"notaires.fr\0tcm.museum\0al.us\0" +"nu.ca\0!pref.nagano.jp\0" +"info.tn\0" +"lib.wa.us\0" +"ed.ao\0info.tt\0" +"barreau.bj\0" +"k12.wy.us\0" +"pp.az\0gop.pk\0" +"int\0" +"l\xc3\xb8renskog.no\0podhale.pl\0" +"voagat.no\0" +"telekommunikation.museum\0" +"qld.au\0" +"te.it\0freiburg.museum\0snasa.no\0" +"gjemnes.no\0" +"sejny.pl\0" +"media.pl\0" +"skjak.no\0" +"watchandclock.museum\0" +"ed.ci\0pacific.museum\0" +"theater.museum\0info.ro\0" +"uk.com\0" +"campobasso.it\0aquarium.museum\0tysv\xc3\xa6r.no\0" +"kragero.no\0" +"windmill.museum\0info.sd\0" +"sologne.museum\0sande.m\xc3\xb8re-og-romsdal.no\0" +"nt.no\0cc.mi.us\0" +"ed.cr\0" +"academy.museum\0zachpomor.pl\0" +"tananger.no\0v\xc3\xa1rgg\xc3\xa1t.no\0ri.us\0" +"federation.aero\0" +"web.tj\0" +"matta-varjjat.no\0" +"steigen.no\0" +"local\0akrehamn.no\0" +"!pref.chiba.jp\0info.pk\0" +"info.pl\0""6bone.pl\0" +"klepp.no\0kherson.ua\0" +"ketrzyn.pl\0info.pr\0" +"sweden.museum\0" +"lardal.no\0" +"!retina.ar\0gz.cn\0" +"barletta-trani-andria.it\0vikna.no\0" +"bearalv\xc3\xa1hki.no\0" +"broker.aero\0gov.nc.tr\0" +"info.na\0k12.fl.us\0" +"hembygdsforbund.museum\0" +"entertainment.aero\0jerusalem.museum\0l\xc3\xa6rdal.no\0" +"hitra.no\0sogndal.no\0" +"farmequipment.museum\0info.mv\0info.nf\0\xc3\xa5lg\xc3\xa5rd.no\0" +"la-spezia.it\0" +"skanland.no\0fam.pk\0" +"skole.museum\0" +"art.museum\0" +"presidio.museum\0" +"3.bg\0public.museum\0" +"h\xc3\xb8yanger.no\0zagan.pl\0" +"an.it\0" +"philadelphia.museum\0info.nr\0" +"pesarourbino.it\0g\xc3\xa1ivuotna.no\0" +"poltava.ua\0" +"nt.ro\0" +"station.museum\0" +"mi.th\0" +"altoadige.it\0" +"nu.it\0" +"usculture.museum\0g.se\0" +"h\xc3\xa1mm\xc3\xa1rfeasta.no\0" +"daegu.kr\0info.la\0" +"dovre.no\0" +"ci.it\0horology.museum\0" +"bergbau.museum\0" +"press.museum\0" +"gangwon.kr\0" +"!city.kitakyushu.jp\0sor-varanger.no\0cc.hi.us\0" +"fuossko.no\0" +"zp.ua\0" +"american.museum\0" +"fl\xc3\xa5.no\0mi.us\0" +"i.bg\0" +"od.ua\0" +"encyclopedic.museum\0" +"ind.tn\0" +"midatlantic.museum\0" +"newyork.museum\0" +"castres.museum\0" +"act.edu.au\0" +"topology.museum\0" +"ed.jp\0" +"of.by\0" +"iris.arpa\0inf.br\0askim.no\0pyatigorsk.ru\0" +"nord-fron.no\0nsn.us\0" +"beardu.no\0" +"agrar.hu\0corvette.museum\0chtr.k12.ma.us\0" +"figueres.museum\0" +"!pref.gunma.jp\0medizinhistorisches.museum\0" +"tjeldsund.no\0" +"nebraska.museum\0" +"bellevue.museum\0" +"abo.pa\0k12.al.us\0" +"info.ki\0" +"inf.cu\0sv.it\0" +"jfk.museum\0" +"!city.osaka.jp\0swinoujscie.pl\0" +"bydgoszcz.pl\0" +"!city.kyoto.jp\0" +"uvic.museum\0" +"madrid.museum\0steinkjer.no\0" +"lib.ma.us\0" +"sirdal.no\0" +"n\xc3\xb8tter\xc3\xb8y.no\0" +"taranto.it\0starnberg.museum\0" +"vic.gov.au\0pvt.ge\0pors\xc3\xa1\xc5\x8bgu.no\0" +"naroy.no\0ris\xc3\xb8r.no\0" +"va.it\0salem.museum\0starachowice.pl\0" +"!nawrastelecom.om\0" +"town.museum\0te.ua\0" +"se.net\0" +"kemerovo.ru\0" +"lerdal.no\0" +"gs.va.no\0" +"kms.ru\0" +"consulado.st\0" +"haram.no\0" +"tysnes.no\0" +"!pref.ibaraki.jp\0hamburg.museum\0" +"\xc3\xa5rdal.no\0" +"airline.aero\0" +"crew.aero\0newhampshire.museum\0" +"muenster.museum\0" +"aerodrome.aero\0" +"heroy.nordland.no\0belau.pw\0" +"kamchatka.ru\0" +"b\xc3\xa5""d\xc3\xa5""ddj\xc3\xa5.no\0lillehammer.no\0hi.us\0" +"hk.cn\0" +"!city.kobe.jp\0berlevag.no\0" +"ardal.no\0" +"askoy.no\0" +"vardo.no\0" +"fyresdal.no\0" +"sassari.it\0" +"video.hu\0drammen.no\0" +"lyngen.no\0nakhodka.ru\0" +"ip6.arpa\0games.hu\0" +"online.museum\0" +"k12.sd.us\0" +"4.bg\0sebastopol.ua\0" +"ao.it\0atlanta.museum\0" +"lebork.pl\0" +"ravenna.it\0" +"railway.museum\0songdalen.no\0" +"!pref.shimane.jp\0delaware.museum\0ed.pw\0" +"f\xc3\xb8rde.no\0" +"living.museum\0" +"juif.museum\0" +"lomza.pl\0" +"h.se\0" +"!bl.uk\0" +"portland.museum\0\xe7\xb5\x84\xe7\xb9\x94.tw\0" +"stj\xc3\xb8rdal.no\0" +"lecce.it\0" +"bz.it\0" +"farmstead.museum\0va.no\0" +"express.aero\0!nacion.ar\0" +"presse.km\0gs.of.no\0" +"\xe5\x8f\xb0\xe7\x81\xa3\0" +"og.ao\0gyeongbuk.kr\0vestv\xc3\xa5g\xc3\xb8y.no\0" +"prd.fr\0" +"pp.ru\0pp.se\0" +"forum.hu\0!pref.saga.jp\0" +"kvalsund.no\0" +"!city.kawasaki.jp\0n\xc3\xa5\xc3\xa5mesjevuemie.no\0" +"j.bg\0" +"vlaanderen.museum\0" +"cc.va.us\0" +"\xd8\xa7\xd9\x8a\xd8\xb1\xd8\xa7\xd9\x86.ir\0alabama.museum\0" +"school.museum\0her\xc3\xb8y.m\xc3\xb8re-og-romsdal.no\0" +"\xc3\xa5seral.no\0" +"traniandriabarletta.it\0" +"flog.br\0" +"presse.ml\0" +"k\xc3\xa1r\xc3\xa1\xc5\xa1johka.no\0" +"historisch.museum\0" +"farm.museum\0palmsprings.museum\0oslo.no\0dyroy.no\0stranda.no\0" +"gs.rl.no\0r\xc3\xa5""de.no\0" +"bomlo.no\0s\xc3\xb8rum.no\0" +"jan-mayen.no\0ivgu.no\0" +"coop\0" +"agr.br\0k12.ak.us\0" +"!nic.ar\0catanzaro.it\0fusa.no\0" +"hu.com\0" +"inf.mk\0" +"vet.br\0" +"k12.mt.us\0k12.nd.us\0" +"vlog.br\0\xe5\x85\xac\xe5\x8f\xb8.cn\0sandnessjoen.no\0" +"lib.az.us\0" +"nsw.edu.au\0of.no\0\xc3\xb8stre-toten.no\0" +"*.okinawa.jp\0" +"vb.it\0" +"asso.fr\0firenze.it\0" +"trieste.it\0" +"\xe5\x85\xac\xe5\x8f\xb8.hk\0" +"museet.museum\0" +"prd.km\0" +"navuotna.no\0lib.ca.us\0" +"cc.nv.us\0" +"asso.gp\0" +"meraker.no\0" +"h\xc3\xa1pmir.no\0" +"i.ph\0" +"sx.cn\0jeonnam.kr\0" +"halden.no\0" +"fed.us\0" +"medio-campidano.it\0tsk.ru\0" +"barcelona.museum\0" +"giessen.museum\0roma.museum\0" +"hl.cn\0" +"\xe0\xae\x87\xe0\xae\xb2\xe0\xae\x99\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x88\0" +"biz.bb\0benevento.it\0rl.no\0bygland.no\0" +"port.fr\0asso.ht\0prd.mg\0" +"biz.at\0" +"tra.kp\0" +"*.aichi.jp\0khabarovsk.ru\0" +"campidano-medio.it\0" +"biz.az\0" +"newmexico.museum\0va.us\0" +"finearts.museum\0" +"murmansk.ru\0" +"\xc3\xb8rsta.no\0radom.pl\0k12.sc.us\0" +"5.bg\0kvinesdal.no\0" +"ap.it\0" +"*.fukushima.jp\0" +"asso.bj\0" +"mad.museum\0" +"lebesby.no\0" +"og.it\0glas.museum\0sauda.no\0" +"i.se\0" +"k12.tx.us\0" +"asso.ci\0mk.ua\0" +"cesena-forli.it\0" +"lowicz.pl\0" +"k12.id.us\0" +"tas.gov.au\0" +"lukow.pl\0" +"utazas.hu\0" +"maritimo.museum\0bjark\xc3\xb8y.no\0" +"adm.br\0" +"pr.it\0lib.vi.us\0" +"bergamo.it\0k12.va.us\0" +"k.bg\0" +"railroad.museum\0" +"!british-library.uk\0" +"cincinnati.museum\0" +"sorreisa.no\0" +"asso.dz\0!nel.uk\0" +"rm.it\0" +"nv.us\0" +"nx.cn\0gos.pk\0" +"vic.edu.au\0" +"biella.it\0tjome.no\0" +"r\xc3\xb8yken.no\0" +"beiarn.no\0" +"qc.ca\0" +"georgia.museum\0square.museum\0" +"labor.museum\0omasvuotna.no\0cc.la.us\0" +"br.com\0reggioemilia.it\0" +"kristiansund.no\0" +"sorum.no\0" +"orsta.no\0" +"furniture.museum\0surrey.museum\0eng.pro\0" +"asn.lv\0balat.no\0" +"lavangen.no\0sld.pa\0" +"fla.no\0k12.ms.us\0k12.nc.us\0" +"bardu.no\0" +"donostia.museum\0" +"club.tw\0" +"elburg.museum\0" +"gs.hl.no\0lodingen.no\0" +"samara.ru\0" +"vc.it\0*.nagasaki.jp\0" +"fosnes.no\0" +"fuel.aero\0" +"qc.com\0" +"skjervoy.no\0" +"bill.museum\0kv\xc3\xa6""fjord.no\0" +"skydiving.aero\0*.tokushima.jp\0" +"!congresodelalengua3.ar\0laquila.it\0k12.ct.us\0" +"gorge.museum\0linz.museum\0sherbrooke.museum\0" +"tranoy.no\0ing.pa\0" +"ptz.ru\0" +"kr.it\0prato.it\0stat.no\0" +"\xd0\xb8\xd0\xba\xd0\xbe\xd0\xbc.museum\0" +"cosenza.it\0" +"stj\xc3\xb8rdalshalsen.no\0" +"finland.museum\0leka.no\0cc.pr.us\0" +"historichouses.museum\0s\xc3\xa1l\xc3\xa1t.no\0" +"venice.it\0" +"biz.ki\0" +"g\xc3\xa1ls\xc3\xa1.no\0" +"\xe7\xbb\x84\xe7\xbb\x87.hk\0" +"*.yamanashi.jp\0" +"rad\xc3\xb8y.no\0" +"6.bg\0" +"fareast.ru\0" +"paragliding.aero\0ba.it\0aq.it\0" +"sk\xc3\xa5nland.no\0" +"its.me\0" +"us.na\0" +"hl.no\0cc.ga.us\0" +"ac\0granvin.no\0" +"ad\0qld.edu.au\0!city.sapporo.jp\0" +"ae\0" +"af\0" +"ag\0crotone.it\0" +"dallas.museum\0" +"ai\0brussels.museum\0" +"dali.museum\0" +"la.us\0" +"al\0salzburg.museum\0" +"am\0" +"an\0cl.it\0" +"ao\0" +"aq\0ba\0" +"bb\0" +"as\0lajolla.museum\0" +"at\0" +"be\0" +"bf\0inderoy.no\0snz.ru\0" +"aw\0bg\0" +"ax\0bh\0cim.br\0ltd.gi\0biz.mv\0" +"bi\0xz.cn\0\xe7\xb5\x84\xe7\xb9\x94.hk\0biz.mw\0" +"az\0bj\0" +"bm\0tranibarlettaandria.it\0naamesjevuemie.no\0" +"chattanooga.museum\0" +"bo\0" +"l.bg\0" +"ca\0" +"br\0stateofdelaware.museum\0" +"bs\0cc\0" +"cd\0biz.nr\0" +"cf\0berlev\xc3\xa5g.no\0" +"bw\0cg\0snaase.no\0" +"ch\0harvestcelebration.museum\0ck.ua\0" +"by\0ci\0" +"bz\0bahccavuotna.no\0" +"cl\0yuzhno-sakhalinsk.ru\0" +"cm\0halsa.no\0lyngdal.no\0" +"cn\0" +"co\0rn.it\0childrens.museum\0frankfurt.museum\0" +"cr\0" +"pskov.ru\0" +"cu\0de\0" +"cv\0fr.it\0lib.ky.us\0" +"aseral.no\0kvam.no\0" +"cx\0hellas.museum\0" +"hof.no\0" +"cz\0dj\0k12.la.us\0" +"dk\0moscow.museum\0" +"sosnowiec.pl\0" +"dm\0biz.pk\0" +"schokoladen.museum\0biz.pl\0" +"far.br\0arna.no\0tynset.no\0" +"even\xc3\xa1\xc5\xa1\xc5\xa1i.no\0" +"ec\0" +"biz.pr\0" +"ee\0celtic.museum\0" +"scientist.aero\0modern.museum\0" +"pr.us\0" +"dz\0" +"mj\xc3\xb8ndalen.no\0s\xc3\xb8r-odal.no\0" +"!nic.tr\0" +"conference.aero\0vestnes.no\0k12.mn.us\0" +"!pref.hiroshima.jp\0" +"es\0trapani.it\0" +"fermo.it\0vard\xc3\xb8.no\0" +"eu\0gs.hm.no\0r\xc3\xb8""d\xc3\xb8y.no\0stordal.no\0" +"gc.ca\0!nhs.uk\0" +"jgora.pl\0" +"fi\0stjordal.no\0" +"fm\0!mediaphone.om\0" +"kirov.ru\0pvt.k12.ma.us\0" +"fo\0" +"ga\0hyllestad.no\0" +"gov.ac\0fr\0andriabarlettatrani.it\0ga.us\0" +"gov.ae\0gd\0estate.museum\0" +"gov.af\0ge\0tolga.no\0" +"gf\0asso.re\0cc.oh.us\0" +"gg\0florida.museum\0" +"presse.ci\0gh\0" +"gi\0k12.dc.us\0" +"ltd.lk\0orland.no\0" +"gov.al\0" +"gl\0tokke.no\0" +"hanggliding.aero\0gm\0" +"hareid.no\0" +"gov.ba\0tj.cn\0gp\0" +"gov.bb\0gq\0" +"gov.as\0gr\0agrigento.it\0lc.it\0" +"gs\0kalmykia.ru\0aero.tt\0" +"gov.bf\0" +"county.museum\0" +"gov.bh\0hn.cn\0gw\0" +"gov.az\0gy\0assn.lk\0guernsey.museum\0" +"hk\0" +"gov.bm\0h\xc3\xa6gebostad.no\0biz.tj\0" +"hm\0computer.museum\0" +"gov.bo\0hn\0kl\xc3\xa6""bu.no\0" +"pulawy.pl\0" +"gov.br\0" +"trd.br\0gov.bs\0hr\0reggio-calabria.it\0historyofscience.museum\0lipetsk.ru\0" +"gov.cd\0*.nagoya.jp\0" +"ht\0id\0spjelkavik.no\0" +"hu\0ie\0aero.mv\0" +"marketplace.aero\0mn.it\0biz.tt\0" +"gov.by\0saintlouis.museum\0mer\xc3\xa5ker.no\0" +"gov.bz\0" +"7.bg\0gov.cl\0virtual.museum\0" +"gov.cm\0vennesla.no\0kr.ua\0" +"gov.cn\0im\0ar.it\0galsa.no\0rovno.ua\0" +"gov.co\0in\0" +"io\0limanowa.pl\0" +"iq\0k12.ga.us\0" +"ir\0" +"riik.ee\0is\0\xc3\xa1laheadju.no\0" +"gov.cu\0it\0hawaii.museum\0seaport.museum\0" +"je\0pubol.museum\0hm.no\0" +"gov.cx\0" +"*.chiba.jp\0" +"*.kawasaki.jp\0" +"k.se\0" +"gov.dm\0" +"aland.fi\0vik.no\0" +"yk.ca\0jo\0kobierzyce.pl\0" +"jp\0biz.vn\0" +"presse.fr\0lib.il.us\0\xe9\xa6\x99\xe6\xb8\xaf\0" +"gov.ec\0" +"transport.museum\0bronnoy.no\0" +"slg.br\0gov.ee\0asso.nc\0bievat.no\0" +"nyny.museum\0" +"kg\0" +"mo-i-rana.no\0" +"gov.dz\0ki\0" +"monmouth.museum\0" +"suldal.no\0" +"bc.ca\0km\0zt.ua\0" +"pt.it\0kn\0" +"fineart.museum\0" +"la\0" +"kr\0gulen.no\0" +"m.bg\0mo.cn\0lc\0alaheadju.no\0g\xc3\xa1\xc5\x8bgaviika.no\0" +"nowaruda.pl\0cc.ut.us\0" +"br\xc3\xb8nn\xc3\xb8y.no\0" +"ky\0li\0overhalla.no\0" +"kz\0khv.ru\0" +"lk\0" +"artdeco.museum\0" +"ma\0fortworth.museum\0kostroma.ru\0" +"ro.it\0kirkenes.no\0vestby.no\0" +"urbino-pesaro.it\0ls\0mc\0alstahaug.no\0" +"blog.br\0gov.ge\0lt\0md\0" +"lu\0me\0botanicgarden.museum\0" +"gov.gg\0lv\0oh.us\0" +"gov.gh\0mg\0valley.museum\0" +"gov.gi\0mh\0" +"ly\0sandiego.museum\0" +"mk\0" +"ml\0" +"gov.gn\0rollag.no\0naklo.pl\0" +"mn\0" +"mo\0" +"mp\0leirvik.no\0" +"gov.gr\0mq\0na\0cc.ks.us\0" +"mr\0" +"ms\0nc\0" +"valer.hedmark.no\0" +"mu\0ne\0" +"mv\0nf\0" +"mw\0" +"mx\0nord-odal.no\0jur.pro\0" +"my\0" +"gov.hk\0name.hr\0" +"nl\0" +"astronomy.museum\0lib.nm.us\0" +"catania.it\0" +"no\0" +"skjerv\xc3\xb8y.no\0" +"k12.ne.us\0" +"monza-e-della-brianza.it\0!pref.fukushima.jp\0nr\0" +"gov.ie\0" +"stuttgart.museum\0nu\0cc.mn.us\0" +"karasjohka.no\0" +"engine.aero\0bearalvahki.no\0" +"oyer.no\0" +"ve.it\0" +"gov.im\0froland.no\0cc.ar.us\0" +"gov.in\0magadan.ru\0" +"pescara.it\0" +"gov.iq\0usdecorativearts.museum\0" +"gov.ir\0pa\0" +"gov.is\0" +"gov.it\0lavagis.no\0" +"gov.je\0" +"naustdal.no\0pe\0k12.or.us\0" +"gd.cn\0carraramassa.it\0pf\0" +"ph\0" +"cc.ny.us\0" +"rissa.no\0" +"info\0pk\0pomorze.pl\0" +"pl\0" +"gov.jo\0asso.km\0pn\0" +"*.okayama.jp\0cieszyn.pl\0" +"freight.aero\0" +"pr\0" +"narvik.no\0ps\0" +"!pref.aichi.jp\0elverum.no\0pt\0" +"edunet.tn\0" +"gov.kg\0" +"flatanger.no\0marker.no\0pw\0" +"gov.ki\0nuremberg.museum\0" +"aip.ee\0" +"gov.km\0" +"gov.kn\0" +"gov.kp\0" +"rieti.it\0gov.la\0bajddar.no\0" +"gov.lb\0aviation.museum\0" +"gov.lc\0" +"asso.mc\0" +"re\0" +"ut.us\0" +"sa.gov.au\0gov.ky\0" +"mo.it\0gov.kz\0" +"gov.lk\0" +"iraq.museum\0" +"badajoz.museum\0" +"8.bg\0inder\xc3\xb8y.no\0" +"monticello.museum\0ro\0ks.ua\0" +"gov.ma\0svizzera.museum\0" +"gov.lr\0sa\0" +"matera.it\0sb\0" +"gov.lt\0rs\0sc\0" +"gov.me\0sd\0" +"gov.lv\0ru\0se\0" +"gov.mg\0" +"rw\0sg\0" +"gov.ly\0assisi.museum\0kids.museum\0sh\0" +"si\0" +"gov.mk\0" +"gov.ml\0sk\0" +"sl\0" +"gov.mn\0airguard.museum\0sm\0" +"gov.mo\0l.se\0sn\0" +"so\0" +"gov.mr\0ks.us\0" +"name.az\0sr\0" +"naturhistorisches.museum\0tc\0" +"trainer.aero\0cn.it\0urbinopesaro.it\0gov.mu\0nativeamerican.museum\0st\0td\0" +"gov.mv\0su\0" +"trentino.it\0gov.mw\0gov.ng\0tf\0" +"tg\0" +"co.ae\0venezia.it\0gov.my\0th\0" +"!pref.ehime.jp\0sy\0" +"co.ag\0lewismiller.museum\0ostrowiec.pl\0sz\0tj\0" +"tk\0" +"motorcycle.museum\0tl\0" +"birdart.museum\0trogstad.no\0tm\0" +"tn\0" +"humanities.museum\0to\0" +"pu.it\0gov.nr\0ua\0lib.ut.us\0" +"co.ao\0" +"co.ba\0trondheim.no\0tt\0" +"in-addr.arpa\0tempioolbia.it\0!city.yokohama.jp\0mn.us\0" +"n.bg\0schoenbrunn.museum\0tv\0" +"co.at\0aremark.no\0tw\0ug\0" +"jus.br\0" +"co.bi\0bialowieza.pl\0ar.us\0" +"audnedaln.no\0kustanai.ru\0" +"va\0" +"us\0vc\0" +"newport.museum\0" +"kopervik.no\0gov.ph\0vg\0" +"ny.us\0vi\0" +"co.bw\0finn\xc3\xb8y.no\0gov.pk\0uz\0" +"honefoss.no\0gov.pl\0lanbib.se\0" +"co.ci\0" +"gov.pn\0intl.tn\0" +"act.gov.au\0vn\0" +"television.museum\0gov.pr\0" +"sykkylven.no\0v\xc3\xa5ler.hedmark.no\0gov.ps\0" +"gov.pt\0" +"co.cr\0vu\0" +"legnica.pl\0" +"sa.au\0" +"bjarkoy.no\0" +"openair.museum\0birkenes.no\0lib.nj.us\0" +"fylkesbibl.no\0holt\xc3\xa5len.no\0" +"iz.hr\0" +"ws\0" +"oceanographique.museum\0" +"b\xc3\xa1id\xc3\xa1r.no\0cc.mo.us\0" +"\xc3\xb8ygarden.no\0" +"contemporary.museum\0" +"gb.com\0cc.as.us\0" +"belluno.it\0gov.sa\0" +"gov.sb\0" +"gov.rs\0gov.sc\0" +"gov.sd\0" +"!pref.nagasaki.jp\0gov.ru\0" +"asia\0" +"sa.cr\0gov.rw\0gov.sg\0" +"kuzbass.ru\0" +"gs.vf.no\0" +"gov.sl\0" +"norfolk.museum\0" +"k12.de.us\0" +"mil\0" +"rendalen.no\0" +"gov.st\0" +"agro.pl\0" +"orkdal.no\0" +"le.it\0gov.sy\0" +"gov.tj\0" +"co.gg\0nore-og-uvdal.no\0v\xc3\xa5ler.\xc3\xb8stfold.no\0" +"gov.tl\0" +"gov.tn\0" +"gov.to\0" +"kids.us\0" +"equipment.aero\0gov.ua\0" +"!city.niigata.jp\0gov.tt\0" +"sel.no\0" +"l\xc3\xa4ns.museum\0" +"gov.tw\0" +"rennebu.no\0" +"egersund.no\0" +"medecin.km\0" +"co.gy\0" +"!mecon.ar\0" +"berlin.museum\0" +"carrara-massa.it\0" +"9.bg\0" +"pri.ee\0gov.vc\0" +"at.it\0" +"muosat.no\0" +"co.id\0" +"co.hu\0" +"etne.no\0" +"\xc3\xa1lt\xc3\xa1.no\0" +"gov.vn\0" +"modelling.aero\0" +"co.im\0" +"co.in\0\xc3\xa5krehamn.no\0m.se\0" +"gouv.fr\0*.kitakyushu.jp\0" +"narviika.no\0" +"rennes\xc3\xb8y.no\0" +"co.ir\0afjord.no\0" +"lea\xc5\x8bgaviika.no\0buryatia.ru\0" +"co.it\0coastaldefence.museum\0" +"co.je\0vf.no\0" +"osteroy.no\0" +"uslivinghistory.museum\0" +"aerobatic.aero\0" +"mesaverde.museum\0mining.museum\0" +"a\xc3\xa9roport.ci\0gov.ws\0" +"co.jp\0copenhagen.museum\0" +"pv.it\0" +"r\xc3\xb8mskog.no\0" +"vossevangen.no\0porsanger.no\0" +"salat.no\0mo.us\0" +"o.bg\0imperia.it\0carrier.museum\0" +"carbonia-iglesias.it\0" +"as.us\0" +"alvdal.no\0" +"state.museum\0mandal.no\0cn.ua\0" +"cuneo.it\0" +"gouv.ht\0" +"!city.okayama.jp\0co.kr\0" +"co.lc\0" +"sa.it\0" +"donna.no\0" +"sortland.no\0" +"tomsk.ru\0" +"birthplace.museum\0l\xc3\xb8""dingen.no\0" +"ge.it\0orenburg.ru\0" +"cn.com\0" +"co.ma\0" +"co.ls\0skaun.no\0name.vn\0" +"navigation.aero\0" +"cagliari.it\0co.me\0portal.museum\0" +"gouv.bj\0" +"udine.it\0" +"engineer.aero\0" +"szczecin.pl\0" +"wales.museum\0" +"co.na\0bo.telemark.no\0" +"austin.museum\0" +"k12.mo.us\0" +"co.mu\0" +"gouv.ci\0" +"co.mw\0" +"esp.br\0" +"naturalhistorymuseum.museum\0" +"mosjoen.no\0" +"solund.no\0" +"name.tj\0" +"sand\xc3\xb8y.no\0" +"kunstunddesign.museum\0" +"cartoonart.museum\0collection.museum\0gsm.pl\0" +"aure.no\0" +"!pref.yamaguchi.jp\0historical.museum\0" +"name.tt\0" +"england.museum\0valle.no\0" +"cc.ok.us\0" +"salangen.no\0" +"gloppen.no\0" +"cc.co.us\0" +"contemporaryart.museum\0" +"tas.edu.au\0" +"trading.aero\0" +"mazury.pl\0" +"!pref.aomori.jp\0co.pl\0" +"opoczno.pl\0" +"*.kobe.jp\0co.pn\0" +"oppegard.no\0" +"co.pw\0" +"saltdal.no\0smolensk.ru\0" +"na.it\0\xc4\x8d\xc3\xa1hcesuolo.no\0" +"vgs.no\0evenassi.no\0" +"parachuting.aero\0jl.cn\0maritime.museum\0bd.se\0" +"badaddja.no\0" +"bergen.no\0" +"brussel.museum\0" +"avoues.fr\0" +"cesenaforli.it\0" +"oregontrail.museum\0" +"ullensaker.no\0" +"jobs\0" +"accident-prevention.aero\0" +"n.se\0" +"association.museum\0california.museum\0" +"cultural.museum\0co.rs\0" +"zoology.museum\0" +"pruszkow.pl\0" +"control.aero\0nt.edu.au\0net\0komforb.se\0" +"lincoln.museum\0aurland.no\0name.pr\0co.rw\0" +"ostroleka.pl\0" +"isernia.it\0" +"tm.fr\0" +"gs.ol.no\0" +"nb.ca\0marnardal.no\0" +"williamsburg.museum\0" +"!jet.uk\0" +"suisse.museum\0\xc3\xa5""fjord.no\0flakstad.no\0" +"karmoy.no\0" +"yn.cn\0chesapeakebay.museum\0" +"nsw.au\0" +"amur.ru\0co.st\0" +"imb.br\0siellak.no\0\xe7\xb6\xb2\xe8\xb7\xaf.tw\0" +"name.na\0" +"co.th\0" +"p.bg\0" +"co.sz\0co.tj\0" +"name.mv\0\xc3\xa5lesund.no\0lib.in.us\0" +"lucerne.museum\0naumburg.museum\0" +"society.museum\0name.my\0" +"tinn.no\0" +"co.tt\0" +"unj\xc3\xa1rga.no\0" +"co.ug\0" +"lib.wy.us\0" +"co.tz\0" +"ass.km\0" +"ok.us\0" +"tm.hu\0kongsvinger.no\0" +"ibestad.no\0" +"juedisches.museum\0co.us\0" +"cq.cn\0" +"rs.ba\0" +"wa.edu.au\0co.vi\0" +"co.uz\0" +"health.museum\0" +"grue.no\0" +"automotive.museum\0journalism.museum\0settlement.museum\0" +"qh.cn\0interactive.museum\0" +"snillfjord.no\0!national-library-scotland.uk\0" +"balsfjord.no\0lib.nh.us\0" +"kolobrzeg.pl\0" +"gs.tm.no\0" +"h\xc3\xb8nefoss.no\0" +"ol.no\0" +"music.museum\0moareke.no\0" +"b\xc3\xb8.nordland.no\0" +"name.mk\0lier.no\0" +"eidfjord.no\0" +"sc.cn\0tm.km\0" +"jelenia-gora.pl\0sanok.pl\0" +"intelligence.museum\0" +"srv.br\0elblag.pl\0" +"judygarland.museum\0" +"padua.it\0" +"k12.co.us\0" +"lindesnes.no\0" +"name.jo\0izhevsk.ru\0" +"yorkshire.museum\0mel\xc3\xb8y.no\0" +"tm.mc\0lib.pr.us\0" +"hjartdal.no\0" +"tm.mg\0" +"bari.it\0milano.it\0" +"lg.jp\0" +"zgrad.ru\0" +"sm\xc3\xb8la.no\0" +"communications.museum\0" +"arts.co\0seoul.kr\0engerdal.no\0" +"oster\xc3\xb8y.no\0" +"\xe6\x95\x8e\xe8\x82\xb2.hk\0foggia.it\0verran.no\0" +"orskog.no\0voronezh.ru\0kv.ua\0" +"av.it\0" +"tm.no\0nissedal.no\0" +"historisches.museum\0gs.mr.no\0" +"medecin.fr\0" +"montreal.museum\0" +"o.se\0" +"!metro.tokyo.jp\0sola.no\0" +"k12.tn.us\0" +"floro.no\0" +"milan.it\0*.shiga.jp\0" +"berkeley.museum\0" +"maintenance.aero\0" +"ws.na\0" +"lindas.no\0cc.ia.us\0" +"brescia.it\0embroidery.museum\0" +"arezzo.it\0tm.pl\0" +"r\xc3\xa6lingen.no\0" +"burghof.museum\0" +"rec.br\0" +"q.bg\0" +"!nawras.om\0" +"hammarfeasta.no\0" +"moss.no\0" +"on.ca\0" +"gouv.rw\0" +"luxembourg.museum\0" +"rec.co\0british.museum\0" +"reggio-emilia.it\0" +"gouv.sn\0lib.wv.us\0" +"avocat.fr\0" +"simbirsk.ru\0" +"jar.ru\0" +"monza-brianza.it\0" +"tm.ro\0" +"imageandsound.museum\0" +"jpn.com\0mr.no\0" +"siracusa.it\0" +"norilsk.ru\0tm.se\0" +"tn.it\0" +"jeju.kr\0" +"!pref.fukuoka.jp\0" +"*.hyogo.jp\0portlligat.museum\0" +"!pref.osaka.jp\0" +"siena.it\0sc.kr\0omaha.museum\0saskatchewan.museum\0" +"phoenix.museum\0vanylven.no\0" +"botanicalgarden.museum\0" +"turek.pl\0" +"vagsoy.no\0" +"riodejaneiro.museum\0" +"vi.it\0" +"uy.com\0" +"kristiansand.no\0" +"sd.cn\0trento.it\0" +"muncie.museum\0" +"berg.no\0meldal.no\0" +"nes.buskerud.no\0" +"saratov.ru\0" +"gs.oslo.no\0" +"harstad.no\0vaga.no\0" +"research.museum\0" +"brunel.museum\0ia.us\0" +"test.tj\0" +"columbia.museum\0" +"ms.it\0stockholm.museum\0" +"reklam.hu\0" +"pomorskie.pl\0lg.ua\0" +"bg.it\0historicalsociety.museum\0rns.tn\0" +"mallorca.museum\0surgut.ru\0cc.sc.us\0" +"ushistory.museum\0" +"palana.ru\0" +"snoasa.no\0" +"naturalsciences.museum\0" +"yaroslavl.ru\0" +"unjarga.no\0" +"p.se\0" +"ingatlan.hu\0" +"irc.pl\0" +"savona.it\0" +"cr.it\0" +"test.ru\0cc.tn.us\0" +"ms.kr\0museumvereniging.museum\0" +"time.no\0k12.ia.us\0" +"vladimir.ru\0" +"correios-e-telecomunica\xc3\xa7\xc3\xb5""es.museum\0" +"gouv.km\0nationalfirearms.museum\0" +"m\xc3\xa1latvuopmi.no\0" +"aero\0yosemite.museum\0" +"r.bg\0school.na\0" +"cc.vi.us\0" +"*.wakayama.jp\0" +"beauxarts.museum\0averoy.no\0ullensvang.no\0bar.pro\0" +"!city.hiroshima.jp\0" +"b\xc3\xa1hccavuotna.no\0" +"frosta.no\0" +"gdynia.pl\0" +"medical.museum\0" +"embaixada.st\0" +"balsan.it\0vantaa.museum\0" +"za.net\0" +"!city.saitama.jp\0lib.ks.us\0" +"fnd.br\0" +"ru.com\0se.com\0hol.no\0modalen.no\0" +"gouv.ml\0chukotka.ru\0" +"malopolska.pl\0" +"mansion.museum\0" +"iki.fi\0children.museum\0" +"cyber.museum\0rec.nf\0mo\xc3\xa5reke.no\0" +"to.it\0" +"hasvik.no\0" +"\xc3\xb8yer.no\0" +"arts.ro\0sc.ug\0" +"lib.ar.us\0" +"sc.tz\0cc.ms.us\0cc.nc.us\0" +"etc.br\0poznan.pl\0" +"cnt.br\0viking.museum\0" +"*.miyazaki.jp\0" +"melhus.no\0" +"skodje.no\0vevelstad.no\0" +"sc.us\0" +"upow.gov.pl\0" +"!city.fukuoka.jp\0brandywinevalley.museum\0natuurwetenschappen.museum\0tranby.no\0" +"bahn.museum\0msk.ru\0" +"delmenhorst.museum\0" +"russia.museum\0fuoisku.no\0" +"shell.museum\0" +"r\xc3\xa1isa.no\0" +"hs.kr\0udmurtia.ru\0" +"palermo.it\0" +"pilot.aero\0" +"tn.us\0" +"priv.hu\0" +"li.it\0" +"kr\xc3\xa5""anghke.no\0mosreg.ru\0" +"lib.fl.us\0" +"plants.museum\0" +"ulsan.kr\0national.museum\0" +"mil.ac\0!pref.nara.jp\0surgeonshall.museum\0" +"mil.ae\0santacruz.museum\0vi.us\0" +"wlocl.pl\0" +"mt.it\0napoli.it\0alaska.museum\0arts.nf\0" +"missoula.museum\0" +"rec.ro\0" +"mil.al\0" +"marburg.museum\0waw.pl\0" +"pharmaciens.km\0indianapolis.museum\0larsson.museum\0" +"cc.sd.us\0" +"mil.ba\0mobi\0" +"indianmarket.museum\0" +"recreation.aero\0padova.it\0" +"varese.it\0parti.se\0" +"mil.az\0" +"mil.bo\0!pref.kagoshima.jp\0khmelnitskiy.ua\0" +"rygge.no\0" +"os\xc3\xb8yro.no\0" +"mil.br\0" +"cs.it\0" +"austevoll.no\0fjell.no\0" +"mil.by\0" +"!pref.tokushima.jp\0org\0" +"mil.cn\0gs.svalbard.no\0" +"mil.co\0" +"pz.it\0lib.va.us\0\xd1\x80\xd1\x84\0" +"\xe4\xb8\xaa\xe4\xba\xba.hk\0ms.us\0nc.us\0k12.wi.us\0" +"s.bg\0drangedal.no\0" +"en.it\0" +"culturalcenter.museum\0" +"house.museum\0divttasvuotna.no\0" +"fhs.no\0" +"circus.museum\0" +"priv.at\0" +"mil.ec\0" +"ruovat.no\0" +"midsund.no\0vagan.no\0" +"casadelamoneda.museum\0" +"bristol.museum\0" +"and.museum\0" +"ascolipiceno.it\0computerhistory.museum\0vyatka.ru\0" +"uhren.museum\0" +"lahppi.no\0" +"*.yokohama.jp\0cody.museum\0lib.al.us\0" +"colonialwilliamsburg.museum\0indian.museum\0cc.ky.us\0" +"tp.it\0biev\xc3\xa1t.no\0" +"can.br\0royken.no\0" +"id.ir\0" +"mediocampidano.it\0tromso.no\0" +"kartuzy.pl\0k12.ok.us\0" +"*.saitama.jp\0stjohn.museum\0m\xc3\xa1tta-v\xc3\xa1rjjat.no\0" +"mil.ge\0trani-barletta-andria.it\0" +"lib.as.us\0" +"swiebodzin.pl\0cc.mt.us\0cc.nd.us\0" +"mil.gh\0" +"science-fiction.museum\0\xd9\x82\xd8\xb7\xd8\xb1\0" +"airtraffic.aero\0" +"konskowola.pl\0" +"scienceandhistory.museum\0nysa.pl\0sd.us\0" +"balestrand.no\0" +"oygarden.no\0" +"her\xc3\xb8y.nordland.no\0" +"!pref.ishikawa.jp\0strand.no\0" +"\xe7\xb5\x84\xe7\xbb\x87.hk\0mil.hn\0" +"gob.bo\0volda.no\0" +"losangeles.museum\0larvik.no\0" +"university.museum\0" +"cc.dc.us\0" +"mil.id\0" +"sorfold.no\0" +"watch-and-clock.museum\0" +"flor\xc3\xb8.no\0" +"nittedal.no\0oppeg\xc3\xa5rd.no\0" +"k12.ri.us\0" +"gob.cl\0" +"komi.ru\0" +"government.aero\0mil.in\0" +"mil.iq\0id.lv\0" +"culture.museum\0" +"id.ly\0" +"raholt.no\0" +"lubin.pl\0grozny.ru\0" +"kchr.ru\0" +"nikolaev.ua\0" +"lib.sd.us\0" +"de.com\0" +"mil.jo\0" +"*.kanagawa.jp\0gaular.no\0miasta.pl\0" +"bi.it\0rnu.tn\0uzhgorod.ua\0" +"idrett.no\0v\xc3\xa5gs\xc3\xb8y.no\0" +"wroclaw.pl\0" +"res.aero\0ne.jp\0mil.kg\0" +"\xc3\xa5mli.no\0" +"education.museum\0" +"dgca.aero\0" +"mil.km\0" +"trolley.museum\0" +"cci.fr\0r.se\0" +"archaeological.museum\0" +"monzaedellabrianza.it\0mil.kr\0" +"gob.es\0kvafjord.no\0ky.us\0" +"lecco.it\0" +"ct.it\0" +"magazine.aero\0" +"operaunite.com\0ne.kr\0" +"mil.kz\0skoczow.pl\0" +"nf.ca\0" +"western.museum\0" +"kunst.museum\0gaivuotna.no\0karpacz.pl\0spb.ru\0cc.id.us\0" +"slask.pl\0" +"youth.museum\0" +"adv.br\0campidanomedio.it\0!songfest.om\0" +"geelvinck.museum\0\xd8\xa7\xd9\x85\xd8\xa7\xd8\xb1\xd8\xa7\xd8\xaa\0" +"mil.lv\0" +"fie.ee\0mil.mg\0mt.us\0nd.us\0k12.vt.us\0" +"t.bg\0ushuaia.museum\0" +"off.ai\0" +"irkutsk.ru\0" +"stor-elvdal.no\0tourism.tn\0" +"penza.ru\0" +"bj.cn\0\xe4\xb8\xad\xe5\x9b\xbd\0" +"civilwar.museum\0mil.mv\0opole.pl\0" +"nes.akershus.no\0" +"mil.my\0karelia.ru\0" +"como.it\0sande.vestfold.no\0" +"\xe4\xb8\xad\xe5\x9c\x8b\0" +"gob.hn\0lib.la.us\0" +"mil.no\0cc.wv.us\0" +"boleslawiec.pl\0" +"!pref.niigata.jp\0gs.sf.no\0dc.us\0k12.mi.us\0" +"museum\0dep.no\0kv\xc3\xa6nangen.no\0l\xc3\xa1hppi.no\0" +"film.museum\0" +"frei.no\0" +"notodden.no\0risor.no\0" +"messina.it\0" +"eidsberg.no\0" +"krakow.pl\0lib.mt.us\0lib.nd.us\0" +"rauma.no\0" +"mulhouse.museum\0" +"sibenik.museum\0grong.no\0mil.pe\0" +"budejju.no\0k12.nv.us\0" +"stavanger.no\0mil.ph\0" +"forli-cesena.it\0" +"naples.it\0cc.ne.us\0" +"s\xc3\xb8r-aurdal.no\0" +"mil.pl\0" +"vibo-valentia.it\0ski.museum\0siedlce.pl\0" +"bus.museum\0" +"tozsde.hu\0" +"!pref.shizuoka.jp\0santabarbara.museum\0" +"zhitomir.ua\0" +"pro.az\0" +"ne.pw\0" +"pro.br\0orkanger.no\0b\xc3\xb8.telemark.no\0" +"roma.it\0cc.ct.us\0" +"heritage.museum\0giske.no\0" +"!pref.kumamoto.jp\0prof.pr\0" +"*.kochi.jp\0" +"andria-barletta-trani.it\0*.toyama.jp\0sveio.no\0" +"id.us\0" +"bolt.hu\0" +"fetsund.no\0porsgrunn.no\0" +"iglesias-carbonia.it\0" +"sf.no\0" +"mil.ru\0" +"from.hr\0asnes.no\0mil.rw\0" +"alesund.no\0sos.pl\0" +"livorno.it\0" +"crafts.museum\0" +"aquila.it\0" +"vega.no\0" +"jewelry.museum\0" +"sk\xc3\xa1nit.no\0chita.ru\0" +"pro.ec\0" +"fortmissoula.museum\0j\xc3\xb8lster.no\0" +"pro\0mil.st\0" +"busan.kr\0lib.ga.us\0" +"dellogliastra.it\0" +"aosta.it\0chungnam.kr\0gob.mx\0" +"mil.sy\0k12.hi.us\0" +"mil.tj\0" +"ulan-ude.ru\0mil.to\0wv.us\0" +"luster.no\0volgograd.ru\0" +"pa.it\0kommunalforbund.se\0lib.tx.us\0" +"s.se\0" +"qsl.br\0" +"mil.tw\0" +"est.pr\0ens.tn\0" +"lib.id.us\0" +"mil.tz\0" +"uscountryestate.museum\0" +"agents.aero\0" +"\xc3\xb8vre-eiker.no\0ne.ug\0" +"pb.ao\0" +"gob.pa\0ne.tz\0" +"tur.br\0" +"mil.vc\0" +"or.at\0gob.pe\0" +"s\xc3\xb8r-fron.no\0" +"or.bi\0ne.us\0" +"u.bg\0gob.pk\0" +"stavern.no\0" +"brindisi.it\0" +"aknoluokta.no\0" +"!pref.kyoto.jp\0tydal.no\0" +"plc.ly\0muos\xc3\xa1t.no\0" +"or.ci\0hamaroy.no\0priv.pl\0" +"vestre-slidre.no\0gniezno.pl\0" +"\xe7\xae\x87\xe4\xba\xba.hk\0" +"andebu.no\0" +"nieruchomosci.pl\0\xd8\xa7\xd9\x84\xd8\xb3\xd8\xb9\xd9\x88\xd8\xaf\xd9\x8a\xd8\xa9\0" +"or.cr\0pro.ht\0bolzano.it\0" +"ct.us\0k12.md.us\0" +"za.org\0" +"!icnet.uk\0" +"localhistory.museum\0" +"firm.ht\0" +"lel.br\0tr.it\0kvanangen.no\0" +"sondre-land.no\0t\xc3\xb8nsberg.no\0vefsn.no\0" +"nature.museum\0yamal.ru\0" +"rv.ua\0" +"lans.museum\0lib.ne.us\0" +"lur\xc3\xb8y.no\0" +"eu.com\0firm.in\0" +"hjelmeland.no\0" +"gs.tr.no\0" +"casino.hu\0essex.museum\0tourism.pl\0" +"rennesoy.no\0" +"priv.no\0" +"baths.museum\0mytis.ru\0" +"tingvoll.no\0" +"cc.az.us\0" +"sh.cn\0" +"!pref.miyazaki.jp\0s\xc3\xb8rfold.no\0" +"aurskog-holand.no\0malatvuopmi.no\0" +"lib.ct.us\0" +"cc.pa.us\0" +"pa.gov.pl\0" +"firm.co\0cc.de.us\0" +"nrw.museum\0" +"daejeon.kr\0livinghistory.museum\0" +"gildeskal.no\0lund.no\0" +"\xc3\xb8ksnes.no\0stavropol.ru\0" +"b\xc3\xa6rum.no\0r\xc3\xb8yrvik.no\0" +"osoyro.no\0" +"priv.me\0sula.no\0!parliament.uk\0" +"nationalheritage.museum\0" +"jaworzno.pl\0" +"dinosaur.museum\0" +"garden.museum\0trust.museum\0" +"turen.tn\0" +"kautokeino.no\0" +"pro.na\0" +"gorizia.it\0" +"siljan.no\0" +"or.id\0pro.mv\0" +"bieszczady.pl\0www.ro\0" +"lib.ee\0antiques.museum\0brasil.museum\0tr.no\0" +"aejrie.no\0" +"!pref.hokkaido.jp\0" +"schlesisches.museum\0" +"huissier-justice.fr\0or.it\0" +"t.se\0" +"environment.museum\0" +"vindafjord.no\0" +"edu.ac\0or.jp\0" +"tree.museum\0" +"groundhandling.aero\0edu.af\0" +"rochester.museum\0sanfrancisco.museum\0" +"ebiz.tw\0" +"kirovograd.ua\0" +"edu.al\0" +"edu.an\0\xc3\xa1k\xc5\x8boluokta.no\0v\xc3\xa5g\xc3\xa5.no\0" +"v.bg\0" +"edu.ba\0" +"edu.bb\0nesset.no\0" +"hornindal.no\0pro.pr\0" +"or.kr\0" +"az.us\0" +"edu.bh\0volkenkunde.museum\0" +"edu.bi\0" +"edu.az\0" +"b\xc3\xb8mlo.no\0" +"edu.bm\0" +"edu.bo\0tyumen.ru\0" +"edu.br\0" +"edu.bs\0pa.us\0" +"alto-adige.it\0whaling.museum\0" +"*.iwate.jp\0" +"edu.ci\0law.pro\0" +"edu.bz\0de.us\0" +"lib.ak.us\0" +"edu.cn\0" +"edu.co\0" +"laspezia.it\0" +"baidar.no\0" +"ts.it\0" +"or.na\0" +"edu.cu\0hotel.lk\0" +"show.aero\0or.mu\0" +"sandnes.no\0" +"museumcenter.museum\0" +"edu.dm\0kazan.ru\0" +"biz\0caltanissetta.it\0odessa.ua\0k12.oh.us\0" +"crimea.ua\0" +"research.aero\0lom.no\0" +"edu.ec\0florence.it\0clock.museum\0sshn.se\0" +"edu.ee\0game.tw\0" +"!pref.okinawa.jp\0" +"ilawa.pl\0" +"edu.dz\0indiana.museum\0" +"gs.jan-mayen.no\0" +"publ.pt\0" +"nom.ad\0" +"skanit.no\0gdansk.pl\0k12.pa.us\0" +"nom.ag\0edu.es\0" +"if.ua\0" +"pro.tt\0lib.de.us\0" +"environmentalconservation.museum\0cc.or.us\0" +"bern.museum\0nat.tn\0" +"rubtsovsk.ru\0" +"!educ.ar\0masoy.no\0" +"bologna.it\0" +"\xc3\xa5snes.no\0fhv.se\0" +"*.tottori.jp\0radoy.no\0" +"romskog.no\0" +"malbork.pl\0" +"olbiatempio.it\0" +"edu.ge\0" +"edu.gh\0" +"edu.gi\0" +"or.pw\0" +"hob\xc3\xb8l.no\0" +"nom.br\0edu.gn\0virginia.museum\0mbone.pl\0!nls.uk\0" +"seljord.no\0pro.vn\0" +"edu.gp\0" +"edu.gr\0" +"!uba.ar\0!pref.saitama.jp\0" +"greta.fr\0gs.aa.no\0kvinnherad.no\0" +"lib.sc.us\0" +"js.cn\0nom.co\0edu.hk\0" +"lesja.no\0" +"bl.it\0" +"edu.hn\0\xc3\xb8ystre-slidre.no\0mari-el.ru\0" +"hotel.hu\0" +"rindal.no\0" +"edu.ht\0" +"!pref.miyagi.jp\0" +"midtre-gauldal.no\0" +"xj.cn\0australia.museum\0" +"ab.ca\0salvadordali.museum\0olawa.pl\0" +"pc.it\0" +"u.se\0" +"edu.in\0b\xc3\xa1l\xc3\xa1t.no\0" +"ln.cn\0alta.no\0" +"chelyabinsk.ru\0" +"edu.iq\0" +"ontario.museum\0" +"edu.is\0" +"edu.it\0" +"b\xc3\xa5tsfjord.no\0" +"trysil.no\0or.th\0" +"utsira.no\0" +"nom.es\0edu.jo\0fhsk.se\0" +"bale.museum\0" +"w.bg\0" +"lillesand.no\0" +"edu.kg\0" +"amusement.aero\0" +"edu.ki\0" +"fauske.no\0or.ug\0" +"int.az\0askvoll.no\0eidskog.no\0cv.ua\0" +"algard.no\0" +"edu.km\0or.tz\0" +"nom.fr\0edu.kn\0" +"*.ibaraki.jp\0hoylandet.no\0" +"int.bo\0edu.kp\0" +"edu.la\0" +"si.it\0edu.lb\0travel.pl\0" +"edu.lc\0mx.na\0n\xc3\xa1vuotna.no\0ovre-eiker.no\0" +"aa.no\0!siemens.om\0" +"sciences.museum\0or.us\0" +"cat\0" +"edu.ky\0" +"int.ci\0edu.kz\0firm.ro\0cc.wy.us\0" +"edu.lk\0vaapste.no\0" +"!pref.tochigi.jp\0" +"int.co\0podlasie.pl\0" +"edu.lr\0" +"karikatur.museum\0jamal.ru\0" +"gjovik.no\0krager\xc3\xb8.no\0k12.az.us\0" +"edu.me\0" +"ud.it\0edu.lv\0entomology.museum\0" +"edu.mg\0moskenes.no\0" +"\xe6\x94\xbf\xe5\xba\x9c.hk\0edu.ly\0" +"stpetersburg.museum\0" +"edu.mk\0" +"edu.ml\0nordreisa.no\0" +"!pref.fukui.jp\0lib.ms.us\0lib.nc.us\0" +"edu.mn\0\xd9\x81\xd9\x84\xd8\xb3\xd8\xb7\xd9\x8a\xd9\x86\0" +"fot.br\0edu.mo\0" +"iron.museum\0" +"asti.it\0annefrank.museum\0stv.ru\0cc.nh.us\0" +"edu.mv\0" +"lodi.it\0edu.mw\0edu.ng\0" +"gwangju.kr\0edu.mx\0" +"edu.my\0" +"soundandvision.museum\0" +"lenvik.no\0" +"ballooning.aero\0" +"name\0" +"jogasz.hu\0frogn.no\0" +"history.museum\0" +"consultant.aero\0edu.nr\0" +"manchester.museum\0" +"*.hiroshima.jp\0" +"pol.dz\0" +"*.tochigi.jp\0heimatunduhren.museum\0" +"!pref.kanagawa.jp\0" +"firm.nf\0edu.pa\0" +"coop.ht\0pc.pl\0" +"chicago.museum\0" +"vn.ua\0" +"edu.pe\0" +"tana.no\0edu.pf\0" +"edu.ph\0" +"nom.km\0" +"travel.tt\0" +"edu.pk\0" +"experts-comptables.fr\0edu.pl\0bryansk.ru\0" +"edu.pn\0" +"evje-og-hornnes.no\0warszawa.pl\0" +"ac.ae\0" +"edu.pr\0" +"vaksdal.no\0edu.ps\0dni.us\0" +"po.gov.pl\0edu.pt\0" +"nordre-land.no\0vadso.no\0" +"rnrt.tn\0" +"sport.hu\0!pref.gifu.jp\0voss.no\0targi.pl\0" +"flesberg.no\0" +"photography.museum\0" +"modena.it\0tonsberg.no\0" +"ac.at\0" +"ac.be\0coop.br\0" +"services.aero\0" +"nom.mg\0" +"wielun.pl\0" +"jefferson.museum\0wy.us\0" +"pd.it\0ot.it\0neues.museum\0slattum.no\0" +"vdonsk.ru\0" +"ar.com\0edu.sa\0" +"\xc3\xa5l.no\0edu.sb\0" +"edu.rs\0edu.sc\0" +"ac.ci\0int.is\0edu.sd\0!tsk.tr\0" +"br\xc3\xb8nn\xc3\xb8ysund.no\0and\xc3\xb8y.no\0edu.ru\0" +"pol.ht\0" +"edu.rw\0edu.sg\0" +"gyeongnam.kr\0olecko.pl\0" +"ac.cn\0" +"graz.museum\0" +"coldwar.museum\0edu.sl\0" +"ac.cr\0" +"edu.sn\0" +"hamar.no\0" +"histoire.museum\0" +"!city.shizuoka.jp\0" +"edu.st\0" +"oceanographic.museum\0nh.us\0" +"x.bg\0" +"surnadal.no\0" +"fc.it\0costume.museum\0stalowa-wola.pl\0" +"valer.ostfold.no\0edu.sy\0" +"edu.tj\0" +"arq.br\0" +"aeroclub.aero\0odo.br\0pe.ca\0\xe7\xb6\xb2\xe7\xb5\xa1.cn\0bronnoysund.no\0nom.pa\0" +"edu.to\0" +"paleo.museum\0nom.pe\0edu.ua\0" +"int.la\0trustee.museum\0forsand.no\0krasnoyarsk.ru\0" +"!pref.hyogo.jp\0" +"edu.tt\0" +"zarow.pl\0" +"edu.tw\0" +"nom.pl\0" +"community.museum\0kvitsoy.no\0" +"int.lk\0tychy.pl\0" +"k12.me.us\0" +"jondal.no\0edu.vc\0" +"illustration.museum\0" +"clinton.museum\0" +"tas.au\0es.kr\0" +"production.aero\0" +"rodoy.no\0" +"database.museum\0bodo.no\0" +"anthro.museum\0landes.museum\0edu.vn\0" +"nom.re\0" +"altai.ru\0" +"filatelia.museum\0" +"sk.ca\0lezajsk.pl\0" +"rockart.museum\0int.mv\0" +"int.mw\0herad.no\0" +"eti.br\0ac.gn\0" +"fedje.no\0nom.ro\0" +"money.museum\0" +"\xd9\x85\xd8\xb5\xd8\xb1\0" +"horten.no\0" +"gangaviika.no\0mielec.pl\0" +"uw.gov.pl\0" +"moma.museum\0" +"edu.ws\0" +"go.ci\0" +"tv.bo\0technology.museum\0" +"s\xc3\xb8ndre-land.no\0" +"tv.br\0" +"jor.br\0lib.dc.us\0" +"arboretum.museum\0" +"go.cr\0" +"artsandcrafts.museum\0\xd8\xaa\xd9\x88\xd9\x86\xd8\xb3\0" +"psc.br\0ac.id\0!city.chiba.jp\0" +"wa.au\0" +"rome.it\0" +"amli.no\0" +"ac.im\0lo.it\0" +"ac.in\0" +"\xe7\xb6\xb2\xe7\xb5\xa1.hk\0durham.museum\0" +"ac.ir\0" +"torino.museum\0" +"loabat.no\0" +"com\0" +"nalchik.ru\0" +"yakutia.ru\0" +"settlers.museum\0" +"!promocion.ar\0int.pt\0" +"union.aero\0" +"utah.museum\0" +"giehtavuoatna.no\0" +"ac.jp\0" +"air-traffic-control.aero\0" +"silk.museum\0usantiques.museum\0" +"bn.it\0" +"kalisz.pl\0" +"perm.ru\0" +"aoste.it\0bindal.no\0" +"coloradoplateau.museum\0k12.gu.us\0" +"frosinone.it\0forde.no\0" +"epilepsy.museum\0" +"olbia-tempio.it\0" +"journalist.aero\0ac.kr\0*.sch.uk\0" +"nic.im\0sciencesnaturelles.museum\0bedzin.pl\0" +"nic.in\0pe.it\0" +"w.se\0" +"!pref.okayama.jp\0" +"urn.arpa\0" +"cinema.museum\0" +"monza.it\0versailles.museum\0int.ru\0" +"andasuolo.no\0skj\xc3\xa5k.no\0chernovtsy.ua\0" +"nyc.museum\0int.rw\0paroch.k12.ma.us\0" +"ringerike.no\0" +"ac.ma\0" +"org.ac\0civilaviation.aero\0" +"rakkestad.no\0" +"org.ae\0ac.me\0" +"org.af\0" +"org.ag\0" +"org.ai\0stokke.no\0" +"airport.aero\0" +"finnoy.no\0" +"org.al\0" +"org.an\0y.bg\0habmer.no\0" +"stadt.museum\0holtalen.no\0" +"int.tj\0" +"org.ba\0gjerdrum.no\0" +"org.bb\0ascoli-piceno.it\0molde.no\0r\xc3\xb8st.no\0tysfjord.no\0" +"pe.kr\0rybnik.pl\0" +"go.id\0" +"ac.mu\0" +"ac.mw\0ac.ng\0" +"org.bh\0\xc3\xa5mot.no\0rana.no\0" +"org.bi\0" +"org.az\0belgorod.ru\0int.tt\0" +"ae.org\0" +"group.aero\0posts-and-telecommunications.museum\0" +"org.bm\0salerno.it\0" +"etnedal.no\0" +"org.bo\0*.hokkaido.jp\0donetsk.ua\0" +"ostroda.pl\0" +"org.br\0" +"org.bs\0" +"go.it\0h\xc3\xb8ylandet.no\0" +"zgorzelec.pl\0" +"org.bw\0" +"org.ci\0" +"org.bz\0vicenza.it\0resistance.museum\0" +"missile.museum\0" +"org.cn\0" +"org.co\0assassination.museum\0" +"go.jp\0" +"tv.it\0austrheim.no\0ac.pa\0" +"verbania.it\0" +"palace.museum\0" +"tmp.br\0int.vn\0" +"org.cu\0" +"paris.museum\0" +"media.aero\0hokksund.no\0" +"arts.museum\0gemological.museum\0hammerfest.no\0" +"k12.ny.us\0" +"org.dm\0hemsedal.no\0ringsaker.no\0sklep.pl\0" +"h\xc3\xa5.no\0cc.nj.us\0" +"rzeszow.pl\0" +"go.kr\0gjesdal.no\0ac.pr\0" +"org.ec\0" +"org.ee\0" +"media.museum\0" +"terni.it\0touch.museum\0zakopane.pl\0" +"journal.aero\0org.dz\0" +"incheon.kr\0" +"b\xc3\xa1hcavuotna.no\0" +"leksvik.no\0ulvik.no\0" +"plantation.museum\0" +"org.es\0loyalist.museum\0" +"gildesk\xc3\xa5l.no\0bytom.pl\0" +"bo.nordland.no\0" +"ambulance.aero\0iglesiascarbonia.it\0" +"tw.cn\0\xe6\x96\xb0\xe5\x8a\xa0\xe5\x9d\xa1\0" +"chocolate.museum\0" +"pittsburgh.museum\0" +"royrvik.no\0sor-odal.no\0ac.rs\0" +"kaluga.ru\0" +"org.ge\0erotica.hu\0ac.ru\0ac.se\0" +"org.gg\0leangaviika.no\0ac.rw\0" +"org.gh\0v\xc3\xa6r\xc3\xb8y.no\0" +"org.gi\0" +"jevnaker.no\0" +"org.gn\0tv.na\0leikanger.no\0" +"org.gp\0" +"ask\xc3\xb8y.no\0" +"org.gr\0wroc.pl\0" +"ad.jp\0" +"powiat.pl\0" +"tj\xc3\xb8me.no\0" +"coop.tt\0" +"ac.th\0" +"mragowo.pl\0ac.sz\0ac.tj\0" +"org.hk\0bo.it\0" +"philately.museum\0" +"org.hn\0" +"fet.no\0" +"axis.museum\0mansions.museum\0" +"wiki.br\0" +"org.ht\0" +"org.hu\0piacenza.it\0scotland.museum\0cpa.pro\0" +"ac.ug\0" +"coop.mv\0x.se\0" +"coop.mw\0ac.tz\0" +"bmd.br\0" +"org.im\0ralingen.no\0" +"org.in\0" +"cz.it\0lib.ia.us\0" +"org.iq\0" +"org.ir\0" +"org.is\0" +"nl.ca\0" +"org.je\0" +"childrensgarden.museum\0" +"kvits\xc3\xb8y.no\0go.pw\0" +"sokndal.no\0" +"ra.it\0grimstad.no\0" +"denmark.museum\0" +"ac.vn\0" +"ecn.br\0org.jo\0" +"bialystok.pl\0nj.us\0" +"z.bg\0bilbao.museum\0stargard.pl\0nic.tj\0" +"eisenbahn.museum\0" +"fe.it\0bryne.no\0vrn.ru\0" +"cc.wa.us\0" +"sex.hu\0skierva.no\0" +"org.kg\0" +"org.ki\0" +"org.km\0" +"org.kn\0khakassia.ru\0" +"org.kp\0" +"org.la\0" +"org.lb\0" +"org.lc\0" +"francaise.museum\0" +"panama.museum\0" +"rotorcraft.aero\0gateway.museum\0olkusz.pl\0" +"org.ky\0czeladz.pl\0ryazan.ru\0" +"org.kz\0" +"org.lk\0dyr\xc3\xb8y.no\0" +"raisa.no\0" +"dlugoleka.pl\0" +"org.ma\0" +"org.lr\0prochowice.pl\0" +"org.ls\0" +"org.me\0sandoy.no\0s\xc3\xb8r-varanger.no\0" +"org.lv\0" +"org.mg\0" +"tel\0go.th\0" +"org.ly\0" +"steam.museum\0go.tj\0" +"org.mk\0pasadena.museum\0jessheim.no\0lib.mn.us\0" +"org.ml\0" +"software.aero\0" +"org.mn\0" +"org.mo\0" +"*.fukui.jp\0decorativearts.museum\0" +"spy.museum\0org.na\0jorpeland.no\0" +"vads\xc3\xb8.no\0" +"org.mu\0building.museum\0gausdal.no\0" +"org.mv\0nannestad.no\0" +"org.mw\0org.ng\0go.ug\0" +"vr.it\0org.mx\0" +"org.my\0" +"go.tz\0" +"oppdal.no\0" +"uk.net\0" +"coop.km\0" +"*.kyoto.jp\0" +"sarpsborg.no\0org.nr\0" +"chernigov.ua\0" +"ha.cn\0no.com\0" +"space.museum\0" +"org.pa\0" +"*.ar\0" +"usgarden.museum\0" +"*.bd\0org.pe\0" +"*.au\0org.pf\0um.gov.pl\0" +"bio.br\0" +"org.ph\0" +"org.pk\0" +"fr\xc3\xa6na.no\0org.pl\0" +"nord-aurdal.no\0org.pn\0" +"*.bn\0handson.museum\0agrinet.tn\0" +"kviteseid.no\0" +"rel.ht\0virtuel.museum\0atm.pl\0org.pr\0" +"org.ps\0cherkassy.ua\0" +"org.pt\0wa.us\0" +"*.bt\0arendal.no\0magnitka.ru\0" +"depot.museum\0porsangu.no\0" +"laakesvuemie.no\0" +"sor-fron.no\0" +"heroy.more-og-romsdal.no\0" +"*.ck\0" +"!rakpetroleum.om\0" +"kr\xc3\xb8""dsherad.no\0mail.pl\0" +"mod.gi\0" +"gs.nl.no\0" +"mb.ca\0" +"pavia.it\0" +"civilisation.museum\0folldal.no\0" +"suli.hu\0" +"brumunddal.no\0" +"*.cy\0" +"pg.it\0troms\xc3\xb8.no\0" +"sex.pl\0y.se\0" +"org.ro\0" +"*.do\0" +"caserta.it\0org.sa\0" +"za.com\0halloffame.museum\0org.sb\0lviv.ua\0" +"mill.museum\0org.rs\0org.sc\0" +"org.sd\0" +"idv.hk\0!omanmobile.om\0org.ru\0org.se\0" +"langev\xc3\xa5g.no\0r\xc3\xa5holt.no\0starostwo.gov.pl\0" +"trani-andria-barletta.it\0org.sg\0" +"*.eg\0hvaler.no\0" +"*.ehime.jp\0" +"gmina.pl\0" +"bod\xc3\xb8.no\0org.sl\0" +"edu\0org.sn\0" +"org.so\0lib.wi.us\0" +"kommune.no\0" +"nome.pt\0" +"*.er\0namdalseid.no\0k12.wa.us\0" +"nm.cn\0org.st\0" +"*.et\0d\xc3\xb8nna.no\0" +"jewish.museum\0preservation.museum\0" +"slupsk.pl\0org.sy\0" +"art.br\0org.sz\0org.tj\0" +"ntr.br\0*.fj\0ski.no\0" +"*.fk\0rimini.it\0grajewo.pl\0" +"loppa.no\0" +"franziskaner.museum\0notteroy.no\0org.tn\0" +"org.to\0" +"nesoddtangen.no\0" +"org.ua\0" +"discovery.museum\0wloclawek.pl\0" +"lakas.hu\0org.tt\0" +"kurgan.ru\0" +"baltimore.museum\0nkz.ru\0org.tw\0" +"com.ac\0castle.museum\0" +"*.fukuoka.jp\0sandefjord.no\0varggat.no\0" +"com.af\0" +"com.ag\0" +"ato.br\0k12.nj.us\0" +"com.ai\0" +"city.hu\0oryol.ru\0" +"com.al\0nl.no\0mielno.pl\0cc.ma.us\0" +"org.vc\0" +"com.an\0g12.br\0" +"*.gt\0" +"*.gu\0" +"com.ba\0" +"com.bb\0americanart.museum\0" +"org.vi\0" +"kunstsammlung.museum\0" +"com.aw\0" +"flight.aero\0com.bh\0lib.mo.us\0org.vn\0" +"com.bi\0adygeya.ru\0" +"com.az\0" +"art.dz\0" +"com.bm\0" +"dr\xc3\xb8""bak.no\0" +"com.bo\0isla.pr\0" +"com.br\0" +"com.bs\0ustka.pl\0kuban.ru\0" +"press.aero\0" +"vs.it\0" +"meloy.no\0" +"*.il\0ulm.museum\0" +"com.by\0com.ci\0genoa.it\0" +"com.bz\0sn.cn\0" +"lib.or.us\0" +"santafe.museum\0org.ws\0" +}; + +#endif // QNETWORKCOOKIEJARTLD_P_H diff --git a/src/network/access/qnetworkcookiejartlds_p.h.INFO b/src/network/access/qnetworkcookiejartlds_p.h.INFO new file mode 100644 index 0000000..57a8d0e --- /dev/null +++ b/src/network/access/qnetworkcookiejartlds_p.h.INFO @@ -0,0 +1,17 @@ +The file qnetworkcookiejartlds_p.h is generated from the Public Suffix +List (see [1] and [2]), by the program residing at +util/network/cookiejar-generateTLDs in the Qt source tree. + +That program generates a character array and an index array from the +list to provide fast lookups of elements within C++. + +Those arrays in qnetworkcookiejartlds_p.h are derived from the Public +Suffix List ([2]), which was originally provided by +Jo Hermans <jo.hermans@gmail.com>. + +The file qnetworkcookiejartlds_p.h was last generated Friday, +November 19th 15:24 2010. + +---- +[1] list: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 +[2] homepage: http://publicsuffix.org/ diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 01b9c0c..6548158 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include <QtNetwork/QNetworkCookieJar> +#include "private/qnetworkcookiejar_p.h" class tst_QNetworkCookieJar: public QObject { @@ -53,6 +54,8 @@ private slots: void setCookiesFromUrl(); void cookiesForUrl_data(); void cookiesForUrl(); + void effectiveTLDs_data(); + void effectiveTLDs(); }; QT_BEGIN_NAMESPACE @@ -174,6 +177,31 @@ void tst_QNetworkCookieJar::setCookiesFromUrl_data() result += cookie; QTest::newRow("security-path-1") << preset << cookie << "http://www.foo.tld" << result << true; + // check effective TLDs + // 1. co.uk is an effective TLD, should be denied + result.clear(); + preset.clear(); + cookie.setPath("/"); + cookie.setDomain(".co.uk"); + QTest::newRow("effective-tld1-denied") << preset << cookie << "http://something.co.uk" << result << false; + cookie.setDomain("co.uk"); + QTest::newRow("effective-tld1-denied2") << preset << cookie << "http://something.co.uk" << result << false; + cookie.setDomain(".something.co.uk"); + result += cookie; + QTest::newRow("effective-tld1-accepted") << preset << cookie << "http://something.co.uk" << result << true; + + // 2. anything .ar is an effective TLD ('*.ar'), but 'gobiernoelectronico.ar' is an exception + result.clear(); + preset.clear(); + cookie.setDomain(".farmacia.ar"); + QTest::newRow("effective-tld2-denied") << preset << cookie << "http://farmacia.ar" << result << false; + QTest::newRow("effective-tld2-denied2") << preset << cookie << "http://www.farmacia.ar" << result << false; + QTest::newRow("effective-tld2-denied3") << preset << cookie << "http://www.anything.farmacia.ar" << result << false; + cookie.setDomain(".gobiernoelectronico.ar"); + result += cookie; + QTest::newRow("effective-tld2-accepted") << preset << cookie << "http://www.gobiernoelectronico.ar" << result << true; + + // setting the defaults: finalCookie = cookie; finalCookie.setPath("/something/"); @@ -334,6 +362,82 @@ void tst_QNetworkCookieJar::cookiesForUrl() QCOMPARE(result, expectedResult); } +void tst_QNetworkCookieJar::effectiveTLDs_data() +{ + QTest::addColumn<QString>("domain"); + QTest::addColumn<bool>("isTLD"); + + QTest::newRow("yes1") << "com" << true; + QTest::newRow("yes2") << "de" << true; + QTest::newRow("yes3") << "ulm.museum" << true; + QTest::newRow("yes4") << "krodsherad.no" << true; + QTest::newRow("yes5") << "1.bg" << true; + QTest::newRow("yes6") << "com.cn" << true; + QTest::newRow("yes7") << "org.ws" << true; + QTest::newRow("yes8") << "co.uk" << true; + QTest::newRow("yes9") << "wallonie.museum" << true; + + QTest::newRow("no1") << "anything.com" << false; + QTest::newRow("no2") << "anything.de" << false; + QTest::newRow("no3") << "eselsberg.ulm.museum" << false; + QTest::newRow("no4") << "noe.krodsherad.no" << false; + QTest::newRow("no5") << "2.1.bg" << false; + QTest::newRow("no6") << "foo.com.cn" << false; + QTest::newRow("no7") << "something.org.ws" << false; + QTest::newRow("no8") << "teatime.co.uk" << false; + QTest::newRow("no9") << "bla" << false; + QTest::newRow("no10") << "bla.bla" << false; + + const ushort s1[] = {0x74, 0x72, 0x61, 0x6e, 0xf8, 0x79, 0x2e, 0x6e, 0x6f, 0x00}; // xn--trany-yua.no + const ushort s2[] = {0x5d9, 0x5e8, 0x5d5, 0x5e9, 0x5dc, 0x5d9, 0x5dd, 0x2e, 0x6d, 0x75, 0x73, 0x65, 0x75, 0x6d, 0x00}; // xn--9dbhblg6di.museum + const ushort s3[] = {0x7ec4, 0x7e54, 0x2e, 0x68, 0x6b, 0x00}; // xn--mk0axi.hk + const ushort s4[] = {0x7f51, 0x7edc, 0x2e, 0x63, 0x6e, 0x00}; // xn--io0a7i.cn + const ushort s5[] = {0x72, 0xe1, 0x68, 0x6b, 0x6b, 0x65, 0x72, 0xe1, 0x76, 0x6a, 0x75, 0x2e, 0x6e, 0x6f, 0x00}; // xn--rhkkervju-01af.no + const ushort s6[] = {0xb9a, 0xbbf, 0xb99, 0xbcd, 0xb95, 0xbaa, 0xbcd, 0xbaa, 0xbc2, 0xbb0, 0xbcd, 0x00}; // xn--clchc0ea0b2g2a9gcd + const ushort s7[] = {0x627, 0x644, 0x627, 0x631, 0x62f, 0x646, 0x00}; // xn--mgbayh7gpa + const ushort s8[] = {0x63, 0x6f, 0x72, 0x72, 0x65, 0x69, 0x6f, 0x73, 0x2d, 0x65, 0x2d, 0x74, 0x65, 0x6c, 0x65, + 0x63, 0x6f, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0xe7, 0xf5, 0x65, 0x73, 0x2e, 0x6d, 0x75, + 0x73, 0x65, 0x75, 0x6d, 0x00}; // xn--correios-e-telecomunicaes-ghc29a.museum + QTest::newRow("yes-specialchars1") << QString::fromUtf16(s1) << true; + QTest::newRow("yes-specialchars2") << QString::fromUtf16(s2) << true; + QTest::newRow("yes-specialchars3") << QString::fromUtf16(s3) << true; + QTest::newRow("yes-specialchars4") << QString::fromUtf16(s4) << true; + QTest::newRow("yes-specialchars5") << QString::fromUtf16(s5) << true; + QTest::newRow("yes-specialchars6") << QString::fromUtf16(s6) << true; + QTest::newRow("yes-specialchars7") << QString::fromUtf16(s7) << true; + QTest::newRow("yes-specialchars8") << QString::fromUtf16(s8) << true; + + QTest::newRow("no-specialchars1") << QString::fromUtf16(s1).prepend("something") << false; + QTest::newRow("no-specialchars2") << QString::fromUtf16(s2).prepend(QString::fromUtf16(s2)) << false; + QTest::newRow("no-specialchars2.5") << QString::fromUtf16(s2).prepend("whatever") << false; + QTest::newRow("no-specialchars3") << QString::fromUtf16(s3).prepend("foo") << false; + QTest::newRow("no-specialchars4") << QString::fromUtf16(s4).prepend("bar") << false; + QTest::newRow("no-specialchars5") << QString::fromUtf16(s5).prepend(QString::fromUtf16(s2)) << false; + QTest::newRow("no-specialchars6") << QString::fromUtf16(s6).prepend(QLatin1Char('.') + QString::fromUtf16(s6)) << false; + QTest::newRow("no-specialchars7") << QString::fromUtf16(s7).prepend("bla") << false; + QTest::newRow("no-specialchars8") << QString::fromUtf16(s8).append("foo") << false; + + QTest::newRow("exception1") << "pref.iwate.jp" << false; + QTest::newRow("exception2") << "omanpost.om" << false; + QTest::newRow("exception3") << "omantel.om" << false; + QTest::newRow("exception4") << "gobiernoelectronico.ar" << false; + QTest::newRow("exception5") << "pref.ishikawa.jp" << false; + + QTest::newRow("yes-wildcard1") << "*.jm" << true; + QTest::newRow("yes-wildcard1.5") << "anything.jm" << true; + QTest::newRow("yes-wildcard2") << "something.kh" << true; + QTest::newRow("yes-wildcard3") << "whatever.uk" << true; + QTest::newRow("yes-wildcard4") << "anything.shizuoka.jp" << true; + QTest::newRow("yes-wildcard5") << "foo.sch.uk" << true; +} + +void tst_QNetworkCookieJar::effectiveTLDs() +{ + QFETCH(QString, domain); + QFETCH(bool, isTLD); + QCOMPARE(QNetworkCookieJarPrivate::isEffectiveTLD(domain), isTLD); +} + QTEST_MAIN(tst_QNetworkCookieJar) #include "tst_qnetworkcookiejar.moc" diff --git a/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro b/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro new file mode 100644 index 0000000..9d5f1cf --- /dev/null +++ b/util/network/cookiejar-generateTLDs/cookiejar-generateTLDs.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +QT = core + +# Input +SOURCES += main.cpp diff --git a/util/network/cookiejar-generateTLDs/main.cpp b/util/network/cookiejar-generateTLDs/main.cpp new file mode 100644 index 0000000..fad2c71 --- /dev/null +++ b/util/network/cookiejar-generateTLDs/main.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the utils of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +static QString utf8encode(const QByteArray &array) // turns e.g. tranøy.no to tran\xc3\xb8y.no +{ + QString result; + result.reserve(array.length() + array.length() / 3); + for (int i = 0; i < array.length(); ++i) { + char c = array.at(i); + // if char is non-ascii, escape it + if (c < 0x20 || uchar(c) >= 0x7f) { + result += "\\x" + QString::number(uchar(c), 16); + } else { + // if previous char was escaped, we need to make sure the next char is not + // interpreted as part of the hex value, e.g. "äc.com" -> "\xabc.com"; this + // should be "\xab""c.com" + QRegExp hexEscape("\\\\x[a-fA-F0-9][a-fA-F0-9]$"); + bool isHexChar = ((c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F')); + if (result.contains(hexEscape) && isHexChar) + result += "\"\""; + result += c; + } + } + return result; +} + +int main(int argc, char **argv) { + + QCoreApplication app(argc, argv); + if (argc < 3) { + printf("\nusage: %s inputFile outputFile\n\n", argv[0]); + printf("'inputFile' should be a list of effective TLDs, one per line,\n"); + printf("as obtained from http://publicsuffix.org . To create indices and data file\n"); + printf("file, do the following:\n\n"); + printf(" wget http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 -O effective_tld_names.dat\n"); + printf(" grep '^[^\\/\\/]' effective_tld_names.dat > effective_tld_names.dat.trimmed\n"); + printf(" %s effective_tld_names.dat.trimmed effective_tld_names.dat.qt\n\n", argv[0]); + printf("Now copy the data from effective_tld_names.dat.qt to the file src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n\n"); + exit(1); + } + QFile file(argv[1]); + QFile outFile(argv[2]); + file.open(QIODevice::ReadOnly); + outFile.open(QIODevice::WriteOnly); + + QByteArray outIndicesBufferBA; + QBuffer outIndicesBuffer(&outIndicesBufferBA); + outIndicesBuffer.open(QIODevice::WriteOnly); + + QByteArray outDataBufferBA; + QBuffer outDataBuffer(&outDataBufferBA); + outDataBuffer.open(QIODevice::WriteOnly); + + int lineCount = 0; + while (!file.atEnd()) { + file.readLine(); + lineCount++; + } + file.reset(); + QVector<QString> strings(lineCount); + while (!file.atEnd()) { + QString s = QString::fromUtf8(file.readLine()); + QString st = s.trimmed(); + int num = qHash(st) % lineCount; + + QString utf8String = utf8encode(st.toUtf8()); + + // for domain 1.com, we could get something like + // a.com\01.com, which would be interpreted as octal 01, + // so we need to separate those strings with quotes + QRegExp regexpOctalEscape(QLatin1String("^[0-9]")); + if (!strings.at(num).isEmpty() && st.contains(regexpOctalEscape)) + strings[num].append("\"\""); + + strings[num].append(utf8String); + strings[num].append("\\0"); + } + + outIndicesBuffer.write("static const quint16 tldCount = "); + outIndicesBuffer.write(QByteArray::number(lineCount)); + outIndicesBuffer.write(";\n"); + outIndicesBuffer.write("static const quint16 tldIndices["); +// outIndicesBuffer.write(QByteArray::number(lineCount+1)); // not needed + outIndicesBuffer.write("] = {\n"); + + int utf8Size = 0; +// int charSize = 0; + for (int a = 0; a < lineCount; a++) { + bool lineIsEmpty = strings.at(a).isEmpty(); + if (!lineIsEmpty) { + strings[a].prepend("\""); + strings[a].append("\""); + } + int zeroCount = strings.at(a).count(QLatin1String("\\0")); + int utf8CharsCount = strings.at(a).count(QLatin1String("\\x")); + int quoteCount = strings.at(a).count('"'); + outDataBuffer.write(strings.at(a).toUtf8()); + if (!lineIsEmpty) + outDataBuffer.write("\n"); + outIndicesBuffer.write(QByteArray::number(utf8Size)); + outIndicesBuffer.write(",\n"); + utf8Size += strings.at(a).count() - (zeroCount + quoteCount + utf8CharsCount * 3); +// charSize += strings.at(a).count(); + } + outIndicesBuffer.write(QByteArray::number(utf8Size)); + outIndicesBuffer.write("};\n"); + outIndicesBuffer.close(); + outFile.write(outIndicesBufferBA); + + outDataBuffer.close(); + outFile.write("\nstatic const char tldData["); +// outFile.write(QByteArray::number(charSize)); // not needed + outFile.write("] = {\n"); + outFile.write(outDataBufferBA); + outFile.write("};\n"); + outFile.close(); + printf("data generated to %s . Now copy the data from this file to src/network/access/qnetworkcookiejartlds_p.h in your Qt repo\n", argv[2]); + exit(0); +} -- cgit v0.12 From 1462a7ba51d25a7d022eab5533885cb1ed1c4c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 5 Jan 2011 09:04:37 +0100 Subject: Lighthouse: Make testlite compile on systems where QtOpenGL is ES2 compatible. Ie. it does not have glx. Haven't made the egl integration yet for testlite --- src/plugins/platforms/testlite/qglxintegration.cpp | 3 +++ src/plugins/platforms/testlite/qglxintegration.h | 3 +++ src/plugins/platforms/testlite/qtestliteintegration.cpp | 6 ++++-- src/plugins/platforms/testlite/qtestlitewindow.cpp | 8 ++++---- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 1dffb3e..8023014 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -46,6 +46,7 @@ #include "qtestlitewindow.h" #include "qtestlitescreen.h" +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include <X11/Xlib.h> #include <X11/Xutil.h> #include <GL/glx.h> @@ -371,3 +372,5 @@ QPlatformWindowFormat QGLXContext::platformWindowFormat() const } QT_END_NAMESPACE + +#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 5ae0b2a..abece45 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -49,6 +49,7 @@ #include <QtCore/QMutex> +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include <GL/glx.h> QT_BEGIN_NAMESPACE @@ -88,4 +89,6 @@ private: QT_END_NAMESPACE +#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) + #endif diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 537e22a..5dbe1e7 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -49,8 +49,10 @@ #include "qtestlitescreen.h" #include "qtestliteclipboard.h" -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) #include <GL/glx.h> +#endif //!defined(QT_OPENGL_ES_2) #include <private/qwindowsurface_gl_p.h> #include <private/qpixmapdata_gl_p.h> #endif //QT_NO_OPENGL @@ -128,7 +130,7 @@ QPlatformClipboard * QTestLiteIntegration::clipboard() const bool QTestLiteIntegration::hasOpenGL() const { -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) QTestLiteScreen *screen = static_cast<const QTestLiteScreen *>(mScreens.at(0)); return glXQueryExtension(screen->display(), 0, 0) != 0; #endif diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index e8d40d7..18fab4a 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -54,7 +54,7 @@ #include <QtGui/private/qwindowsurface_p.h> #include <QtGui/private/qapplication_p.h> -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include "qglxintegration.h" #endif @@ -74,7 +74,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); @@ -83,7 +83,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); -#endif //QT_NO_OPENGL +#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) } else { x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), x, y, w, h, 0 /*border_width*/, @@ -548,7 +548,7 @@ QPlatformGLContext *QTestLiteWindow::glContext() const return 0; if (!mGLContext) { QTestLiteWindow *that = const_cast<QTestLiteWindow *>(this); -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); #endif } -- cgit v0.12 From cc8877068dc6ae8f3142ffec0b85f6fbac4a0d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 5 Jan 2011 17:14:54 +0100 Subject: Lighthouse: Adding support for EGL to testlite There is really no good way of detecting if to use EGL instead of GLX using qmake. So this is the behavior for now: if QtOpenGL is compiled with "desktop gl" then use GLX if its compiled with OpenGLES2 then use EGL. --- .../platforms/eglconvenience/qeglconvenience.cpp | 8 ++ .../platforms/eglconvenience/qeglconvenience.h | 1 + .../platforms/testlite/qtestliteeglintegration.cpp | 145 +++++++++++++++++++++ .../platforms/testlite/qtestliteeglintegration.h | 13 ++ .../platforms/testlite/qtestliteintegration.cpp | 19 ++- src/plugins/platforms/testlite/qtestlitewindow.cpp | 94 ++++++++++--- src/plugins/platforms/testlite/qtestlitewindow.h | 2 + src/plugins/platforms/testlite/testlite.pro | 37 ++++-- 8 files changed, 287 insertions(+), 32 deletions(-) create mode 100644 src/plugins/platforms/testlite/qtestliteeglintegration.cpp create mode 100644 src/plugins/platforms/testlite/qtestliteeglintegration.h diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp index b203fe8..1612f79 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp @@ -313,4 +313,12 @@ QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, con return format; } +bool q_hasEglExtension(EGLDisplay display, const char* extensionName) +{ + QList<QByteArray> extensions = + QByteArray(reinterpret_cast<const char *> + (eglQueryString(display, EGL_EXTENSIONS))).split(' '); + return extensions.contains(extensionName); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index 604262b..98c30b8 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -53,6 +53,7 @@ QVector<EGLint> q_createConfigAttributesFromFormat(const QPlatformWindowFormat & bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes); EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format); QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config); +bool q_hasEglExtension(EGLDisplay display,const char* extensionName); QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp new file mode 100644 index 0000000..3cbcc05 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp @@ -0,0 +1,145 @@ +#include "qtestliteeglintegration.h" + +static int countBits(unsigned long mask) +{ + int count = 0; + while (mask != 0) { + if (mask & 1) + ++count; + mask >>= 1; + } + return count; +} + +VisualID QTestLiteEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLDisplay eglDisplay = eglGetDisplay(display); + + EGLint configRedSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + // Skip size checks if implementation supports non-matching visual + // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). + if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { + XFree(chosenVisualInfo); + return visualId; + } + + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } + visualId = 0; + } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; + } + XFree(chosenVisualInfo); + } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configAlphaSize > 0) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); +#endif + return visualId; + } + + // Finally, try to + // use XGetVisualInfo and only use the bit depths to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + XVisualInfo *matchingVisuals; + int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); + return (VisualID)0; +} diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.h b/src/plugins/platforms/testlite/qtestliteeglintegration.h new file mode 100644 index 0000000..3717976 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.h @@ -0,0 +1,13 @@ +#ifndef QTESTLITEEGLINTEGRATION_H +#define QTESTLITEEGLINTEGRATION_H + +#include "qtestlitestaticinfo.h" +#include "../eglconvenience/qeglconvenience.h" + +class QTestLiteEglIntegration +{ +public: + static VisualID getCompatibleVisualId(Display *display, EGLConfig config); +}; + +#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 5dbe1e7..9b641d1 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -52,6 +52,8 @@ #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) #include <GL/glx.h> +#else +#include <EGL/egl.h> #endif //!defined(QT_OPENGL_ES_2) #include <private/qwindowsurface_gl_p.h> #include <private/qpixmapdata_gl_p.h> @@ -59,7 +61,6 @@ QT_BEGIN_NAMESPACE - QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) : mUseOpenGL(useOpenGL) , mFontDb(new QGenericUnixFontDatabase()) @@ -130,9 +131,23 @@ QPlatformClipboard * QTestLiteIntegration::clipboard() const bool QTestLiteIntegration::hasOpenGL() const { -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) QTestLiteScreen *screen = static_cast<const QTestLiteScreen *>(mScreens.at(0)); return glXQueryExtension(screen->display(), 0, 0) != 0; +#else + static bool eglHasbeenInitialized = false; + static bool wasEglInitialized = false; + if (!eglHasbeenInitialized) { + eglHasbeenInitialized = true; + QTestLiteScreen *screen = static_cast<const QTestLiteScreen *>(mScreens.at(0)); + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + EGLDisplay disp = eglGetDisplay(screen->display()); + wasEglInitialized = eglInitialize(disp,&major,&minor); + } + return wasEglInitialized; +#endif #endif return false; } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 18fab4a..d9c69e3 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -54,9 +54,15 @@ #include <QtGui/private/qwindowsurface_p.h> #include <QtGui/private/qapplication_p.h> -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) #include "qglxintegration.h" -#endif +#else +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qeglplatformcontext.h" +#include "qtestliteeglintegration.h" +#endif //QT_OPENGL_ES_2 +#endif //QT_NO_OPENGL //#define MYX11_DEBUG @@ -74,16 +80,36 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) + #if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); -#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#else + QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); + + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); + VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; + + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); +#endif //!defined(QT_OPENGL_ES_2) + if (visualInfo) { + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + } else { + qFatal("no window!"); + } +#endif //!defined(QT_NO_OPENGL) } else { x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), x, y, w, h, 0 /*border_width*/, @@ -93,12 +119,6 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; #endif -// } - -// width = -1; -// height = -1; -// xpos = -1; -// ypos = -1; XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); @@ -548,8 +568,23 @@ QPlatformGLContext *QTestLiteWindow::glContext() const return 0; if (!mGLContext) { QTestLiteWindow *that = const_cast<QTestLiteWindow *>(this); -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); +#else + EGLDisplay display = eglGetDisplay(mScreen->display()); + + QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); + + EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); + QVector<EGLint> eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); + that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); +#endif #endif } return mGLContext; @@ -584,4 +619,27 @@ void QTestLiteWindow::doSizeHints() XSetWMNormalHints(mScreen->display(), x_window, &s); } +QPlatformWindowFormat QTestLiteWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +{ + // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, + // so this might be not what we want to do :) + if ( !(platformWindowFormat.redBufferSize() == -1 && + platformWindowFormat.greenBufferSize() == -1 && + platformWindowFormat.blueBufferSize() == -1)) + return platformWindowFormat; + + QPlatformWindowFormat windowFormat = platformWindowFormat; + if (mScreen->depth() == 16) { + windowFormat.setRedBufferSize(5); + windowFormat.setGreenBufferSize(6); + windowFormat.setBlueBufferSize(5); + } else { + windowFormat.setRedBufferSize(8); + windowFormat.setGreenBufferSize(8); + windowFormat.setBlueBufferSize(8); + } + + return windowFormat; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 4b952dc..e45c3fd 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -129,6 +129,8 @@ protected: void doSizeHints(); private: + QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; + Window x_window; GC gc; diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index eb196c3..7fb3304 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -9,22 +9,22 @@ SOURCES = \ qtestlitewindowsurface.cpp \ qtestlitewindow.cpp \ qtestlitecursor.cpp \ - qtestlitescreen.cpp \ - qtestlitekeyboard.cpp \ - qtestliteclipboard.cpp \ - qtestlitemime.cpp \ - qtestlitestaticinfo.cpp + qtestlitescreen.cpp \ + qtestlitekeyboard.cpp \ + qtestliteclipboard.cpp \ + qtestlitemime.cpp \ + qtestlitestaticinfo.cpp HEADERS = \ qtestliteintegration.h \ qtestlitewindowsurface.h \ qtestlitewindow.h \ qtestlitecursor.h \ - qtestlitescreen.h \ - qtestlitekeyboard.h \ - qtestliteclipboard.h \ - qtestlitemime.h \ - qtestlitestaticinfo.h + qtestlitescreen.h \ + qtestlitekeyboard.h \ + qtestliteclipboard.h \ + qtestlitemime.h \ + qtestlitestaticinfo.h LIBS += -lX11 -lXext @@ -36,8 +36,21 @@ include (../fontdatabases/genericunix/genericunix.pri) contains(QT_CONFIG, opengl) { QT += opengl - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp + !contains(QT_CONFIG, opengles2) { + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } else { # There is no easy way to detect if we'r suppose to use glx or not + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + qtestliteeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qtestliteeglintegration.cpp + LIBS += -lEGL + } } target.path += $$[QT_INSTALL_PLUGINS]/platforms -- cgit v0.12 From 70d96d5d17c62fb97ce15967012527dd8b292316 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Thu, 6 Jan 2011 09:51:29 +0100 Subject: fix build with namespaces in new cookie jar table forgot the QT_END_NAMESPACE macro. --- src/network/access/qnetworkcookiejartlds_p.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/access/qnetworkcookiejartlds_p.h b/src/network/access/qnetworkcookiejartlds_p.h index fc1c75f..b06d881 100644 --- a/src/network/access/qnetworkcookiejartlds_p.h +++ b/src/network/access/qnetworkcookiejartlds_p.h @@ -6476,4 +6476,6 @@ static const char tldData[] = { "santafe.museum\0org.ws\0" }; +QT_END_NAMESPACE + #endif // QNETWORKCOOKIEJARTLD_P_H -- cgit v0.12 From 18447df1d021cfed69472b867cb7593401be27a6 Mon Sep 17 00:00:00 2001 From: Jiang Jiang <jiang.jiang@nokia.com> Date: Wed, 5 Jan 2011 19:39:00 +0100 Subject: Make application font family names locale sensitive in X11 So that they will match the family names returned by QFontDatabase::families. Because the family names returned by FcFreeTypeQueryFace are not sorted with locale as the names returned by FcFontList, we have to find out the family name matching the system language in the former case. Task-number: QTBUG-14269 Reviewed-by: Eskil --- src/gui/text/qfontdatabase.cpp | 3 +++ src/gui/text/qfontdatabase_x11.cpp | 23 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index bae2a20..ec94de9 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -664,6 +664,9 @@ public: } int count; +#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) + QString systemLang; +#endif QtFontFamily **families; struct ApplicationFont { diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 635d2cf..c67558b 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -1018,6 +1018,13 @@ static void loadFontConfig() QFontDatabasePrivate *db = privateDb(); FcFontSet *fonts; + FcPattern *pattern = FcPatternCreate(); + FcDefaultSubstitute(pattern); + FcChar8 *lang = 0; + if (FcPatternGetString(pattern, FC_LANG, 0, &lang) == FcResultMatch) + db->systemLang = QString::fromUtf8((const char *) lang); + FcPatternDestroy(pattern); + QString familyName; FcChar8 *value = 0; int weight_value; @@ -2037,6 +2044,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) int count = 0; QStringList families; + QFontDatabasePrivate *db = privateDb(); FcPattern *pattern = 0; do { @@ -2048,8 +2056,19 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) FcPatternDel(pattern, FC_FILE); FcPatternAddString(pattern, FC_FILE, (const FcChar8 *)fnt->fileName.toUtf8().constData()); - FcChar8 *fam = 0; - if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) { + FcChar8 *fam = 0, *familylang = 0; + int i, n = 0; + for (i = 0; ; i++) { + if (FcPatternGetString(pattern, FC_FAMILYLANG, i, &familylang) != FcResultMatch) + break; + QString familyLang = QString::fromUtf8((const char *) familylang); + if (familyLang.compare(db->systemLang, Qt::CaseInsensitive) == 0) { + n = i; + break; + } + } + + if (FcPatternGetString(pattern, FC_FAMILY, n, &fam) == FcResultMatch) { QString family = QString::fromUtf8(reinterpret_cast<const char *>(fam)); families << family; } -- cgit v0.12 From 7ee36ca4cf6359ade995e974abd2adfcf4dc7612 Mon Sep 17 00:00:00 2001 From: Mark Brand <mabrand@mabrand.nl> Date: Thu, 6 Jan 2011 13:51:55 +0100 Subject: fix include path In many situations building succeeds without explicity including this dir in the include path, probably due to a side-effect of calling uic on the form in this project. However, it is known to fail at least on mingw-cross-env. Anyway, it makes sense to explcitly add this dir to the include path since a needed header resides here. Merge-request: 1016 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> --- examples/painting/svggenerator/svggenerator.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/painting/svggenerator/svggenerator.pro b/examples/painting/svggenerator/svggenerator.pro index e0e4895..2e67372 100644 --- a/examples/painting/svggenerator/svggenerator.pro +++ b/examples/painting/svggenerator/svggenerator.pro @@ -8,6 +8,8 @@ SOURCES = displaywidget.cpp \ QT += svg +INCLUDEPATH += $$PWD + # install target.path = $$[QT_INSTALL_EXAMPLES]/painting/svggenerator sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS svggenerator.pro -- cgit v0.12 From 5c3010cf467d437ccfc8a263bed167e979614504 Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Thu, 6 Jan 2011 14:01:53 +0100 Subject: qkeymapper_x11.cpp: fix compilation with LSB and without XKB Task-number: QTBUG-16312 Reviewed-by: Marius Storm-Olsen --- src/gui/kernel/qkeymapper_x11.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp index 825edbc..e085d11 100644 --- a/src/gui/kernel/qkeymapper_x11.cpp +++ b/src/gui/kernel/qkeymapper_x11.cpp @@ -61,13 +61,6 @@ #include <ctype.h> -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_XKB - -// bring in the auto-generated xkbLayoutData -#include "qkeymapper_x11_p.cpp" - #ifdef QT_LINUXBASE // LSB's IsKeypadKey define is wrong - see // http://bugs.linuxbase.org/show_bug.cgi?id=2521 @@ -80,6 +73,13 @@ QT_BEGIN_NAMESPACE (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) #endif +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_XKB + +// bring in the auto-generated xkbLayoutData +#include "qkeymapper_x11_p.cpp" + QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &variantName) { int i = 0; @@ -92,7 +92,6 @@ QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &vari } #endif // QT_NO_XKB - // from qapplication_x11.cpp extern uchar qt_alt_mask; extern uchar qt_meta_mask; -- cgit v0.12 From 91596c9c08208690894ec11a3a99eac57ad17f2b Mon Sep 17 00:00:00 2001 From: Olivier Goffart <olivier.goffart@nokia.com> Date: Thu, 6 Jan 2011 14:51:04 +0100 Subject: QUrl::setUrl should call detach Task-number: QTBUG-16425 Reviewed-by: Gabriel Reviewed-by: Markus Goetz --- src/corelib/io/qurl.cpp | 1 + tests/auto/qurl/tst_qurl.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 6a3037d..45f908d 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -4262,6 +4262,7 @@ void QUrl::setUrl(const QString &url) */ void QUrl::setUrl(const QString &url, ParsingMode parsingMode) { + detach(); // escape all reserved characters and delimiters // reserved = gen-delims / sub-delims if (parsingMode != TolerantMode) { diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 63f9721..4354ffb 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -675,6 +675,14 @@ void tst_QUrl::setUrl() QCOMPARE(url.encodedPath().constData(), "text/javascript,d5%20%3D%20'five%5Cu0027s'%3B"); } + { //check it calls detach + QUrl u1("http://aaa.com"); + QUrl u2 = u1; + u2.setUrl("http://bbb.com"); + QCOMPARE(u1.host(), QString::fromLatin1("aaa.com")); + QCOMPARE(u2.host(), QString::fromLatin1("bbb.com")); + } + /* The tests below are copied from kdelibs/kdecore/tests/kurltest.cpp (an old version of) -- cgit v0.12 From 6d331b6ee7711cde2bf9adc1a584a45875c07983 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Thu, 6 Jan 2011 15:34:48 +0100 Subject: Designer: Block QEvent::WinIdChange. As it causes an obscure deletion crash related to the formeditor rubberband on Mac. Reviewed-by: con --- tools/designer/src/components/formeditor/formwindowmanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/designer/src/components/formeditor/formwindowmanager.cpp b/tools/designer/src/components/formeditor/formwindowmanager.cpp index ce809ff..ed854cf 100644 --- a/tools/designer/src/components/formeditor/formwindowmanager.cpp +++ b/tools/designer/src/components/formeditor/formwindowmanager.cpp @@ -192,6 +192,7 @@ bool FormWindowManager::eventFilter(QObject *o, QEvent *e) case QEvent::ToolTip: case QEvent::WhatsThis: case QEvent::WhatsThisClicked: + case QEvent::WinIdChange: case QEvent::DynamicPropertyChange: case QEvent::HoverEnter: case QEvent::HoverLeave: -- cgit v0.12 From 66cfe2a776b7542fe1d8bae9c0d7bb5be79406fd Mon Sep 17 00:00:00 2001 From: Shane Kearns <shane.kearns@accenture.com> Date: Thu, 6 Jan 2011 15:16:03 +0000 Subject: Fix KERN-EXEC 0 panic on exit when bearer is searching for WLANs The access point scanner cancels itself in the destructor. This requires the handle to be valid, but it was closed in the symbian engine destructor immediately before deleting the AP scanner. Because of the way symbian active objects work, the crashing function is only called if there was an asynchronous request in progress. So it could be missed in cases where the scan completes faster than the test case. Task-number: QTBUG-16484 Reviewed-by: Markus Goetz --- src/plugins/bearer/symbian/symbianengine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index f025d86..a370d78 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -144,6 +144,10 @@ SymbianEngine::~SymbianEngine() { Cancel(); + //The scanner may be using the connection monitor so it needs to be + //deleted first while the handle is still valid. + delete ipAccessPointsAvailabilityScanner; + iConnectionMonitor.CancelNotifications(); iConnectionMonitor.Close(); @@ -151,8 +155,6 @@ SymbianEngine::~SymbianEngine() iCmManager.Close(); #endif - delete ipAccessPointsAvailabilityScanner; - // CCommsDatabase destructor uses cleanup stack. Since QNetworkConfigurationManager // is a global static, but the time we are here, E32Main() has been exited already and // the thread's default cleanup stack has been deleted. Without this line, a -- cgit v0.12 From 273cc18e59af6b495462cbe101652a444a2cc8f4 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Thu, 6 Jan 2011 17:04:37 +0100 Subject: licensing: exclude generated cookie jar table from license check This file is generated from the Public Suffix List, and thus under a different license. Reviewed-by: Markus Goetz --- tests/auto/headers/tst_headers.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp index 8c8bc2c..b889a37 100644 --- a/tests/auto/headers/tst_headers.cpp +++ b/tests/auto/headers/tst_headers.cpp @@ -176,7 +176,9 @@ void tst_Headers::allSourceFilesData() || sourceFile.endsWith(".ui.h") || sourceFile.endsWith("/src/corelib/global/qconfig.h") || sourceFile.endsWith("/src/corelib/global/qconfig.cpp") - || sourceFile.endsWith("/src/tools/uic/qclass_lib_map.h")) + || sourceFile.endsWith("/src/tools/uic/qclass_lib_map.h") + || sourceFile.endsWith("src/network/access/qnetworkcookiejartlds_p.h") + ) continue; QTest::newRow(qPrintable(sourceFile)) << sourceFile; -- cgit v0.12 From e185e5f008f6852bd7a79d74262717c8e377b918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Wed, 5 Jan 2011 08:25:56 +0100 Subject: Restored old flushing behavior in -graphicssystem opengl on desktop. Change 284211ccbd2cbd recently introduced a fix for EGL, to prevent flushing when nothing has been rendered into the back buffer. However, the skip should only be done when there's no partial update support in the window surface. If there is partial update support we can still flush as usual. Reviewed-by: Gunnar Sletta --- src/opengl/qwindowsurface_gl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index b8716ce..7243f02 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -520,9 +520,10 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & // did_paint is set to true in ::beginPaint. ::beginPaint means that we // at least cleared the background (= painted something). In EGL API it's a - // mistakte to call swapBuffers if nothing was painted. This check protects - // the flush func from being executed if it's for nothing. - if (!d_ptr->did_paint) + // mistake to call swapBuffers if nothing was painted unless + // EGL_BUFFER_PRESERVED is set. This check protects the flush func from + // being executed if it's for nothing. + if (!hasPartialUpdateSupport() && !d_ptr->did_paint) return; QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); -- cgit v0.12 From 84658ec4e650b12dcea6f886b530e66a195465cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 6 Jan 2011 13:09:14 +0100 Subject: Fixed bug and performance problem in windowsstyle. QImage::fill(Qt::transparent) pre-4.8 is a bug, also using Format_ARGB32 is very unoptimal compared to Format_ARGB32_Premultiplied. Task-number: QTBUG-16439 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/styles/qwindowsstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 32a6d8d..4144b80 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -1395,8 +1395,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, if (!QPixmapCache::find(pixmapName, pixmap)) { int border = size/5; int sqsize = 2*(size/2); - QImage image(sqsize, sqsize, QImage::Format_ARGB32); - image.fill(Qt::transparent); + QImage image(sqsize, sqsize, QImage::Format_ARGB32_Premultiplied); + image.fill(0); QPainter imagePainter(&image); QPolygon a; -- cgit v0.12 From 5780ff75c1e63322f3edd6158c08f1d944919cce Mon Sep 17 00:00:00 2001 From: Kai Koehne <kai.koehne@nokia.com> Date: Fri, 7 Jan 2011 08:47:51 +0100 Subject: QmlViewer: Remove unused class variables --- tools/qml/qmlruntime.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index b43aa54..a70ffc9 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -188,8 +188,6 @@ private: ScriptOptions m_scriptOptions; QDeclarativeTester *tester; - QNetworkReply *wgtreply; - QString wgtdir; NetworkAccessManagerFactory *namFactory; bool useQmlFileBrowser; -- cgit v0.12 From e24d7c9cab4a50fe682478d43ac74e867666d48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Thu, 6 Jan 2011 10:30:18 +0100 Subject: Lighthouse: Support external plugins. Add -platformpluginpath command line option that spesifies an additional directory to scan for plugins. Also read QT_QPA_PLATFORM_PLUGIN_PATH. QlatformIntegrationFacgtory::create() now tries to load the plugin from the external path first. Similarly, keys() returns the keys from the extra path in addition to the "internal" keys API changes: QPlatformIntegration::create() and keys() now take an optional const QString &platformPluginPath. New file: externalplugin.pri, contains instructions and a base setup for building external plugins. --- src/gui/kernel/qapplication_qpa.cpp | 12 ++++++--- src/gui/kernel/qplatformintegrationfactory_qpa.cpp | 27 +++++++++++++++++--- src/gui/kernel/qplatformintegrationfactory_qpa_p.h | 4 +-- src/plugins/platforms/externalplugin.pri | 29 ++++++++++++++++++++++ 4 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 src/plugins/platforms/externalplugin.pri diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index a164c2d..fdbb931 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -444,11 +444,11 @@ void QApplication::alert(QWidget *, int) { } -static void init_platform(const QString &name) +static void init_platform(const QString &name, const QString &platformPluginPath) { - QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name); + QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath); if (!QApplicationPrivate::platform_integration) { - QStringList keys = QPlatformIntegrationFactory::keys(); + QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); QString fatalMessage = QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); foreach(QString key, keys) { @@ -513,6 +513,7 @@ void qt_init(QApplicationPrivate *priv, int type) } QList<QByteArray> pluginList; + QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH")); QString platformName = QLatin1String(qgetenv("QT_QPA_PLATFORM")); // Get command line params @@ -527,6 +528,9 @@ void qt_init(QApplicationPrivate *priv, int type) if (arg == "-fn" || arg == "-font") { if (++i < argc) appFont = QString::fromLocal8Bit(argv[i]); + } else if (arg == "-platformpluginpath") { + if (++i < argc) + platformPluginPath = QLatin1String(argv[i]); } else if (arg == "-platform") { if (++i < argc) platformName = QLatin1String(argv[i]); @@ -550,7 +554,7 @@ void qt_init(QApplicationPrivate *priv, int type) } #endif - init_platform(platformName); + init_platform(platformName, platformPluginPath); init_plugins(pluginList); QColormap::initialize(); diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp index 9122e1a..17a130d 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp @@ -52,15 +52,27 @@ QT_BEGIN_NAMESPACE #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) #endif -QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) +QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, const QString &platformPluginPath) { QPlatformIntegration *ret = 0; QStringList paramList = key.split(QLatin1Char(':')); QString platform = paramList.takeFirst().toLower(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + // Try loading the plugin from platformPluginPath first: + if (!platformPluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(platformPluginPath); + if (QPlatformIntegrationFactoryInterface *factory = + qobject_cast<QPlatformIntegrationFactoryInterface*>(directLoader()->instance(platform))) + ret = factory->create(key, paramList); + + if (ret) + return ret; + } if (QPlatformIntegrationFactoryInterface *factory = qobject_cast<QPlatformIntegrationFactoryInterface*>(loader()->instance(platform))) ret = factory->create(platform, paramList); #endif @@ -74,10 +86,19 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) \sa create() */ -QStringList QPlatformIntegrationFactory::keys() +QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath) { #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - QStringList list = loader()->keys(); + QStringList list; + + if (!platformPluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(platformPluginPath); + foreach (const QString &key, directLoader()->keys()) { + list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath); + } + } + + list += loader()->keys(); #else QStringList list; #endif diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h index ba02d2c..77e1da1 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h +++ b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h @@ -66,8 +66,8 @@ class QPlatformIntegration; class QPlatformIntegrationFactory { public: - static QStringList keys(); - static QPlatformIntegration *create(const QString&); + static QStringList keys(const QString &platformPluginPath = QString()); + static QPlatformIntegration *create(const QString &key, const QString &platformPluginPath = QString()); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/externalplugin.pri b/src/plugins/platforms/externalplugin.pri new file mode 100644 index 0000000..54da4d9 --- /dev/null +++ b/src/plugins/platforms/externalplugin.pri @@ -0,0 +1,29 @@ +# +# Lighthouse now has preliminarily support for building and +# loading platform plugins from outside the Qt source/build +# tree. +# +# 1) Building external plugins: +# Set QTDIR to the Qt build directory, copy this file to +# the plugin source repository and include it at the top +# of the plugin's pro file. Use QT_SOURCE_TREE if you +# want to pull in source code from Qt: +# +# include($$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/genericunix/genericunix.pri) +# +# 2) Loading external plugins: +# Specify the path to the directory containing the +# plugin on the command line, in addition to the +# platform name. +# +# ./wiggly -platformPluginPath /path/to/myPlugin -platform gullfaksA +# + +!exists($$(QTDIR)/.qmake.cache) { + error("Please set QTDIR to the Qt build directory") +} + +QT_SOURCE_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE) +QT_BUILD_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_BUILD_TREE) + +include($$QT_SOURCE_TREE/src/plugins/qpluginbase.pri) -- cgit v0.12 From ec46ec7d5d4783fb450ed75e2f6a2ae3edca918e Mon Sep 17 00:00:00 2001 From: Markus Goetz <Markus.Goetz@nokia.com> Date: Fri, 7 Jan 2011 11:26:52 +0100 Subject: Revert "QNAM HTTP: Fix missing error() signal" We don't think this is the right solution. This reverts commit de72670c620e1193fa875bf1a4adee553700bacb. --- src/network/access/qhttpnetworkconnectionchannel.cpp | 20 +------------------- src/network/access/qhttpnetworkconnectionchannel_p.h | 1 - 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index c4471eb..c8caad4 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -66,7 +66,6 @@ QHttpNetworkConnectionChannel::QHttpNetworkConnectionChannel() , bytesTotal(0) , resendCurrent(false) , lastStatus(0) - , unhandledError(QNetworkReply::NoError) , pendingEncrypt(false) , reconnectAttempts(2) , authMethod(QAuthenticatorPrivate::None) @@ -643,23 +642,7 @@ void QHttpNetworkConnectionChannel::allDone() // slot connected to it. The socket will not fire readyRead signal, if we are already // in the slot connected to readyRead if (emitFinished) - { - // Check whether _q_error was invoked previously and if it left a socket - // error unhandled AND that there are no http errors. - // In case there are both socket errors and http errors, the socket error is suppressed. - // Http errors are handled in the QNetworkAccessHttpBackend. - if(unhandledError != QNetworkReply::NoError && reply->statusCode() == 200) { - QString errorString = connection->d_func()->errorDetail(unhandledError, socket, socket->errorString()); - qRegisterMetaType<QNetworkReply::NetworkError>("QNetworkReply::NetworkError"); - QMetaObject::invokeMethod(reply, "finishedWithError", - Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, unhandledError), - Q_ARG(QString, errorString)); - } else { - QMetaObject::invokeMethod(reply, "finished", Qt::QueuedConnection); - } - unhandledError = QNetworkReply::NoError; // Reset the value - } + QMetaObject::invokeMethod(reply, "finished", Qt::QueuedConnection); // reset the reconnection attempts after we receive a complete reply. // in case of failures, each channel will attempt two reconnects before emitting error. reconnectAttempts = 2; @@ -981,7 +964,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket errorCode = QNetworkReply::RemoteHostClosedError; } } else { - unhandledError = QNetworkReply::RemoteHostClosedError; return; } break; diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index e1d42fb..fd18042 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -105,7 +105,6 @@ public: qint64 bytesTotal; bool resendCurrent; int lastStatus; // last status received on this channel - QNetworkReply::NetworkError unhandledError; // Stored code of an unhandled error. bool pendingEncrypt; // for https (send after encrypted) int reconnectAttempts; // maximum 2 reconnection attempts QAuthenticatorPrivate::Method authMethod; -- cgit v0.12 From 0d6eb2b59f626dbcb51209cc98ef74878fdf5437 Mon Sep 17 00:00:00 2001 From: Markus Goetz <Markus.Goetz@nokia.com> Date: Fri, 7 Jan 2011 11:31:20 +0100 Subject: Revert "Fix QNetworkReply autotest cases for QT-3494" We don't think this is the right fix. This reverts commit 5d18d393808d7a4be56eb00ab9f1e9cda9e211c9. --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 6cd9d3c..cff0ae9 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2585,19 +2585,17 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer() void tst_QNetworkReply::ioGetFromHttpStatus100_data() { QTest::addColumn<QByteArray>("dataToSend"); - QTest::addColumn<QNetworkReply::NetworkError>("expectedError"); - QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; - QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; - QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n") << QNetworkReply::RemoteHostClosedError; - QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n") << QNetworkReply::RemoteHostClosedError; - QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; - QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n") << QNetworkReply::NoError; + QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n"); + QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n"); + QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); } void tst_QNetworkReply::ioGetFromHttpStatus100() { QFETCH(QByteArray, dataToSend); - QFETCH(QNetworkReply::NetworkError, expectedError); MiniHttpServer server(dataToSend); server.doClose = true; @@ -2609,7 +2607,7 @@ void tst_QNetworkReply::ioGetFromHttpStatus100() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), request.url()); - QCOMPARE(reply->error(), expectedError); + QCOMPARE(reply->error(), QNetworkReply::NoError); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QVERIFY(reply->rawHeader("bla").isNull()); } @@ -2617,14 +2615,12 @@ void tst_QNetworkReply::ioGetFromHttpStatus100() void tst_QNetworkReply::ioGetFromHttpNoHeaders_data() { QTest::addColumn<QByteArray>("dataToSend"); - QTest::addColumn<QNetworkReply::NetworkError>("expectedError"); - QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n") << QNetworkReply::RemoteHostClosedError; + QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n"); } void tst_QNetworkReply::ioGetFromHttpNoHeaders() { QFETCH(QByteArray, dataToSend); - QFETCH(QNetworkReply::NetworkError, expectedError); MiniHttpServer server(dataToSend); server.doClose = true; @@ -2636,7 +2632,7 @@ void tst_QNetworkReply::ioGetFromHttpNoHeaders() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->url(), request.url()); - QCOMPARE(reply->error(), expectedError); + QCOMPARE(reply->error(), QNetworkReply::NoError); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); } -- cgit v0.12 From 2371b6570ee4fa6296bb05e577c160bbab92e0b1 Mon Sep 17 00:00:00 2001 From: Markus Goetz <Markus.Goetz@nokia.com> Date: Fri, 7 Jan 2011 11:41:19 +0100 Subject: tst_qnetworkreply: Add EXPECT_FAIL for ioGetFromBuiltinHttp Reviewed-by: Peter Hartmann --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index cff0ae9..5ac34ad 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3795,6 +3795,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() const int maxRate = rate * 1024 * (100+allowedDeviation) / 100; qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?"; QVERIFY(server.transferRate >= minRate); + QEXPECT_FAIL("http+limited", "Limiting is broken right now", Continue); + QEXPECT_FAIL("https+limited", "Limiting is broken right now", Continue); QVERIFY(server.transferRate <= maxRate); } } -- cgit v0.12 From 67267842ce658d956f11d52194566b6de1f84f9a Mon Sep 17 00:00:00 2001 From: Sergio Ahumada <sergio.ahumada@nokia.com> Date: Fri, 7 Jan 2011 12:37:12 +0100 Subject: Doc: Fixing typo --- src/gui/painting/qdrawhelper_ssse3.cpp | 2 +- src/gui/painting/qdrawingprimitive_sse2_p.h | 4 ++-- src/gui/painting/qpaintengine.cpp | 2 +- src/gui/painting/qpaintengine_raster.cpp | 4 ++-- src/gui/painting/qpainter.cpp | 2 +- src/gui/painting/qprintengine_ps.cpp | 2 +- src/gui/text/qfontengine_p.h | 2 +- src/gui/text/qtextdocument_p.cpp | 2 +- src/gui/text/qtextdocumentlayout.cpp | 2 +- src/gui/text/qtextengine.cpp | 2 +- src/gui/text/qtextlist.cpp | 2 +- src/gui/text/qzip.cpp | 2 +- src/gui/widgets/qabstractscrollarea.cpp | 2 +- src/gui/widgets/qabstractslider.cpp | 2 +- src/gui/widgets/qdatetimeedit.cpp | 2 +- src/gui/widgets/qdockarealayout.cpp | 2 +- src/gui/widgets/qdockarealayout_p.h | 2 +- src/gui/widgets/qdockwidget_p.h | 2 +- src/gui/widgets/qlinecontrol_p.h | 2 +- src/gui/widgets/qscrollarea.cpp | 2 +- src/gui/widgets/qsplitter.cpp | 2 +- 21 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index fb5602e..01e0ccf 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -80,7 +80,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) // Basically blend src over dst with the const alpha defined as constAlphaVector. -// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +// nullVector, half, one, colorMask are constant across the whole image/texture, and should be defined as: //const __m128i nullVector = _mm_set1_epi32(0); //const __m128i half = _mm_set1_epi16(0x80); //const __m128i one = _mm_set1_epi16(0xff); diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index d8f6bf5..a4614ad 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE } // Basically blend src over dst with the const alpha defined as constAlphaVector. -// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +// nullVector, half, one, colorMask are constant across the whole image/texture, and should be defined as: //const __m128i nullVector = _mm_set1_epi32(0); //const __m128i half = _mm_set1_epi16(0x80); //const __m128i one = _mm_set1_epi16(0xff); @@ -186,7 +186,7 @@ QT_BEGIN_NAMESPACE } // Basically blend src over dst with the const alpha defined as constAlphaVector. -// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +// nullVector, half, one, colorMask are constant across the whole image/texture, and should be defined as: //const __m128i nullVector = _mm_set1_epi32(0); //const __m128i half = _mm_set1_epi16(0x80); //const __m128i one = _mm_set1_epi16(0xff); diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index a2d0337..58bba35 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -992,7 +992,7 @@ void QPaintEngine::setSystemRect(const QRect &rect) /*! \internal - Retreives the rect for drawing within the backing store. This + Retrieves the rect for drawing within the backing store. This function should ONLY be used by the backing store. */ QRect QPaintEngine::systemRect() const diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4d06c9f..a5d647d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1815,7 +1815,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) ensureState(); if (s->flags.tx_noshear) { d->initializeRasterizer(&s->brushData); - // ### Is normalizing really nessesary here? + // ### Is normalizing really necessary here? const qreal *p = path.points(); QRectF r = QRectF(p[0], p[1], p[2] - p[0], p[7] - p[1]).normalized(); if (!r.isEmpty()) { @@ -3193,7 +3193,7 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) #endif // Q_OS_SYMBIAN && QT_NO_FREETYPE /*! - * Returns true if the rectangle is completly within the current clip + * Returns true if the rectangle is completely within the current clip * state of the paint engine. */ bool QRasterPaintEnginePrivate::isUnclipped_normalized(const QRect &r) const diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index ab9707d..3f6586d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -9085,7 +9085,7 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment QPainter::drawPixmapFragments() function. The variables \a x, \a y, \a width and \a height are used to calculate the target rectangle that is drawn. \a x and \a y denotes the center of the target rectangle. The \a - width and \a heigth in the target rectangle is scaled by the \a scaleX and + width and \a height in the target rectangle is scaled by the \a scaleX and \a scaleY values. The resulting target rectangle is then rotated \a rotation degrees around the \a x, \a y center point. diff --git a/src/gui/painting/qprintengine_ps.cpp b/src/gui/painting/qprintengine_ps.cpp index ca694ae..6fb2db5 100644 --- a/src/gui/painting/qprintengine_ps.cpp +++ b/src/gui/painting/qprintengine_ps.cpp @@ -908,7 +908,7 @@ void QPSPrintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con if (d->clipEnabled && d->allClipped) return; - // ### Optimise implementation! + // ### Optimize implementation! qreal yPos = r.y(); qreal yOff = p.y(); while(yPos < r.y() + r.height()) { diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index fc26eef..c9dd5bc 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -180,7 +180,7 @@ public: void addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags); /** * Create a qimage with the alpha values for the glyph. - * Returns an image indexed_8 with index values ranging from 0=fully transparant to 255=opaque + * Returns an image indexed_8 with index values ranging from 0=fully transparent to 255=opaque */ virtual QImage alphaMapForGlyph(glyph_t); virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t); diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 0bdd20d..14d85b7 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE END_OF_PARA/START_OF_FRAME/END_OF_FRAME (see below). Lists are not in here, as they are treated specially. A list is just - a collection of (not neccessarily connected) blocks, that share the + a collection of (not necessarily connected) blocks, that share the same objectIndex() in the format that refers to the list format and object. diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index ff14490..a1bea12 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -327,7 +327,7 @@ static inline bool isLineSeparatorBlockAfterTable(const QTextBlock &block, const /* -Optimisation strategies: +Optimization strategies: HTML layout: diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 3bd6122..75dcf57 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1879,7 +1879,7 @@ void QTextEngine::justify(const QScriptLine &line) if (end == layoutData->string.length()) return; // no justification at end of paragraph if (end && layoutData->items[findItem(end-1)].analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) - return; // no justification at the end of an explicitely separated line + return; // no justification at the end of an explicitly separated line } // justify line diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index a0ff520..b66766e 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -235,7 +235,7 @@ QString QTextList::itemText(const QTextBlock &blockIt) const if (i % 4) { // c[i] == 4|5|9|40|50|90|400|500|900 if ((i-2) % 4) { - // c[i] == 4|9|40|90|400|900 => with substraction (IV, IX, XL, XC, ...) + // c[i] == 4|9|40|90|400|900 => with subtraction (IV, IX, XL, XC, ...) numDigits = 2; } else { diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index 6f099a9..c449588 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -825,7 +825,7 @@ int QZipReader::count() const /*! Returns a FileInfo of an entry in the zipfile. - The \a index is the index into the directoy listing of the zipfile. + The \a index is the index into the directory listing of the zipfile. Returns an invalid FileInfo if \a index is out of boundaries. \sa fileInfoList() diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 30ce23b..4edbf2d 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -1012,7 +1012,7 @@ bool QAbstractScrollArea::event(QEvent *e) You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead. - Specialised handlers for viewport events are: paintEvent(), + Specialized handlers for viewport events are: paintEvent(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), wheelEvent(), dragEnterEvent(), dragMoveEvent(), dragLeaveEvent(), dropEvent(), contextMenuEvent(), and diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index a8b39f4..ee9a861 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -717,7 +717,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb offset_accumulated += stepsToScrollF; #ifndef Q_WS_MAC - // Dont't scroll more than one page in any case: + // Don't scroll more than one page in any case: stepsToScroll = qBound(-pageStep, int(offset_accumulated), pageStep); #else // Native UI-elements on Mac can scroll hundreds of lines at a time as diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 8043747..4d52e38 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -902,7 +902,7 @@ void QDateTimeEdit::setDisplayFormat(const QString &format) /*! \property QDateTimeEdit::calendarPopup - \brief the current calender pop-up showing mode. + \brief the current calendar pop-up showing mode. \since 4.2 The calendar pop-up will be shown upon clicking the arrow button. diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index b540e76..867e5a3 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -3163,7 +3163,7 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or } #ifndef QT_NO_TABBAR -// Sets the correct positions for the seperator widgets +// Sets the correct positions for the separator widgets // Allocates new sepearator widgets with getSeparatorWidget void QDockAreaLayout::updateSeparatorWidgets() const { diff --git a/src/gui/widgets/qdockarealayout_p.h b/src/gui/widgets/qdockarealayout_p.h index 9cb77ba..37f3783 100644 --- a/src/gui/widgets/qdockarealayout_p.h +++ b/src/gui/widgets/qdockarealayout_p.h @@ -83,7 +83,7 @@ class QTabBar; // which then has one QDockAreaLayoutInfo as a child. (QDockAreaLayoutItem::subInfo) or // a widgetItem if this is a node of the tree (QDockAreaLayoutItem::widgetItem) // -// A path indetifies uniquely one object in this tree, the first number beeing the side and all the following +// A path indetifies uniquely one object in this tree, the first number being the side and all the following // indexes into the QDockAreaLayoutInfo::item_list. struct QDockAreaLayoutItem diff --git a/src/gui/widgets/qdockwidget_p.h b/src/gui/widgets/qdockwidget_p.h index d272b2c..655e216 100644 --- a/src/gui/widgets/qdockwidget_p.h +++ b/src/gui/widgets/qdockwidget_p.h @@ -169,7 +169,7 @@ private: QRect _titleArea; }; -/* The size hints of a QDockWidget will depend on wether it is docked or not. +/* The size hints of a QDockWidget will depend on whether it is docked or not. This layout item always returns the size hints as if the dock widget was docked. */ class QDockWidgetItem : public QWidgetItem diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index d881acf..dd8fb97 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -239,7 +239,7 @@ public: #ifndef QT_NO_COMPLETER QCompleter *completer() const { return m_completer; } - /* Note that you must set the widget for the completer seperately */ + /* Note that you must set the widget for the completer separately */ void setCompleter(const QCompleter *c) { m_completer = const_cast<QCompleter*>(c); } void complete(int key); #endif diff --git a/src/gui/widgets/qscrollarea.cpp b/src/gui/widgets/qscrollarea.cpp index 38e799e..64a0049 100644 --- a/src/gui/widgets/qscrollarea.cpp +++ b/src/gui/widgets/qscrollarea.cpp @@ -121,7 +121,7 @@ QT_BEGIN_NAMESPACE If a scroll area is used to display the contents of a widget that contains child widgets arranged in a layout, it is important to - realise that the size policy of the layout will also determine the + realize that the size policy of the layout will also determine the size of the widget. This is especially useful to know if you intend to dynamically change the contents of the layout. In such cases, setting the layout's \l{QLayout::sizeConstraint}{size constraint} diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 88b7517..7775f39 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -124,7 +124,7 @@ QSplitterHandle::QSplitterHandle(Qt::Orientation orientation, QSplitter *parent) /*! Sets the orientation of the splitter handle to \a orientation. - This is usually propogated from the QSplitter. + This is usually propagated from the QSplitter. \sa QSplitter::setOrientation() */ -- cgit v0.12 From dc11a951d30ce1c668550ab5e7b487f00cca7f1a Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Fri, 7 Jan 2011 11:56:33 +0100 Subject: Assistant: Don't tabify "Open Pages" dock widget by default. The user is likely to always want to see it plus one of the others. --- tools/assistant/tools/assistant/mainwindow.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index d7d01da..d6b9e24 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -106,7 +106,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) TRACE_OBJ setToolButtonStyle(Qt::ToolButtonFollowStyle); - setDockOptions(ForceTabbedDocks); // Has no effect; Qt bug? + setDockOptions(dockOptions() | AllowNestedDocks); QString collectionFile; if (usesDefaultCollection()) { @@ -218,8 +218,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) } else { tabifyDockWidget(contentDock, indexDock); tabifyDockWidget(indexDock, bookmarkDock); - tabifyDockWidget(bookmarkDock, openPagesDock); - tabifyDockWidget(openPagesDock, searchDock); + tabifyDockWidget(bookmarkDock, searchDock); contentDock->raise(); const QRect screen = QApplication::desktop()->screenGeometry(); resize(4*screen.width()/5, 4*screen.height()/5); -- cgit v0.12 From 9fd43b8bc40e3b7657dc7eba2dccff95f0d0077a Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Fri, 7 Jan 2011 14:03:52 +0100 Subject: Assistant: Fix warnings. --- .../tools/assistant/bookmarkfiltermodel.cpp | 37 +++++++++++----------- tools/assistant/tools/assistant/mainwindow.cpp | 5 +-- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp b/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp index fe510a5..d60e537 100644 --- a/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp +++ b/tools/assistant/tools/assistant/bookmarkfiltermodel.cpp @@ -54,25 +54,24 @@ void BookmarkFilterModel::setSourceModel(QAbstractItemModel *_sourceModel) { beginResetModel(); - disconnect(sourceModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, - SLOT(changed(QModelIndex, QModelIndex))); - - disconnect(sourceModel, SIGNAL(rowsInserted(QModelIndex, int, int)), - this, SLOT(rowsInserted(QModelIndex, int, int))); - - disconnect(sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), - this, SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); - disconnect(sourceModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, - SLOT(rowsRemoved(QModelIndex, int, int))); - - disconnect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this, - SLOT(layoutAboutToBeChanged())); - disconnect(sourceModel, SIGNAL(layoutChanged()), this, - SLOT(layoutChanged())); - - disconnect(sourceModel, SIGNAL(modelAboutToBeReset()), this, - SLOT(modelAboutToBeReset())); - disconnect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset())); + if (sourceModel) { + disconnect(sourceModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(changed(QModelIndex, QModelIndex))); + disconnect(sourceModel, SIGNAL(rowsInserted(QModelIndex, int, int)), + this, SLOT(rowsInserted(QModelIndex, int, int))); + disconnect(sourceModel, + SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), this, + SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); + disconnect(sourceModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SLOT(rowsRemoved(QModelIndex, int, int))); + disconnect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this, + SLOT(layoutAboutToBeChanged())); + disconnect(sourceModel, SIGNAL(layoutChanged()), this, + SLOT(layoutChanged())); + disconnect(sourceModel, SIGNAL(modelAboutToBeReset()), this, + SLOT(modelAboutToBeReset())); + disconnect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset())); + } QAbstractProxyModel::setSourceModel(sourceModel); sourceModel = qobject_cast<BookmarkModel*> (_sourceModel); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index d6b9e24..7852104 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -199,6 +199,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) } QToolBar *toolBar = addToolBar(tr("Bookmark Toolbar")); + toolBar->setObjectName(QLatin1String("Bookmark Toolbar")); bookMarkManager->setBookmarksToolbar(toolBar); // Show the widget here, otherwise the restore geometry and state won't work @@ -459,10 +460,6 @@ void MainWindow::setupActions() menu->addAction(globalActions->printAction()); menu->addSeparator(); - m_closeTabAction = menu->addAction(tr("&Close Tab"), m_centralWidget, - SLOT(closeTab())); - m_closeTabAction->setShortcuts(QKeySequence::Close); - QIcon appExitIcon = QIcon::fromTheme("application-exit"); QAction *tmp; #ifdef Q_OS_WIN -- cgit v0.12 From 8ffb49a4ac68b1c243b25343053e6e99f97ec2e7 Mon Sep 17 00:00:00 2001 From: Yoann Lopes <yoann.lopes@nokia.com> Date: Fri, 7 Jan 2011 14:29:38 +0100 Subject: Fixes crash in QGraphicsItem's destructor. Crash introduced by 783a278f243c6411f5f32d11f2165b9eed9b6f8c. Autotest written by Niklas Kurkisuo <ext-niklas.kurkisuo@nokia.com> Task-number: QTBUG-16374 Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsitem.cpp | 4 +- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 53 ++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 94e1a72..e52c970 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5589,9 +5589,11 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem // Reset sub focus chain. QGraphicsItem *parent = rootItem ? rootItem : q_ptr; do { - if (parent->d_ptr->subFocusItem != q_ptr || parent == stopItem) + if (parent->d_ptr->subFocusItem != q_ptr) break; parent->d_ptr->subFocusItem = 0; + if (parent == stopItem) + break; parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 0b29410..5daafd8 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -65,6 +65,7 @@ #include <QInputContext> #include <QPushButton> #include <QLineEdit> +#include <QGraphicsLinearLayout> #include "../../shared/util.h" @@ -469,6 +470,7 @@ private slots: void itemDiesDuringDraggingOperation(); void QTBUG_12112_focusItem(); void QTBUG_13473_sceneposchange(); + void QTBUG_16374_crashInDestructor(); private: QList<QGraphicsItem *> paintedItems; @@ -11077,5 +11079,56 @@ void tst_QGraphicsItem::QTBUG_13473_sceneposchange() QCOMPARE(child->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2); } +class MyGraphicsWidget : public QGraphicsWidget { +Q_OBJECT +public: + MyGraphicsWidget() + : QGraphicsWidget(0) + { + QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(Qt::Vertical); + QLatin1String wiseWords("AZ BUKI VEDI"); + QString sentence(wiseWords); + QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts); + for (int i = 0; i < words.count(); ++i) { + QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this); + QLabel *label = new QLabel(words.at(i)); + proxy->setWidget(label); + proxy->setFocusPolicy(Qt::StrongFocus); + proxy->setFlag(QGraphicsItem::ItemAcceptsInputMethod, true); + if (i%2 == 0) + proxy->setVisible(false); + proxy->setFocus(); + lay->addItem(proxy); + } + setLayout(lay); + } + +}; + +class MyWidgetWindow : public QGraphicsWidget +{ +public: + MyWidgetWindow() + : QGraphicsWidget(0, Qt::Window) + { + QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(Qt::Vertical); + MyGraphicsWidget *widget = new MyGraphicsWidget(); + lay->addItem(widget); + setLayout(lay); + } +}; + +void tst_QGraphicsItem::QTBUG_16374_crashInDestructor() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + MyWidgetWindow win; + scene.addItem(&win); + + view.show(); + QTest::qWaitForWindowShown(&view); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From 362a61cd821144141324d99cdbaf1ddd858076d9 Mon Sep 17 00:00:00 2001 From: Peter Hartmann <peter.hartmann@nokia.com> Date: Fri, 7 Jan 2011 16:17:13 +0100 Subject: fix build with QT_NO_BEARERMANAGEMENT start() is only defined when using bearer management; that method calls open(), which we just call directly if not using bearer. Reviewed-by: Markus Goetz Task-number: QTBUG-16477 --- src/network/access/qnetworkaccessdatabackend.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/network/access/qnetworkaccessdatabackend.cpp b/src/network/access/qnetworkaccessdatabackend.cpp index 74aebdb..d2db2f2 100644 --- a/src/network/access/qnetworkaccessdatabackend.cpp +++ b/src/network/access/qnetworkaccessdatabackend.cpp @@ -124,7 +124,11 @@ bool QNetworkAccessDataBackend::waitForUpstreamBytesWritten(int) bool QNetworkAccessDataBackend::processRequestSynchronously() { +#ifndef QT_NO_BEARERMANAGEMENT start(); +#else + open(); +#endif return true; } -- cgit v0.12 From 64852122ba71bbb297b4f1e440f6fabee16ca2fe Mon Sep 17 00:00:00 2001 From: Jiang Jiang <jiang.jiang@nokia.com> Date: Fri, 7 Jan 2011 16:15:25 +0100 Subject: Fix crash in QTextBlock::next()/previous() We should check not just p but also n in next()/previous(), which is what isValid() does. Otherwise n == 0 will cause crash in QFragmentMap. Task-number: QTBUG-16279 Reviewed-by: Eskil --- src/gui/text/qtextobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index ea2ef2d..4b92379 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1488,7 +1488,7 @@ QTextBlock::iterator QTextBlock::end() const */ QTextBlock QTextBlock::next() const { - if (!p) + if (!isValid()) return QTextBlock(); return QTextBlock(p, p->blockMap().next(n)); @@ -1504,7 +1504,7 @@ QTextBlock QTextBlock::next() const */ QTextBlock QTextBlock::previous() const { - if (!p) + if (!isValid()) return QTextBlock(); return QTextBlock(p, p->blockMap().previous(n)); -- cgit v0.12 From 55b0db65877ef5cfb6616f11988c990e2c207bd6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Fri, 7 Jan 2011 16:42:16 +0100 Subject: Examples: Fix compilation with namespace. --- examples/webkit/imageanalyzer/imageanalyzer.h | 6 +++--- examples/webkit/imageanalyzer/mainwindow.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/webkit/imageanalyzer/imageanalyzer.h b/examples/webkit/imageanalyzer/imageanalyzer.h index 1bb25dc..265a0c5 100644 --- a/examples/webkit/imageanalyzer/imageanalyzer.h +++ b/examples/webkit/imageanalyzer/imageanalyzer.h @@ -44,9 +44,9 @@ #include <QFutureWatcher> #include <QtGui> -class QNetworkAccessManager; -class QNetworkReply; -class QNetworkDiskCache; +QT_FORWARD_DECLARE_CLASS(QNetworkAccessManager) +QT_FORWARD_DECLARE_CLASS(QNetworkReply) +QT_FORWARD_DECLARE_CLASS(QNetworkDiskCache) //! [ ImageAnalyzer - public interface ] class ImageAnalyzer : public QObject diff --git a/examples/webkit/imageanalyzer/mainwindow.h b/examples/webkit/imageanalyzer/mainwindow.h index 076e586..dac7c56 100644 --- a/examples/webkit/imageanalyzer/mainwindow.h +++ b/examples/webkit/imageanalyzer/mainwindow.h @@ -45,7 +45,7 @@ #include <QWebView> class ImageAnalyzer; -class QNetworkDiskCache; +QT_FORWARD_DECLARE_CLASS(QNetworkDiskCache) class MainWin : public QWebView { -- cgit v0.12 From eab9b566d8e7cd98dd69cbcfc39393192a9e6efa Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Fri, 7 Jan 2011 16:43:46 +0100 Subject: CLucene: Use the right delete operator. Task-number: QTBUG-15787 Task-number: QTBUG-15788 --- tools/assistant/lib/fulltextsearch/qindexwriter.cpp | 2 +- tools/assistant/lib/fulltextsearch/qsort.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assistant/lib/fulltextsearch/qindexwriter.cpp b/tools/assistant/lib/fulltextsearch/qindexwriter.cpp index 357569c..ee1c2dc 100644 --- a/tools/assistant/lib/fulltextsearch/qindexwriter.cpp +++ b/tools/assistant/lib/fulltextsearch/qindexwriter.cpp @@ -88,7 +88,7 @@ void QCLuceneIndexWriter::addIndexes(const QList<QCLuceneIndexReader*> &readers) readerArray[i] = (readers.at(i))->d->reader; d->writer->addIndexes(readerArray); - delete readerArray; + delete [] readerArray; } void QCLuceneIndexWriter::addDocument(QCLuceneDocument &doc, diff --git a/tools/assistant/lib/fulltextsearch/qsort.cpp b/tools/assistant/lib/fulltextsearch/qsort.cpp index d9375bf..3263195 100644 --- a/tools/assistant/lib/fulltextsearch/qsort.cpp +++ b/tools/assistant/lib/fulltextsearch/qsort.cpp @@ -84,7 +84,7 @@ void QCLuceneSort::setSort(const QStringList &fieldNames) for (int i = 0; i < fieldNames.count(); ++i) delete [] nameArray[i]; - delete nameArray; + delete [] nameArray; } void QCLuceneSort::setSort(const QString &field, bool reverse) -- cgit v0.12 From 33379f4a8b27ee37321c4e51f0d2f75f0eedd854 Mon Sep 17 00:00:00 2001 From: aavit <qt-info@nokia.com> Date: Fri, 7 Jan 2011 16:47:04 +0100 Subject: Added api for efficient data driven baseline testing --- tests/arthur/common/qbaselinetest.cpp | 133 ++++++++++++++++----- tests/arthur/common/qbaselinetest.h | 13 ++ tests/auto/baselineexample/tst_baselineexample.cpp | 50 +++----- 3 files changed, 133 insertions(+), 63 deletions(-) diff --git a/tests/arthur/common/qbaselinetest.cpp b/tests/arthur/common/qbaselinetest.cpp index e95b510..79241d5 100644 --- a/tests/arthur/common/qbaselinetest.cpp +++ b/tests/arthur/common/qbaselinetest.cpp @@ -44,56 +44,45 @@ namespace QBaselineTest { +BaselineProtocol proto; bool connected = false; bool triedConnecting = false; -BaselineProtocol proto; - -bool checkImage(const QImage& img, const char *name, quint16 checksum, QByteArray *msg, bool *error) -{ - QByteArray itemName; - bool hasName = qstrlen(name); - const char *tag = QTest::currentDataTag(); - if (qstrlen(tag)) { - itemName = tag; - if (hasName) - itemName.append('_').append(name); - } else { - itemName = hasName ? name : "default_name"; - } +QByteArray curFunction; +ImageItemList itemList; +bool gotBaselines; - *msg = "Baseline check of image '" + itemName + "': "; +bool connect(QByteArray *msg, bool *error) +{ if (!triedConnecting) { triedConnecting = true; if (!proto.connect(QTest::testObject()->metaObject()->className())) { *msg += "Failed to connect to baseline server: " + proto.errorMessage().toLatin1(); *error = true; - return true; + return false; } connected = true; } if (!connected) { *msg = "Not connected to baseline server."; *error = true; - return true; + return false; } + return true; +} - ImageItem item; - item.itemName = QLatin1String(itemName); - item.itemChecksum = checksum; - item.testFunction = QLatin1String(QTest::currentTestFunction()); - ImageItemList list; - list.append(item); - if (!proto.requestBaselineChecksums(QLatin1String(QTest::currentTestFunction()), &list) || list.isEmpty()) { - *msg = "Communication with baseline server failed: " + proto.errorMessage().toLatin1(); - *error = true; - return true; - } + +bool compareItem(const ImageItem &baseline, const QImage &img, QByteArray *msg, bool *error) +{ + ImageItem item = baseline; item.image = img; + item.imageChecksums.clear(); item.imageChecksums.prepend(ImageItem::computeChecksum(img)); QByteArray srvMsg; - switch (list.at(0).status) { + switch (baseline.status) { + case ImageItem::Ok: + break; case ImageItem::IgnoreItem : qDebug() << msg->constData() << "Ignored, blacklisted on server."; return true; @@ -105,8 +94,6 @@ bool checkImage(const QImage& img, const char *name, quint16 checksum, QByteArra qDebug() << msg->constData() << "Baseline not found on server. Uploading of new baseline failed:" << srvMsg; return true; break; - case ImageItem::Ok: - break; default: qWarning() << "Unexpected reply from baseline server."; return true; @@ -114,11 +101,93 @@ bool checkImage(const QImage& img, const char *name, quint16 checksum, QByteArra } *error = false; // The actual comparison of the given image with the baseline: - if (list.at(0).imageChecksums.contains(item.imageChecksums.at(0))) + if (baseline.imageChecksums.contains(item.imageChecksums.at(0))) return true; proto.submitMismatch(item, &srvMsg); *msg += "Mismatch. See report:\n " + srvMsg; return false; } +bool checkImage(const QImage &img, const char *name, quint16 checksum, QByteArray *msg, bool *error) +{ + if (!connected && !connect(msg, error)) + return true; + + QByteArray itemName; + bool hasName = qstrlen(name); + const char *tag = QTest::currentDataTag(); + if (qstrlen(tag)) { + itemName = tag; + if (hasName) + itemName.append('_').append(name); + } else { + itemName = hasName ? name : "default_name"; + } + + *msg = "Baseline check of image '" + itemName + "': "; + + + ImageItem item; + item.itemName = QString::fromLatin1(itemName); + item.itemChecksum = checksum; + item.testFunction = QString::fromLatin1(QTest::currentTestFunction()); + ImageItemList list; + list.append(item); + if (!proto.requestBaselineChecksums(QLatin1String(QTest::currentTestFunction()), &list) || list.isEmpty()) { + *msg = "Communication with baseline server failed: " + proto.errorMessage().toLatin1(); + *error = true; + return true; + } + + return compareItem(list.at(0), img, msg, error); +} + + +QTestData &newRow(const char *dataTag, quint16 checksum) +{ + if (QTest::currentTestFunction() != curFunction) { + curFunction = QTest::currentTestFunction(); + itemList.clear(); + gotBaselines = false; + } + ImageItem item; + item.itemName = QString::fromLatin1(dataTag); + item.itemChecksum = checksum; + item.testFunction = QString::fromLatin1(QTest::currentTestFunction()); + itemList.append(item); + + return QTest::newRow(dataTag); +} + + +bool testImage(const QImage& img, QByteArray *msg, bool *error) +{ + if (!connected && !connect(msg, error)) + return true; + + if (QTest::currentTestFunction() != curFunction || itemList.isEmpty()) { + qWarning() << "Usage error: QBASELINE_TEST used without corresponding QBaselineTest::newRow()"; + return true; + } + + if (!gotBaselines) { + if (!proto.requestBaselineChecksums(QString::fromLatin1(QTest::currentTestFunction()), &itemList) || itemList.isEmpty()) { + *msg = "Communication with baseline server failed: " + proto.errorMessage().toLatin1(); + *error = true; + return true; + } + gotBaselines = true; + } + + QString curTag = QString::fromLatin1(QTest::currentDataTag()); + ImageItemList::const_iterator it = itemList.constBegin(); + while (it != itemList.constEnd() && it->itemName != curTag) + ++it; + if (it == itemList.constEnd()) { + qWarning() << "Usage error: QBASELINE_TEST used without corresponding QBaselineTest::newRow() for row" << curTag; + return true; + } + return compareItem(*it, img, msg, error); +} + } diff --git a/tests/arthur/common/qbaselinetest.h b/tests/arthur/common/qbaselinetest.h index 3445c72..e27cda2 100644 --- a/tests/arthur/common/qbaselinetest.h +++ b/tests/arthur/common/qbaselinetest.h @@ -46,6 +46,8 @@ namespace QBaselineTest { bool checkImage(const QImage& img, const char *name, quint16 checksum, QByteArray *msg, bool *error); +bool testImage(const QImage& img, QByteArray *msg, bool *error); +QTestData &newRow(const char *dataTag, quint16 checksum = 0); } #define QBASELINE_CHECK_SUM(image, name, checksum)\ @@ -61,4 +63,15 @@ do {\ #define QBASELINE_CHECK(image, name) QBASELINE_CHECK_SUM(image, name, 0) +#define QBASELINE_TEST(image)\ +do {\ + QByteArray _msg;\ + bool _err = false;\ + if (!QBaselineTest::testImage((image), &_msg, &_err)) {\ + QFAIL(_msg.constData());\ + } else if (_err) {\ + QSKIP(_msg.constData(), SkipSingle);\ + }\ +} while (0) + #endif // BASELINETEST_H diff --git a/tests/auto/baselineexample/tst_baselineexample.cpp b/tests/auto/baselineexample/tst_baselineexample.cpp index 28cbec5..b97cc63 100644 --- a/tests/auto/baselineexample/tst_baselineexample.cpp +++ b/tests/auto/baselineexample/tst_baselineexample.cpp @@ -54,10 +54,8 @@ private Q_SLOTS: void testMultipleImages(); void testDataDriven_data(); void testDataDriven(); - void testDataDrivenMultiple_data(); - void testDataDrivenMultiple(); - void testChecksum_data(); - void testChecksum(); + void testDataDrivenChecksum_data(); + void testDataDrivenChecksum(); }; @@ -98,9 +96,11 @@ void tst_BaselineExample::testMultipleImages() void tst_BaselineExample::testDataDriven_data() { QTest::addColumn<QString>("label"); - QTest::newRow("short") << "Ok!"; - QTest::newRow("long") << "A really long button text that just does not seem to end"; - QTest::newRow("empty") << ""; + QBaselineTest::newRow("short") << "Ok!"; + QBaselineTest::newRow("long") << "A really long button text that just does not seem to end"; + QBaselineTest::newRow("empty") << ""; + QBaselineTest::newRow("signs") << "!@#$%^&*()_"; + QBaselineTest::newRow("html") << "<b>BOLD</b>"; } @@ -111,45 +111,33 @@ void tst_BaselineExample::testDataDriven() b.resize(100, 50); b.show(); QTest::qWaitForWindowShown(&b); - QBASELINE_CHECK(QPixmap::grabWidget(&b).toImage(), 0); + QBASELINE_TEST(QPixmap::grabWidget(&b).toImage()); } -void tst_BaselineExample::testDataDrivenMultiple_data() +void tst_BaselineExample::testDataDrivenChecksum_data() { - testDataDriven_data(); -} - - -void tst_BaselineExample::testDataDrivenMultiple() -{ - QFETCH(QString, label); - QPushButton b(label); - b.resize(100, 50); - b.show(); - QTest::qWaitForWindowShown(&b); - QBASELINE_CHECK(QPixmap::grabWidget(&b).toImage(), "normal"); - - b.setText(label.prepend('&')); - QTest::qWait(50); - QBASELINE_CHECK(QPixmap::grabWidget(&b).toImage(), "shortcut"); -} + QTest::addColumn<QString>("label"); + const int numItems = 5; + const char *tags[numItems] = {"short", "long", "empty", "signs", "html"}; + const char *labels[numItems] = {"Ok!", "A really long button text that just does not seem to end", "", "!@#$%^&*()_", "<b>BOLD</b>"}; -void tst_BaselineExample::testChecksum_data() -{ - testDataDriven_data(); + for (int i = 0; i<numItems; i++) { + quint16 checksum = qChecksum(labels[i], qstrlen(labels[i])); + QBaselineTest::newRow(tags[i], checksum) << labels[i]; + } } -void tst_BaselineExample::testChecksum() +void tst_BaselineExample::testDataDrivenChecksum() { QFETCH(QString, label); QPushButton b(label); b.resize(100, 50); b.show(); QTest::qWaitForWindowShown(&b); - QBASELINE_CHECK_SUM(QPixmap::grabWidget(&b).toImage(), 0, quint16(qHash(label))); + QBASELINE_TEST(QPixmap::grabWidget(&b).toImage()); } -- cgit v0.12 From 9a6cfc07e5ab21460cd85dbe6ac1f6de62c69524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= <joao.abecasis@nokia.com> Date: Wed, 5 Jan 2011 15:24:50 +0100 Subject: Check elapsed time only once Task-number: QTBUG-16262 Reviewed-by: Bradley T. Hughes --- src/corelib/thread/qsemaphore.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 8e8a88a..15f45b6 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -223,8 +223,9 @@ bool QSemaphore::tryAcquire(int n, int timeout) QElapsedTimer timer; timer.start(); while (n > d->avail) { - if (timer.hasExpired(timeout) - || !d->cond.wait(locker.mutex(), timeout - timer.elapsed())) + const qint64 elapsed = timer.elapsed(); + if (timeout - elapsed > 0 + || !d->cond.wait(locker.mutex(), timeout - elapsed)) return false; } } -- cgit v0.12 From 1638129ccbe9680a41859dc48d063a63ae103b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= <joao.abecasis@nokia.com> Date: Thu, 6 Jan 2011 17:16:20 +0100 Subject: Fix compilation error on Solaris d_type in dirent is a non-standard extension to POSIX available on some platforms (namely BSDs, Mac, Linux, Symbian). Taking the conservative approach and using this information only on platforms known to support it. Reviewed-by: Shane Kearns --- src/corelib/io/qfilesystemengine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp index d9d802e..9446ebb 100644 --- a/src/corelib/io/qfilesystemengine.cpp +++ b/src/corelib/io/qfilesystemengine.cpp @@ -289,6 +289,9 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer) void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry) { +#if defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4) || defined(Q_OS_SYMBIAN) + // BSD4 includes Mac OS X + // ### This will clear all entry flags and knownFlagsMask switch (entry.d_type) { @@ -344,6 +347,9 @@ void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry) default: clear(); } +#else + Q_UNUSED(entry) +#endif } #endif -- cgit v0.12 From 30080bdcb226a5a815465299bcb0dbb6a347cb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Fri, 7 Jan 2011 12:12:35 +0100 Subject: Lighthouse: Fix keyboard modifier handling QApplication allready knows the modifiers --- src/gui/kernel/qapplication_qpa.cpp | 8 +++--- .../platforms/testlite/qtestlitekeyboard.cpp | 29 ++++++++++++++-------- src/plugins/platforms/testlite/qtestlitekeyboard.h | 1 + 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index fdbb931..cd76adf 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -79,7 +79,6 @@ int qt_last_x = 0; int qt_last_y = 0; QPointer<QWidget> qt_last_mouse_receiver = 0; -static Qt::KeyboardModifiers modifiers = Qt::NoModifier; static Qt::MouseButtons buttons = Qt::NoButton; static ulong mousePressTime; static Qt::MouseButton mousePressButton = Qt::NoButton; @@ -731,7 +730,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse // qDebug() << "sending mouse ev." << ev.type() << localPoint << globalPoint << ev.button() << ev.buttons() << mouseWidget << "mouse grabber" << implicit_mouse_grabber; - QMouseEvent ev(type, localPoint, globalPoint, button, buttons, modifiers); + QMouseEvent ev(type, localPoint, globalPoint, button, buttons, QApplication::keyboardModifiers()); QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances(); foreach (QWeakPointer<QPlatformCursor> cursor, cursors) { @@ -744,7 +743,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse #ifndef QT_NO_CONTEXTMENU if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { - QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, modifiers); + QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint, globalPoint, QApplication::keyboardModifiers()); QApplication::sendSpontaneousEvent(mouseWidget, &e); } #endif // QT_NO_CONTEXTMENU @@ -786,7 +785,7 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wheel p = mouseWidget->mapFromGlobal(globalPoint); } - QWheelEvent ev(p, globalPoint, e->delta, buttons, modifiers, + QWheelEvent ev(p, globalPoint, e->delta, buttons, QApplication::keyboardModifiers(), e->orient); QApplication::sendSpontaneousEvent(mouseWidget, &ev); } @@ -817,7 +816,6 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEven if (app_do_modal && !qt_try_modal(focusW, e->keyType)) return; - modifiers = e->modifiers; QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); QApplication::sendSpontaneousEvent(focusW, &ev); } diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp index 93d21b3..ca4c203 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -1,5 +1,7 @@ #include "qtestlitekeyboard.h" +#include <QDebug> + #include "qtestlitescreen.h" #include <QtGui/QWindowSystemInterface> @@ -710,8 +712,8 @@ Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) ret |= Qt::AltModifier; if (s & m_meta_mask) ret |= Qt::MetaModifier; - if (s & m_mode_switch_mask) - ret |= Qt::GroupSwitchModifier; +// if (s & m_mode_switch_mask) //doesn't seem to work correctly +// ret |= Qt::GroupSwitchModifier; return ret; } @@ -947,14 +949,21 @@ static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) { - int qtcode = 0; - Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); + const int xkeycode = ev->keycode; + const uint xmodifiers = ev->state; + + KeySym baseKeySym; + uint consumedModifiers; + if (!XkbLookupKeySym(m_screen->display(), xkeycode, (xmodifiers & (LockMask | m_num_lock_mask)), + &consumedModifiers, &baseKeySym)) + return; + + Qt::KeyboardModifiers baseModifiers = 0; + int baseCode = -1; QByteArray chars; - chars.resize(513); int count = 0; - KeySym keySym; - count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); - QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - modifiers ^= modifierFromKeyCode(qtcode); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); + QString text = translateKeySym(baseKeySym, xmodifiers, baseCode, baseModifiers, chars, count); + + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,baseCode,baseModifiers,text.left(count)); + } diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h index 65ead16..4e9d98d 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.h +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.h @@ -14,6 +14,7 @@ public: Qt::KeyboardModifiers translateModifiers(int s); + enum { MaxBits = sizeof(uint) * 8 }; private: void setMask(KeySym sym, uint mask); -- cgit v0.12 From 2bc7d2af6be2b09c38e989f339ec2ee33cc204eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Fri, 7 Jan 2011 17:38:59 +0100 Subject: Lighthouse: Fix keyboard on testlite Remove code which was wrong --- .../platforms/testlite/qtestlitekeyboard.cpp | 24 +++++++--------------- src/plugins/platforms/testlite/qtestlitekeyboard.h | 1 - 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp index ca4c203..72e6d50 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -1,7 +1,5 @@ #include "qtestlitekeyboard.h" -#include <QDebug> - #include "qtestlitescreen.h" #include <QtGui/QWindowSystemInterface> @@ -949,21 +947,13 @@ static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) { - const int xkeycode = ev->keycode; - const uint xmodifiers = ev->state; - - KeySym baseKeySym; - uint consumedModifiers; - if (!XkbLookupKeySym(m_screen->display(), xkeycode, (xmodifiers & (LockMask | m_num_lock_mask)), - &consumedModifiers, &baseKeySym)) - return; - - Qt::KeyboardModifiers baseModifiers = 0; - int baseCode = -1; + int qtcode = 0; + Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); QByteArray chars; + chars.resize(513); int count = 0; - QString text = translateKeySym(baseKeySym, xmodifiers, baseCode, baseModifiers, chars, count); - - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,baseCode,baseModifiers,text.left(count)); - + KeySym keySym; + count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); + QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); } diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h index 4e9d98d..65ead16 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.h +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.h @@ -14,7 +14,6 @@ public: Qt::KeyboardModifiers translateModifiers(int s); - enum { MaxBits = sizeof(uint) * 8 }; private: void setMask(KeySym sym, uint mask); -- cgit v0.12 From 6e3ae781a7bd3b5ae2143ef60f969d89663508e3 Mon Sep 17 00:00:00 2001 From: miniak <milan.burda@gmail.com> Date: Fri, 7 Jan 2011 19:16:33 +0100 Subject: Add /DYNAMICBASE /NXCOMPAT to linker options in Visual Studio 2005 and higher Native Win32 C++ projects created in Visual Studio have this enabled in the default configuration in order to increase security. Merge-request: 2539 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> --- mkspecs/win32-msvc2005/qmake.conf | 2 +- mkspecs/win32-msvc2008/qmake.conf | 2 +- mkspecs/win32-msvc2010/qmake.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 0c79561..63bef80 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -53,7 +53,7 @@ QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $< QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link -QMAKE_LFLAGS = /NOLOGO \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" +QMAKE_LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF QMAKE_LFLAGS_DEBUG = /DEBUG diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 24a0486..9f9c919 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -55,7 +55,7 @@ QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $< QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link -QMAKE_LFLAGS = /NOLOGO \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" +QMAKE_LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF QMAKE_LFLAGS_DEBUG = /DEBUG diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index c08a74d..9471034 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -55,7 +55,7 @@ QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $< QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link -QMAKE_LFLAGS = /NOLOGO \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" +QMAKE_LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF QMAKE_LFLAGS_DEBUG = /DEBUG -- cgit v0.12 From 272a144ed06a4c11e058404f872609f0b43b4dd6 Mon Sep 17 00:00:00 2001 From: Rohan McGovern <rohan.mcgovern@nokia.com> Date: Fri, 31 Dec 2010 11:44:38 +1000 Subject: tst_networkselftest: add checks for echo, daytime --- tests/auto/networkselftest/tst_networkselftest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index 5e9c50e..90387d0 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -398,6 +398,8 @@ void tst_NetworkSelfTest::serverReachability() void tst_NetworkSelfTest::remotePortsOpen_data() { QTest::addColumn<int>("portNumber"); + QTest::newRow("echo") << 7; + QTest::newRow("daytime") << 13; QTest::newRow("ftp") << 21; QTest::newRow("ssh") << 22; QTest::newRow("imap") << 143; -- cgit v0.12 From e6286c54bd66c2db06687127fea69fcc398ffbde Mon Sep 17 00:00:00 2001 From: Rohan McGovern <rohan.mcgovern@nokia.com> Date: Tue, 4 Jan 2011 14:30:19 +1000 Subject: Remove garbage empty test. --- tests/auto/gui.pro | 1 - tests/auto/qtwidgets/.gitignore | 1 - tests/auto/qtwidgets/advanced.ui | 319 --------- tests/auto/qtwidgets/icons/big.png | Bin 1323 -> 0 bytes tests/auto/qtwidgets/icons/folder.png | Bin 4069 -> 0 bytes tests/auto/qtwidgets/icons/icon.bmp | Bin 246 -> 0 bytes tests/auto/qtwidgets/icons/icon.png | Bin 344 -> 0 bytes tests/auto/qtwidgets/mainwindow.cpp | 314 --------- tests/auto/qtwidgets/mainwindow.h | 80 --- tests/auto/qtwidgets/qtstyles.qrc | 8 - tests/auto/qtwidgets/qtwidgets.pro | 10 - tests/auto/qtwidgets/standard.ui | 1207 -------------------------------- tests/auto/qtwidgets/system.ui | 658 ----------------- tests/auto/qtwidgets/tst_qtwidgets.cpp | 112 --- 14 files changed, 2710 deletions(-) delete mode 100644 tests/auto/qtwidgets/.gitignore delete mode 100644 tests/auto/qtwidgets/advanced.ui delete mode 100644 tests/auto/qtwidgets/icons/big.png delete mode 100644 tests/auto/qtwidgets/icons/folder.png delete mode 100644 tests/auto/qtwidgets/icons/icon.bmp delete mode 100644 tests/auto/qtwidgets/icons/icon.png delete mode 100644 tests/auto/qtwidgets/mainwindow.cpp delete mode 100644 tests/auto/qtwidgets/mainwindow.h delete mode 100644 tests/auto/qtwidgets/qtstyles.qrc delete mode 100644 tests/auto/qtwidgets/qtwidgets.pro delete mode 100644 tests/auto/qtwidgets/standard.ui delete mode 100644 tests/auto/qtwidgets/system.ui delete mode 100644 tests/auto/qtwidgets/tst_qtwidgets.cpp diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index 2d9ea93..802e74a 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -197,7 +197,6 @@ SUBDIRS=\ qtreeview \ qtreewidget \ qtreewidgetitemiterator \ - qtwidgets \ qudpsocket \ qundogroup \ qundostack \ diff --git a/tests/auto/qtwidgets/.gitignore b/tests/auto/qtwidgets/.gitignore deleted file mode 100644 index d8e55c3..0000000 --- a/tests/auto/qtwidgets/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tst_qtwidgets diff --git a/tests/auto/qtwidgets/advanced.ui b/tests/auto/qtwidgets/advanced.ui deleted file mode 100644 index ce27374..0000000 --- a/tests/auto/qtwidgets/advanced.ui +++ /dev/null @@ -1,319 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>Advanced</class> - <widget class="QWidget" name="Advanced" > - <property name="objectName" > - <string notr="true" >Advanced</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="pushButton" > - <property name="objectName" > - <string notr="true" >pushButton</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>80</width> - <height>23</height> - </rect> - </property> - <property name="text" > - <string/> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="pushButton_2" > - <property name="objectName" > - <string notr="true" >pushButton_2</string> - </property> - <property name="geometry" > - <rect> - <x>87</x> - <y>1</y> - <width>80</width> - <height>23</height> - </rect> - </property> - <property name="text" > - <string>Text</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox" > - <property name="objectName" > - <string notr="true" >checkBox</string> - </property> - <property name="geometry" > - <rect> - <x>173</x> - <y>6</y> - <width>23</width> - <height>13</height> - </rect> - </property> - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset/> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton" > - <property name="objectName" > - <string notr="true" >radioButton</string> - </property> - <property name="geometry" > - <rect> - <x>202</x> - <y>6</y> - <width>22</width> - <height>12</height> - </rect> - </property> - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset/> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox_2" > - <property name="objectName" > - <string notr="true" >checkBox_2</string> - </property> - <property name="geometry" > - <rect> - <x>230</x> - <y>3</y> - <width>44</width> - <height>18</height> - </rect> - </property> - <property name="text" > - <string>Text</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton_2" > - <property name="objectName" > - <string notr="true" >radioButton_2</string> - </property> - <property name="geometry" > - <rect> - <x>280</x> - <y>3</y> - <width>43</width> - <height>18</height> - </rect> - </property> - <property name="text" > - <string>Text</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QGridLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QListWidget" name="listWidget" > - <property name="objectName" > - <string notr="true" >listWidget</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>186</width> - <height>91</height> - </rect> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QListWidget" name="listWidget_3" > - <property name="objectName" > - <string notr="true" >listWidget_3</string> - </property> - <property name="geometry" > - <rect> - <x>193</x> - <y>96</y> - <width>188</width> - <height>60</height> - </rect> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QTreeWidget" name="treeWidget_2" > - <property name="objectName" > - <string notr="true" >treeWidget_2</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>96</y> - <width>186</width> - <height>60</height> - </rect> - </property> - </widget> - </item> - <item row="0" column="1" > - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QListWidget" name="listWidget_2" > - <property name="objectName" > - <string notr="true" >listWidget_2</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>186</width> - <height>43</height> - </rect> - </property> - </widget> - </item> - <item> - <widget class="QTreeWidget" name="treeWidget" > - <property name="objectName" > - <string notr="true" >treeWidget</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>48</y> - <width>186</width> - <height>43</height> - </rect> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <widget class="QTabWidget" name="tabWidget" > - <property name="objectName" > - <string notr="true" >tabWidget</string> - </property> - <property name="geometry" > - <rect> - <x>9</x> - <y>201</y> - <width>382</width> - <height>90</height> - </rect> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>90</height> - </size> - </property> - <property name="tabPosition" > - <enum>QTabWidget::North</enum> - </property> - <property name="tabShape" > - <enum>QTabWidget::Rounded</enum> - </property> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>380</width> - <height>63</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 1</string> - </attribute> - </widget> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>459</width> - <height>66</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 2</string> - </attribute> - </widget> - </widget> - </item> - </layout> - </widget> - <pixmapfunction></pixmapfunction> - <connections/> -</ui> diff --git a/tests/auto/qtwidgets/icons/big.png b/tests/auto/qtwidgets/icons/big.png deleted file mode 100644 index 6032804..0000000 Binary files a/tests/auto/qtwidgets/icons/big.png and /dev/null differ diff --git a/tests/auto/qtwidgets/icons/folder.png b/tests/auto/qtwidgets/icons/folder.png deleted file mode 100644 index 981a25d..0000000 Binary files a/tests/auto/qtwidgets/icons/folder.png and /dev/null differ diff --git a/tests/auto/qtwidgets/icons/icon.bmp b/tests/auto/qtwidgets/icons/icon.bmp deleted file mode 100644 index 196de6a..0000000 Binary files a/tests/auto/qtwidgets/icons/icon.bmp and /dev/null differ diff --git a/tests/auto/qtwidgets/icons/icon.png b/tests/auto/qtwidgets/icons/icon.png deleted file mode 100644 index 8f9c562..0000000 Binary files a/tests/auto/qtwidgets/icons/icon.png and /dev/null differ diff --git a/tests/auto/qtwidgets/mainwindow.cpp b/tests/auto/qtwidgets/mainwindow.cpp deleted file mode 100644 index 341c416..0000000 --- a/tests/auto/qtwidgets/mainwindow.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "mainwindow.h" -#include <QSplitter> -#include <QHeaderView> - -StyleWidget::StyleWidget(QWidget *parent, Qt::WFlags f) - : QWidget(parent, f) -{ - QHBoxLayout *hbox = new QHBoxLayout(this); - QSplitter *spl = new QSplitter(this); - - // standard widgets - QWidget *leftWidget = new QWidget(this); - m_staWidget.setupUi(leftWidget); - - // advanced/system widgets - QGroupBox *rightWidget = new QGroupBox("Advanced", this); - QVBoxLayout *vbox = new QVBoxLayout(rightWidget); - QWidget *adv = new QWidget(rightWidget); - m_advWidget.setupUi(adv); - QWidget *sys = new QWidget(rightWidget); - m_sysWidget.setupUi(sys); - vbox->addWidget(adv); - vbox->addWidget(sys); - - spl->addWidget(leftWidget); - spl->addWidget(rightWidget); - - hbox->setMargin(4); - hbox->addWidget(spl); - - m_small1 = QIcon(":/icons/icon.bmp"); - m_small2 = QIcon(":/icons/icon.png"); - m_big = QIcon(":/icons/big.png"); - - addComboBoxItems(); - addTreeItems(); - addTreeListItems(); - addListItems(); - addTextEdit(); - setupOtherWidgets(); - setupButtons(); - - foreach(QWidget *w, qFindChildren<QWidget *>(parentWidget())) - w->setWhatsThis(w->metaObject()->className()); -} - -StyleWidget::~StyleWidget() -{ - -} - -void StyleWidget::addTextEdit() -{ - m_staWidget.textEdit->setPlainText( - "Some Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text"); - m_staWidget.textEdit_2->setPlainText( - "Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text"); - m_staWidget.textEdit_3->setPlainText( - "Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text" \ - "Some Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\n"); -} - -void StyleWidget::addComboBoxItems() -{ - m_staWidget.comboBox->addItem("Item 1"); - m_staWidget.comboBox->addItem("Item 2"); - m_staWidget.comboBox->addItem("Item 3"); - m_staWidget.comboBox->addItem("Item 4"); - m_staWidget.comboBox->addItem("Item 5"); -} - -void StyleWidget::addListItems() -{ - m_staWidget.listWidget->addItem("Item 1"); - m_staWidget.listWidget->addItem("Item 2"); - m_staWidget.listWidget->addItem("Item 3"); - m_staWidget.listWidget->addItem("Item 4"); - m_staWidget.listWidget->addItem("Item 5"); - - QListWidgetItem *tmp = new QListWidgetItem("Item 1", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 2", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 3", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 4", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 5", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - - tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - - m_advWidget.listWidget->setViewMode(QListView::IconMode); - QIcon folder(":/icons/folder.png"); - tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget); - tmp->setIcon(folder); - - tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); -} - -void StyleWidget::setupOtherWidgets() -{ - m_sysWidget.tableWidget->setRowCount(100); - m_sysWidget.tableWidget->setColumnCount(100); -} - -void StyleWidget::addTreeItems() -{ - //standard tree - m_staWidget.treeWidget_2->setColumnCount(1); - m_staWidget.treeWidget_2->header()->hide(); - - QTreeWidgetItem *tmp; - QTreeWidgetItem *subtmp; - QTreeWidgetItem *root1 = new QTreeWidgetItem(m_staWidget.treeWidget_2); - root1->setText(0, "Root 1"); - QTreeWidgetItem *root2 = new QTreeWidgetItem(m_staWidget.treeWidget_2); - root2->setText(0, "Root 2"); - - for (int i=1; i<=10; ++i) - { - tmp = new QTreeWidgetItem(root1); - tmp->setText(0, QString("Item %1").arg(i)); - for (int j=1; j<=5; ++j) - { - subtmp = new QTreeWidgetItem(tmp); - subtmp->setText(0, QString("Sub Item %1").arg(j)); - } - } - - // standard checked tree - m_staWidget.treeWidget_4->setColumnCount(1); - m_staWidget.treeWidget_4->header()->hide(); - - root1 = new QTreeWidgetItem(m_staWidget.treeWidget_4); - root1->setText(0, "Root 1"); - root1->setCheckState(0, Qt::Checked); - root2 = new QTreeWidgetItem(m_staWidget.treeWidget_4); - root2->setText(0, "Root 2"); - root2->setCheckState(0, Qt::Checked); - - for (int i=1; i<=10; ++i) - { - tmp = new QTreeWidgetItem(root1); - tmp->setText(0, QString("Item %1").arg(i)); - tmp->setCheckState(0, Qt::Checked); - for (int j=1; j<=5; ++j) - { - subtmp = new QTreeWidgetItem(tmp); - subtmp->setText(0, QString("Sub Item %1").arg(j)); - subtmp->setCheckState(0, Qt::Checked); - } - } - - // advanced (images) tree - m_advWidget.treeWidget_2->setColumnCount(1); - m_advWidget.treeWidget_2->header()->hide(); - - root1 = new QTreeWidgetItem(m_advWidget.treeWidget_2); - root1->setText(0, "Root 1"); - root1->setIcon(0, m_small1); - root2 = new QTreeWidgetItem(m_advWidget.treeWidget_2); - root2->setText(0, "Root 2"); - root2->setIcon(0, m_small1); - - for (int i=1; i<=10; ++i) - { - tmp = new QTreeWidgetItem(root1); - tmp->setText(0, QString("Item %1").arg(i)); - tmp->setIcon(0, m_small2); - for (int j=1; j<=5; ++j) - { - subtmp = new QTreeWidgetItem(tmp); - subtmp->setText(0, QString("Sub Item %1").arg(j)); - tmp->setIcon(0, m_small1); - } - } - -} - -void StyleWidget::addTreeListItems() -{ - //standard list - QTreeWidgetItem *tmp; - m_staWidget.treeWidget->setColumnCount(3); - m_staWidget.treeWidget->headerItem()->setText(0, "Col1"); - m_staWidget.treeWidget->headerItem()->setText(1, "Col2"); - m_staWidget.treeWidget->headerItem()->setText(2, "Col3"); - - for (int i=1; i<10; ++i) - { - tmp = new QTreeWidgetItem(m_staWidget.treeWidget); - tmp->setText(0, QString("Item%1").arg(i)); - tmp->setText(1, QString("Item%11").arg(i)); - tmp->setText(2, QString("Item%12").arg(i)); - } - - //standard checked list - m_staWidget.treeWidget_3->setColumnCount(3); - m_staWidget.treeWidget_3->headerItem()->setText(0, "Col1"); - m_staWidget.treeWidget_3->headerItem()->setText(1, "Col2"); - m_staWidget.treeWidget_3->headerItem()->setText(2, "Col3"); - - for (int i=1; i<10; ++i) - { - tmp = new QTreeWidgetItem(m_staWidget.treeWidget_3); - tmp->setText(0, QString("Item%1").arg(i)); - tmp->setCheckState(0, Qt::Checked); - tmp->setText(1, QString("Item%11").arg(i)); - tmp->setText(2, QString("Item%12").arg(i)); - } - - //with images - m_advWidget.treeWidget->setColumnCount(2); - m_advWidget.treeWidget->headerItem()->setText(0, "Col1"); - m_advWidget.treeWidget->headerItem()->setIcon(0, m_small2); - m_advWidget.treeWidget->headerItem()->setText(1, "Col2"); - m_advWidget.treeWidget->headerItem()->setIcon(1, m_small2); - - for (int i=1; i<10; ++i) - { - tmp = new QTreeWidgetItem(m_advWidget.treeWidget); - tmp->setText(0, QString("Item%1").arg(i)); - tmp->setIcon(0, m_small1); - tmp->setText(1, QString("Item%11").arg(i)); - } -} - -void StyleWidget::setupButtons() -{ - m_advWidget.pushButton->setIcon(m_small1); - m_advWidget.pushButton_2->setIcon(m_small1); - m_advWidget.checkBox->setIcon(m_small2); - m_advWidget.checkBox_2->setIcon(m_small2); - m_advWidget.radioButton->setIcon(m_small2); - m_advWidget.radioButton_2->setIcon(m_small2); - - // tab page images - m_advWidget.tabWidget->setTabIcon(0, m_small2); - m_advWidget.tabWidget->setTabIcon(1, m_small2); -} diff --git a/tests/auto/qtwidgets/mainwindow.h b/tests/auto/qtwidgets/mainwindow.h deleted file mode 100644 index 8a4521a..0000000 --- a/tests/auto/qtwidgets/mainwindow.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include <QWidget> -#include <QWhatsThis> -#include "ui_standard.h" -#include "ui_advanced.h" -#include "ui_system.h" - -class StyleWidget : public QWidget -{ - Q_OBJECT - -public: - StyleWidget(QWidget *parent = 0, Qt::WFlags f = 0); - ~StyleWidget(); - -public slots: - void onWhatsThis() { QWhatsThis::enterWhatsThisMode(); } - -private: - void addComboBoxItems(); - void addListItems(); - void addTextEdit(); - void setupOtherWidgets(); - void setupButtons(); - void addTreeItems(); - void addTreeListItems(); - - Ui::Standard m_staWidget; - Ui::Advanced m_advWidget; - Ui::System m_sysWidget; - - QIcon m_small1; - QIcon m_small2; - QIcon m_big; -}; - -#endif //MAINWINDOW_H - diff --git a/tests/auto/qtwidgets/qtstyles.qrc b/tests/auto/qtwidgets/qtstyles.qrc deleted file mode 100644 index 772891d..0000000 --- a/tests/auto/qtwidgets/qtstyles.qrc +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/"> - <file name="icon.png">./icons/icon.png</file> - <file name="icon.bmp">./icons/icon.bmp</file> - <file name="big.png">./icons/big.png</file> - <file name="folder.png">./icons/folder.png</file> -</qresource> -</RCC> diff --git a/tests/auto/qtwidgets/qtwidgets.pro b/tests/auto/qtwidgets/qtwidgets.pro deleted file mode 100644 index 9c33cd1..0000000 --- a/tests/auto/qtwidgets/qtwidgets.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -symbian:TARGET.EPOCHEAPSIZE=0x200000 0xa00000 - -SOURCES += tst_qtwidgets.cpp mainwindow.cpp -HEADERS += mainwindow.h -QT += network -RESOURCES = qtstyles.qrc -FORMS += advanced.ui system.ui standard.ui - - diff --git a/tests/auto/qtwidgets/standard.ui b/tests/auto/qtwidgets/standard.ui deleted file mode 100644 index 9764a66..0000000 --- a/tests/auto/qtwidgets/standard.ui +++ /dev/null @@ -1,1207 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>Standard</class> - <widget class="QWidget" name="Standard" > - <property name="objectName" > - <string notr="true" >Standard</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>0</number> - </property> - <item> - <widget class="QGroupBox" name="groupBox" > - <property name="objectName" > - <string notr="true" >groupBox</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <property name="title" > - <string>Standard</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QCheckBox" name="checkBox" > - <property name="objectName" > - <string notr="true" >checkBox</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>114</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>Enabled &CheckBox</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox_2" > - <property name="objectName" > - <string notr="true" >checkBox_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>121</x> - <y>1</y> - <width>116</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>Disabled Check&Box</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>243</x> - <y>1</y> - <width>80</width> - <height>3</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QComboBox" name="comboBox" > - <property name="objectName" > - <string notr="true" >comboBox</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>41</width> - <height>3</height> - </rect> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="comboBox_2" > - <property name="objectName" > - <string notr="true" >comboBox_2</string> - </property> - <property name="geometry" > - <rect> - <x>48</x> - <y>1</y> - <width>41</width> - <height>3</height> - </rect> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="comboBox_3" > - <property name="objectName" > - <string notr="true" >comboBox_3</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>95</x> - <y>1</y> - <width>41</width> - <height>3</height> - </rect> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="pushButton" > - <property name="objectName" > - <string notr="true" >pushButton</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>80</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>&Enabled</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="pushButton_2" > - <property name="objectName" > - <string notr="true" >pushButton_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>87</x> - <y>1</y> - <width>80</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>Di&sabled</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>173</x> - <y>1</y> - <width>150</width> - <height>3</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label" > - <property name="objectName" > - <string notr="true" >label</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>99</width> - <height>3</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> - </property> - <property name="text" > - <string>Label with some text.</string> - </property> - <property name="textFormat" > - <enum>Qt::AutoText</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_2" > - <property name="objectName" > - <string notr="true" >label_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>106</x> - <y>1</y> - <width>139</width> - <height>3</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> - </property> - <property name="text" > - <string>Disabled label with some text.</string> - </property> - <property name="textFormat" > - <enum>Qt::AutoText</enum> - </property> - </widget> - </item> - <item> - <spacer> - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>251</x> - <y>1</y> - <width>72</width> - <height>3</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLineEdit" name="lineEdit" > - <property name="objectName" > - <string notr="true" >lineEdit</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>135</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>Enabled</string> - </property> - <property name="echoMode" > - <enum>QLineEdit::Normal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="lineEdit_2" > - <property name="objectName" > - <string notr="true" >lineEdit_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>142</x> - <y>1</y> - <width>134</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>Disabled</string> - </property> - <property name="echoMode" > - <enum>QLineEdit::Normal</enum> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinBox" > - <property name="objectName" > - <string notr="true" >spinBox</string> - </property> - <property name="geometry" > - <rect> - <x>282</x> - <y>1</y> - <width>41</width> - <height>3</height> - </rect> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QRadioButton" name="radioButton" > - <property name="objectName" > - <string notr="true" >radioButton</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>123</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>Enabled RadioButton</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton_2" > - <property name="objectName" > - <string notr="true" >radioButton_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>130</x> - <y>1</y> - <width>125</width> - <height>3</height> - </rect> - </property> - <property name="text" > - <string>Disabled RadioButton</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>261</x> - <y>1</y> - <width>62</width> - <height>3</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QScrollBar" name="horizontalScrollBar" > - <property name="objectName" > - <string notr="true" >horizontalScrollBar</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>90</width> - <height>3</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>90</width> - <height>0</height> - </size> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QScrollBar" name="horizontalScrollBar_2" > - <property name="objectName" > - <string notr="true" >horizontalScrollBar_2</string> - </property> - <property name="geometry" > - <rect> - <x>97</x> - <y>1</y> - <width>30</width> - <height>3</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <widget class="QScrollBar" name="verticalScrollBar" > - <property name="objectName" > - <string notr="true" >verticalScrollBar</string> - </property> - <property name="geometry" > - <rect> - <x>333</x> - <y>1</y> - <width>17</width> - <height>37</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="slider" > - <property name="objectName" > - <string notr="true" >slider</string> - </property> - <property name="geometry" > - <rect> - <x>356</x> - <y>1</y> - <width>21</width> - <height>37</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::TicksBelow</enum> - </property> - <property name="tickInterval" > - <number>0</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QSlider" name="slider_2" > - <property name="objectName" > - <string notr="true" >slider_2</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>6</y> - <width>90</width> - <height>16</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::NoTicks</enum> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="slider_3" > - <property name="objectName" > - <string notr="true" >slider_3</string> - </property> - <property name="geometry" > - <rect> - <x>97</x> - <y>3</y> - <width>89</width> - <height>21</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::TicksBelow</enum> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="slider_4" > - <property name="objectName" > - <string notr="true" >slider_4</string> - </property> - <property name="geometry" > - <rect> - <x>192</x> - <y>3</y> - <width>90</width> - <height>21</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::TicksAbove</enum> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="slider_5" > - <property name="objectName" > - <string notr="true" >slider_5</string> - </property> - <property name="geometry" > - <rect> - <x>288</x> - <y>1</y> - <width>89</width> - <height>26</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::TicksBothSides</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QTextEdit" name="textEdit" > - <property name="objectName" > - <string notr="true" >textEdit</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>89</width> - <height>37</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOn</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - </widget> - </item> - <item> - <widget class="QTextEdit" name="textEdit_2" > - <property name="objectName" > - <string notr="true" >textEdit_2</string> - </property> - <property name="geometry" > - <rect> - <x>96</x> - <y>1</y> - <width>90</width> - <height>37</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOn</enum> - </property> - </widget> - </item> - <item> - <widget class="QTextEdit" name="textEdit_3" > - <property name="objectName" > - <string notr="true" >textEdit_3</string> - </property> - <property name="geometry" > - <rect> - <x>192</x> - <y>1</y> - <width>89</width> - <height>100</height> - </rect> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>100</height> - </size> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOn</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAlwaysOn</enum> - </property> - </widget> - </item> - <item> - <widget class="QTextEdit" name="textEdit_4" > - <property name="objectName" > - <string notr="true" >textEdit_4</string> - </property> - <property name="geometry" > - <rect> - <x>287</x> - <y>1</y> - <width>90</width> - <height>37</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - <property name="verticalScrollBarPolicy" > - <enum>Qt::ScrollBarAsNeeded</enum> - </property> - <property name="horizontalScrollBarPolicy" > - <enum>Qt::ScrollBarAsNeeded</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2" > - <property name="objectName" > - <string notr="true" >groupBox_2</string> - </property> - <property name="geometry" > - <rect> - <x>11</x> - <y>132</y> - <width>378</width> - <height>39</height> - </rect> - </property> - <property name="title" > - <string>GroupBox</string> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QProgressBar" name="progressBar" > - <property name="objectName" > - <string notr="true" >progressBar</string> - </property> - <property name="geometry" > - <rect> - <x>11</x> - <y>20</y> - <width>356</width> - <height>8</height> - </rect> - </property> - <property name="value" > - <number>50</number> - </property> - <property name="textVisible" > - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QListWidget" name="listWidget" > - <property name="objectName" > - <string notr="true" >listWidget</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>107</width> - <height>37</height> - </rect> - </property> - </widget> - </item> - <item> - <widget class="QListWidget" name="listWidget_2" > - <property name="objectName" > - <string notr="true" >listWidget_2</string> - </property> - <property name="geometry" > - <rect> - <x>114</x> - <y>1</y> - <width>107</width> - <height>37</height> - </rect> - </property> - </widget> - </item> - <item> - <widget class="QTabWidget" name="tabWidget" > - <property name="objectName" > - <string notr="true" >tabWidget</string> - </property> - <property name="geometry" > - <rect> - <x>227</x> - <y>1</y> - <width>150</width> - <height>37</height> - </rect> - </property> - <property name="minimumSize" > - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="tabPosition" > - <enum>QTabWidget::North</enum> - </property> - <property name="tabShape" > - <enum>QTabWidget::Rounded</enum> - </property> - <widget class="QWidget" name="" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>148</width> - <height>10</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 1</string> - </attribute> - </widget> - <widget class="QWidget" name="" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>116</width> - <height>56</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 2</string> - </attribute> - </widget> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>116</width> - <height>56</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 3</string> - </attribute> - </widget> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>146</width> - <height>36</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 4</string> - </attribute> - </widget> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QTabWidget" name="tabWidget_2" > - <property name="objectName" > - <string notr="true" >tabWidget_2</string> - </property> - <property name="geometry" > - <rect> - <x>11</x> - <y>214</y> - <width>378</width> - <height>90</height> - </rect> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>90</height> - </size> - </property> - <property name="tabPosition" > - <enum>QTabWidget::North</enum> - </property> - <property name="tabShape" > - <enum>QTabWidget::Rounded</enum> - </property> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>376</width> - <height>63</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 1</string> - </attribute> - </widget> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>424</width> - <height>66</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 2</string> - </attribute> - </widget> - </widget> - </item> - <item> - <layout class="QGridLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="1" > - <widget class="QTreeWidget" name="treeWidget_2" > - <property name="objectName" > - <string notr="true" >treeWidget_2</string> - </property> - <property name="geometry" > - <rect> - <x>192</x> - <y>1</y> - <width>185</width> - <height>18</height> - </rect> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QTreeWidget" name="treeWidget_3" > - <property name="objectName" > - <string notr="true" >treeWidget_3</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>20</y> - <width>185</width> - <height>18</height> - </rect> - </property> - </widget> - </item> - <item row="0" column="0" > - <widget class="QTreeWidget" name="treeWidget" > - <property name="objectName" > - <string notr="true" >treeWidget</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>185</width> - <height>18</height> - </rect> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QTreeWidget" name="treeWidget_4" > - <property name="objectName" > - <string notr="true" >treeWidget_4</string> - </property> - <property name="geometry" > - <rect> - <x>192</x> - <y>20</y> - <width>185</width> - <height>18</height> - </rect> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <pixmapfunction></pixmapfunction> - <connections/> -</ui> diff --git a/tests/auto/qtwidgets/system.ui b/tests/auto/qtwidgets/system.ui deleted file mode 100644 index a641e0e..0000000 --- a/tests/auto/qtwidgets/system.ui +++ /dev/null @@ -1,658 +0,0 @@ -<ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> - <class>System</class> - <widget class="QWidget" name="System" > - <property name="objectName" > - <string notr="true" >System</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>604</height> - </rect> - </property> - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <layout class="QGridLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="1" column="1" > - <widget class="QToolButton" name="toolButton" > - <property name="objectName" > - <string notr="true" >toolButton</string> - </property> - <property name="geometry" > - <rect> - <x>340</x> - <y>138</y> - <width>15</width> - <height>19</height> - </rect> - </property> - <property name="text" > - <string>...</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QFrame" name="horizontalLine" > - <property name="objectName" > - <string notr="true" >horizontalLine</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>146</y> - <width>333</width> - <height>3</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::HLine</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - </widget> - </item> - <item row="0" column="2" > - <widget class="QFrame" name="verticalLine" > - <property name="objectName" > - <string notr="true" >verticalLine</string> - </property> - <property name="geometry" > - <rect> - <x>361</x> - <y>1</y> - <width>3</width> - <height>131</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::VLine</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - </widget> - </item> - <item row="0" column="0" colspan="2" > - <layout class="QGridLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="1" column="0" > - <widget class="QDateTimeEdit" name="dateTimeEdit_2" > - <property name="objectName" > - <string notr="true" >dateTimeEdit_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>108</y> - <width>113</width> - <height>20</height> - </rect> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - </widget> - </item> - <item row="0" column="0" > - <widget class="QDateTimeEdit" name="dateTimeEdit" > - <property name="objectName" > - <string notr="true" >dateTimeEdit</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>41</y> - <width>113</width> - <height>20</height> - </rect> - </property> - <property name="buttonSymbols" > - <enum>QAbstractSpinBox::UpDownArrows</enum> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QDial" name="dial" > - <property name="objectName" > - <string notr="true" >dial</string> - </property> - <property name="geometry" > - <rect> - <x>120</x> - <y>1</y> - <width>114</width> - <height>100</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QLCDNumber" name="lcdNumber" > - <property name="objectName" > - <string notr="true" >lcdNumber</string> - </property> - <property name="geometry" > - <rect> - <x>120</x> - <y>107</y> - <width>114</width> - <height>23</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::Box</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <property name="mode" > - <enum>QLCDNumber::Dec</enum> - </property> - <property name="segmentStyle" > - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="1" column="2" > - <widget class="QLCDNumber" name="lcdNumber_2" > - <property name="objectName" > - <string notr="true" >lcdNumber_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>240</x> - <y>107</y> - <width>113</width> - <height>23</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::Box</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <property name="mode" > - <enum>QLCDNumber::Dec</enum> - </property> - <property name="segmentStyle" > - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="0" column="2" > - <widget class="QDial" name="dial_2" > - <property name="objectName" > - <string notr="true" >dial_2</string> - </property> - <property name="enabled" > - <bool>false</bool> - </property> - <property name="geometry" > - <rect> - <x>240</x> - <y>1</y> - <width>113</width> - <height>100</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QTableWidget" name="tableWidget" > - <property name="objectName" > - <string notr="true" >tableWidget</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>256</width> - <height>193</height> - </rect> - </property> - </widget> - </item> - <item> - <widget class="QToolBox" name="toolBox" > - <property name="objectName" > - <string notr="true" >toolBox</string> - </property> - <property name="geometry" > - <rect> - <x>263</x> - <y>1</y> - <width>118</width> - <height>193</height> - </rect> - </property> - <property name="frameShape" > - <enum>QFrame::Box</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Plain</enum> - </property> - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>98</width> - <height>119</height> - </rect> - </property> - <attribute name="label" > - <string>Tool Page 1</string> - </attribute> - </widget> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>115</width> - <height>56</height> - </rect> - </property> - <attribute name="label" > - <string>Tool Page 2</string> - </attribute> - </widget> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QTabWidget" name="tabWidget" > - <property name="objectName" > - <string notr="true" >tabWidget</string> - </property> - <property name="geometry" > - <rect> - <x>9</x> - <y>375</y> - <width>382</width> - <height>220</height> - </rect> - </property> - <property name="tabShape" > - <enum>QTabWidget::Rounded</enum> - </property> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>378</width> - <height>196</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 1</string> - </attribute> - <layout class="QGridLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>9</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <layout class="QVBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QComboBox" name="comboBox_3" > - <property name="objectName" > - <string notr="true" >comboBox_3</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>332</width> - <height>20</height> - </rect> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QPushButton" name="pushButton_5" > - <property name="objectName" > - <string notr="true" >pushButton_5</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>1</y> - <width>80</width> - <height>23</height> - </rect> - </property> - <property name="text" > - <string>&Enabled</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="pushButton_6" > - <property name="objectName" > - <string notr="true" >pushButton_6</string> - </property> - <property name="geometry" > - <rect> - <x>87</x> - <y>1</y> - <width>80</width> - <height>23</height> - </rect> - </property> - <property name="text" > - <string>Di&sabled</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>173</x> - <y>1</y> - <width>158</width> - <height>23</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" > - <property name="objectName" > - <string notr="true" /> - </property> - <property name="margin" > - <number>1</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QRadioButton" name="radioButton_3" > - <property name="objectName" > - <string notr="true" >radioButton_3</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>2</y> - <width>123</width> - <height>18</height> - </rect> - </property> - <property name="text" > - <string>Enabled RadioButton</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton_4" > - <property name="objectName" > - <string notr="true" >radioButton_4</string> - </property> - <property name="geometry" > - <rect> - <x>130</x> - <y>2</y> - <width>125</width> - <height>18</height> - </rect> - </property> - <property name="text" > - <string>Disabled RadioButton</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>261</x> - <y>1</y> - <width>70</width> - <height>20</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QProgressBar" name="progressBar" > - <property name="objectName" > - <string notr="true" >progressBar</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>86</y> - <width>332</width> - <height>22</height> - </rect> - </property> - <property name="value" > - <number>24</number> - </property> - </widget> - </item> - <item> - <widget class="QScrollBar" name="horizontalScrollBar" > - <property name="objectName" > - <string notr="true" >horizontalScrollBar</string> - </property> - <property name="geometry" > - <rect> - <x>1</x> - <y>114</y> - <width>332</width> - <height>17</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </item> - <item row="0" column="1" > - <widget class="QScrollBar" name="verticalScrollBar" > - <property name="objectName" > - <string notr="true" >verticalScrollBar</string> - </property> - <property name="geometry" > - <rect> - <x>349</x> - <y>9</y> - <width>17</width> - <height>132</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item row="1" column="0" > - <spacer> - <property name="objectName" > - <string notr="true" /> - </property> - <property name="geometry" > - <rect> - <x>9</x> - <y>147</y> - <width>334</width> - <height>40</height> - </rect> - </property> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="widget" > - <property name="objectName" > - <string notr="true" >widget</string> - </property> - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>377</width> - <height>187</height> - </rect> - </property> - <attribute name="title" > - <string>Tab Page 2</string> - </attribute> - </widget> - </widget> - </item> - </layout> - </widget> - <pixmapfunction></pixmapfunction> - <connections/> -</ui> diff --git a/tests/auto/qtwidgets/tst_qtwidgets.cpp b/tests/auto/qtwidgets/tst_qtwidgets.cpp deleted file mode 100644 index 501402b..0000000 --- a/tests/auto/qtwidgets/tst_qtwidgets.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtGui> -#include <QtNetwork> - -#include <QtTest/QtTest> - - -#include "mainwindow.h" -#include "../network-settings.h" - -class tst_QtWidgets: public QObject -{ - Q_OBJECT - -public: - tst_QtWidgets(); - virtual ~tst_QtWidgets(); - -private slots: - void snapshot(); -}; - -tst_QtWidgets::tst_QtWidgets() -{ - Q_SET_DEFAULT_IAP -} - -tst_QtWidgets::~tst_QtWidgets() -{ -} - -void tst_QtWidgets::snapshot() -{ - QSKIP("Jesper will fix this test when he has time.", SkipAll); -#if 0 - StyleWidget widget(0, Qt::X11BypassWindowManagerHint); - widget.show(); - - QPixmap pix = QPixmap::grabWidget(&widget); - - QVERIFY(!pix.isNull()); - - QBuffer buf; - pix.save(&buf, "PNG"); - QVERIFY(buf.size() > 0); - - QString filename = "qtwidgets_" + QHostInfo::localHostName() + "_" + QDateTime::currentDateTime().toString("yyyy.MM.dd_hh.mm.ss") + ".png"; - - QFtp ftp; - ftp.connectToHost("qt-test-server.qt-test-net"); - ftp.login("ftptest", "password"); - ftp.cd("qtest/pics"); - ftp.put(buf.data(), filename, QFtp::Binary); - ftp.close(); - - int i = 0; - while (i < 100 && ftp.hasPendingCommands()) { - QCoreApplication::instance()->processEvents(); - QTest::qWait(250); - ++i; - } - QVERIFY2(ftp.error() == QFtp::NoError, ftp.errorString().toLocal8Bit().constData()); - QVERIFY(!ftp.hasPendingCommands()); -#endif -} - - - -QTEST_MAIN(tst_QtWidgets) - -#include "tst_qtwidgets.moc" -- cgit v0.12 From 026a24855ec16626ab101007719a836f5a4e3c47 Mon Sep 17 00:00:00 2001 From: Rohan McGovern <rohan.mcgovern@nokia.com> Date: Thu, 6 Jan 2011 13:39:14 +1000 Subject: network tests: make IMAP, FTP testdata more flexible. Move all hardcoded IMAP/FTP fixtures into network-settings.h. Make it work with new and old network test server. Reviewed-by: Markus Goetz Task: QTBUG-15114 --- tests/auto/network-settings.h | 79 ++++++++++++++++---- .../qhttpsocketengine/tst_qhttpsocketengine.cpp | 10 +-- .../tst_qnativesocketengine.cpp | 2 +- .../tst_qsocks5socketengine.cpp | 12 +-- tests/auto/qsslsocket/tst_qsslsocket.cpp | 3 +- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 87 ++++++++++++++++------ 6 files changed, 142 insertions(+), 51 deletions(-) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index 6730946..0cb8e3a 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -64,6 +64,7 @@ //#define SYMBIAN_WINSOCK_CONNECTIVITY #endif // Q_CC_NOKIAX86 +// FIXME: any reason we do this for symbian only, and not other platforms? class QtNetworkSettingsRecord { public: QtNetworkSettingsRecord() { } @@ -128,7 +129,6 @@ public: static QString wildcardServerName() { return "qt-test-server.wildcard.dev." + serverDomainName(); - //return "qttest.wildcard.dev." + serverDomainName(); } #ifdef QT_NETWORK_LIB @@ -149,8 +149,10 @@ public: } #endif - static QByteArray expectedReplyIMAP() + static bool compareReplyIMAP(QByteArray const& actual) { + QList<QByteArray> expected; + #ifdef Q_OS_SYMBIAN loadTestSettings(); @@ -160,17 +162,35 @@ public: imapExpectedReply = entry->recordValue().toAscii(); imapExpectedReply.append('\r').append('\n'); } - return imapExpectedReply.data(); + expected << imapExpectedReply.data(); } #endif - QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " ); - expected = expected.append(QtNetworkSettings::serverName().toAscii()); - expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); - return expected; + + // Mandriva; old test server + expected << QByteArray( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " ) + .append(QtNetworkSettings::serverName().toAscii()) + .append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); + + // Ubuntu 10.04; new test server + expected << QByteArray( "* OK " ) + .append(QtNetworkSettings::serverLocalName().toAscii()) + .append(" Cyrus IMAP4 v2.2.13-Debian-2.2.13-19 server ready\r\n"); + + // Feel free to add more as needed + + Q_FOREACH (QByteArray const& ba, expected) { + if (ba == actual) { + return true; + } + } + + return false; } - static QByteArray expectedReplySSL() + static bool compareReplyIMAPSSL(QByteArray const& actual) { + QList<QByteArray> expected; + #ifdef Q_OS_SYMBIAN loadTestSettings(); @@ -180,19 +200,46 @@ public: imapExpectedReplySsl = entry->recordValue().toAscii(); imapExpectedReplySsl.append('\r').append('\n'); } - return imapExpectedReplySsl.data(); + expected << imapExpectedReplySsl.data(); } #endif - QByteArray expected( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] " ); - expected = expected.append(QtNetworkSettings::serverName().toAscii()); - expected = expected.append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); - return expected; + // Mandriva; old test server + expected << QByteArray( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] " ) + .append(QtNetworkSettings::serverName().toAscii()) + .append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); + + // Ubuntu 10.04; new test server + expected << QByteArray( "* OK " ) + .append(QtNetworkSettings::serverLocalName().toAscii()) + .append(" Cyrus IMAP4 v2.2.13-Debian-2.2.13-19 server ready\r\n"); + + // Feel free to add more as needed + + Q_FOREACH (QByteArray const& ba, expected) { + if (ba == actual) { + return true; + } + } + + return false; } - static QByteArray expectedReplyFtp() + static bool compareReplyFtp(QByteArray const& actual) { - QByteArray expected( "220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n" ); - return expected; + QList<QByteArray> expected; + + // A few different vsFTPd versions. + // Feel free to add more as needed + expected << QByteArray( "220 (vsFTPd 2.0.5)\r\n221 Goodbye.\r\n" ); + expected << QByteArray( "220 (vsFTPd 2.2.2)\r\n221 Goodbye.\r\n" ); + + Q_FOREACH (QByteArray const& ba, expected) { + if (ba == actual) { + return true; + } + } + + return false; } #ifdef Q_OS_SYMBIAN diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp index f86ba63..972185b 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -325,7 +325,7 @@ void tst_QHttpSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(array), array.constData()); // Write a logout message @@ -455,7 +455,7 @@ void tst_QHttpSocketEngine::tcpSocketBlockingTest() // Read greeting QVERIFY(socket.waitForReadyRead(5000)); QString s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), qPrintable(s)); // Write NOOP QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8); @@ -530,8 +530,8 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest() // Read greeting QVERIFY(!tcpSocketNonBlocking_data.isEmpty()); - QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), - QtNetworkSettings::expectedReplyIMAP().constData()); + QByteArray data = tcpSocketNonBlocking_data.at(0).toLatin1(); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(data), data.constData()); tcpSocketNonBlocking_data.clear(); @@ -713,7 +713,7 @@ void tst_QHttpSocketEngine::passwordAuth() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(array), array.constData()); // Write a logout message diff --git a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp index 2b0b632..782c2f0 100644 --- a/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp +++ b/tests/auto/qnativesocketengine/tst_qnativesocketengine.cpp @@ -173,7 +173,7 @@ void tst_QNativeSocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(array), array.constData()); // Write a logout message QByteArray array2 = "ZZZ LOGOUT\r\n"; diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index 8f0cbc3..9da7197 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -336,7 +336,7 @@ void tst_QSocks5SocketEngine::simpleConnectToIMAP() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(array), array.constData()); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -596,7 +596,7 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() // Read greeting QVERIFY(socket.waitForReadyRead(5000)); QString s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), s.toLatin1().constData()); // Write NOOP QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8); @@ -671,8 +671,8 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() // Read greeting QVERIFY(!tcpSocketNonBlocking_data.isEmpty()); - QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), - QtNetworkSettings::expectedReplyIMAP().constData()); + QByteArray data = tcpSocketNonBlocking_data.at(0).toLatin1(); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(data), data.constData()); tcpSocketNonBlocking_data.clear(); @@ -859,7 +859,7 @@ void tst_QSocks5SocketEngine::passwordAuth() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(array), array.constData()); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; @@ -927,7 +927,7 @@ void tst_QSocks5SocketEngine::passwordAuth2() QVERIFY(socketDevice.read(array.data(), array.size()) == available); // Check that the greeting is what we expect it to be - QCOMPARE(array.constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(array), array.constData()); // Write a logout message QByteArray array2 = "XXXX LOGOUT\r\n"; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index d6a7a01..3223006 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -502,8 +502,9 @@ void tst_QSslSocket::simpleConnectWithIgnore() if (!socket.canReadLine()) enterLoop(10); - QCOMPARE(socket.readAll(), QtNetworkSettings::expectedReplySSL()); + QByteArray data = socket.readAll(); socket.disconnectFromHost(); + QVERIFY2(QtNetworkSettings::compareReplyIMAPSSL(data), data.constData()); } void tst_QSslSocket::sslErrors_data() diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 2dbe5b7..86069cd 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -95,6 +95,7 @@ #include "private/qhostinfo_p.h" #include "../network-settings.h" +#include "../../shared/util.h" Q_DECLARE_METATYPE(QAbstractSocket::SocketError) Q_DECLARE_METATYPE(QAbstractSocket::SocketState) @@ -222,6 +223,8 @@ protected slots: void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); private: + QByteArray expectedReplyIMAP(); + void fetchExpectedReplyIMAP(); QTcpSocket *newSocket() const; QTcpSocket *nonBlockingIMAP_socket; QStringList nonBlockingIMAP_data; @@ -233,6 +236,8 @@ private: bool readingBody; QTime timer; + QByteArray expectedReplyIMAP_cached; + mutable int proxyAuthCalled; bool gotClosedSignal; @@ -658,8 +663,6 @@ void tst_QTcpSocket::nonBlockingIMAP() // Read greeting QVERIFY(!nonBlockingIMAP_data.isEmpty()); -// QCOMPARE(nonBlockingIMAP_data.at(0).toLatin1().constData(), -// "* OK fluke Cyrus IMAP4 v2.2.12 server ready\r\n"); QCOMPARE(nonBlockingIMAP_data.at(0).left(4).toLatin1().constData(), "* OK"); nonBlockingIMAP_data.clear(); @@ -787,6 +790,36 @@ void tst_QTcpSocket::delayedClose() delete socket; } + +//---------------------------------------------------------------------------------- + +QByteArray tst_QTcpSocket::expectedReplyIMAP() +{ + if (expectedReplyIMAP_cached.isEmpty()) { + fetchExpectedReplyIMAP(); + } + + return expectedReplyIMAP_cached; +} + +// Figure out how the current IMAP server responds +void tst_QTcpSocket::fetchExpectedReplyIMAP() +{ + QTcpSocket *socket = newSocket(); + socket->connectToHost(QtNetworkSettings::serverName(), 143); + QVERIFY2(socket->waitForConnected(10000), qPrintable(socket->errorString())); + QVERIFY2(socket->state() == QTcpSocket::ConnectedState, qPrintable(socket->errorString())); + + QTRY_VERIFY(socket->canReadLine()); + + QByteArray greeting = socket->readLine(); + delete socket; + + QVERIFY2(QtNetworkSettings::compareReplyIMAP(greeting), greeting.constData()); + + expectedReplyIMAP_cached = greeting; +} + //---------------------------------------------------------------------------------- void tst_QTcpSocket::partialRead() @@ -797,8 +830,8 @@ void tst_QTcpSocket::partialRead() QVERIFY(socket->state() == QTcpSocket::ConnectedState); char buf[512]; -// QByteArray greeting = "* OK fluke Cyrus IMAP4 v2.2.12 server ready"; - QByteArray greeting = "* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE"; + QByteArray greeting = expectedReplyIMAP(); + QVERIFY(!greeting.isEmpty()); for (int i = 0; i < 10; i += 2) { while (socket->bytesAvailable() < 2) @@ -821,8 +854,8 @@ void tst_QTcpSocket::unget() QVERIFY(socket->state() == QTcpSocket::ConnectedState); char buf[512]; -// QByteArray greeting = "* OK fluke Cyrus IMAP4 v2.2.12 server ready"; - QByteArray greeting = "* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE"; + QByteArray greeting = expectedReplyIMAP(); + QVERIFY(!greeting.isEmpty()); for (int i = 0; i < 10; i += 2) { while (socket->bytesAvailable() < 2) @@ -1244,13 +1277,17 @@ void tst_QTcpSocket::readLine() QVERIFY(socket->waitForReadyRead(10000)); char buffer[1024]; - int expectedReplySize = QtNetworkSettings::expectedReplyIMAP().size(); - Q_ASSERT(expectedReplySize >= 3); - QCOMPARE(socket->readLine(buffer, sizeof(buffer)), qint64(expectedReplySize)); - QCOMPARE((int) buffer[expectedReplySize-2], (int) '\r'); - QCOMPARE((int) buffer[expectedReplySize-1], (int) '\n'); - QCOMPARE((int) buffer[expectedReplySize], (int) '\0'); + qint64 linelen = socket->readLine(buffer, sizeof(buffer)); + QVERIFY(linelen >= 3); + QVERIFY(linelen < 1024); + + QByteArray reply = QByteArray::fromRawData(buffer, linelen); + QCOMPARE((int) buffer[linelen-2], (int) '\r'); + QCOMPARE((int) buffer[linelen-1], (int) '\n'); + QCOMPARE((int) buffer[linelen], (int) '\0'); + + QVERIFY2(QtNetworkSettings::compareReplyIMAP(reply), reply.constData()); QCOMPARE(socket->write("1 NOOP\r\n"), qint64(8)); @@ -1282,13 +1319,11 @@ void tst_QTcpSocket::readLine() void tst_QTcpSocket::readLineString() { QTcpSocket *socket = newSocket(); -// QByteArray expected("* OK fluke Cyrus IMAP4 v2.2.12 server ready\r\n"); - QByteArray expected("* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] qt-test-server.qt-test-net Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); socket->connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket->waitForReadyRead(10000)); QByteArray arr = socket->readLine(); - QCOMPARE(arr, QtNetworkSettings::expectedReplyIMAP()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(arr), arr.constData()); delete socket; } @@ -1456,8 +1491,11 @@ void tst_QTcpSocket::atEnd() QVERIFY(!stream.atEnd()); QString greeting = stream.readLine(); QVERIFY(stream.atEnd()); -// QCOMPARE(greeting, QString("220 (vsFTPd 2.0.4)")); - QCOMPARE(greeting, QString("220 (vsFTPd 2.0.5)")); + + // Test server must use some vsFTPd 2.x.x version + QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 2.x.x)")-1, qPrintable(greeting)); + QVERIFY2(greeting.startsWith("220 (vsFTPd 2."), qPrintable(greeting)); + QVERIFY2(greeting.endsWith(")"), qPrintable(greeting)); delete socket; } @@ -1522,7 +1560,8 @@ void tst_QTcpSocket::socketInAThread() TestThread thread; thread.start(); QVERIFY(thread.wait(15000)); - QCOMPARE(thread.data(), QtNetworkSettings::expectedReplyFtp()); + QByteArray data = thread.data(); + QVERIFY2(QtNetworkSettings::compareReplyFtp(data), data.constData()); } } @@ -1542,9 +1581,13 @@ void tst_QTcpSocket::socketsInThreads() QVERIFY(thread3.wait(15000)); QVERIFY(thread1.wait(15000)); - QCOMPARE(thread1.data(),QtNetworkSettings::expectedReplyFtp()); - QCOMPARE(thread2.data(),QtNetworkSettings::expectedReplyFtp()); - QCOMPARE(thread3.data(),QtNetworkSettings::expectedReplyFtp()); + QByteArray data1 = thread1.data(); + QByteArray data2 = thread2.data(); + QByteArray data3 = thread3.data(); + + QVERIFY2(QtNetworkSettings::compareReplyFtp(data1), data1.constData()); + QVERIFY2(QtNetworkSettings::compareReplyFtp(data2), data2.constData()); + QVERIFY2(QtNetworkSettings::compareReplyFtp(data3), data3.constData()); } } @@ -1846,7 +1889,7 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead() QCOMPARE(readyReadSpy.count(), 1); QString s = socket->readLine(); - QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData()); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), s.toLatin1().constData()); QCOMPARE(socket->bytesAvailable(), qint64(0)); QCoreApplication::instance()->processEvents(); -- cgit v0.12 From 82ff3f484c7ec49e60b7fddf23794937974a6768 Mon Sep 17 00:00:00 2001 From: Bea Lam <bea.lam@nokia.com> Date: Mon, 10 Jan 2011 12:13:00 +1000 Subject: Fix loaded() signal to be emitted only once Task-number: QTBUG-16319 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativeloader.cpp | 60 +++++++------- .../graphicsitems/qdeclarativeloader_p_p.h | 2 + .../qdeclarativeloader/tst_qdeclarativeloader.cpp | 94 +++++++++++++--------- 3 files changed, 89 insertions(+), 67 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 1119b92..22ec019 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QDeclarativeLoaderPrivate::QDeclarativeLoaderPrivate() - : item(0), component(0), ownComponent(false) + : item(0), component(0), ownComponent(false), isComponentComplete(false) { } @@ -262,6 +262,7 @@ void QDeclarativeLoader::setSource(const QUrl &url) d->clear(); d->source = url; + if (d->source.isEmpty()) { emit sourceChanged(); emit statusChanged(); @@ -272,18 +273,9 @@ void QDeclarativeLoader::setSource(const QUrl &url) d->component = new QDeclarativeComponent(qmlEngine(this), d->source, this); d->ownComponent = true; - if (!d->component->isLoading()) { - d->_q_sourceLoaded(); - } else { - connect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), - this, SLOT(_q_sourceLoaded())); - connect(d->component, SIGNAL(progressChanged(qreal)), - this, SIGNAL(progressChanged())); - emit statusChanged(); - emit progressChanged(); - emit sourceChanged(); - emit itemChanged(); - } + + if (d->isComponentComplete) + d->load(); } /*! @@ -324,6 +316,7 @@ void QDeclarativeLoader::setSourceComponent(QDeclarativeComponent *comp) d->component = comp; d->ownComponent = false; + if (!d->component) { emit sourceChanged(); emit statusChanged(); @@ -332,18 +325,8 @@ void QDeclarativeLoader::setSourceComponent(QDeclarativeComponent *comp) return; } - if (!d->component->isLoading()) { - d->_q_sourceLoaded(); - } else { - connect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), - this, SLOT(_q_sourceLoaded())); - connect(d->component, SIGNAL(progressChanged(qreal)), - this, SIGNAL(progressChanged())); - emit progressChanged(); - emit sourceChanged(); - emit statusChanged(); - emit itemChanged(); - } + if (d->isComponentComplete) + d->load(); } void QDeclarativeLoader::resetSourceComponent() @@ -351,6 +334,27 @@ void QDeclarativeLoader::resetSourceComponent() setSourceComponent(0); } +void QDeclarativeLoaderPrivate::load() +{ + Q_Q(QDeclarativeLoader); + + if (!isComponentComplete || !component) + return; + + if (!component->isLoading()) { + _q_sourceLoaded(); + } else { + QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), + q, SLOT(_q_sourceLoaded())); + QObject::connect(component, SIGNAL(progressChanged(qreal)), + q, SIGNAL(progressChanged())); + emit q->statusChanged(); + emit q->progressChanged(); + emit q->sourceChanged(); + emit q->itemChanged(); + } +} + void QDeclarativeLoaderPrivate::_q_sourceLoaded() { Q_Q(QDeclarativeLoader); @@ -465,9 +469,11 @@ QDeclarativeLoader::Status QDeclarativeLoader::status() const void QDeclarativeLoader::componentComplete() { + Q_D(QDeclarativeLoader); + QDeclarativeItem::componentComplete(); - if (status() == Ready) - emit loaded(); + d->isComponentComplete = true; + d->load(); } diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h index 0d4c4d0..bc65781 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h @@ -72,11 +72,13 @@ public: void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); void clear(); void initResize(); + void load(); QUrl source; QGraphicsObject *item; QDeclarativeComponent *component; bool ownComponent : 1; + bool isComponentComplete : 1; void _q_sourceLoaded(); void _q_updateSize(bool loaderGeometryChanged = true); diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 1bde55b..f6244e4 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -69,9 +69,8 @@ public: tst_QDeclarativeLoader(); private slots: - void url(); - void invalidUrl(); - void component(); + void sourceOrComponent(); + void sourceOrComponent_data(); void clear(); void urlToComponent(); void componentToUrl(); @@ -100,56 +99,71 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader() { } -void tst_QDeclarativeLoader::url() +void tst_QDeclarativeLoader::sourceOrComponent() { + QFETCH(QString, sourceDefinition); + QFETCH(QUrl, sourceUrl); + QFETCH(QString, errorString); + + bool error = !errorString.isEmpty(); + if (error) + QTest::ignoreMessage(QtWarningMsg, errorString.toUtf8().constData()); + QDeclarativeComponent component(&engine); - component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load: 0; onLoaded: did_load=123; source: \"Rect120x60.qml\" }"), TEST_FILE("")); + component.setData(QByteArray( + "import QtQuick 1.0\n" + "Loader {\n" + " property int onItemChangedCount: 0\n" + " property int onSourceChangedCount: 0\n" + " property int onStatusChangedCount: 0\n" + " property int onProgressChangedCount: 0\n" + " property int onLoadedCount: 0\n") + + sourceDefinition.toUtf8() + + QByteArray( + " onItemChanged: onItemChangedCount += 1\n" + " onSourceChanged: onSourceChangedCount += 1\n" + " onStatusChanged: onStatusChangedCount += 1\n" + " onProgressChanged: onProgressChangedCount += 1\n" + " onLoaded: onLoadedCount += 1\n" + "}") + , TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); - QVERIFY(loader->item()); - QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml")); + QCOMPARE(loader->item() == 0, error); + QCOMPARE(loader->source(), sourceUrl); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->status(), QDeclarativeLoader::Ready); - QCOMPARE(loader->property("did_load").toInt(), 123); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - delete loader; -} + QCOMPARE(loader->status(), error ? QDeclarativeLoader::Error : QDeclarativeLoader::Ready); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), error ? 0: 1); -void tst_QDeclarativeLoader::component() -{ - QDeclarativeComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); - QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); - QVERIFY(item); + if (!error) { + QDeclarativeComponent *c = qobject_cast<QDeclarativeComponent*>(loader->QGraphicsObject::children().at(0)); + QVERIFY(c); + QCOMPARE(loader->sourceComponent(), c); + } - QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1)); - QVERIFY(loader); - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->status(), QDeclarativeLoader::Ready); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + QCOMPARE(loader->property("onSourceChangedCount").toInt(), 1); + QCOMPARE(loader->property("onStatusChangedCount").toInt(), 1); + QCOMPARE(loader->property("onProgressChangedCount").toInt(), 1); - QDeclarativeComponent *c = qobject_cast<QDeclarativeComponent*>(item->QGraphicsObject::children().at(0)); - QVERIFY(c); - QCOMPARE(loader->sourceComponent(), c); + QCOMPARE(loader->property("onItemChangedCount").toInt(), error ? 0 : 1); + QCOMPARE(loader->property("onLoadedCount").toInt(), error ? 0 : 1); - delete item; + delete loader; } -void tst_QDeclarativeLoader::invalidUrl() +void tst_QDeclarativeLoader::sourceOrComponent_data() { - QTest::ignoreMessage(QtWarningMsg, QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found").toUtf8().constData()); + QTest::addColumn<QString>("sourceDefinition"); + QTest::addColumn<QUrl>("sourceUrl"); + QTest::addColumn<QString>("errorString"); - QDeclarativeComponent component(&engine); - component.setData(QByteArray("import QtQuick 1.0\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); - QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); - QVERIFY(loader != 0); - QVERIFY(loader->item() == 0); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->status(), QDeclarativeLoader::Error); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); + QTest::newRow("source") << "source: 'Rect120x60.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml") << ""; + QTest::newRow("sourceComponent") << "Component { id: comp; Rectangle { width: 100; height: 50 } }\n sourceComponent: comp\n" << QUrl() << ""; - delete loader; + QTest::newRow("invalid source") << "source: 'IDontExist.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml") + << QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found"); } void tst_QDeclarativeLoader::clear() @@ -446,7 +460,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: did_load=123 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import QtQuick 1.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); @@ -456,7 +470,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->property("did_load").toInt(), 123); + QCOMPARE(loader->property("signalCount").toInt(), 1); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); delete loader; -- cgit v0.12 From 279f701c7fd988a5dec4abca8e9da01dc629672b Mon Sep 17 00:00:00 2001 From: Alan Alpert <alan.alpert@nokia.com> Date: Mon, 10 Jan 2011 14:32:41 +1000 Subject: Update pathview test This updates the tests to match the correct behaviour as of 1ba3e41f09ea719249286fede5d3fe96621ccb61 Task-number: QTBUG-16357 --- .../data/test-pathview-2.0.png | Bin 1114 -> 1114 bytes .../data/test-pathview-2.1.png | Bin 1119 -> 1119 bytes .../data/test-pathview-2.2.png | Bin 1102 -> 1102 bytes .../data/test-pathview-2.3.png | Bin 1092 -> 1092 bytes .../data/test-pathview-2.4.png | Bin 1143 -> 1140 bytes .../data/test-pathview-2.5.png | Bin 1143 -> 1140 bytes .../qdeclarativepathview/data/test-pathview-2.qml | 394 ++++++++++----------- .../qdeclarativepathview/data/test-pathview.0.png | Bin 1169 -> 1169 bytes .../qdeclarativepathview/data/test-pathview.1.png | Bin 1172 -> 1172 bytes .../qdeclarativepathview/data/test-pathview.2.png | Bin 1201 -> 1201 bytes .../qdeclarativepathview/data/test-pathview.3.png | Bin 1164 -> 1164 bytes .../qdeclarativepathview/data/test-pathview.4.png | Bin 1226 -> 1227 bytes .../qdeclarativepathview/data/test-pathview.5.png | Bin 1192 -> 1184 bytes .../qdeclarativepathview/data/test-pathview.6.png | Bin 1188 -> 1188 bytes .../qdeclarativepathview/data/test-pathview.qml | 242 ++++++------- 15 files changed, 318 insertions(+), 318 deletions(-) diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.0.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.0.png index 347e773..1b87edb 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.0.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.1.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.1.png index 370ca80..4fc12d6 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.1.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.2.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.2.png index 97e3906..d761a0c 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.2.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.2.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.3.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.3.png index 5fa3c67..e22464f 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.3.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.3.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.4.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.4.png index ce11c09..14f07be 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.4.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.4.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.5.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.5.png index d155742..ba1ad34 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.5.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.5.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.qml b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.qml index 304d5c7..9eaff18 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview-2.qml @@ -10,171 +10,171 @@ VisualTest { } Frame { msec: 32 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 48 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 64 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 80 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 96 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 112 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 128 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 144 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 160 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 176 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 192 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 208 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 224 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 240 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 256 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 272 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 288 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 304 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 320 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 336 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 352 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 368 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 384 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 400 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 416 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 432 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 448 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 464 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 480 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 496 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 512 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 528 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 544 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 560 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 576 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 592 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 608 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 624 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 640 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 656 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 672 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 688 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Mouse { type: 2 @@ -186,11 +186,11 @@ VisualTest { } Frame { msec: 704 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Frame { msec: 720 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Mouse { type: 5 @@ -202,7 +202,7 @@ VisualTest { } Frame { msec: 736 - hash: "fe6d7d28dbeef3cfbac3ac3c3e909216" + hash: "cc72b488dcdfa7c251782cbcae7ab1d5" } Mouse { type: 5 @@ -222,7 +222,7 @@ VisualTest { } Frame { msec: 752 - hash: "d2dda5bec262721d653e88ec3eaeca57" + hash: "ae9028c15de8ba4b02c733212d521c29" } Mouse { type: 5 @@ -254,7 +254,7 @@ VisualTest { } Frame { msec: 784 - hash: "0a178235529d721529e8dc3b439a64c9" + hash: "6a6c5551e3a5a08f5505eb0f61d9df36" } Mouse { type: 5 @@ -294,11 +294,11 @@ VisualTest { } Frame { msec: 848 - hash: "1ba9bc8c2b941fd0ec82f211eb559682" + hash: "a1e475643d0871bb7d63f8cf2e0b780d" } Frame { msec: 864 - hash: "ee8680df3c58a48f3fff4a8fc221e38c" + hash: "ba429e0c1a7f1624973813ae8be6b090" } Frame { msec: 880 @@ -310,11 +310,11 @@ VisualTest { } Frame { msec: 912 - hash: "f2400819feb116ae3b327284bbb292ff" + hash: "1910f67eb9180a866924fa8567afbdf5" } Frame { msec: 928 - hash: "5d9a3458cb59ede36e7b51bac869785a" + hash: "68c60f1bc67a1d1117be7ed305b61ae1" } Frame { msec: 944 @@ -330,7 +330,7 @@ VisualTest { } Frame { msec: 992 - hash: "493e3c7b0de4a7b4b46678fe4ce9a763" + hash: "2bcde5c7b2e1aac1439b379ed729f6e1" } Frame { msec: 1008 @@ -342,11 +342,11 @@ VisualTest { } Frame { msec: 1040 - hash: "4b28ebf737b8c4228771122d844b8166" + hash: "e615b8648d5449535b1f47ab770db423" } Frame { msec: 1056 - hash: "b04155316770a1265e5dc431e1b9a9a1" + hash: "877e6357cc9a183a0288aa1551e26179" } Frame { msec: 1072 @@ -354,7 +354,7 @@ VisualTest { } Frame { msec: 1088 - hash: "b3e7cbc83c65ec61c768757798b17c58" + hash: "d15e299030bc08097c3b9b4bbaace558" } Frame { msec: 1104 @@ -362,7 +362,7 @@ VisualTest { } Frame { msec: 1120 - hash: "77c3bbb94471cfbfd23cc3914d796dfc" + hash: "937c7e346463c58c909795fa382761d9" } Frame { msec: 1136 @@ -374,7 +374,7 @@ VisualTest { } Frame { msec: 1168 - hash: "bf9c02945fdee4b06353f8f7f4fca2a3" + hash: "5872891af6953f07a635698581695c58" } Frame { msec: 1184 @@ -394,7 +394,7 @@ VisualTest { } Frame { msec: 1248 - hash: "b6bdf2f21c4137d4b5f25e0fe728bba5" + hash: "d8de3485eb7fb1f3675a25d7f807d08e" } Frame { msec: 1264 @@ -422,7 +422,7 @@ VisualTest { } Frame { msec: 1360 - hash: "44cd80041a1965c8c60fdffd9ae19395" + hash: "ee9ac101215923305fa75ab4c99c8f36" } Frame { msec: 1376 @@ -434,11 +434,11 @@ VisualTest { } Frame { msec: 1408 - hash: "8da4613759e9bcb926a0c84556213eb5" + hash: "a9012dc82230c791bda1a7e6b7741896" } Frame { msec: 1424 - hash: "1085fcc81f0aed8508817839ca748359" + hash: "78774bdff6cef175dcb7a190e5f1bcab" } Frame { msec: 1440 @@ -454,11 +454,11 @@ VisualTest { } Frame { msec: 1488 - hash: "832c857f2e05f2f82308cbf91f7bf401" + hash: "d74aa07d0b66a5f2be42b9868d3cd8f2" } Frame { msec: 1504 - hash: "ca3e50cd337a07ef07f063be28fa6dc2" + hash: "ea4c8f35367ee6f7631aa6e6d8aead03" } Frame { msec: 1520 @@ -470,11 +470,11 @@ VisualTest { } Frame { msec: 1552 - hash: "bfa62672ee7fcd9c3a75b63198a4c2bf" + hash: "5361d1f1100c4815dca1b49046b44593" } Frame { msec: 1568 - hash: "cdaafe7f622c18c2409ac539649de1cd" + hash: "5cd97dc8a237fa92373eb50de8a3bd7b" } Frame { msec: 1584 @@ -482,15 +482,15 @@ VisualTest { } Frame { msec: 1600 - hash: "925c55a8564f2318f9de4bd406cb5b13" + hash: "7b3cd8f583e6045d2e923a34abfc3aeb" } Frame { msec: 1616 - hash: "466208a8f6ecf45393be01a6dd7f2b0f" + hash: "2146e67d469f1eb2071a1f04d8e9fc4e" } Frame { msec: 1632 - hash: "35cff8c0f4b503ba4948966079484feb" + hash: "26839de649101c7b3bc6d9b1131325e6" } Frame { msec: 1648 @@ -498,7 +498,7 @@ VisualTest { } Frame { msec: 1664 - hash: "b699165e354bcadfd0d914d9ecb3d2aa" + hash: "30bc1d78a0cbd29813ad9504b1f0864b" } Frame { msec: 1680 @@ -518,7 +518,7 @@ VisualTest { } Frame { msec: 1744 - hash: "a9dda9ebaa97133c671917473721272c" + hash: "864a4d26e719dd9fc0e3ce5c28d7726a" } Mouse { type: 2 @@ -638,7 +638,7 @@ VisualTest { } Frame { msec: 1872 - hash: "d82969ef0f4baf3c51e112e049cb1334" + hash: "57d5b71d5ff16f986c7df8d8405822b6" } Mouse { type: 5 @@ -650,7 +650,7 @@ VisualTest { } Frame { msec: 1888 - hash: "e746a3eb8527036b09afb9cdd3d15648" + hash: "6fd4123cfc8998cfc7716f3d928fb03f" } Mouse { type: 5 @@ -738,7 +738,7 @@ VisualTest { } Frame { msec: 1984 - hash: "f500232133ec07a3b833b06425379484" + hash: "d823492036431e23d8b6876baccec263" } Mouse { type: 5 @@ -758,7 +758,7 @@ VisualTest { } Frame { msec: 2000 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Mouse { type: 5 @@ -770,7 +770,7 @@ VisualTest { } Frame { msec: 2016 - hash: "1754875ee6a5712ffb8ce1bbae6d4ed1" + hash: "f87df2e12dfe2ebb5b093e21970885b4" } Mouse { type: 5 @@ -794,7 +794,7 @@ VisualTest { } Frame { msec: 2048 - hash: "ab3a64b41c67a0b8a6c0830c0e0cb797" + hash: "ba9d1850c5c43c9aec5660601ba21d2f" } Mouse { type: 5 @@ -806,7 +806,7 @@ VisualTest { } Frame { msec: 2064 - hash: "d05f721f1d7d23d6e0cc67993bf1fa8f" + hash: "8eb1f2c8c02c2acf4262e05000045649" } Mouse { type: 5 @@ -838,7 +838,7 @@ VisualTest { } Frame { msec: 2096 - hash: "f0ae80ed5965d7531d6a653c80eed444" + hash: "c55a189b05d87e8937d272f32bdc2481" } Mouse { type: 5 @@ -858,7 +858,7 @@ VisualTest { } Frame { msec: 2112 - hash: "1419fe55cc28ce9690846d4c03275fe7" + hash: "bb1515904f9b299402d1141445154430" } Mouse { type: 5 @@ -870,7 +870,7 @@ VisualTest { } Frame { msec: 2128 - hash: "2e22df53697a599b0e44fb2a3986dcd0" + hash: "93363142c5a05c52c21e771b2bce71f6" } Mouse { type: 5 @@ -946,7 +946,7 @@ VisualTest { } Frame { msec: 2304 - hash: "1419fe55cc28ce9690846d4c03275fe7" + hash: "bb1515904f9b299402d1141445154430" } Mouse { type: 5 @@ -978,7 +978,7 @@ VisualTest { } Frame { msec: 2336 - hash: "ab3a64b41c67a0b8a6c0830c0e0cb797" + hash: "ba9d1850c5c43c9aec5660601ba21d2f" } Mouse { type: 5 @@ -1002,31 +1002,31 @@ VisualTest { } Frame { msec: 2368 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Frame { msec: 2384 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Frame { msec: 2400 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Frame { msec: 2416 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Frame { msec: 2432 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Frame { msec: 2448 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Frame { msec: 2464 - hash: "0a0cd0433e206dfc923ec0d3617e04a1" + hash: "11d77567aeff20d8f62f2e4100603de3" } Mouse { type: 5 @@ -1070,7 +1070,7 @@ VisualTest { } Frame { msec: 2512 - hash: "360a47795f7f9389f82f2f55fa1fe83f" + hash: "2234e44042daf277bd5307635155117f" } Mouse { type: 5 @@ -1158,7 +1158,7 @@ VisualTest { } Frame { msec: 2608 - hash: "44a30531642ada65c052afe30874d7ba" + hash: "398e4a0ebc812b779b38c4541d33424c" } Frame { msec: 2624 @@ -1166,7 +1166,7 @@ VisualTest { } Frame { msec: 2640 - hash: "645e43948279d528020070125b71c33b" + hash: "0d09a6a0cce6d22c14bc41b8465e8ba0" } Frame { msec: 2656 @@ -1174,7 +1174,7 @@ VisualTest { } Frame { msec: 2672 - hash: "fa3b12e9869bf4254c8cdf6e5b10bb2d" + hash: "5329441c12424e5aa69ee0c5cff5926d" } Frame { msec: 2688 @@ -1182,11 +1182,11 @@ VisualTest { } Frame { msec: 2704 - hash: "79d70563c7e139d9f9785565219133c7" + hash: "aa8b21cdea3d0ae6a2e59a1b318da842" } Frame { msec: 2720 - hash: "0dc70772aa50445c1cb7dbd8ee0092b0" + hash: "dd142875acafdc8591a29bcd9f871dab" } Frame { msec: 2736 @@ -1198,7 +1198,7 @@ VisualTest { } Frame { msec: 2768 - hash: "e3972b3244e4a98c9ee4df2d4b623c12" + hash: "36217f04f3b1b70a9cf3fa4881b2def7" } Frame { msec: 2784 @@ -1210,11 +1210,11 @@ VisualTest { } Frame { msec: 2816 - hash: "47d757dab5c72cad08cb8026631d67e6" + hash: "7313fc37802c462ddd324a13c8fcdc9c" } Frame { msec: 2832 - hash: "8522a3b6202b303a9e65a9e136423e27" + hash: "961e84cbb3591cebdb5b83c2aa83887c" } Frame { msec: 2848 @@ -1226,7 +1226,7 @@ VisualTest { } Frame { msec: 2880 - hash: "579688ff6ec910570c0c0c60fdf44cf6" + hash: "943dfcee3f04c77fba2cec289a288c4b" } Frame { msec: 2896 @@ -1234,7 +1234,7 @@ VisualTest { } Frame { msec: 2912 - hash: "7ab8cf0d0b650e8f994a9beed8be29fb" + hash: "36be9a0d4376ece0b279a118a3fab364" } Frame { msec: 2928 @@ -1250,11 +1250,11 @@ VisualTest { } Frame { msec: 2976 - hash: "f0267f59e247e24e4cf9c56f8931112b" + hash: "b17faafb59a9d182faf00495736a7fac" } Frame { msec: 2992 - hash: "ddbc73e2df4da11d5122539a00c126de" + hash: "549eb98193f0e81aee716239f872a21c" } Frame { msec: 3008 @@ -1286,7 +1286,7 @@ VisualTest { } Frame { msec: 3120 - hash: "2ad733363d239d9a3ea1c31427a3b3fe" + hash: "9506c95e1febf3d781e6b1dbbaf640d3" } Frame { msec: 3136 @@ -1294,7 +1294,7 @@ VisualTest { } Frame { msec: 3152 - hash: "53b05d8be52a74c3a24b88779d4927bf" + hash: "adef134dc735305b673c6fa47a3d1a34" } Frame { msec: 3168 @@ -1310,11 +1310,11 @@ VisualTest { } Frame { msec: 3216 - hash: "8a7ab6dc549b247f3b897e098d784dd8" + hash: "036d247dd83e0fbfe4f65cbd79e9ab57" } Frame { msec: 3232 - hash: "0a3144254f66a6b005b95a026496cd32" + hash: "959270d536187e6b669263a57b260e78" } Frame { msec: 3248 @@ -1322,7 +1322,7 @@ VisualTest { } Frame { msec: 3264 - hash: "c17922ca04f5ce9916e2907a6c28bf8b" + hash: "42a9b43e2c66a5ef32c8b6564235c623" } Frame { msec: 3280 @@ -1330,11 +1330,11 @@ VisualTest { } Frame { msec: 3296 - hash: "1f41a314699151771d7d1ca672aaba8f" + hash: "cf5c7868e399fadac1642f47a0b4dbd2" } Frame { msec: 3312 - hash: "de94c2ad2e74036d975e8402dd8b06e9" + hash: "9c689254f44a6ced1c4962400613d4da" } Frame { msec: 3328 @@ -1358,7 +1358,7 @@ VisualTest { } Frame { msec: 3408 - hash: "2f3e7040a4966e56858312f6534e9e77" + hash: "f65c57211997139ae1473951333d7b35" } Frame { msec: 3424 @@ -1370,7 +1370,7 @@ VisualTest { } Frame { msec: 3456 - hash: "6639a15d4d23540ccf63c9bea0e1689e" + hash: "191115950915abcb338c3f4c17595840" } Frame { msec: 3472 @@ -1402,7 +1402,7 @@ VisualTest { } Frame { msec: 3584 - hash: "4b2706d1215f2b5b08ac87e40ba8c21b" + hash: "e9de53c430f9de55146ac6606d55d427" } Frame { msec: 3600 @@ -1418,19 +1418,19 @@ VisualTest { } Frame { msec: 3648 - hash: "14bdec5663d1a81fa617d3b81e19f8b4" + hash: "a44936319089e2379de34edf58b453c1" } Frame { msec: 3664 - hash: "3430047eca214a217aca0bd71814f4db" + hash: "c894ceaf318dd1afe29dcfe171aadf0f" } Frame { msec: 3680 - hash: "974c431fe7030990389c7fc719655cfd" + hash: "deea3a520f3fe43bf92f05a25f791458" } Frame { msec: 3696 - hash: "d38f3153b3cf39a278dc6948ff9ef71d" + hash: "176381c4acfacecd0d203b7ad8fbd7d4" } Frame { msec: 3712 @@ -1438,35 +1438,35 @@ VisualTest { } Frame { msec: 3728 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3744 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3760 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3776 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3792 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3808 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3824 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3840 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Frame { msec: 3856 @@ -1474,7 +1474,7 @@ VisualTest { } Frame { msec: 3872 - hash: "bf2de49dc940043a955a075dcda1b52b" + hash: "21f2e0c3ba2142d1baae9406858f1cea" } Mouse { type: 2 @@ -1486,11 +1486,11 @@ VisualTest { } Frame { msec: 3888 - hash: "cf72e9ae81dcf833f7a48ffa348b8966" + hash: "e66b75e5644018aecd321e498de08ca1" } Frame { msec: 3904 - hash: "cf72e9ae81dcf833f7a48ffa348b8966" + hash: "e66b75e5644018aecd321e498de08ca1" } Mouse { type: 5 @@ -1502,7 +1502,7 @@ VisualTest { } Frame { msec: 3920 - hash: "cf72e9ae81dcf833f7a48ffa348b8966" + hash: "eb346d68bd5b51a31ee2f5d807970d96" } Mouse { type: 5 @@ -1522,7 +1522,7 @@ VisualTest { } Frame { msec: 3936 - hash: "1cea11ee435caa8515797ee5c4fb79cb" + hash: "ffd30479d99b19926072fa94cdec6195" } Mouse { type: 5 @@ -1534,7 +1534,7 @@ VisualTest { } Frame { msec: 3952 - hash: "0da1743b066a73dd19aff6b60ef76830" + hash: "207efe4cbcebaedca1d2fc6726d46543" } Mouse { type: 5 @@ -1554,7 +1554,7 @@ VisualTest { } Frame { msec: 3968 - hash: "ddace1df123421675bc9153c4017cdd0" + hash: "f011a043293362d5affcbcdfe3c93131" } Mouse { type: 5 @@ -1566,7 +1566,7 @@ VisualTest { } Frame { msec: 3984 - hash: "0c57fe8eef4e41e326dbc82f7b6ae87b" + hash: "934ed8956abae51fd19352f23ef9a16a" } Mouse { type: 5 @@ -1586,151 +1586,151 @@ VisualTest { } Frame { msec: 4000 - hash: "53968b4b57c09fe0b47e720031c1eed7" + hash: "0daf00b242485319f5c9050b9cdb6775" } Frame { msec: 4016 - hash: "2ab593b498892bf8bacef875e524284f" + hash: "8111f56ae5cfcf1d6c934e134602a8dc" } Frame { msec: 4032 - hash: "da77708f525ab9d1d3f760595a1f9efa" + hash: "6f3f6c2ae3c36401d1d96a37bbd62c52" } Frame { msec: 4048 - hash: "ce73ecb012139dda8e21cb0dce95582a" + hash: "11cde9b9369addaa5ff140e3a0bbf9ac" } Frame { msec: 4064 - hash: "086754b023addbbecf3b361382133279" + hash: "fefd7d44805c330c606fcc23b691832e" } Frame { msec: 4080 - hash: "adcb9881f246993ff35af24f8750ea2f" + hash: "b9eb8f8a78485deafc04a9bac39e5c31" } Frame { msec: 4096 - hash: "974b423c99316c9a5b2e097bb3a42fcc" + hash: "f0be22ea55a6a9621718cb5e1b55e6f7" } Frame { msec: 4112 - hash: "e37263abe79b203cfc4306aa7e5c4853" + hash: "cb0d62b8c16406a0ff35feea3ff074b9" } Frame { msec: 4128 - hash: "0136eaf2704a5af80f8ba26bbb7f51da" + hash: "15bf986b1e4072ce48ef40651e11a93a" } Frame { msec: 4144 - hash: "55fe0338e24aa91790f2cd466464acae" + hash: "d29f81f0c8468ea045f1c21adca8c0e6" } Frame { msec: 4160 - hash: "9fa5eaebd34e2af136a2894f360301a5" + hash: "577f27fd6212bbb7394b64b0872d7e6e" } Frame { msec: 4176 - hash: "c48822e620b788947d8a5ec850d6313b" + hash: "f26c83a4ede9e04ceabf276fd2eeaa4d" } Frame { msec: 4192 - hash: "ec763070f81e115a5e471923aa539683" + hash: "34f449f3c29c4b0bb0972e8d3510452c" } Frame { msec: 4208 - hash: "2aa84ad9ef88313a4c63e91bba959920" + hash: "5cf950b9f0bb8c851a2865718bd3e6ec" } Frame { msec: 4224 - hash: "14cf7ba825d704c4acc72670fd868d6c" + hash: "202b5c9cd1717dfef0d1f667ca115571" } Frame { msec: 4240 - hash: "987bf945cd9c1cfe5bbb17442daa4f26" + hash: "5d703db8af0eeba0327177f79b0fd85b" } Frame { msec: 4256 - hash: "5d4d80565bf4f522c79044d0df55a1fd" + hash: "69e4fdbaba2ad4983edcbaad0ccfa905" } Frame { msec: 4272 - hash: "d0a5ec7ff2c5b64c6691888412d0cc6d" + hash: "c91389bd9e9c7fce2a8e5ffca851cf89" } Frame { msec: 4288 - hash: "93750528b6f27df22423eb957a07b55f" + hash: "5e2b94dda5af845a368032cc85e3167f" } Frame { msec: 4304 - hash: "65fd0474f918bac61b46fde8ed8e3b59" + hash: "5946e2bd9a32130fed9612d6152b7ddd" } Frame { msec: 4320 - hash: "cd15f6499863ef84f0ad3b2ff48d6406" + hash: "74f13b9111005e610028ea252132c1fc" } Frame { msec: 4336 - hash: "65101124208b062de9718b34fb43425b" + hash: "ba2a587b26fd3d92a368e3b63513e145" } Frame { msec: 4352 - hash: "cb42d683dc5e4020891601afb0a77947" + hash: "2047ecb0be3173846b7c09b7054bad07" } Frame { msec: 4368 - hash: "88fdddbf2f766ffff7e77c7612d9cfee" + hash: "db6993dfaad694f812130c112e9c78b6" } Frame { msec: 4384 - hash: "776c63f1bbc40624d7fedd6141fbdd97" + hash: "aea54cad7368b8511412f4d9fd1e8b07" } Frame { msec: 4400 - hash: "24f11b5abb33d8f180a56fca6f15ef45" + hash: "431d140c8e9a61f6c1fe7a044900b4b7" } Frame { msec: 4416 - hash: "71d9ab083d15b57336ee278793815713" + hash: "ed80bccd69ebd4326b01fdf46b56dd52" } Frame { msec: 4432 - hash: "b48e64cb1b8b39e7001af4e7c7d22098" + hash: "edd82b44bd2813f2bf20bbf8be4ad10d" } Frame { msec: 4448 - hash: "587ef2440cd021038cc902a3b1839ff4" + hash: "527b3fb45d585f70ef2ef2e78d2fff05" } Frame { msec: 4464 - hash: "99e0485247c907c5b6e0f8d5dc7b8977" + hash: "00b68c12c6cef0b523eeef8c7556a26c" } Frame { msec: 4480 - hash: "3b2496d61eefaa413f0688afed150749" + hash: "37c62b1c2c3d70220b1d7b28a57de0a5" } Frame { msec: 4496 - hash: "0144d27095182c58e50ae1ccdbfaa05e" + hash: "e73843907eb7ee18c59b5fe98022f542" } Frame { msec: 4512 - hash: "06237be375826d2434dc564dd2eaf165" + hash: "139d84bfdefd825a89ddd4150a72fa9f" } Frame { msec: 4528 - hash: "7235d512503b134ac267b7128163eea2" + hash: "779690a2e5291b7d64ceed193bf8e572" } Frame { msec: 4544 - hash: "5d5f7ff9bd0a4aa316b764bec8524fe0" + hash: "4ffd9beb48bd769d9e3b8ad3aedff08b" } Frame { msec: 4560 - hash: "9be01e649140f950cd882af2e8e1e27c" + hash: "b1edf784de34b42bd74390836db976b9" } Frame { msec: 4576 - hash: "0773e5d219d6fc4f2d385fd1bcd17f93" + hash: "78327706741822e6ba8b0b88be469422" } Frame { msec: 4592 @@ -1738,55 +1738,55 @@ VisualTest { } Frame { msec: 4608 - hash: "6f87571a59aa358755d80e94894fe7a9" + hash: "8274a35f384478ca2f018c5d914d428d" } Frame { msec: 4624 - hash: "0e31c55386e8838f52024c49d4929710" + hash: "70f4b77c65450eddfa61ebdf2dc75985" } Frame { msec: 4640 - hash: "7d6c89f5fae7990643687512f2294449" + hash: "2f95623085afc48094f122c290566440" } Frame { msec: 4656 - hash: "f8542ff33dbad93ed51a0801bd8af778" + hash: "8f671bd7878b897593eb8ae0358c8a01" } Frame { msec: 4672 - hash: "8bed907fe5b04eec118ac4e7759386ae" + hash: "64cf5c749c85d0e42b6c99f31da955b8" } Frame { msec: 4688 - hash: "d84facac927215d8d83bd9e375fbace1" + hash: "22e3394e779e25cc0d6c05bd2c6159d5" } Frame { msec: 4704 - hash: "f1c8b7dc9897713487fcc62c697f41ff" + hash: "42bc5633692228e48aa3ce3e3d8a7bbe" } Frame { msec: 4720 - hash: "611c45384b2abd883a4e3ec3bb30ebd3" + hash: "4dd05fce6984dbc6b6764b5e4189fd94" } Frame { msec: 4736 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4752 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4768 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4784 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4800 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4816 @@ -1794,62 +1794,62 @@ VisualTest { } Frame { msec: 4832 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4848 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4864 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4880 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4896 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4912 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4928 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4944 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4960 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4976 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 4992 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 5008 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 5024 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 5040 - hash: "63e075c2cac3770e657217989cc7d80f" + hash: "ca7b9bc30c728268b338848230a5a859" } Frame { msec: 5056 - hash: "34967fb7248c860643bdc01e0135309f" + hash: "d30be31c0f9d92aeba83ce345551005a" } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.0.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.0.png index da688c7..af0e781 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.0.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.1.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.1.png index 618d238..d3e98dc 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.1.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.2.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.2.png index 0688ed1..9c6c1c3 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.2.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.2.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.3.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.3.png index ec6e330..fc1574a 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.3.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.3.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.4.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.4.png index 1692d17..f76ae14 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.4.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.4.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.5.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.5.png index d70704d..f6b8e83 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.5.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.5.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.6.png b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.6.png index f8f37c6..be041d8 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.6.png and b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.6.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.qml b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.qml index 3828e76..32c2a15 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.qml @@ -226,7 +226,7 @@ VisualTest { } Frame { msec: 640 - hash: "6cdaa8ffc906ade671fe259711e76f24" + hash: "51c14d87d2cf89aaece5bd682008f67f" } Mouse { type: 5 @@ -258,7 +258,7 @@ VisualTest { } Frame { msec: 672 - hash: "76fdf4cb75376ec3a9e084d93765c5cb" + hash: "1bfd848a89a0477596b77903a173f728" } Mouse { type: 5 @@ -286,15 +286,15 @@ VisualTest { } Frame { msec: 688 - hash: "b12e86c13e012c5992930b3e559c337c" + hash: "f66f04b42b0db33b852a82030d647886" } Frame { msec: 704 - hash: "4056e78a59e8f1e030f3e3a51c436b46" + hash: "e1573c6fd92f0fc4e267a37f417d0bc0" } Frame { msec: 720 - hash: "c84781b7586943ef889b8911c23e91db" + hash: "017044987c781ad8bb4cd8242f9091ed" } Frame { msec: 736 @@ -306,7 +306,7 @@ VisualTest { } Frame { msec: 768 - hash: "ef6319b262fc299b14b40d1521f9c9c3" + hash: "cb9e1ef51c8367e0b8c71cfdb70906fa" } Frame { msec: 784 @@ -326,11 +326,11 @@ VisualTest { } Frame { msec: 848 - hash: "2e01e2e252ca9fb3e7107f04a3ba4031" + hash: "c684dc3153314fe3a73fa0dd09f27695" } Frame { msec: 864 - hash: "547a9f25404c2bf7737526faf67a459d" + hash: "f1d5e911a68f9922f29bb6ae14234da9" } Frame { msec: 880 @@ -490,7 +490,7 @@ VisualTest { } Frame { msec: 1248 - hash: "ac97616fc3c54711bb067cc72c15d4c5" + hash: "1cea77e58dbf1c9f321eab2f01f37be0" } Mouse { type: 5 @@ -554,7 +554,7 @@ VisualTest { } Frame { msec: 1312 - hash: "4e0a90dda433c1615ea367ec90917409" + hash: "11717eaf13ac83760984afa47bbd52f7" } Frame { msec: 1328 @@ -566,7 +566,7 @@ VisualTest { } Frame { msec: 1360 - hash: "0abbf36b5e3f2db9288bde05825dc111" + hash: "514d400cdc9c356a0de3c04649d885dc" } Frame { msec: 1376 @@ -574,11 +574,11 @@ VisualTest { } Frame { msec: 1392 - hash: "430d7719ebf3b5835af92683cff10e56" + hash: "ab04af0d0f0f0d4538ec58841306cea7" } Frame { msec: 1408 - hash: "411a8fe1ee3a0510574cbf6a69d23456" + hash: "5cbc813c467b453c3e8de177aaede5b6" } Frame { msec: 1424 @@ -602,7 +602,7 @@ VisualTest { } Frame { msec: 1504 - hash: "cf360de1c6649e45beb974ddbe436ea9" + hash: "24421668a7814c3db8b7d1e50d2e9137" } Frame { msec: 1520 @@ -626,11 +626,11 @@ VisualTest { } Frame { msec: 1600 - hash: "faf898388f87948fbacd74589cb18af0" + hash: "a4a436b32e96fe5f9c3309bd1cabe65a" } Frame { msec: 1616 - hash: "b818181b3fee6f5a35a0da6c0f8e240e" + hash: "cb801c9d2b7f04a0413898ea74c61f80" } Mouse { type: 2 @@ -694,7 +694,7 @@ VisualTest { } Frame { msec: 1680 - hash: "684a17820c3693d893f8199cd7c7076f" + hash: "38e396c6fa5754d0070e4fd17ab2dc8b" } Frame { msec: 1696 @@ -714,15 +714,15 @@ VisualTest { } Frame { msec: 1760 - hash: "c36b60f81e7de5c0e5a59655041adff2" + hash: "ba1a6b8e55d7c5d73b371c8821f8caa2" } Frame { msec: 1776 - hash: "297abbc6b38a1909324fcee6d8b1d908" + hash: "ec19910e0f7b3e218d5a1992a7d00c4a" } Frame { msec: 1792 - hash: "0af89e3bab7c517f375897239ea35153" + hash: "7ca87adb6f69c5530be9da6df6b1d9a9" } Frame { msec: 1808 @@ -730,27 +730,27 @@ VisualTest { } Frame { msec: 1824 - hash: "57e1e871cbbc627f2fb9bf5583c4f097" + hash: "3da4fe69c1d6904a36d95bcd43f52195" } Frame { msec: 1840 - hash: "5220aecdd1516d94f0698e79f17fee57" + hash: "3cdb89ceb3ee66349b8a19301cc58e3d" } Frame { msec: 1856 - hash: "f3d8c908e61e5d61bbeeb9c6b5e8a704" + hash: "98088442867a0f1ec90144c531c9c5fb" } Frame { msec: 1872 - hash: "f27867aeb39ef64ebd50b5d79b69337e" + hash: "22d87a7d6409e2ce659a869dce57eef8" } Frame { msec: 1888 - hash: "b807b4e74a0f008df3f4534901debe38" + hash: "c1466f188c724c889017db70e2d60153" } Frame { msec: 1904 - hash: "e19832a0a7fcd57efe46cb0102a8d418" + hash: "e5392d308078449277be8d2f57561551" } Frame { msec: 1920 @@ -762,15 +762,15 @@ VisualTest { } Frame { msec: 1952 - hash: "746c60e03c50dc2e28c62fe52a8dd9d2" + hash: "8d6a232f303e48c9366dbf265cedf958" } Frame { msec: 1968 - hash: "27d6da44b605cb38552147fdf451ef45" + hash: "c6bc2031a4c59eb7a5b34e663252e91c" } Frame { msec: 1984 - hash: "c41d5491c417531ee86ac6ec8571c6a8" + hash: "bf8be42cdcdcfd205c8cb7e937ff5d0d" } Frame { msec: 2000 @@ -782,11 +782,11 @@ VisualTest { } Frame { msec: 2032 - hash: "0850d4b73a664ee0f1ed6d6e0615ea80" + hash: "9a2c8dd1883824415f5825a2a5cf3d09" } Frame { msec: 2048 - hash: "ae6cb0bfda1cea70b3641251d0dc60c4" + hash: "78e31d9b30619ee5774d3cf10b5af762" } Frame { msec: 2064 @@ -798,7 +798,7 @@ VisualTest { } Frame { msec: 2096 - hash: "2081c1ffe35f20dd827b3d9f52be90b3" + hash: "6a2f7dde022d4044e8772b8fcc28b02e" } Frame { msec: 2112 @@ -806,11 +806,11 @@ VisualTest { } Frame { msec: 2128 - hash: "7f289e50f1bbd570b6bc2ca1998f8493" + hash: "662402cd180eb325c174b6935a9d3f0a" } Frame { msec: 2144 - hash: "8bb3a37f416032d40cb5f919abb42e30" + hash: "8eb192c9d01fe205ddcba2d5cadab65f" } Frame { msec: 2160 @@ -818,7 +818,7 @@ VisualTest { } Frame { msec: 2176 - hash: "d3e8aae08a2518c039d6bda80fc520a4" + hash: "bc0ee50215b6b31422ee423f7955770c" } Frame { msec: 2192 @@ -826,11 +826,11 @@ VisualTest { } Frame { msec: 2208 - hash: "8eebcff152288a4ab2a3e64fd7ba6f80" + hash: "0ce5216f041f657a96ae4693319bfad3" } Frame { msec: 2224 - hash: "85fe363271d480163fb7847a3501472f" + hash: "0370a09ab78439e9df487ea55853ef98" } Frame { msec: 2240 @@ -854,15 +854,15 @@ VisualTest { } Frame { msec: 2320 - hash: "029428301287e4c7cd2f8a1fa6a25381" + hash: "44ecad3423a36882755fad6fb79bc2c8" } Frame { msec: 2336 - hash: "aef25177af3511dc99004a1e37f7f5d3" + hash: "b3eaadeb9d3b008fcf21c58158e8b028" } Frame { msec: 2352 - hash: "f9e11fd7023a72366dacaaf19b2eb81c" + hash: "110b000fa3e122560480d466fe231b21" } Frame { msec: 2368 @@ -874,7 +874,7 @@ VisualTest { } Frame { msec: 2400 - hash: "39df3050c4100e8a4f6e648b4aa16ba7" + hash: "65c1f85d2086f5e6d95d9b99a84281a5" } Frame { msec: 2416 @@ -882,7 +882,7 @@ VisualTest { } Frame { msec: 2432 - hash: "54d50f6c980cb04a1634622a29a6f0e9" + hash: "f00ea591d697546b5afe4420b702db49" } Frame { msec: 2448 @@ -1274,7 +1274,7 @@ VisualTest { } Frame { msec: 3264 - hash: "849ffa1fdd718a48e9570b88987f9203" + hash: "dc7f5231d844b36e1429f1072080a60c" } Mouse { type: 5 @@ -1294,7 +1294,7 @@ VisualTest { } Frame { msec: 3280 - hash: "d497eff3c8879d30619630e7ffcbf5c9" + hash: "161410fe9eb458c717cfbb9ef0626535" } Mouse { type: 5 @@ -1314,7 +1314,7 @@ VisualTest { } Frame { msec: 3296 - hash: "b0679dfe2f631e41f5cc269bd16d742c" + hash: "91a884de3e19dc6ca7fcde32492b3ff1" } Mouse { type: 5 @@ -1354,7 +1354,7 @@ VisualTest { } Frame { msec: 3328 - hash: "ea3cff28ff3be273332b19a2b8acb95e" + hash: "ed299cd4ef2364ab1d7b702e2b0a7233" } Mouse { type: 5 @@ -1374,7 +1374,7 @@ VisualTest { } Frame { msec: 3344 - hash: "458decd62af57d333a07459c89e62393" + hash: "4346ad16720e853154bfc1a22d9e7f55" } Mouse { type: 5 @@ -1422,11 +1422,11 @@ VisualTest { } Frame { msec: 3408 - hash: "0f53231de64ac5b0503e92ad10155dea" + hash: "fb7b31720b9de8d820ce29d9861482dd" } Frame { msec: 3424 - hash: "f2be693c23ea0885d6e8180c3062ba76" + hash: "4bb82c8b498b41e0785bea6b2c52b5e6" } Frame { msec: 3440 @@ -1434,7 +1434,7 @@ VisualTest { } Frame { msec: 3456 - hash: "ba86efade16e8965f59f6257ae90d131" + hash: "04f3c7a5cb270405446cbb85da8c1c16" } Frame { msec: 3472 @@ -1446,23 +1446,23 @@ VisualTest { } Frame { msec: 3504 - hash: "c822447614f47b5e15ffad967964a061" + hash: "3b0dce0a781799bd24073a6dc9717f68" } Frame { msec: 3520 - hash: "5eb2e64f11847cc9360291e14e866611" + hash: "1f6fc9f37a02e54418d90307f06c5b6f" } Frame { msec: 3536 - hash: "545dcc2645b50d78c84c658880d0500c" + hash: "a1116c06874af67ff54d69009f78d4da" } Frame { msec: 3552 - hash: "9d984e07b99137b3cb57dd4df16b8237" + hash: "4717c402fc7ad0d3f44b9944672d2746" } Frame { msec: 3568 - hash: "da27085e7a3cccde7cc3db2d9c6cc2cd" + hash: "7a180273295e9a30f5e26cdb080b87f2" } Frame { msec: 3584 @@ -1470,7 +1470,7 @@ VisualTest { } Frame { msec: 3600 - hash: "bfb5ed7b65f36d80e3156560a0ec58b7" + hash: "3cee427f42e8ccd33e9fccd903ae6f1d" } Frame { msec: 3616 @@ -1478,7 +1478,7 @@ VisualTest { } Frame { msec: 3632 - hash: "1c36be8deb2079ed81f1718c92e44803" + hash: "25779cf68847c0a132ea4aed6a5ef4d3" } Frame { msec: 3648 @@ -1490,11 +1490,11 @@ VisualTest { } Frame { msec: 3680 - hash: "1551c4aae06a258bdadc9ef356724871" + hash: "9f3c20980b481806ce7c1b33c177a049" } Frame { msec: 3696 - hash: "526aec43f710e524d247f8a4b08c261c" + hash: "5fb403dc08f95fb0651dcd33d32ef6c0" } Mouse { type: 2 @@ -1514,7 +1514,7 @@ VisualTest { } Frame { msec: 3712 - hash: "b50ef7198c1831623ed2210e651ac618" + hash: "c6422e39ed268dd67846e55908bc6f21" } Mouse { type: 5 @@ -1586,7 +1586,7 @@ VisualTest { } Frame { msec: 3776 - hash: "ecf04273061af5f881925f3a33015fbb" + hash: "8c30751e1d1e443b5ad217151e8e8fc8" } Mouse { type: 5 @@ -1626,7 +1626,7 @@ VisualTest { } Frame { msec: 3808 - hash: "4a1dbbac65a3caac16b38c45be61003c" + hash: "e621e9486e10332d937417a0b6be6be7" } Mouse { type: 5 @@ -1706,7 +1706,7 @@ VisualTest { } Frame { msec: 3872 - hash: "fd2eab6b3a65713f057da22a412512c7" + hash: "f6495f86ae29c7a996b3302300e98f75" } Mouse { type: 5 @@ -1766,7 +1766,7 @@ VisualTest { } Frame { msec: 3920 - hash: "fd18bd5f8f09c995f122b8b4ecb80279" + hash: "3a303646ea0fd126ee00c847efa48d0c" } Mouse { type: 5 @@ -1854,7 +1854,7 @@ VisualTest { } Frame { msec: 4016 - hash: "b00b78122721ddcded2c7131cfe40d53" + hash: "3cc1355449b8ec7209537fedb0af43b1" } Frame { msec: 4032 @@ -1862,7 +1862,7 @@ VisualTest { } Frame { msec: 4048 - hash: "076fefc33455667af954dcc5a06017d3" + hash: "2f4e6b57c6a4fa1689e585214f35702a" } Frame { msec: 4064 @@ -1870,19 +1870,19 @@ VisualTest { } Frame { msec: 4080 - hash: "12e6711077da076b737aef1aaa336d42" + hash: "68165bd37b4cb1609d686a361ae54e06" } Frame { msec: 4096 - hash: "1e19329fb839a00faa3b95d13b7a9015" + hash: "436e81734e23502ef8604145d5892c41" } Frame { msec: 4112 - hash: "7469fb57ce0b7ea9a7cc6da14f6a245a" + hash: "93f005a5a6a989db3e1702fa4f11f6ee" } Frame { msec: 4128 - hash: "17e3aca0838e2ba75cc9b869bb969220" + hash: "7d00d2a606d92cb8c0726c14cba0f989" } Frame { msec: 4144 @@ -1994,7 +1994,7 @@ VisualTest { } Frame { msec: 4448 - hash: "a29d4b3fa16829823e63bf83e7b62aff" + hash: "96815da788d9968a173e7005d3ca8bff" } Mouse { type: 5 @@ -2014,7 +2014,7 @@ VisualTest { } Frame { msec: 4464 - hash: "d8f9d016318e0bd38d4654b4850da952" + hash: "6949c70729c3e43bc59cc12d4bb82d8f" } Mouse { type: 5 @@ -2034,7 +2034,7 @@ VisualTest { } Frame { msec: 4480 - hash: "13a2382e08ab10ecb40f9c24c682a797" + hash: "26ce66ebfa6eec9eab4d987ef4ec5d5f" } Mouse { type: 5 @@ -2054,7 +2054,7 @@ VisualTest { } Frame { msec: 4496 - hash: "cef145c5d105466f3913bb81bb2b58df" + hash: "46e206837a34ba4d418c4e1098b49fd8" } Mouse { type: 5 @@ -2074,7 +2074,7 @@ VisualTest { } Frame { msec: 4512 - hash: "9bc0a21266bebbf8fc3509e5f92dd77f" + hash: "ac7451dcd3f1359ca2850bd986c22994" } Mouse { type: 5 @@ -2086,7 +2086,7 @@ VisualTest { } Frame { msec: 4528 - hash: "e419dbe857667b014e4dd9b57b01bbe4" + hash: "f9179ba9c011bc1492daf0d22f7e85e0" } Mouse { type: 5 @@ -2098,7 +2098,7 @@ VisualTest { } Frame { msec: 4544 - hash: "411cb7a7f331161059faba4ae6549229" + hash: "8db5ba9548ecad76b889d9024f59b5cf" } Mouse { type: 5 @@ -2110,7 +2110,7 @@ VisualTest { } Frame { msec: 4560 - hash: "b008d6b2b444881c36521595f6b31539" + hash: "30375b9f69ca4ac1b67ff208fd18817f" } Mouse { type: 5 @@ -2122,7 +2122,7 @@ VisualTest { } Frame { msec: 4576 - hash: "77fcc3c74c3832ae6b80aec420cb06e0" + hash: "3ba2bd45231cdea3bd9f868c9d35f91e" } Mouse { type: 5 @@ -2142,59 +2142,59 @@ VisualTest { } Frame { msec: 4592 - hash: "41d1c54bc76caeae057fb1bdb3b93843" + hash: "50646478058ada031f29b5df661e734e" } Frame { msec: 4608 - hash: "03fdd91b352798b1ff958c23c0bc5f35" + hash: "ab6f2fb209650dbf83710f3299db8907" } Frame { msec: 4624 - hash: "2098ea8b55b54ca8dd648fb285c43ebf" + hash: "dbec24d44d19b834e9a4936c960c4295" } Frame { msec: 4640 - hash: "9929c509654819fd04da4e4b5c8e22b4" + hash: "09c41872193e4a6eab37b35ef4e90465" } Frame { msec: 4656 - hash: "c470d3a57c6b56f9f56b176823b27d53" + hash: "1778dc99de59e28a730a1439a7576abb" } Frame { msec: 4672 - hash: "37474b3a23f90dafee6b9e0043a702fa" + hash: "6dbbdb5b4e6c6870b5dd62b1b94f9dd3" } Frame { msec: 4688 - hash: "0fbb6a9fded011b010fa6f3a2819630c" + hash: "3b5cf826c12339c0c635ae1ffcd431e7" } Frame { msec: 4704 - hash: "6c5a7dad864999548257e4bf0ddc3687" + hash: "6d6068c26eea67214fd3529ab84ab5b5" } Frame { msec: 4720 - hash: "339bc42e559c66d07f37af5e06feacef" + hash: "54cbc4842acb46254746984936656c5b" } Frame { msec: 4736 - hash: "513dc773dc93275e32fa9ac61e6dcb46" + hash: "10707bae5274ad29ac3e4aea320a30bf" } Frame { msec: 4752 - hash: "b725c84435b1f387dc3f375280e39de6" + hash: "ad288c8afc21a87077bae47cbaed1a46" } Frame { msec: 4768 - hash: "f3d04b513df286aacb9ebdb107d7a0b4" + hash: "bc1c391b0d7a56276b7c082aa2882e47" } Frame { msec: 4784 - hash: "c22839005ed0cb6b2fa9c958d17fd948" + hash: "c62341687ca048da1551eb708c7e8a19" } Frame { msec: 4800 - hash: "2fb9a2d5d22a6d0ed567328ffaa512f0" + hash: "1a4e3bb688d6fcfe937f53f8179b21e0" } Frame { msec: 4816 @@ -2202,115 +2202,115 @@ VisualTest { } Frame { msec: 4832 - hash: "ba13b0b4790aec7084b5553fe0b0d72b" + hash: "0646877fe2f6935ca4b34495abed5919" } Frame { msec: 4848 - hash: "2bc983733d4004cc67a56d77e9f48e5d" + hash: "46899d9c0a188671d9b7ec01c827ad03" } Frame { msec: 4864 - hash: "0f729cbe41b155b6eef20a4be207b853" + hash: "85cd8aa6dfa28c5d2e10f1ff83644d8f" } Frame { msec: 4880 - hash: "c2ca47a7d70ef827029b32c11a052b83" + hash: "323711ddd10147f51d903f524195b9fe" } Frame { msec: 4896 - hash: "803aefca7f1cbd494d2d2f7e7eea9a3f" + hash: "ba6b46ac25a4f111c926522fc47d7367" } Frame { msec: 4912 - hash: "2641683e1fa9ed418ac89631be7922f1" + hash: "5dab5804d66b6aa8e4f73246c3b19557" } Frame { msec: 4928 - hash: "3d9370305ca147625828f7ee3b34ca33" + hash: "2cac21d8e33bc01431a6aedabba3ce18" } Frame { msec: 4944 - hash: "5cdfdd22a0dc1ed78035ae4b5e2e26a7" + hash: "e1edf4268e206a40543d1a6caa4d0b43" } Frame { msec: 4960 - hash: "2af663981b43dbe699849eff4731829a" + hash: "4989e920c0d173e68c3de730a5f4f877" } Frame { msec: 4976 - hash: "b159d3a09666327bd2d860bf56920734" + hash: "9840b722350840b56b096fda3a70f8e8" } Frame { msec: 4992 - hash: "a1ed6f686f4cda9aa59bfd49deb8a075" + hash: "261b7a66300ff2a9b761dd70d02ed490" } Frame { msec: 5008 - hash: "c5f1862e7cbb1dcd6b303e58c525ab5c" + hash: "7b6ffb01c050c31bfb433077c8336ed9" } Frame { msec: 5024 - hash: "3cc5e5d87067978961eee6e7b33ada06" + hash: "f8a20f8fe943b498dae9ba8fed113496" } Frame { msec: 5040 - hash: "74f3b0eae443bd9f171020fd973ca960" + hash: "e66b0f50bae2d0bba73f415af2c8dba1" } Frame { msec: 5056 - hash: "432037812ab1a09e0d0b32dfaf0f876e" + hash: "c82bb5035ff84c955f34f1189dcdbda4" } Frame { msec: 5072 - hash: "0eec7146b8df3b4892e89abd13b8bc9d" + hash: "8fce2628032b2a1f16373e721671ab8c" } Frame { msec: 5088 - hash: "a01dc5f4b4307aa66068d21159dd64d5" + hash: "e260e978d88301448eb56145e0fdfd07" } Frame { msec: 5104 - hash: "11eefdf5b1be8493a6ed9aaf519c7e17" + hash: "7c5d5bfdabf8b7f1d01fb1761ec976b3" } Frame { msec: 5120 - hash: "55ed797b82f5bca2ac2b5954c44c041e" + hash: "eeb8f15a4cbecf4013f48015ebb1840d" } Frame { msec: 5136 - hash: "498d4ca9faabf8b59e2359b60dc1aff2" + hash: "fb7bbed845f6fd5648c73431b0e4f65a" } Frame { msec: 5152 - hash: "78895368b141ab6d3a16f65f4389b2d5" + hash: "6e944ef5057031fc6a56ea27036c953a" } Frame { msec: 5168 - hash: "c73b27167bad79f3f3c5ebb64fa579c2" + hash: "0f96b7d876cb893081606ff93f7cf5c7" } Frame { msec: 5184 - hash: "fb05312d65155f0300f456d727698b80" + hash: "5904e4105e1108427a2826f24f82b293" } Frame { msec: 5200 - hash: "6e974736a0ecea6a71c1a7052a14fa20" + hash: "79a79fd11348a5a250d132a151446711" } Frame { msec: 5216 - hash: "f5daf5bec03d3e56c877e9b2dc5701b6" + hash: "edfed341f047b923aea434a3c31c8c27" } Frame { msec: 5232 - hash: "29793d2147563feb9ed0ebff18b303cd" + hash: "06e8e9e202b395dc3b230b1b7a982bf8" } Frame { msec: 5248 - hash: "5b63dfa3cb7ac0847f2e63f9d2a0b2b6" + hash: "d2ba2520683cdb64d366ab44a54b4668" } Frame { msec: 5264 - hash: "cf2f42dd9830d80f50df30e93a0b1ad2" + hash: "94b1e8a018f17f761de164a8acf4d68a" } Frame { msec: 5280 -- cgit v0.12 From d281cea3a445aa244901decceffd7d653ed829c8 Mon Sep 17 00:00:00 2001 From: Sami Merila <sami.merila@nokia.com> Date: Mon, 10 Jan 2011 10:36:41 +0200 Subject: QWidgets support for VGA screen Add pixelmetrics data for QS60Style to support VGA screensizes. Task-number: QT-4079 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 040ca4f..3ba8887 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -96,7 +96,8 @@ const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { {320,240,1,19,"QVGA Portrait"}, {360,640,1,19,"NHD Landscape"}, {640,360,1,19,"NHD Portrait"}, -{352,800,1,12,"E90 Landscape"} +{352,800,1,12,"E90 Landscape"}, +{480,640,1,19,"VGA Landscape"} // *** End of generated data *** }; const int QS60StylePrivate::m_numberOfLayouts = @@ -109,6 +110,7 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { {7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} +{9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} // *** End of generated data *** }; -- cgit v0.12 From 19b6e2b944a0d1eeef0fb707a00f567e4ee870e6 Mon Sep 17 00:00:00 2001 From: Sami Merila <sami.merila@nokia.com> Date: Mon, 10 Jan 2011 11:32:15 +0200 Subject: Build failure fix (related to QT-4079) Change d281cea3a445aa244901decceffd7d653ed829c8 caused build failure, due to missing comma (one line missing from commit). Fixed by adding the missing change. Task-number: QT-4079 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 3ba8887..4a4095d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -109,7 +109,7 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { {5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, {7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} +{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} // *** End of generated data *** }; -- cgit v0.12 From 0faab4442040fdfe3790e3c02808fd45993f0265 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Date: Mon, 10 Jan 2011 10:25:42 +0100 Subject: Compile when qreal != double Compile fix for devices where qreals are floats. Reviewed-by: Fabien Freling --- src/gui/text/qtextdocumentlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 22c6b8c..c0f3fb4 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2513,7 +2513,7 @@ static inline void getLineHeightParams(const QTextBlockFormat &blockFormat, cons if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight || blockFormat.lineHeightType() == QTextBlockFormat::MinimumHeight) { *lineBreakHeight = *lineHeight; if (blockFormat.lineHeightType() == QTextBlockFormat::FixedHeight) - *lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), 0.0)) - ((*lineHeight * 4) / 5); + *lineAdjustment = QFixed::fromReal(line.ascent() + qMax(line.leading(), qreal(0.0))) - ((*lineHeight * 4) / 5); else *lineAdjustment = QFixed::fromReal(line.height()) - *lineHeight; } -- cgit v0.12 From 963ada5805d61e318a04295b6d06e527b49cdb7a Mon Sep 17 00:00:00 2001 From: Jerome Pasion <jerome.pasion@nokia.com> Date: Mon, 10 Jan 2011 11:06:48 +0100 Subject: Fix for qtdemo bug Task-number: QTBUG-15931 Reviewed-by: Kevin Wright --- tools/qdoc3/test/qt-html-templates.qdocconf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 698164d..ff45451 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -74,8 +74,8 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ " <div id=\"resultdialog\"> \n" \ " <a href=\"#\" id=\"resultclose\">Close</a> \n" \ - " <p id=\"resultlinks\" class=\"all\"><a href=\"#\" id=\"showallresults\">All</a> | <a href=\"#\" id=\"showapiresults\">API</a> | <a href=\"#\" id=\"showarticleresults\">Articles</a> | <a href=\"#\" id=\"showexampleresults\">Examples</a></p> \n" \ - " <p id=\"searchcount\" class=\"all\"><span id=\"resultcount\"></span><span id=\"apicount\"></span><span id=\"articlecount\"></span><span id=\"examplecount\"></span> results:</p> \n" \ + "<!-- <p id=\"resultlinks\" class=\"all\"><a href=\"#\" id=\"showallresults\">All</a> | <a href=\"#\" id=\"showapiresults\">API</a> | <a href=\"#\" id=\"showarticleresults\">Articles</a> | <a href=\"#\" id=\"showexampleresults\">Examples</a></p> \n" \ + " <p id=\"searchcount\" class=\"all\"><span id=\"resultcount\"></span><span id=\"apicount\"></span><span id=\"articlecount\"></span><span id=\"examplecount\"></span> results:</p> --> \n" \ " <ul id=\"resultlist\" class=\"all\"> \n" \ " </ul> \n" \ " </div> \n" \ @@ -183,4 +183,4 @@ HTML.footer = "" \ " </form>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ - " </div>\n" \ No newline at end of file + " </div>\n" -- cgit v0.12 From 2b1b617664bfc78f6e95e53dc0f9749bd1f2d27a Mon Sep 17 00:00:00 2001 From: Shane Kearns <shane.kearns@accenture.com> Date: Fri, 7 Jan 2011 15:57:28 +0000 Subject: Fix handle leak in symbian QTimer implementation The timer handle was only being closed when a timer was cancelled, which resulted in a leak for one shot timers that have completed normally. Instead the timer is now closed in a destructor (closing null handles is safe, so it doesn't matter if the handle was never created - e.g. in the case of a zero timer) Also added a handle check before creating a timer to prevent a leak in case the start function is called twice in the backend. Task-number: QTBUG-16380 Reviewed-by: mread --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 6 ++-- tests/auto/qtimer/tst_qtimer.cpp | 38 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index bb9bd01..99c4087 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -217,13 +217,13 @@ QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, Symb QTimerActiveObject::~QTimerActiveObject() { Cancel(); + m_rTimer.Close(); //close of null handle is safe } void QTimerActiveObject::DoCancel() { if (m_timerInfo->interval > 0) { m_rTimer.Cancel(); - m_rTimer.Close(); } else { if (iStatus.Int() == KRequestPending) { TRequestStatus *status = &iStatus; @@ -302,7 +302,9 @@ void QTimerActiveObject::Start() CActiveScheduler::Add(this); m_timerInfo->msLeft = m_timerInfo->interval; if (m_timerInfo->interval > 0) { - m_rTimer.CreateLocal(); + if (!m_rTimer.Handle()) { + qt_symbian_throwIfError(m_rTimer.CreateLocal()); + } StartTimer(); } else { iStatus = KRequestPending; diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 102308e..e964728 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -90,6 +90,9 @@ private slots: void QTBUG13633_dontBlockEvents(); void postedEventsShouldNotStarveTimers(); +#ifdef Q_OS_SYMBIAN + void handleLeaks(); +#endif }; class TimerHelper : public QObject @@ -750,5 +753,40 @@ void tst_QTimer::postedEventsShouldNotStarveTimers() QVERIFY(timerHelper.count > 5); } +#ifdef Q_OS_SYMBIAN +void tst_QTimer::handleLeaks() +{ + const int timercount = 5; + int processhandles_start; + int threadhandles_start; + RThread().HandleCount(processhandles_start, threadhandles_start); + { + TimerHelper timerHelper; + QList<QTimer*> timers; + for (int i=0;i<timercount;i++) { + QTimer* timer = new QTimer; + timers.append(timer); + connect(timer, SIGNAL(timeout()), &timerHelper, SLOT(timeout())); + timer->setSingleShot(true); + timer->start(i); //test both zero and normal timeouts + } + int processhandles_mid; + int threadhandles_mid; + RThread().HandleCount(processhandles_mid, threadhandles_mid); + qDebug() << threadhandles_mid - threadhandles_start << "new thread owned handles"; + QTest::qWait(100); + QCOMPARE(timerHelper.count, timercount); + qDeleteAll(timers); + } + int processhandles_end; + int threadhandles_end; + RThread().HandleCount(processhandles_end, threadhandles_end); + QCOMPARE(threadhandles_end, threadhandles_start); //RTimer::CreateLocal creates a thread owned handle + //Can not verify process handles because QObject::connect may create up to 2 mutexes + //from a QMutexPool (4 process owned handles with open C imp.) + //QCOMPARE(processhandles_end, processhandles_start); +} +#endif + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" -- cgit v0.12 From 7471178137e6fcc193ba55acdfb2bbeed33f8e7a Mon Sep 17 00:00:00 2001 From: Niklas Kurkisuo <ext-niklas.kurkisuo@nokia.com> Date: Mon, 10 Jan 2011 12:17:27 +0100 Subject: Change QHostInfoCache to use QElapsedTime instead of QTime. Use QElapsedTime instead of QTime for performance gain. See QT-2965 for more info. Task-number: QTBUG-16468 Reviewed-by: Markus Goetz --- src/network/kernel/qhostinfo.cpp | 2 +- src/network/kernel/qhostinfo_p.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index f984cf8..0c0e1cd 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -740,7 +740,7 @@ void QHostInfoCache::put(const QString &name, const QHostInfo &info) QHostInfoCacheElement* element = new QHostInfoCacheElement(); element->info = info; - element->age = QTime(); + element->age = QElapsedTimer(); element->age.start(); QMutexLocker locker(&this->mutex); diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index 85d14c2..8814bd8 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -68,7 +68,7 @@ #include "QtCore/qrunnable.h" #include "QtCore/qlist.h" #include "QtCore/qqueue.h" -#include <QTime> +#include <QElapsedTimer> #include <QCache> #endif @@ -135,7 +135,7 @@ private: bool enabled; struct QHostInfoCacheElement { QHostInfo info; - QTime age; + QElapsedTimer age; }; QCache<QString,QHostInfoCacheElement> cache; QMutex mutex; -- cgit v0.12 From 13370ead4e9184fd82c08c060dbb1ea29a51cc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= <joao.abecasis@nokia.com> Date: Mon, 10 Jan 2011 12:39:16 +0100 Subject: Fix reversed condition introduced in 9a6cfc07e5 Reviewed-by: Bradley T. Hughes --- src/corelib/thread/qsemaphore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 15f45b6..5fa41f1 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -224,7 +224,7 @@ bool QSemaphore::tryAcquire(int n, int timeout) timer.start(); while (n > d->avail) { const qint64 elapsed = timer.elapsed(); - if (timeout - elapsed > 0 + if (timeout - elapsed <= 0 || !d->cond.wait(locker.mutex(), timeout - elapsed)) return false; } -- cgit v0.12 From 2c0f568061b3377ee55ff423c70d67a6341615ba Mon Sep 17 00:00:00 2001 From: Markus Goetz <Markus.Goetz@nokia.com> Date: Mon, 10 Jan 2011 14:00:59 +0100 Subject: tst_qhttpnetworkconnection: Compile fix --- .../qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 4a32a5a..321b787 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -178,7 +178,7 @@ void tst_QHttpNetworkConnection::head() QHttpNetworkConnection connection(host, port, encrypt); QCOMPARE(connection.port(), port); QCOMPARE(connection.hostName(), host); - QCOMPARE(connection.isEncrypted(), encrypt); + QCOMPARE(connection.isSsl(), encrypt); QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Head); QHttpNetworkReply *reply = connection.sendRequest(request); @@ -236,7 +236,7 @@ void tst_QHttpNetworkConnection::get() QHttpNetworkConnection connection(host, port, encrypt); QCOMPARE(connection.port(), port); QCOMPARE(connection.hostName(), host); - QCOMPARE(connection.isEncrypted(), encrypt); + QCOMPARE(connection.isSsl(), encrypt); QHttpNetworkRequest request(protocol + host + path); QHttpNetworkReply *reply = connection.sendRequest(request); @@ -314,7 +314,7 @@ void tst_QHttpNetworkConnection::put() QHttpNetworkConnection connection(host, port, encrypt); QCOMPARE(connection.port(), port); QCOMPARE(connection.hostName(), host); - QCOMPARE(connection.isEncrypted(), encrypt); + QCOMPARE(connection.isSsl(), encrypt); QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Put); @@ -402,7 +402,7 @@ void tst_QHttpNetworkConnection::post() QHttpNetworkConnection connection(host, port, encrypt); QCOMPARE(connection.port(), port); QCOMPARE(connection.hostName(), host); - QCOMPARE(connection.isEncrypted(), encrypt); + QCOMPARE(connection.isSsl(), encrypt); QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Post); @@ -539,7 +539,7 @@ void tst_QHttpNetworkConnection::get401() QHttpNetworkConnection connection(host, port, encrypt); QCOMPARE(connection.port(), port); QCOMPARE(connection.hostName(), host); - QCOMPARE(connection.isEncrypted(), encrypt); + QCOMPARE(connection.isSsl(), encrypt); connection.setProperty("setCredentials", setCredentials); connection.setProperty("username", username); connection.setProperty("password", password); @@ -609,7 +609,7 @@ void tst_QHttpNetworkConnection::compression() QHttpNetworkConnection connection(host, port, encrypt); QCOMPARE(connection.port(), port); QCOMPARE(connection.hostName(), host); - QCOMPARE(connection.isEncrypted(), encrypt); + QCOMPARE(connection.isSsl(), encrypt); QHttpNetworkRequest request(protocol + host + path); if (!autoCompress) @@ -701,7 +701,7 @@ void tst_QHttpNetworkConnection::ignoresslerror() QCOMPARE(connection.hostName(), host); if (ignoreInit) connection.ignoreSslErrors(); - QCOMPARE(connection.isEncrypted(), encrypt); + QCOMPARE(connection.isSsl(), encrypt); connection.setProperty("ignoreFromSignal", ignoreFromSignal); QHttpNetworkRequest request(protocol + host + path); -- cgit v0.12 From 7b49c37db01ca8f6308cead2b7209a7b480a5446 Mon Sep 17 00:00:00 2001 From: Adrian Constantin <adrian.constantin@nokia.com> Date: Mon, 10 Jan 2011 12:27:35 +0200 Subject: For non-developer builds, skip test that requires private API Fix build break on harmattan. Reviewed-by: Lucian Varlan --- tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 6548158..0003eb6 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -433,6 +433,9 @@ void tst_QNetworkCookieJar::effectiveTLDs_data() void tst_QNetworkCookieJar::effectiveTLDs() { +#ifndef QT_BUILD_INTERNAL + QSKIP("Test requires private API", SkipAll); +#endif QFETCH(QString, domain); QFETCH(bool, isTLD); QCOMPARE(QNetworkCookieJarPrivate::isEffectiveTLD(domain), isTLD); -- cgit v0.12 From d62e9f4a6fe199ae790b1561fd4ba9ea84bd4d1e Mon Sep 17 00:00:00 2001 From: Jani Hautakangas <jani.hautakangas@nokia.com> Date: Mon, 10 Jan 2011 13:22:15 +0200 Subject: Setting WA_TranslucentBackground after winid() is ineffective on Symbian. Currently Symbian doesn't support semi-transparent EGL surfaces. WA_TranslucentBackground attribute is ineffective if set after EGL surface creation. To enable translucency in this case we need to recreate backing store to get raster surface which supports translucency. Task-number: QT-4416 Reviewed-by: Jason Barron --- src/gui/kernel/qwidget_s60.cpp | 8 ++++++++ src/gui/painting/qgraphicssystem_runtime.cpp | 3 ++- src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index d6ad3c3..d55c21e 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -780,6 +780,14 @@ void QWidgetPrivate::s60UpdateIsOpaque() if (window->SetTransparencyAlphaChannel() == KErrNone) { window->SetBackgroundColor(TRgb(255, 255, 255, 0)); extra->topextra->nativeWindowTransparencyEnabled = 1; + + if (extra->topextra->backingStore.data() && + QApplicationPrivate::graphics_system_name == QLatin1String("openvg")) { + // Semi-transparent EGL surfaces aren't supported. We need to + // recreate backing store to get translucent surface (raster surface). + extra->topextra->backingStore.create(q); + extra->topextra->backingStore.registerWidget(q); + } } } else if (extra->topextra->nativeWindowTransparencyEnabled) { window->SetTransparentRegion(TRegionFix<1>()); diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index a9fbbee..db3b0d8 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -322,7 +322,6 @@ QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() : m_windowSurfaceDestroyPolicy(DestroyImmediately), m_graphicsSystem(0) { - QApplicationPrivate::graphics_system_name = QLatin1String("runtime"); QApplicationPrivate::runtime_graphics_system = true; #ifdef QT_DEFAULT_RUNTIME_SYSTEM @@ -336,6 +335,8 @@ QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() #endif m_graphicsSystem = QGraphicsSystemFactory::create(m_graphicsSystemName); + + QApplicationPrivate::graphics_system_name = QLatin1String("runtime"); } diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp index 9674233..5f4941f 100644 --- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp +++ b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp @@ -45,11 +45,13 @@ #if defined(Q_OS_SYMBIAN) && !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE) #include <QtGui/private/qwidget_p.h> #endif +#include <QtGui/private/qapplication_p.h> QT_BEGIN_NAMESPACE QV