void FmFileView::setRootPath( const QString &pathName )
{
    if( pathName.isEmpty() ) {
        return;
    }
    mWidget->setRootPath( pathName );
    QString driveName = FmUtils::getDriveNameFromPath( pathName );
    /*
	FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName );
    QString volumeName = driverInfo.volumeName();
	if( volumeName.isEmpty() ){
        FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( driveName ).driveState();
        if( !( driveState & FmDriverInfo::EDriveNotPresent ) ){
            if( driveState & FmDriverInfo::EDriveRemovable ) {
                if( driveState & FmDriverInfo::EDriveMassStorage ) {
                    volumeName.append( hbTrId( "Mass Storage" ) );  
                }
                else{
                    volumeName.append( hbTrId( "Memory Card" ) );
                }
            }
            else{
                volumeName.append( hbTrId( "Phone Memory" ) );
            }
        }
	    }
	*/
	//QString titleText = FmUtils::removePathSplash( driverInfo.name() ) + ' ' + volumeName;
    QString titleText( FmUtils::fillDriveVolume( driveName, true ) );
	setTitle( titleText );
}
Exemple #2
0
bool KexiSimplePrintingCommand::showPrintPreview(const KexiSimplePrintingSettings& settings, 
	const QString& aTitleText, bool reload)
{
	m_settings = settings;
	if (!m_previewEngine)
		m_previewEngine = new KexiSimplePrintingEngine(m_settings, this);

	if (reload)
		m_printPreviewNeedsReloading = true;

	bool backToPage0 = true;
	QString titleText(aTitleText.stripWhiteSpace());
	KexiDB::Connection *conn = m_mainWin->project()->dbConnection();
	KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId);
	if (!tableOrQuery.table() && !tableOrQuery.query()) {
//! @todo item not found
		return false;
	}
	if (titleText.isEmpty())
		titleText = tableOrQuery.captionOrName();
	if (!m_previewWindow || m_printPreviewNeedsReloading) {
		QString errorMessage;
		if (!m_previewEngine->init(
			*conn, tableOrQuery, titleText, errorMessage)) {
			if (!errorMessage.isEmpty())
				KMessageBox::sorry(m_mainWin, errorMessage, i18n("Print Preview")); 
			return false;
		}
	}
	if (!m_previewWindow) {
		backToPage0 = false;
		m_previewWindow = new KexiSimplePrintPreviewWindow(
			*m_previewEngine, tableOrQuery.captionOrName(), 0, 
			Qt::WStyle_Customize|Qt::WStyle_NormalBorder|Qt::WStyle_Title|
			Qt::WStyle_SysMenu|Qt::WStyle_MinMax|Qt::WStyle_ContextHelp);
		connect(m_previewWindow, SIGNAL(printRequested()), this, SLOT(print()));
		connect(m_previewWindow, SIGNAL(pageSetupRequested()), this, SLOT(slotShowPageSetupRequested()));
		m_previewWindow->show();
		KDialog::centerOnScreen(m_previewWindow);
		m_printPreviewNeedsReloading = false;
	}

	if (m_printPreviewNeedsReloading) {//dirty
		m_previewEngine->clear();
//! @todo progress bar...
		m_previewEngine->setTitleText( titleText );
		m_previewWindow->setFullWidth();
		m_previewWindow->updatePagesCount();
		m_printPreviewNeedsReloading = false;
	}
	if (backToPage0)
		m_previewWindow->goToPage(0);
	m_previewWindow->show();
	m_previewWindow->raise();
//	m_previewWindow->setPagesCount(INT_MAX); //will be properly set on demand
	return true;
}
Exemple #3
0
VectorPlot::VectorPlot(QWidget *parent, const QString &title, SetLegend * externalLegend)
    : QWidget(parent), legend(externalLegend)
{
	this->setMinimumHeight(200);
	
	QwtText titleText(title);
	QFont titleTextFont(titleText.font());
	titleTextFont.setPointSize(10);
	titleText.setFont(titleTextFont);
	plot = new QwtPlot(titleText, this);

	plot->setCanvasBackground(Qt::white);

	//plot->setGeometry(ui.widget_plot->geometry());

	plot->setAxisScale(QwtPlot::xBottom, 0, 0.01);
	plot->setAxisScale(QwtPlot::yLeft, 0, 0.01);

	for ( int i = 0; i < QwtPlot::axisCnt; i++ )
    {
    	plot->setAxisAutoScale(i);
        QwtScaleWidget *scaleWidget = (QwtScaleWidget *)plot->axisWidget(i);
        if ( scaleWidget )
            scaleWidget->setMargin(0);

        QwtScaleDraw *scaleDraw = (QwtScaleDraw *)plot->axisScaleDraw(i);
        if ( scaleDraw )
            scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
    }
	plot->canvas()->setFrameStyle(QFrame::Box|QFrame::Plain);
	plot->setAutoReplot(true);

	//plot->setMinimumSize(QSize(200, 200));
	//this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
	plot->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	
	QPen pen(QColor(255, 0, 0));
	
	marker1 = new QwtPlotMarker();
	marker1->setLineStyle(QwtPlotMarker::VLine);
	marker1->setLinePen(pen);
	marker1->setXValue(0);
	
	marker2 = new QwtPlotMarker();
	marker2->setLineStyle(QwtPlotMarker::VLine);
	marker2->setLinePen(pen);
	marker2->setXValue(0);	

	zoomer = 0;
}
void CntActionPopupPrivate::buildMessageActionPopup()
{
    // Create message action
    QList<QContactPhoneNumber> details = mContact->details<QContactPhoneNumber>();
    CntStringMapper map;
    for (int index = 0; index < details.count(); index++)
    {
        if(supportsDetail("message", details[index]))
        {
            // Todo : Use loc string for this dialog
            QString context = details[index].contexts().isEmpty() ? QString() : details[index].contexts().first();
            QString subtype = details[index].subTypes().isEmpty() ? details[index].definitionName() : details[index].subTypes().first();
            
            int position = getPosition(subtype, context);
        
            QString icon;
            if (details[index].contexts().isEmpty())
            {
              icon = "qtg_large_message";
            }
            else if (details[index].contexts().first() == QContactDetail::ContextHome)
            {
              icon = "qtg_large_message_home";
            }
            else if (details[index].contexts().first() == QContactDetail::ContextWork)
            {
              icon = "qtg_large_message_work";
            }
            else
            {
              icon = "qtg_large_message";
            }
            
            QString titleText( hbTrId("txt_phob_dblist_send_message"));
            QString valueText = details[index].number();
            
            QStandardItem *labelItem = new QStandardItem();
            QStringList textList;
            textList << titleText << valueText;
            labelItem->setData(textList, Qt::DisplayRole);
            labelItem->setData(HbIcon(icon), Qt::DecorationRole);
            labelItem->setData(index, Qt::UserRole);
            labelItem->setData("message", Qt::UserRole+1);
            labelItem->setData(position, Qt::UserRole+2);
            mDataItemList.append(labelItem);
        }
    }
}
Exemple #5
0
AboutDialog::AboutDialog(QWidget *parent) :
    QDialog(parent)
{
    setupUi(this);
    setWindowTitle(tr("About Flacon"));

    logoLabel->setFixedSize(48, 48);
    logoLabel->setScaledContents(true);
    logoLabel->setPixmap(QPixmap(":logo"));

    authorsEdit->viewport()->setAutoFillBackground(false);
    thanksEdit->viewport()->setAutoFillBackground(false);
    translationsEdit->viewport()->setAutoFillBackground(false);
    programsEdit->viewport()->setAutoFillBackground(false);


    QString css="<style TYPE='text/css'> "
                    "body { font-family: sans-serif;} "
                    ".name { font-size: 16pt; } "
                    "a { white-space: nowrap ;} "
                    "h2 { font-size: 10pt;} "
                    "li { line-height: 120%;} "
                    ".techInfoKey { white-space: nowrap ; margin: 0 20px 0 16px; } "
                "</style>";

    titleLabel->setText(css + titleText());

    aboutLabel->setText(descriptionText() +
                        "<br><br><br>" +
                        copyrightText() +
                        "<hr>" +

                        tr("Homepage: %1").arg(homepageText()) +
                        "<p>" +

                        tr("Bug tracker %1", "About dialog, About tab").arg(bugTrackerText()) +
                        "<p>" +

                        tr("License: %1").arg(licenseText()));


    authorsEdit->setHtml(css + authorsInfo().asString());
    thanksEdit->setHtml(css + tr("Special thanks to:") + thanksInfo().asString());
    translationsEdit->setHtml(css + translationsText());
    programsEdit->setHtml(css + tr("Flacon uses external programs. Many thanks to their authors!") + programsInfo().asString());
}
RazorAboutDLGPrivate::RazorAboutDLGPrivate()
{
    libTranslate("librazorqt");
    setupUi(this);

    QString css="<style TYPE='text/css'> "
                    "body { font-family: sans-serif;} "
                    ".name { font-size: 16pt; } "
                    "a { white-space: nowrap ;} "
                    "h2 { font-size: 10pt;} "
                    "li { line-height: 120%;} "
                    ".techInfoKey { white-space: nowrap ; margin: 0 20px 0 16px; } "
                "</style>"
            ;

    iconLabel->setFixedSize(48, 48);
    iconLabel->setScaledContents(true);
    iconLabel->setPixmap(QPixmap(QString(SHARE_DIR) + "/graphics/razor_logo.png"));

    nameLabel->setText(css + titleText());

    aboutBrowser->setHtml(css + aboutText());
    aboutBrowser->viewport()->setAutoFillBackground(false);

    autorsBrowser->setHtml(css + authorsText());
    autorsBrowser->viewport()->setAutoFillBackground(false);

    thanksBrowser->setHtml(css + thanksText());
    thanksBrowser->viewport()->setAutoFillBackground(false);

    translationsBrowser->setHtml(css + translationsText());
    translationsBrowser->viewport()->setAutoFillBackground(false);

    TechnicalInfo info;
    techBrowser->setHtml(info.html());
    techBrowser->viewport()->setAutoFillBackground(false);

    connect(techCopyToClipboardButton, SIGNAL(clicked()), this, SLOT(copyToCliboardTechInfo()));
    this->setAttribute(Qt::WA_DeleteOnClose);
    show();

}
// --------------------------------------------------------------------------
// CMSBaseView::SetTitlePaneTextL()
// Sets text to title pane.
// --------------------------------------------------------------------------
void CMSBaseView::SetTitlePaneTextL( TInt aResourceId )
    {
    LOG(_L("[MediaServant]\t CMSBaseView::SetTitlePaneTextL"));

    // Fetches pointer to the default title pane control.
    CAknTitlePane* titlePane = static_cast<CAknTitlePane*>(
        StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );

    // Makes and sets text which is used title pane.
    if ( aResourceId == KMSDefaultTitleId )
        {
        titlePane->SetTextToDefaultL();
        }
    else
        {
        TBuf<KMSTitleBufLength> titleText( 0 );
        iCoeEnv->ReadResourceL( titleText, aResourceId );
        titlePane->SetTextL( titleText );
        }
    }
Exemple #8
0
//AboutDialogPrivate::AboutDialogPrivate()
AboutDialog::AboutDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AboutDialog)
{
//    this->setAttribute(Qt::WA_DeleteOnClose);
    ui->setupUi(this);

    QString css="<style TYPE='text/css'> "
                    "body { font-family: sans-serif;} "
                    ".name { font-size: 16pt; } "
                    "a { white-space: nowrap ;} "
                    "h2 { font-size: 10pt;} "
                    "li { line-height: 120%;} "
                    ".techInfoKey { white-space: nowrap ; margin: 0 20px 0 16px; } "
                "</style>"
            ;

    ui->iconLabel->setFixedSize(48, 48);
    ui->iconLabel->setScaledContents(true);
    //iconLabel->setPixmap(QPixmap(QString(SHARE_DIR) + "/graphics/razor_logo.png"));

    ui->nameLabel->setText(css + titleText());

    ui->aboutBrowser->setHtml(css + aboutText());
    ui->aboutBrowser->viewport()->setAutoFillBackground(false);

    ui->autorsBrowser->setHtml(css + authorsText());
    ui->autorsBrowser->viewport()->setAutoFillBackground(false);

    ui->thanksBrowser->setHtml(css + thanksText());
    ui->thanksBrowser->viewport()->setAutoFillBackground(false);
    ui->thanksTab->setVisible(false);

    ui->translationsBrowser->setHtml(css + translationsText());
    ui->translationsBrowser->viewport()->setAutoFillBackground(false);


    //    show();
}
Exemple #9
0
void TitleWidget::settingsChanged()
{
    int mainIconExtend = qCeil(26 * m_settings->sizeFactor());
    m_icon->setMinimumSize( mainIconExtend, mainIconExtend );
    m_icon->setMaximumSize( mainIconExtend, mainIconExtend );

    QFont font = m_settings->sizedFont();
    QFont boldFont = font;
    boldFont.setBold( true );
    m_title->setFont( boldFont );

    if ( m_filterWidget ) {
        m_filterWidget->setFont( font );
    }
    if ( m_journeysWidget ) {
        m_journeysWidget->setFont( font );
    }

    if ( m_type == ShowDepartureArrivalListTitle
      || m_type == ShowIntermediateDepartureListTitle )
    {
        setTitle( titleText() );
    }
}
/**
  * The parser uses a code sandwich to wrap the parsing process. Before
  * the process begins, WillBuildModel() is called. Afterwards the parser
  * calls DidBuildModel().
  * @update gess5/18/98
  * @param  aFilename is the name of the file being parsed.
  * @return error code (almost always 0)
  */
NS_IMETHODIMP CViewSourceHTML::BuildModel(nsITokenizer* aTokenizer,
                                          PRBool aCanInterrupt,
                                          PRBool aCountLines,
                                          const nsCString* aCharsetPtr)
{
  nsresult result=NS_OK;

  if(aTokenizer) {

    nsITokenizer*  oldTokenizer=mTokenizer;
    mTokenizer=aTokenizer;
    nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator();

    if(!mHasOpenRoot) {
      // For the stack-allocated tokens below, it's safe to pass a null
      // token allocator, because there are no attributes on the tokens.
      CStartToken htmlToken(NS_LITERAL_STRING("HTML"), eHTMLTag_html);
      nsCParserNode htmlNode(&htmlToken, 0/*stack token*/);
      mSink->OpenContainer(htmlNode);

      CStartToken headToken(NS_LITERAL_STRING("HEAD"), eHTMLTag_head);
      nsCParserNode headNode(&headToken, 0/*stack token*/);
      mSink->OpenContainer(headNode);

      CStartToken titleToken(NS_LITERAL_STRING("TITLE"), eHTMLTag_title);
      nsCParserNode titleNode(&titleToken, 0/*stack token*/);
      mSink->OpenContainer(titleNode);

      // Note that XUL will automatically add the prefix "Source of: "
      if (StringBeginsWith(mFilename, NS_LITERAL_STRING("data:")) &&
          mFilename.Length() > 50) {
        nsAutoString dataFilename(Substring(mFilename, 0, 50));
        dataFilename.AppendLiteral("...");
        CTextToken titleText(dataFilename);
        nsCParserNode titleTextNode(&titleText, 0/*stack token*/);
        mSink->AddLeaf(titleTextNode);
      } else {
        CTextToken titleText(mFilename);
        nsCParserNode titleTextNode(&titleText, 0/*stack token*/);
        mSink->AddLeaf(titleTextNode);
      }

      mSink->CloseContainer(eHTMLTag_title);

      if (theAllocator) {
        CStartToken* theToken=
          static_cast<CStartToken*>
                     (theAllocator->CreateTokenOfType(eToken_start,
                                                         eHTMLTag_link,
                                                         NS_LITERAL_STRING("LINK")));
        if (theToken) {
          nsCParserStartNode theNode(theToken, theAllocator);

          AddAttrToNode(theNode, theAllocator,
                        NS_LITERAL_STRING("rel"),
                        NS_LITERAL_STRING("stylesheet"));

          AddAttrToNode(theNode, theAllocator,
                        NS_LITERAL_STRING("type"),
                        NS_LITERAL_STRING("text/css"));

          AddAttrToNode(theNode, theAllocator,
                        NS_LITERAL_STRING("href"),
                        NS_LITERAL_STRING("resource://gre/res/viewsource.css"));

          mSink->AddLeaf(theNode);
        }
        IF_FREE(theToken, theAllocator);
      }

      result = mSink->CloseContainer(eHTMLTag_head);
      if(NS_SUCCEEDED(result)) {
        mHasOpenRoot = PR_TRUE;
      }
    }
    if (NS_SUCCEEDED(result) && !mHasOpenBody) {
      if (theAllocator) {
        CStartToken* bodyToken=
          static_cast<CStartToken*>
                     (theAllocator->CreateTokenOfType(eToken_start,
                                                         eHTMLTag_body,
                                                         NS_LITERAL_STRING("BODY")));
        if (bodyToken) {
          nsCParserStartNode bodyNode(bodyToken, theAllocator);

          AddAttrToNode(bodyNode, theAllocator,
                        NS_LITERAL_STRING("id"),
                        NS_ConvertASCIItoUTF16(kBodyId));

          if (mWrapLongLines) {
            AddAttrToNode(bodyNode, theAllocator,
                          NS_LITERAL_STRING("class"),
                          NS_ConvertASCIItoUTF16(kBodyClassWrap));
          }
          result = mSink->OpenContainer(bodyNode);
          if(NS_SUCCEEDED(result)) mHasOpenBody=PR_TRUE;
        }
        IF_FREE(bodyToken, theAllocator);

        if (NS_SUCCEEDED(result)) {
          CStartToken* preToken =
            static_cast<CStartToken*>
                       (theAllocator->CreateTokenOfType(eToken_start,
                                                           eHTMLTag_pre,
                                                           NS_LITERAL_STRING("PRE")));
          if (preToken) {
            nsCParserStartNode preNode(preToken, theAllocator);
            AddAttrToNode(preNode, theAllocator,
                          NS_LITERAL_STRING("id"),
                          NS_LITERAL_STRING("line1"));
            result = mSink->OpenContainer(preNode);
          } else {
            result = NS_ERROR_OUT_OF_MEMORY;
          }
          IF_FREE(preToken, theAllocator);
        }
      }
    }

    NS_ASSERTION(aCharsetPtr, "CViewSourceHTML::BuildModel expects a charset!");
    mCharset = *aCharsetPtr;

    NS_ASSERTION(aCanInterrupt, "CViewSourceHTML can't run scripts, so "
                 "document.write should not forbid interruptions. Why is "
                 "the parser telling us not to interrupt?");

    while(NS_SUCCEEDED(result)){
      CToken* theToken=mTokenizer->PopToken();
      if(theToken) {
        result=HandleToken(theToken);
        if(NS_SUCCEEDED(result)) {
          IF_FREE(theToken, mTokenizer->GetTokenAllocator());
          if (mSink->DidProcessAToken() == NS_ERROR_HTMLPARSER_INTERRUPTED) {
            result = NS_ERROR_HTMLPARSER_INTERRUPTED;
            break;
          }
        } else {
          mTokenizer->PushTokenFront(theToken);
        }
      }
      else break;
    }//while

    mTokenizer=oldTokenizer;
  }
  else result=NS_ERROR_HTMLPARSER_BADTOKENIZER;
  return result;
}
Exemple #11
0
void TitleWidget::setTitleType( TitleType titleType,
                                bool validDepartureData, bool validJourneyData )
{
    // Remove old additional widgets
    clearWidgets();

    // New type
    m_type = titleType;
    switch ( titleType ) {
        case ShowDepartureArrivalListTitle:
            // Default state, a departure/arrival board is shown
            setIcon( validDepartureData ? DepartureListOkIcon : DepartureListErrorIcon );
            m_icon->setToolTip( i18nc("@info:tooltip", "Show available actions in the applet") );
            setTitle( titleText() );

            // Show a title (with the stop name) and the filter and quick journey search widgets
            addWidget( m_title, WidgetTitle );
            if ( m_journeysSupported ) {
                addWidget( m_journeysWidget, WidgetQuickJourneySearch );
            }
            addWidget( m_filterWidget, WidgetFilter );
            break;

        case ShowIntermediateDepartureListTitle:
            // An intermediate deparure list is shown
            setIcon( GoBackIcon );
            m_icon->setToolTip( i18nc("@info:tooltip", "Go back to original stop") );
            setTitle( titleText() );

            // Same as for normal departure/arrival boards
            addWidget( m_title, WidgetTitle );
            if ( m_journeysSupported ) {
                addWidget( m_journeysWidget, WidgetQuickJourneySearch );
            }
            addWidget( m_filterWidget, WidgetFilter );
            break;

        case ShowSearchJourneyLineEdit: {
            // The journey search UI is shown
            setIcon( AbortJourneySearchIcon );
            m_icon->setToolTip( i18nc("@info:tooltip", "Abort search for journeys "
                                                       "to or from the home stop" ) );

            // Add widgets
            addJourneySearchWidgets();
            Plasma::LineEdit *journeySearchLine =
                    castedWidget<Plasma::LineEdit>(WidgetJourneySearchLine);
            journeySearchLine->setEnabled( true );
            journeySearchLine->setFocus();
            journeySearchLine->nativeWidget()->selectAll();
            break;
        }
        case ShowSearchJourneyLineEditDisabled:
            // The journey search UI is shown,
            // but the currently used service provider does not support journeys
            setIcon( AbortJourneySearchIcon );
            m_icon->setToolTip( i18nc("@info:tooltip", "Abort search for journeys "
                                                       "to or from the home stop") );

            // Add widgets
            addJourneySearchWidgets();

            // Disable all widgets, because journeys are not supported by the currently used
            // service provider
            castedWidget<Plasma::LineEdit>(WidgetJourneySearchLine)->setEnabled( false );
            castedWidget<Plasma::LineEdit>(WidgetFillJourneySearchLineButton)->setEnabled( false );
            castedWidget<Plasma::LineEdit>(WidgetStartJourneySearchButton)->setEnabled( false );
            break;

        case ShowJourneyListTitle: {
            // A list of journeys is shown
            setIcon( validJourneyData ? JourneyListOkIcon : JourneyListErrorIcon );
            m_icon->setToolTip( i18nc("@info:tooltip", "Show available actions in the applet") );

            // Add a close icon to close the journey view
            int iconExtend = 26 * m_settings->sizeFactor();
            Plasma::IconWidget *closeIcon = new Plasma::IconWidget;
            closeIcon->setIcon( "window-close" );
            closeIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
            closeIcon->setMinimumSize( iconExtend, iconExtend );
            closeIcon->setMaximumSize( iconExtend, iconExtend );
            closeIcon->setToolTip( i18nc("@info:tooltip", "Show departures / arrivals") );
            connect( closeIcon, SIGNAL(clicked()), this, SIGNAL(closeIconClicked()) );
            addWidget( closeIcon, WidgetCloseIcon );

            // Add a title label
            addWidget( m_title, WidgetTitle );
            break;
        }
    }
}
Exemple #12
0
//show splash screen (BLOCKING)
bool Game::ShowSplashScreen()
{

    sf::String titleText("Ace SPACE Pilot");
    sf::Text title(titleText, datagoth);
    title.setCharacterSize(50);
    //title.setStyle(sf::Text::Bold);
    title.setColor(sf::Color::White);
    title.setPosition(288-(title.getGlobalBounds().width/2), 280);

    sf::String prompt("Press Enter to Begin");
    sf::Text text(prompt, datagoth);
    text.setCharacterSize(24);
    text.setColor(sf::Color::White);
    text.setPosition(288-text.getGlobalBounds().width/2, 725);

    sf::String fpsString("\nESC to Quit\nP to Pause\nSPACE to Fire\nWASD to Move");
    sf::Text text2(fpsString, datagoth);
    text2.setCharacterSize(20);
    text2.setColor(sf::Color::White);
    text2.setPosition(596, 650);

    music[0].openFromFile("sounds/menu_bgm.ogg");
    music[0].play();

    music[1].openFromFile("sounds/stage_bgm.ogg");
    music[1].setVolume(60);

    sf::Event event;
    while(true)
    {
        while(mainWindow.pollEvent(event))
        {
           if(event.type == sf::Event::Resized)
           {
                float aspectRatio = float(event.size.width)/float(event.size.height);
                float newHeight = (1024.f*event.size.height)/event.size.width;
                float newWidth = (768.f*event.size.width)/event.size.height;
                if(aspectRatio > (4.f/3.f))
                {
                    float displace = (newWidth - 1024.f)/(-2.f);
                    View = sf::View(sf::FloatRect(displace, 0, newWidth, 768));
                }
                else if(aspectRatio < (4.f/3.f))
                {
                    float displace = (newHeight - 768.f)/(-2.f);
                    View = sf::View(sf::FloatRect(0, displace, 1024, newHeight));
                }
                mainWindow.setView(View);
           }
           if((event.type == (sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Return)))
           {
               sounds[1].play();
                return 1;
           }
           if((event.type == (sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)) || event.type == sf::Event::Closed )
           {
             return 0;
           }
        }

        //update paralaxed backgrounds
        if(bgMove1 > (2500-768))
            bgMove1 = 0;
        bgMove1 += 2;
        background1.sprite.setTextureRect(sf::Rect<int>(0,(2500-768)-bgMove1,576,768));

        mainWindow.draw(wholeArea);
        mainWindow.draw(spawnArea);
        background0.Draw(mainWindow);
        background1.Draw(mainWindow);
        mainWindow.draw(rightBound);
        mainWindow.draw(leftBound);
        mainWindow.draw(bottomBound);
        mainWindow.draw(title);
        mainWindow.draw(text);
        mainWindow.draw(text2);
        scoreboard.drawScoreboard(mainWindow, player1.sprite);
        mainWindow.display();
    }
}
Exemple #13
0
bool KexiSimplePrintingCommand::print(const QString& aTitleText)
{
	KexiDB::Connection *conn = m_mainWin->project()->dbConnection();
	KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId);
	if (!tableOrQuery.table() && !tableOrQuery.query()) {
//! @todo item not found
		return false;
	}
	QString titleText(aTitleText.stripWhiteSpace());
	if (titleText.isEmpty())
		titleText = tableOrQuery.captionOrName();

	KexiSimplePrintingEngine engine(m_settings, this);
	QString errorMessage;
	if (!engine.init(*conn, tableOrQuery, titleText, errorMessage)) {
		if (!errorMessage.isEmpty())
			KMessageBox::sorry(m_mainWin, errorMessage, i18n("Printing"));
		return false;
	}

	//setup printing
#ifdef Q_WS_WIN
	QPrinter printer(QPrinter::HighResolution);
	printer.setOrientation( m_settings.pageLayout.orientation == PG_PORTRAIT 
		? QPrinter::Portrait : QPrinter::Landscape );
	printer.setPageSize( 
		(QPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) );

	// "chicken-egg" problem: 
	// we cannot use real from/to values in setMinMax() and setFromTo() 
	// because page count is known after obtaining print settings
	printer.setFromTo(1,1);
#else
	KPrinter printer;
	printer.setOrientation( m_settings.pageLayout.orientation == PG_PORTRAIT 
		? KPrinter::Portrait : KPrinter::Landscape );
	printer.setPageSize( 
		(KPrinter::PageSize)KoPageFormat::printerPageSize( m_settings.pageLayout.format ) );
#endif

	printer.setFullPage(true);
	QString docName( titleText );
	printer.setDocName( docName );
	printer.setCreator(KEXI_APP_NAME);
	if ( !printer.setup( m_mainWin ) ) {
		return true;
	}

	// now we have final settings

//! @todo get printer.pageOrder() (for reversed order requires improved engine)
	QPainter painter;

	if (!painter.begin(&printer)) {
//! @todo msg
		return false;
	}
	engine.calculatePagesCount(painter);

	uint loops, loopsPerPage;
	QValueList<int> pagesToPrint;
	int fromPage = 0;
#ifdef Q_WS_WIN
	int toPage = 0;
	if (QPrinter::PageRange == printer.printRange()) {
		fromPage = printer.fromPage();
		toPage = printer.toPage();
	}
	if (fromPage==0 || toPage==0) {
		fromPage = 0;
		toPage = (int)engine.pagesCount()-1;
	}
	else {
		fromPage--;
		if (toPage > (int)engine.pagesCount())
			toPage = (int)engine.pagesCount();
		toPage--;
	}
	// win32 only supports one range, build the list
	for (int i = fromPage; i<=toPage; i++) {
		pagesToPrint.append(i);
	}
	// on win32 the OS does perform buffering (only when collation is off, each copy needs to be repeated)
	loops = 1;
	loopsPerPage = printer.collateCopies() ? 1 : printer.numCopies();
#else
	// on !win32 print QPrinter::numCopies() times (the OS does not perform buffering)
	pagesToPrint = printer.pageList();
	kdDebug() << pagesToPrint << endl;
	if (pagesToPrint.isEmpty()) {
		fromPage = 0;
		for (int i = 0; i<(int)engine.pagesCount(); i++) {
			pagesToPrint.append(i);
		}
	}
	else
		fromPage = pagesToPrint.first();
	if (printer.collate()==KPrinter::Collate) {
		//collation: p1, p2,..pn; p1, p2,..pn; ......; p1, p2,..pn
		loops = printer.numCopies();
		loopsPerPage = 1;
	}
	else {
		//no collation: p1, p1, ..., p1; p2, p2, ..., p2; ......; pn, pn,..pn
		loops = 1; 
		loopsPerPage = printer.numCopies();
	}
//! @todo also look at printer.pageSet() option : all/odd/even pages
#endif
	// now, total number of printed pages is printer.numCopies()*printer.pageList().count()

	kdDebug() << "printing..." << endl;
	bool firstPage = true;
	for (uint copy = 0;copy < loops; copy++) {
		kdDebug() << "copy " << (copy+1) << " of " << loops << endl;
		uint pageNumber = fromPage;
		QValueList<int>::ConstIterator pagesIt = pagesToPrint.constBegin();
		for(;(int)pageNumber == fromPage || !engine.eof(); ++pageNumber) {
			kdDebug() << "printing..." << endl;
			if (pagesIt == pagesToPrint.constEnd()) //no more pages to print
				break;
			if ((int)pageNumber < *pagesIt) { //skip pages without printing (needed for computation)
				engine.paintPage(pageNumber, painter, false);
				continue;
			}
			if (*pagesIt < (int)pageNumber) { //sanity
				++pagesIt;
				continue;
			}
			for (uint onePageCounter = 0; onePageCounter < loopsPerPage; onePageCounter++) {
				if (!firstPage)
					printer.newPage();
				else
					firstPage = false;
				kdDebug() << "page #" << pageNumber << endl;
				engine.paintPage(pageNumber, painter);
			}
			++pagesIt;
		}
	}
	kdDebug() << "end of printing." << endl;

	// stop painting, this will automatically send the print data to the printer
	if (!painter.end())
		return false;

	if (!engine.done())
		return false;

	return true;
}
Exemple #14
0
/********************************************************************************
* TitleBrowser- opens a browser with a list of installed Titles
* relies on code from any title deleter.
*********************************************************************************/
int TitleBrowser(u32 type) {

	u32 num_titles;
	u32 titles[100] ATTRIBUTE_ALIGN(32);
	u32 num_sys_titles;
	u32 sys_titles[10] ATTRIBUTE_ALIGN(32);
	s32 ret = -1;
	int numtitle;//to get rid of a stupid compile wrning
	//open the database file
	FILE *f;
	char path[100];

	ISFS_Initialize();

	sprintf(path,"%s/config/database.txt",bootDevice);
	f = fopen(path, "r");

	// Get count of titles of our requested type
	ret = getTitles_TypeCount(type, &num_titles);
	if (ret < 0) {
		//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
		//exit(1);
	}

	// Get titles of our requested type
	ret = getTitles_Type(type, titles, num_titles);
	if (ret < 0) {
		//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
		//exit(1);
	}

	// Get count of system titles
	ret = getTitles_TypeCount(0x00010002, &num_sys_titles);
	if (ret < 0) {
		//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
		//exit(1);
	}

	// Get system titles
	ret = getTitles_Type(0x00010002, sys_titles, num_sys_titles);
	if (ret < 0) {
		//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
		//exit(1);
	}


	//this array will hold all the names for the titles so we only have to get them one time
	char name[num_titles+num_sys_titles][50];

	customOptionList options3(num_titles+num_sys_titles+1);
	//write the titles on the option browser
	u32 i = 0;



	//first add the good stuff
	while (i < num_titles) {
		//start from the beginning of the file each loop
		if (f)rewind(f);
		//char name[50];
		char text[15];
		strcpy(name[i],"");//make sure name is empty
		u8 found=0;
		//set the title's name, number, ID to text
		sprintf(text, "%s", titleText(type, titles[i]));

		//get name from database cause i dont like the ADT function
		char line[200];
		char tmp[50];
		snprintf(tmp,50," ");
		
		//check if the content.bin is on the SD card for that game
		//if there is content.bin,then the game is on the SDmenu and not the wii
		sprintf(line,"SD:/private/wii/title/%s/content.bin",text);
		if (!checkfile(line))
			{
				if (f) {
					while (fgets(line, sizeof(line), f)) {
						if (line[0]== text[0]&&
								line[1]== text[1]&&
								line[2]== text[2]) {
							int j=0;
							found=1;
							for (j=0;(line[j+4]!='\0' || j<51);j++)

								tmp[j]=line[j+4];
							snprintf(name[i],sizeof(name[i]),"%s",tmp);
							//break;
						}
					}
				}
				if (!found) {
					if (getName00(name[i], TITLE_ID(type, titles[i]),CONF_GetLanguage()*2)>=0)
						found=2;

					if (!found) {
						if (getNameBN(name[i], TITLE_ID(type, titles[i]))>=0)
							found=3;

						if (!found)
							snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",titles[i]);
					}
				}

				//set the text to the option browser
				options3.SetName(i, "%s",text);
				options3.SetValue(i, "%s",name[i]);
				//options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
				//move on to the next title
			}
        i++;
    }

    // now add the crappy system titles
    while (i < num_titles+num_sys_titles) {
        //start from the beginning of the file each loop
        if (f)rewind(f);
        //char name[50];
        char text[15];
        strcpy(name[i],"");//make sure name is empty
        u8 found=0;
        //set the title's name, number, ID to text
        sprintf(text, "%s", titleText(0x00010002, sys_titles[i-num_titles]));

        //get name from database cause i dont like the ADT function
        char line[200];
        char tmp[50];
        snprintf(tmp,50," ");
        //snprintf(name[i],sizeof(name[i]),"Unknown Title");
        if (f) {
            while (fgets(line, sizeof(line), f)) {
                if (line[0]== text[0]&&
                        line[1]== text[1]&&
                        line[2]== text[2]) {
                    int j=0;
                    found=1;
                    for (j=0;(line[j+4]!='\0' || j<51);j++)

                        tmp[j]=line[j+4];
                    snprintf(name[i],sizeof(name[i]),"%s",tmp);
                    break;
                }
            }
        }
        if (!found) {
            if (getName00(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
                found=2;

            if (!found) {
                if (getNameBN(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
                    found=3;

                if (!found)
                    snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",sys_titles[i-num_titles]);
            }
        }

        //set the text to the option browser
        options3.SetName(i, "%s",text);
        options3.SetValue(i, "%s",name[i]);
        //options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
        //move on to the next title
        i++;
    }
    if (i == num_titles+num_sys_titles) {
        options3.SetName(i, " ");
        options3.SetValue(i, "%s",tr("Wii Settings"));
    }
    //we have all the titles we need so close the database and stop poking around in the wii
    fclose(f);

    //get rid of our footprints in there
    Uninstall_FromTitle(TITLE_ID(1, 0));
    ISFS_Deinitialize();
    bool exit = false;

    if (IsNetworkInit())
        ResumeNetworkWait();

    GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
	// because destroy GuiSound must wait while sound playing is finished, we use a global sound
	if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
	//	GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);

    char imgPath[100];

    snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
    GuiImageData btnOutline(imgPath, button_dialogue_box_png);
    snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
    GuiImageData settingsbg(imgPath, settings_background_png);

    GuiTrigger trigA;
    trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
    GuiTrigger trigHome;
    trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
    GuiTrigger trigB;
    trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

    GuiText titleTxt(tr("Title Launcher"), 28, (GXColor) {0, 0, 0, 255});
    titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
    titleTxt.SetPosition(12,40);
    titleTxt.SetMaxWidth(356, GuiText::SCROLL);

    GuiImage settingsbackground(&settingsbg);
    GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
    settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    settingsbackgroundbtn.SetPosition(0, 0);
    settingsbackgroundbtn.SetImage(&settingsbackground);

    GuiText cancelBtnTxt(tr("Back"), 22, THEME.prompttext);
    cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
    GuiImage cancelBtnImg(&btnOutline);
    if (Settings.wsprompt == yes) {
        cancelBtnTxt.SetWidescreen(CFG.widescreen);
        cancelBtnImg.SetWidescreen(CFG.widescreen);
    }
    GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, btnClick2,1);
    cancelBtn.SetScale(0.9);
    cancelBtn.SetLabel(&cancelBtnTxt);
    cancelBtn.SetTrigger(&trigB);

    u8 scrollbaron = 0;
    if (num_titles > 9)
        scrollbaron = 1;

    GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, num_titles+num_sys_titles>9?1:0, 200);
    optionBrowser3.SetPosition(0, 90);
    optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);

    snprintf(imgPath, sizeof(imgPath), "%sWifi_btn.png", CFG.theme_path);
    GuiImageData wifiImgData(imgPath, Wifi_btn_png);
    GuiImage wifiImg(&wifiImgData);
    if (Settings.wsprompt == yes) {
        wifiImg.SetWidescreen(CFG.widescreen);
    }
    GuiButton wifiBtn(wifiImg.GetWidth(), wifiImg.GetHeight());
    wifiBtn.SetImage(&wifiImg);
    wifiBtn.SetPosition(100, 400);
    wifiBtn.SetEffectGrow();
    wifiBtn.SetAlpha(80);
    wifiBtn.SetTrigger(&trigA);

    GuiTrigger trigZ;
    trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);

    GuiButton screenShotBtn(0,0);
    screenShotBtn.SetPosition(0,0);
    screenShotBtn.SetTrigger(&trigZ);

    HaltGui();
    GuiWindow w(screenwidth, screenheight);
    w.Append(&screenShotBtn);
    w.Append(&settingsbackgroundbtn);
    w.Append(&titleTxt);
    w.Append(&cancelBtn);
    w.Append(&wifiBtn);
    w.Append(&optionBrowser3);

    mainWindow->Append(&w);


    int tmp=num_titles+num_sys_titles;
    ResumeGui();
    numtitle=num_titles;
    while (!exit) {
        VIDEO_WaitVSync();

        if (shutdown == 1)
            Sys_Shutdown();
        if (reset == 1)
            Sys_Reboot();

        else if (wifiBtn.GetState() == STATE_CLICKED) {

                ResumeNetworkWait();
                wifiBtn.ResetState();
        }

        if (IsNetworkInit()) {
                wifiBtn.SetAlpha(255);
        }

        ret = optionBrowser3.GetClickedOption();

        if (ret > -1) {//if a click happened

            //char name[50];
            char text[15];
            if (f)rewind(f);
            //strcpy(name,"");//make sure name is empty

            if (ret<numtitle) {
                //set the title's name, number, ID to text
                sprintf(text, "%s", titleText(type, titles[ret]));

                char temp[100];
                //prompt to boot selected title
                snprintf(temp, sizeof(temp), "%s : %s",text,name[ret]);
                int  choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
                if (choice) {//if they say yes


                    //stop all this stuff before starting the channel

                    CloseXMLDatabase();
                    ExitGUIThreads();
                    ShutdownAudio();
                    StopGX();
                    WII_Initialize();
                    WII_LaunchTitle(TITLE_ID(type,titles[ret]));
                    //this really shouldn't be needed because the title will be booted
                    exit = true;
                    break;
                } else {
                    //if they said no to booting the title
                    ret = -1;
                    optionBrowser3.ResetState();
                }

            } else { //if they clicked a system title
                if (ret == tmp) {
                    CloseXMLDatabase();
                    ExitGUIThreads();
                    ShutdownAudio();
                    StopGX();
                    WII_Initialize();
                    WII_ReturnToSettings();

                } else {
                    //set the title's name, number, ID to text
                    sprintf(text, "%s", titleText(0x00010002, sys_titles[ret-num_titles]));

                    char temp[112];
                    //prompt to boot selected title
					snprintf(temp, sizeof(temp), tr("%s : %s May not boot correctly if your System Menu is not up to date."),text,name[ret]);
                    int  choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
                    if (choice) {//if they say yes


                        //stop all this stuff before starting the channel

                        CloseXMLDatabase();
                        ExitGUIThreads();
                        ShutdownAudio();
                        StopGX();
                        WII_Initialize();
                        WII_LaunchTitle(TITLE_ID(0x00010002,sys_titles[ret-num_titles]));
                        //this really shouldn't be needed because the title will be booted
                        exit = true;
                        break;
                    } else {
                        //if they said no to booting the title
                        ret = -1;
                        optionBrowser3.ResetState();
                    }
                }
            }
        }

        if(infilesize > 0) {

                char filesizetxt[50];
                char temp[50];
                char filepath[100];
//				u32 read = 0;
				
				//make sure there is a folder for this to be saved in
				struct stat st;
                snprintf(filepath, sizeof(filepath), "%s/wad/", bootDevice);
				if (stat(filepath, &st) != 0) {
						if (subfoldercreate(filepath) != 1) {
							WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK"));
						}
					}
				snprintf(filepath, sizeof(filepath), "%s/wad/tmp.tmp", bootDevice);
				

                if (infilesize < MB_SIZE)
                    snprintf(filesizetxt, sizeof(filesizetxt), tr("Incoming file %0.2fKB"), infilesize/KB_SIZE);
                else
                    snprintf(filesizetxt, sizeof(filesizetxt), tr("Incoming file %0.2fMB"), infilesize/MB_SIZE);

                snprintf(temp, sizeof(temp), tr("Load file from: %s ?"), GetIncommingIP());

                int choice = WindowPrompt(filesizetxt, temp, tr("OK"), tr("Cancel"));
		gprintf("\nchoice:%d",choice);

		if (choice == 1) {

			u32 read = 0;
			u8 *temp = NULL;
			int len = NETWORKBLOCKSIZE;
			temp = (u8 *) malloc(infilesize);

						bool error = false;
						u8 *ptr = temp;
						gprintf("\nrecieving shit");
			while (read < infilesize) {

			    ShowProgress(tr("Receiving file from:"), GetIncommingIP(), NULL, read, infilesize, true);

			    if (infilesize - read < (u32) len)
				len = infilesize-read;
			    else
				len = NETWORKBLOCKSIZE;

			    int result = network_read(ptr, len);

			    if (result < 0) {
				WindowPrompt(tr("Error while transfering data."), 0, tr("OK"));
				error = true;
				break;
			    }
			    if (!result) {
				gprintf("\n!RESULT");
				break;
							}
			    ptr += result;
			    read += result;
			}
			ProgressStop();

						char filename[101];
						char tmptxt[200];



						//bool installWad=0;
						if (!error) {
						    gprintf("\nno error yet");

							network_read((u8*) &filename, 100);
							gprintf("\nfilename: %s",filename);

							// Do we need to unzip this thing?
							if (wiiloadVersion[0] > 0 || wiiloadVersion[1] > 4) {
							    gprintf("\nusing newer wiiload version");

								if (uncfilesize != 0) { // if uncfilesize == 0, it's not compressed
								    gprintf("\ntrying to uncompress");
									// It's compressed, uncompress
									u8 *unc = (u8 *) malloc(uncfilesize);
									uLongf f = uncfilesize;
									error = uncompress(unc, &f, temp, infilesize) != Z_OK;
									uncfilesize = f;

									free(temp);
									temp = unc;
								}
							}

							if (!error) {
								sprintf(tmptxt,"%s",filename);
								//if we got a wad
								if (strcasestr(tmptxt,".wad")) {
								    FILE *file = fopen(filepath, "wb");
								    fwrite(temp, 1, (uncfilesize>0?uncfilesize:infilesize), file);
								    fclose(file);

								    sprintf(tmptxt,"%s/wad/%s",bootDevice,filename);
								    if (checkfile(tmptxt))remove(tmptxt);
								    rename(filepath, tmptxt);

								    //check and make sure the wad we just saved is the correct size
								    u32 lSize;
								    file = fopen(tmptxt, "rb");

								    // obtain file size:
								    fseek (file , 0 , SEEK_END);
								    lSize = ftell (file);

								    rewind (file);
								    if (lSize==(uncfilesize>0?uncfilesize:infilesize)) {
									gprintf("\nsize is ok");
									int pick = WindowPrompt(tr(" Wad Saved as:"), tmptxt, tr("Install"),tr("Uninstall"),tr("Cancel"));
									//install or uninstall it
									if (pick==1)
										{
											HaltGui();
											w.Remove(&titleTxt);
											w.Remove(&cancelBtn);
											w.Remove(&wifiBtn);
											w.Remove(&optionBrowser3);
											ResumeGui();

											Wad_Install(file);

											HaltGui();
											w.Append(&titleTxt);
											w.Append(&cancelBtn);
											w.Append(&wifiBtn);
											w.Append(&optionBrowser3);
											ResumeGui();

										}
									if (pick==2)Wad_Uninstall(file);
								    }
								    else gprintf("\nBad size");
								    //close that beast, we're done with it
								    fclose (file);

								    //do we want to keep the file in the wad folder
								    if (WindowPrompt(tr("Delete ?"), tmptxt, tr("Delete"),tr("Keep"))!=0)
									remove(tmptxt);
								    }
								else {
								    WindowPrompt(tr("ERROR:"), tr("Not a WAD file."), tr("OK"));
								    }
							}
						}



			if (error || read != infilesize) {
			    WindowPrompt(tr("Error:"), tr("No data could be read."), tr("OK"));


			}
			if(temp)free(temp);
		}



		CloseConnection();
                ResumeNetworkWait();
        }

        if (cancelBtn.GetState() == STATE_CLICKED) {
            //break the loop and end the function
            exit = true;
            ret = -10;
        }
	else if (screenShotBtn.GetState() == STATE_CLICKED) {
			gprintf("\n\tscreenShotBtn clicked");
			screenShotBtn.ResetState();
			ScreenShot();
			gprintf("...It's easy, mmmmmmKay");
		    }
    }

    CloseConnection();
    if (IsNetworkInit())
        HaltNetworkThread();

    fclose(f);
    HaltGui();
    mainWindow->Remove(&w);
    ResumeGui();

    return ret;
}