/****************************************************************************
**
** 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 demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "menumanager.h"
#include "colors.h"
#include "menucontent.h"
#include "examplecontent.h"
MenuManager *MenuManager::pInstance = 0;
MenuManager * MenuManager::instance()
{
if (!MenuManager::pInstance)
MenuManager::pInstance = new MenuManager();
return MenuManager::pInstance;
}
MenuManager::MenuManager()
{
this->ticker = 0;
this->tickerInAnim = 0;
this->upButton = 0;
this->downButton = 0;
this->helpEngine = 0;
this->score = new Score();
this->currentMenu = QLatin1String("[no menu visible]");
this->currentCategory = QLatin1String("[no category visible]");
this->currentMenuButtons = QLatin1String("[no menu buttons visible]");
this->currentInfo = QLatin1String("[no info visible]");
this->currentMenuCode = -1;
this->readXmlDocument();
this->initHelpEngine();
}
MenuManager::~MenuManager()
{
delete this->score;
delete this->contentsDoc;
delete this->helpEngine;
}
QByteArray MenuManager::getResource(const QString &name)
{
QByteArray ba = this->helpEngine->fileData(name);
if (Colors::verbose && ba.isEmpty())
qDebug() << " - WARNING: Could not get " << name;
return ba;
}
void MenuManager::readXmlDocument()
{
this->contentsDoc = new QDomDocument();
QString errorStr;
int errorLine;
int errorColumn;
QFile file(":/xml/examples.xml");
bool statusOK = this->contentsDoc->setContent(&file, true, &errorStr, &errorLine, &errorColumn);
if (!statusOK){
QMessageBox::critical(0,
QObject::tr("DOM Parser"),
QObject::tr("Could not read or find the contents document. Error at line %1, column %2:\n%3")
.arg(errorLine).arg(errorColumn).arg(errorStr)
);
exit(-1);
}
}
void MenuManager::initHelpEngine()
{
this->helpRootUrl = QString("qthelp://com.trolltech.qt.%1%2%3/qdoc/")
.arg(QT_VERSION >> 16).arg((QT_VERSION >> 8) & 0xFF)
.arg(QT_VERSION & 0xFF);
// Store help collection file in cache dir of assistant
QString cacheDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation)
+ QLatin1String("/Trolltech/Assistant/");
QString helpDataFile = QString(QLatin1String("qtdemo_%1.qhc")).arg(QLatin1String(QT_VERSION_STR));
QDir dir;
if (!dir.exists(cacheDir))
dir.mkpath(cacheDir);
// Create help engine (and new
// helpDataFile if it does not exist):
this->helpEngine = new QHelpEngineCore(cacheDir + helpDataFile);
this->helpEngine->setupData();
QString qtDocRoot = QLibraryInfo::location(QLibraryInfo::DocumentationPath) + QLatin1String("/qch");
qtDocRoot = QDir(qtDocRoot).absolutePath();
QStringList qchFiles;
qchFiles << QLatin1String("/qt.qch")
<< QLatin1String("/designer.qch")
<< QLatin1String("/linguist.qch");
QString oldDir = helpEngine->customValue(QLatin1String("docDir"), QString()).toString();
if (oldDir != qtDocRoot) {
foreach (const QString &qchFile, qchFiles)
helpEngine->unregisterDocumentation(QHelpEngineCore::namespaceName(qtDocRoot + qchFile));
}
// If the data that the engine will work
// on is not yet registered, do it now:
foreach (const QString &qchFile, qchFiles)
helpEngine->registerDocumentation(qtDocRoot + qchFile);
helpEngine->setCustomValue(QLatin1String("docDir"), qtDocRoot);
}
void MenuManager::itemSelected(int userCode, const QString &menuName)
{
switch (userCode){
case LAUNCH:
this->launchExample(this->currentInfo);
break;
case LAUNCH_QML:
this->launchQmlExample(this->currentInfo);
break;
case DOCUMENTATION:
this->showDocInAssistant(this->currentInfo);
break;
case QUIT:
this->window->loop = false;
QCoreApplication::quit();
break;
case FULLSCREEN:
this->window->toggleFullscreen();
break;
case ROOT:
// out:
this->score->queueMovie(this->currentMenu + " -out", Score::FROM_START, Score::LOCK_ITEMS);
this->score->queueMovie(this->currentMenuButtons + " -out", Score::FROM_START, Score::LOCK_ITEMS);
this->score->queueMovie(this->currentInfo + " -out");
this->score->queueMovie(this->currentInfo + " -buttons -out", Score::NEW_ANIMATION_ONLY);
this->score->queueMovie("back -out", Score::ONLY_IF_VISIBLE);
if(qmlRoot)
qmlRoot->setProperty("show", QVariant(false));
// book-keeping:
this->currentMenuCode = ROOT;
this->currentMenu = menuName + " -menu1";
this->currentMenuButtons = menuName + " -buttons";
this->currentInfo = menuName + " -info";
// in:
this->score->queueMovie("upndown -shake");
this->score->queueMovie(this->currentMenu, Score::FROM_START, Score::UNLOCK_ITEMS);
this->score->queueMovie(this->currentMenuButtons, Score::FROM_START, Score::UNLOCK_ITEMS);
this->score->queueMovie(this->currentInfo);
if (!Colors::noTicker){
this->ticker->doIntroTransitions = true;
this->tickerInAnim->startDelay = 2000;
this->ticker->useGuideQt();
this->score->queueMovie("ticker", Score::NEW_ANIMATION_ONLY);
}
break;
case MENU1:
// out:
this->score->queueMovie(this->currentMenu + " -out", Score::FROM_START, Score::LOCK_ITEMS);
this->score->queueMovie(this->currentMenuButtons + " -out", Score::FROM_START, Score::LOCK_ITEMS);
this->score->queueMovie(this->currentInfo + " -out");
if(qmlRoot)
qmlRoot->setProperty("show", QVariant(false));
// book-keeping:
this->currentMenuCode = MENU1;
this->
没有合适的资源?快使用搜索试试~ 我知道了~
Qt4.7.1-64位版,适用于Vistual Studio 2015
共2000个文件
html:5857个
png:3496个
h:1711个
需积分: 5 1 下载量 164 浏览量
2023-04-24
09:18:43
上传
评论 1
收藏 297.8MB ZIP 举报
温馨提示
Qt官网没有提供适用于VS2015的Qt4版本,自己编译比较费劲。在此分享自己编译的64位版Qt4.7.1,适用于Vistual Studio 2015下的Qt4开发。 使用方法:下载解压后,放到自己需要的目录下,如C://Qt/Qt4.7.1,然后在VS2015的Qt-Addin插件菜单中添加Qt版本及路径即可。
资源推荐
资源详情
资源评论
收起资源包目录
Qt4.7.1-64位版,适用于Vistual Studio 2015 (2000个子文件)
fbm.c 5KB
menumanager.cpp 43KB
xform.cpp 40KB
xform.cpp 40KB
scene.cpp 36KB
mediaplayer.cpp 35KB
colorswatch.cpp 25KB
textedit.cpp 25KB
engine.cpp 24KB
pathstroke.cpp 24KB
pathstroke.cpp 24KB
spreadsheet.cpp 22KB
composition.cpp 21KB
composition.cpp 21KB
pathdeform.cpp 21KB
pathdeform.cpp 21KB
gradients.cpp 19KB
gradients.cpp 19KB
arthurstyle.cpp 18KB
mainwindow.cpp 17KB
qtbox.cpp 16KB
itemcircleanimation.cpp 16KB
mainwindow.cpp 16KB
mainwidget.cpp 16KB
mainwindow.cpp 15KB
glbuffers.cpp 14KB
hoverpoints.cpp 14KB
waveform.cpp 14KB
colors.cpp 13KB
textbutton.cpp 13KB
toolbar.cpp 13KB
document.cpp 12KB
arthurwidgets.cpp 11KB
states.cpp 11KB
graphicsscene.cpp 10KB
boat.cpp 10KB
browser.cpp 10KB
spectrumanalyser.cpp 10KB
demoitem.cpp 10KB
plugin.cpp 9KB
wavfile.cpp 9KB
spectrograph.cpp 8KB
view.cpp 8KB
main.cpp 7KB
roundedbox.cpp 7KB
demoitemanimation.cpp 7KB
customproxy.cpp 6KB
submarine.cpp 6KB
settingsdialog.cpp 6KB
tonegeneratordialog.cpp 6KB
examplecontent.cpp 6KB
chip.cpp 6KB
spreadsheetitem.cpp 5KB
commands.cpp 5KB
trackball.cpp 5KB
connectionwidget.cpp 5KB
main.cpp 5KB
bookdelegate.cpp 5KB
menucontent.cpp 5KB
score.cpp 5KB
bookwindow.cpp 5KB
model.cpp 5KB
utils.cpp 5KB
imageitem.cpp 5KB
progressbar.cpp 5KB
guide.cpp 5KB
levelmeter.cpp 5KB
bomb.cpp 4KB
qanimationstate.cpp 4KB
spreadsheetdelegate.cpp 4KB
torpedo.cpp 4KB
demotextitem.cpp 4KB
headingitem.cpp 4KB
dockitem.cpp 4KB
embeddeddialog.cpp 4KB
main.cpp 4KB
main.cpp 4KB
tonegenerator.cpp 4KB
mainwindow.cpp 4KB
qsqlconnectiondialog.cpp 4KB
guidecircle.cpp 4KB
letteritem.cpp 3KB
glextensions.cpp 3KB
animationmanager.cpp 3KB
main.cpp 3KB
main.cpp 3KB
mainwindow.cpp 3KB
scanitem.cpp 3KB
guideline.cpp 3KB
frequencyspectrum.cpp 3KB
main.cpp 3KB
main.cpp 3KB
main.cpp 3KB
pixmapitem.cpp 3KB
main.cpp 3KB
progressitem.cpp 3KB
main.cpp 2KB
main.cpp 2KB
textinformationitem.cpp 2KB
main.cpp 2KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
深蓝静音
- 粉丝: 245
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功