Exemple #1
0
void ClosableImage::setLoading(const bool &loading)
{
    m_loading = loading;
    if (loading) {
        setMovie(m_loadingMovie);
        m_image = QByteArray();
        m_imagePath.clear();
        update();
    } else {
        setMovie(0);
    }
}
Exemple #2
0
void HostExplorerDock::start(const int index)
{
    auto label = new QLabel(_tabs);
    auto movie = new QMovie(makeIconPath("loading.gif"), QByteArray(), label);
    label->setMovie(movie);
    movie->start();
    _tabs->tabBar()->setTabButton(index, QTabBar::LeftSide, label);
}
void PixmapListDialog::setImageList( const QList<QByteArray> &list )
{
	contents_image_list = list;

	if ( contents_image_list.size() <= 0 ) return;

	if ( current_image < 0 || current_image > contents_image_list.size() )
	{
		current_image = 0;
		left_icon->setPixmap( QPixmap() );
		left_icon_hover = false;
		if ( contents_image_list.size() > 1 )
		{
			if ( right_icon_hover ) right_icon->setPixmap( right_icon_pixmap_lighter );
			else right_icon->setPixmap( right_icon_pixmap );
		}
	}

	if ( current_image == 0 )
	{
		left_icon->setPixmap( QPixmap() );
		left_icon_hover = false;
	}
	else
	{
		if ( left_icon_hover ) left_icon->setPixmap( left_icon_pixmap_lighter );
		else left_icon->setPixmap( left_icon_pixmap );
	}

	if ( current_image < contents_image_list.size() - 1 )
	{
		if ( right_icon_hover ) right_icon->setPixmap( right_icon_pixmap_lighter );
		else right_icon->setPixmap( right_icon_pixmap );
	}
	else
	{
		right_icon->setPixmap( QPixmap() );
		right_icon_hover = false;
	}

	if ( !resizable )
	{
		int left, top, right, bottom;
		getLabelOffset( left, top, right, bottom );

		QImage tmp_image;
		tmp_image.loadFromData( contents_image_list.at( current_image ) );

		resize( QSize( tmp_image.width() + left + right, tmp_image.height() + top + bottom ) );
		setMovie( contents_image_list.at( current_image ) );
	}
	else
	{
		resized();
	}
}
Exemple #4
0
ImageLabel::ImageLabel(QObject *parent, QString url, int timeToDelay)
{
    //setAttribute(Qt::WA_TranslucentBackground, true);
    this->url=url;
    isImgLoaded =false;
    QMovie*movie=new QMovie(":/app/skin/imgs/loading.gif");
    setMovie(movie);
    QTimer::singleShot(timeToDelay,this,SLOT(getImage()));
    //qDebug()<< url;
}
Exemple #5
0
MoviePlayerWindow::MoviePlayerWindow(Movie *movie, QWidget *parent)
  : QWidget(parent)
  , ui(new Ui::MoviePlayerWindow)
  , m_timer_id(0)
  , m_cur_frame(0)
  , m_paused(false)
{
  ui->setupUi(this);
  setMovie(movie);
}
FullscreenHypnotoad::FullscreenHypnotoad()
    : movie_(new QMovie(":/hypnotoad.gif")) {
  setMovie(movie_);
  setScaledContents(true);

  // White background
  QPalette p(palette());
  p.setColor(QPalette::Window, Qt::white);
  setPalette(p);
}
Exemple #7
0
void ClosableImage::clear()
{
    if (m_anim)
        m_anim->stop();
    m_imagePath.clear();
    m_image = QByteArray();
    m_pixmap = m_emptyPixmap;
    m_loading = false;
    setMovie(0);
    update();
}
Exemple #8
0
void Overlay::setBusy(bool busy)
{
    if (busy)
    {
        setMovie(new QMovie(":/resources/ajax-loader.gif", QByteArray(), this));
        movie()->start();
    }
    else
    {
        delete movie();
    }
}
void LoadingWidget::start(const QString &fileName)
{
    Q_ASSERT(!fileName.isEmpty());

    show();

    if (!m_movie)
        m_movie = new QMovie(fileName, "gif", this);
        setMovie(m_movie);

    if (m_movie->isValid())
        m_movie->start();
}
void Overlay::setBusy(bool busy)
{
	QMovie* mov = movie();
	if (busy) {
		if (!mov) {
			mov = new QMovie(QString(":/Resource/ajax-loader-%1.gif").arg(d.dark ? "dark" : "light"), QByteArray(), this);
			qDebug() << "QMovie supported formats: " << movie()->supportedFormats();
			setMovie(mov);
		}
		mov->start();
	} else {
		delete mov;
	}
}
Exemple #11
0
EmoticonLabel::EmoticonLabel(Emoticon emoticon, QWidget *parent)
  : QLabel(parent)
  , m_ready(false)
{
  QMovie *movie = new QMovie(emoticon->file(), QByteArray(), this);
  setMovie(movie);
  setAlignment(Qt::AlignCenter);

  m_text = emoticon->texts().first();
  setToolTip(LS("<span>") + m_text + LS("</span>"));

  movie->start();

  updateStyleSheet();
}
Exemple #12
0
bool DataMediaWidget::updateWidget(const IDataMediaURI &AUri, const QByteArray &AData)
{
    bool success = false;
    if (AUri.type == MEDIAELEM_TYPE_IMAGE)
    {
        QBuffer *buffer = new QBuffer(this);
        buffer->setData(AData);
        buffer->open(QIODevice::ReadOnly);

        QImageReader reader(buffer);
        if (reader.supportsAnimation())
        {
            QMovie *movie = new QMovie(buffer,reader.format(),this);
            if (movie->isValid())
            {
                success = true;
                setMovie(movie);
                movie->start();
            }
            else
            {
                delete movie;
            }
        }
        else
        {
            QPixmap pixmap;
            pixmap.loadFromData(AData,reader.format());
            if (!pixmap.isNull())
            {
                success = true;
                setPixmap(pixmap);
            }
        }
        if (success)
        {
            setFrameShape(QLabel::NoFrame);
            setFrameShadow(QLabel::Plain);
            disconnect(FDataForms->instance());
            emit mediaShown();
        }
        else
        {
            delete buffer;
        }
    }
    return success;
}
Exemple #13
0
/*
	OnButtonDown -- walks through hotspot list.  For each hotspot,
		uses PtInRect to see if its in the rect.  If it is, it uses
		VwrCommand to transmit the hotspot's command to viewer.  Then
		it looks at the Stop/Continue/Jump to setting and uses the return
		value to handle Stop and Continue, or calls setMovie to do a
		jump.
*/ 
BOOL OnButtonDown(PMOVIEINFO pMovieInfo, USHORT msg, USHORT wp, LONG lp)
{
    PHOTSPOT pHotspot;
    DWORD dwFrame;                      
    POINT pt;
    HWND hwnd;
    
    if (!pMovieInfo)
        return FALSE;
    
    pHotspot = pMovieInfo->pHotspotList;
    pt = MAKEPOINT(lp);
    dwFrame = GetMovieFrame(pMovieInfo);
    
    while (pHotspot)
        {        
        if (dwFrame >= pHotspot->BeginFrame && dwFrame <= pHotspot->EndFrame)
            {
            if (PtInRect(&pHotspot->rc, pt) != 0)
                {                
                hwnd = GetParent(pMovieInfo->hwndParent);
                if (!hwnd)
                    hwnd = pMovieInfo->hwndParent;
                VwrCommand(VwrFromHinst(GetWindowWord(hwnd, GWW_HINSTANCE)),
                                NULL, pHotspot->pszCommand, cmdoptNONE);
                switch (pHotspot->OnClick)
                    {
                    case ID_CONTINUE:
                        return (TRUE);                        
                    case ID_STOP:
                        return (FALSE);
                    case ID_JUMP:
                        setMovie(pMovieInfo, pHotspot->ToFrame, NULL);
                        pMovieInfo->dwCurrentFrame = pHotspot->ToFrame;
                        pMovieInfo->fPlaying = FALSE;
                        playMovie(pMovieInfo, 1);
                        return (TRUE);                        
                    default:
                        return (TRUE);                                            
                    }                                
                }
            }
        pHotspot = pHotspot->pNext;                        
        }
    return (TRUE);        
}
void PixmapListDialog::resized()
{
	if ( current_image >= 0 && contents_image_list.size() > 0 && current_image <= contents_image_list.size() - 1 )
	{
		if ( current_image == 0 )
		{
			left_icon->setPixmap( QPixmap() );
			left_icon_hover = false;
		}
		else
		{
			if ( left_icon_hover ) left_icon->setPixmap( left_icon_pixmap_lighter );
			else left_icon->setPixmap( left_icon_pixmap );
		}

		if ( current_image < contents_image_list.size() - 1 )
		{
			if ( right_icon_hover ) right_icon->setPixmap( right_icon_pixmap_lighter );
			else right_icon->setPixmap( right_icon_pixmap );
		}
		else
		{
			right_icon->setPixmap( QPixmap() );
			right_icon_hover = false;
		}

		setMovie( contents_image_list.at( current_image ) );

		if ( current_image >= 0 && contents_name_list.size() > 0 && current_image <= contents_name_list.size() - 1 )
		{
			title->setText( contents_name_list.at( current_image ) );
		}
		else
		{
			title->setText( "" );
		}
	}

	left_icon->update();
	right_icon->update();
	title->update();
	background_label->update();
	label->resize( background_label->size() );
	label->update();
}
EmoticonLabel::EmoticonLabel(const QString &emoticonText, const QString &pixmapPath, QWidget *parent, const char *name)
	: QLabel(parent,name)
{
	mText = emoticonText;
	setMovie( QMovie(pixmapPath) );
	setAlignment(Qt::AlignCenter);
	QToolTip::add(this,emoticonText);
	// Somehow QLabel doesn't tell a reasonable size when you use setMovie
	// although it does it correctly for setPixmap. Therefore here is a little workaround
	// to tell our minimum size.
	QPixmap p(pixmapPath);
    //
    // Some of the custom icons are rather large
    // so lets limit them to a maximum size for this display panel
    //
    if (p.width() > 32 || p.height() > 32)
        p.resize(32, 32);
	setMinimumSize(p.size());
}
bool QLabel::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setText((const QString&)static_QUType_QString.get(_o+1)); break;
    case 1: setPixmap((const QPixmap&)*((const QPixmap*)static_QUType_ptr.get(_o+1))); break;
    case 2: setPicture((const QPicture&)*((const QPicture*)static_QUType_ptr.get(_o+1))); break;
    case 3: setMovie((const QMovie&)*((const QMovie*)static_QUType_ptr.get(_o+1))); break;
    case 4: setNum((int)static_QUType_int.get(_o+1)); break;
    case 5: setNum((double)static_QUType_double.get(_o+1)); break;
    case 6: clear(); break;
    case 7: acceleratorSlot(); break;
    case 8: buddyDied(); break;
    case 9: movieUpdated((const QRect&)*((const QRect*)static_QUType_ptr.get(_o+1))); break;
    case 10: movieResized((const QSize&)*((const QSize*)static_QUType_ptr.get(_o+1))); break;
    default:
	return QFrame::qt_invoke( _id, _o );
    }
    return TRUE;
}
void RegisterNotifierIcon::onRegisterCountChanged(int count)
{
	if(count == 0)
	{
		//setEnabled(false);
		m_RegisterMovie->stop();
		setPixmap(m_Icon);
	}
	else
	{
		//setEnabled(true);
//		QPoint currentPos = pos();
//		if(parent() != NULL)
//			currentPos += ( (QWidget*)parent() )->pos();
//		QToolTip::showText(currentPos, tr("еÄ×¢²áÇëÇó"));
		m_RegisterMovie->start();
		setMovie(m_RegisterMovie);
	}
	setToolTip(tr("×¢²áÇëÇóÊý:") + QString::number(count));
	m_UnhandledCount = count;
}
Exemple #18
0
/*
	OnButtonDown -- walks through hotspot list.  For each hotspot,
		uses PtInRect to see if its in the rect.  If it is, it uses
		VwrCommand to transmit the hotspot's command to viewer.  Then
		it looks at the Stop/Continue/Jump to setting and uses the return
		value to handle Stop and Continue, or calls setMovie to do a
		jump.
*/ 
BOOL OnButtonDown(PMOVIEINFO pMovieInfo, USHORT msg, USHORT wp, LONG lp)
{
	PHOTSPOT pHotspot;
	DWORD dwFrame;
	POINT pt;

	if (!pMovieInfo)
		return FALSE;
	pHotspot = pMovieInfo->pHotspotList;
	pt = MAKEPOINT(lp);
	dwFrame = GetMovieFrame(pMovieInfo);
	while (pHotspot)
	{
		if (dwFrame >= pHotspot->BeginFrame && dwFrame <= pHotspot->EndFrame)
		{
			if (PtInRect(&pHotspot->rc, pt) != 0)
			{
				FireHspClick(pMovieInfo->hctl, pHotspot);
				switch (pHotspot->OnClick)
				{
				case ID_CONTINUE:
					return (TRUE);
				case ID_STOP:
					return (FALSE);
				case ID_JUMP:
					setMovie(pMovieInfo, pHotspot->ToFrame, NULL);
					pMovieInfo->dwCurrentFrame = pHotspot->ToFrame;
					pMovieInfo->fPlaying = FALSE;
					playMovie(pMovieInfo, 1);
					return (TRUE);
					default:
					return (TRUE);
				}
			}
		}
		pHotspot = pHotspot->pNext;
	}
	return (TRUE);
}
Exemple #19
0
void MyView::busyMessage(TQString mssge,bool reset)
{
if (reset) openTasks=0;
if (!mssge.isEmpty())
{
openTasks++;
TQToolTip::remove(this);
TQToolTip::add(this, mssge);
setMovie(TQMovie(locate("appdata","pics/kgpg_docked.gif")));
}
else openTasks--;

//kdDebug(2100) << "Emit message: "<<openTasks<<endl;

if (openTasks<=0)
{
setPixmap( KSystemTray::loadIcon("kgpg_docked"));
TQToolTip::remove(this);
TQToolTip::add(this, i18n("KGpg - encryption tool"));
openTasks=0;
}
}
FindSubtitlesWindow::FindSubtitlesWindow( QWidget * parent, Qt::WindowFlags f )
	: QDialog(parent,f)
{
	setupUi(this);

	set = 0; // settings

	subtitles_for_label->setBuddy(file_chooser->lineEdit());

	progress->hide();

	connect( file_chooser, SIGNAL(fileChanged(QString)),
             this, SLOT(setMovie(QString)) );
	connect( file_chooser->lineEdit(), SIGNAL(textChanged(const QString &)),
             this, SLOT(updateRefreshButton()) );

	connect( refresh_button, SIGNAL(clicked()),
             this, SLOT(refresh()) );

	connect( download_button, SIGNAL(clicked()),
             this, SLOT(download()) );

	/*
	connect( language_filter, SIGNAL(editTextChanged(const QString &)),
             this, SLOT(applyFilter(const QString &)) );
	*/
	connect( language_filter, SIGNAL(activated(int)),
             this, SLOT(applyCurrentFilter()) );

	table = new QStandardItemModel(this);
	table->setColumnCount(COL_USER + 1);

	proxy_model = new QSortFilterProxyModel(this);
	proxy_model->setSourceModel(table);
	proxy_model->setFilterKeyColumn(COL_LANG);
	proxy_model->setFilterRole(Qt::UserRole);

	view->setModel(proxy_model);
	view->setRootIsDecorated(false);
	view->setSortingEnabled(true);
	view->setAlternatingRowColors(true);
	view->header()->setSortIndicator(COL_LANG, Qt::AscendingOrder);
	view->setEditTriggers(QAbstractItemView::NoEditTriggers);
	view->setContextMenuPolicy( Qt::CustomContextMenu );

	connect(view, SIGNAL(activated(const QModelIndex &)),
            this, SLOT(itemActivated(const QModelIndex &)) );
	connect(view->selectionModel(), SIGNAL(currentChanged(const QModelIndex &,const QModelIndex &)),
            this, SLOT(currentItemChanged(const QModelIndex &,const QModelIndex &)) );

	connect(view, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(showContextMenu(const QPoint &)) );

	downloader = new SimpleHttp(this);

	connect( downloader, SIGNAL(downloadFailed(QString)),
             this, SLOT(showError(QString)) );
	connect( downloader, SIGNAL(downloadFinished(QByteArray)), 
             this, SLOT(downloadFinished()) );
	connect( downloader, SIGNAL(downloadFinished(QByteArray)), 
             this, SLOT(parseInfo(QByteArray)) );
	connect( downloader, SIGNAL(stateChanged(int)),
             this, SLOT(updateRefreshButton()) );

	connect( downloader, SIGNAL(connecting(QString)),
             this, SLOT(connecting(QString)) );
	connect( downloader, SIGNAL(dataReadProgress(int, int)),
             this, SLOT(updateDataReadProgress(int, int)) );

#ifdef DOWNLOAD_SUBS
	include_lang_on_filename = true;

	file_downloader = new FileDownloader(this);
	file_downloader->setModal(true);
	connect( file_downloader, SIGNAL(downloadFailed(QString)),
             this, SLOT(showError(QString)), Qt::QueuedConnection );
	connect( file_downloader, SIGNAL(downloadFinished(const QByteArray &)),
             this, SLOT(archiveDownloaded(const QByteArray &)), Qt::QueuedConnection );
#endif

	// Actions
	downloadAct = new QAction(this);
	downloadAct->setEnabled(false);
	connect( downloadAct, SIGNAL(triggered()), this, SLOT(download()) );

	copyLinkAct = new QAction(this);
	copyLinkAct->setEnabled(false);
	connect( copyLinkAct, SIGNAL(triggered()), this, SLOT(copyLink()) );

	context_menu = new QMenu(this);
	context_menu->addAction(downloadAct);
	context_menu->addAction(copyLinkAct);

	retranslateStrings();

	language_filter->setCurrentIndex(0);
}
void FindSubtitlesWindow::refresh() {
	last_file = "";
	setMovie(file_chooser->text());
}
Exemple #22
0
/*
	FileOpen -- uses GetOpenFileName to prompt user for AVI and HOT
		filenames.  Uses fileOpenMovie to load the AVI file, and
		playMovie and setMovie and MCI_WHERE to get it into the window
		and on the first frame.  Uses InitHotspots() to load
		hotspot file.
*/
BOOL FileOpen(HWND hWnd)
{    
    static OPENFILENAME ofn;
    char szBuf[129];
    char szFileName[MAXFILENAME] = "";
    char szFileTitle[MAXFILENAME] = "";
    char szFilterSpec [128] =                       /* file type filters */
             "AVI Files (*.AVI)\0*.AVI\0All Files (*.*)\0*.*\0";
    char szFilterSpec2 [128] = 
            "Hotspot Files (*.HOT)\0*.HOT\0All Files (*.*)\0*.*\0";

    ofn.lStructSize       = sizeof(OPENFILENAME);
    ofn.hwndOwner         = hWnd;
    ofn.lpstrFilter       = szFilterSpec;
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter    = 0;
    ofn.nFilterIndex      = 1;
    ofn.lpstrFile         = szFileName;
    ofn.nMaxFile          = MAXFILENAME;
    ofn.lpstrInitialDir   = NULL;
    ofn.lpstrFileTitle    = szFileTitle;
    ofn.nMaxFileTitle     = MAXFILENAME;
    ofn.lpstrTitle        = "Open AVI File";
    ofn.lpstrDefExt       = "AVI";
    ofn.Flags             = 0;
    
    if (!GetOpenFileName ((LPOPENFILENAME)&ofn))
            return FALSE;    
    
    if (pMovieInfo)                                     // get rid of old stuff if there is
        {
        fileCloseMovie(pMovieInfo, TRUE);
        DeleteHotspotList(pMovieInfo);
        FREE(pMovieInfo);
        }
            
    lstrcpy(szWindowTitle, szBaseWindowTitle);
                    lstrcat(szWindowTitle, " - ");
                    lstrcat(szWindowTitle, szFileTitle);
    
    SetWindowText(hWnd, szWindowTitle);                
    
    {	// added SetProp to accomodate new drawproc
    	HANDLE hglb;
    	
    	hglb = GlobalAlloc(GHND,(DWORD)(sizeof(MOVIEINFO)));
    	if (hglb)
    	{
    		pMovieInfo = (PMOVIEINFO) GlobalLock(hglb);
    	}
    	else
    	{
    		pMovieInfo = NULL;
    	}
    	//pMovieInfo = (PMOVIEINFO) ((hglb = GlobalAlloc(GHND, (DWORD)(sizeof(MOVIEINFO)))) ? GlobalLock(hglb) : NULL);

	    if (!pMovieInfo)
	        return (FALSE);

	    pMovieInfo->hwndParent = hWnd;
	    lstrcpy(pMovieInfo->szAVIFileName, ofn.lpstrFile);

	    fileOpenMovie(pMovieInfo, ofn.lpstrFile);    
   	    SetProp(hWnd, (LPSTR) szMovieInfo,hglb);    
	    SetProp(pMovieInfo->hwndMovie, (LPSTR) szMovieInfo, hglb);
{ char a[256];wsprintf(a,"wnd1 %X wnd2 %X\n",hWnd,pMovieInfo->hwndMovie); OutputDebugString(a);}
    }
    //playMovie(pMovieInfo, 0);		// screws up drawproc for some reason
	{
		MCI_DGV_SETVIDEO_PARMS	dgv;
		UINT					uDevice;
		dgv.dwValue = (DWORD) ICAVIDrawProc;
			//MakeProcInstance((FARPROC) ICAVIDrawProc,hInstApp);
		dgv.dwItem = MCI_AVI_SETVIDEO_DRAW_PROCEDURE;
		uDevice = pMovieInfo->wMCIDeviceID;
		if (uDevice)
		{
			DWORD dw;
								
			dw = mciSendCommand(uDevice,
			MCI_SETVIDEO,
			MCI_DGV_SETVIDEO_ITEM | MCI_DGV_SETVIDEO_VALUE,
			(DWORD) (MCI_DGV_SETVIDEO_PARMS FAR *)&dgv);
			OutputDebugString("set draw proc!\n");
			if (dw != 0)
			{
				MessageBox(GetFocus(),
					"The currently installed MCIAVI does not "
					"support the MCI_AVI_SETVIDEO_DRAW_PROCEDURE "
					"command during play.","MCI Problem",
					MB_OK | MB_ICONHAND);
			}
		}
		else
		{
			MessageBox(GetFocus(),"movie info has no device id",
				"real bummer",MB_OK);
		}
	}    
    setMovie(pMovieInfo, pMovieInfo->dwCurrentFrame, NULL);
    {
    RECT rcClient, rcWindow;      //rcMovieBounds, rc
    MCI_DGV_RECT_PARMS   mciRect;
    BOOL retcode = TRUE;
    
    /* if there is no movie yet then just get out of here */
    GetClientRect(hWnd, &rcClient);  /* get the parent windows rect */
    GetWindowRect(hWnd, &rcWindow);
    mciSendCommand(pMovieInfo->wMCIDeviceID, MCI_WHERE,
                  (DWORD)(MCI_DGV_WHERE_SOURCE),
                  (DWORD)(LPMCI_DGV_RECT_PARMS)&mciRect);
    
    }
    
    pMovieInfo->fPlaying = FALSE;

    bFileLoaded = TRUE;
    wsprintf(szBuf, "%ld of %ld", pMovieInfo->dwCurrentFrame,
                    pMovieInfo->dwMovieLength);
    SetDlgItemText(hwndDlg, ID_CURRENTFRAME, szBuf);
    
    // now try opening a HOT file
    
    memset(szFileName, 0, sizeof(szFileName));
    memset(szFileTitle, 0, sizeof(szFileTitle));
    memset(&ofn, 0, sizeof(OPENFILENAME));
    
    ofn.lStructSize       = sizeof(OPENFILENAME);
    ofn.hwndOwner         = hWnd;
    ofn.lpstrFilter       = szFilterSpec2;
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter    = 0;
    ofn.nFilterIndex      = 1;
    ofn.lpstrFile         = szFileName;
    ofn.nMaxFile          = MAXFILENAME;
    ofn.lpstrInitialDir   = NULL;
    ofn.lpstrFileTitle    = szFileTitle;
    ofn.nMaxFileTitle     = MAXFILENAME;
    ofn.lpstrTitle        = "Open Hotspot File";
    ofn.lpstrDefExt       = "HOT";
    ofn.Flags             = 0;
    
    if (!GetOpenFileName ((LPOPENFILENAME)&ofn))
            return TRUE;
    
    lstrcpy(pMovieInfo->szIniFileName, ofn.lpstrFile);
    InitHotspots(pMovieInfo, ofn.lpstrFile);
    if (pMovieInfo->pHotspotList && pMovieInfo->hwndMovie)                    
        {
        HDC hDC;
        
        hDC = GetDC(pMovieInfo->hwndMovie);
        DrawRects(hDC, pMovieInfo);            
        ReleaseDC(pMovieInfo->hwndMovie, hDC);
        }
    return TRUE;
}
Exemple #23
0
int addMovie(eMovie *movie,int length)
{
    int retorno = -1;
    int codeAux;
    char titleAux[50];
    char descriptionAux[1000];
    char genreAux[30];
    int ratingAux;
    int durationAux;
    char linkAux[300];
    int freeIndex;

    if(movie!=NULL && length>0)
    {

        freeIndex = searchFreePlace(movie,QTY);//si status==0 retorna el indice, sino 1.
        //printf("%d",freeIndex);
        if(freeIndex==-1)
        {
            printf("No hay mas espacio\n");
            //break; //cdo estaba en el case del main
        }

        codeAux=getValidInt("Ingrese codigo de pelicula: \n","Ingrese codigo numerico\n",1,1000);
        if(searchInt(movie,QTY,codeAux)!=-1)
        {
            printf("El codigo ya existe\n");
            // break;
        }
        else
        {
        getValidString("Ingrese titulo de la pelicula: \n","El titulo tiene que ser alfabetico",titleAux);

        fflush(stdin);

        getValidString("Ingrese descripcion de la pelicula: \n","La descripcion tiene que ser alfabetica",descriptionAux);
        fflush(stdin);
        getValidString("Ingrese genero de la pelicula: \n","El genero tiene que ser alfabetico",genreAux);
        fflush(stdin);
        durationAux=getValidInt("Ingrese duracion total en minutos :\n","Ingrese datos numericos",30, 500);
        fflush(stdin);
        ratingAux = getValidInt("Ingrese puntuacion :\n","Ingrese datos numericos",1, 100);
        fflush(stdin);
        //printf("LINK : %s",linkAux);
        system("pause");
        getStringL("Ingrese link de la pelicula: \n",linkAux);
        printf("link : %s\n",linkAux);
        fflush(stdin);
        setMovie(movie,freeIndex,codeAux,titleAux,descriptionAux,genreAux,durationAux,ratingAux,linkAux);
        printf("\nTitulo %s\nDuracion %d\n%s\n%s\n %d\n", movie[freeIndex].title,movie[freeIndex].duration,movie[freeIndex].description,movie[freeIndex].genre,movie[freeIndex].status);
        retorno=0;

        }



    }
    return retorno;


}
Exemple #24
0
BusyWidget::BusyWidget(QWidget *parent)
    : QLabel(parent), _animation(":/icons/loading.gif")
{
    setMovie(&_animation);
}
void ScheduleManager::registerSchedule()
{
	enum ScheduleManagerFunction
	{
		SET_SCREEN = 1,
		SET_DATE,
		SET_MOVIE,
		SET_TIME,
		REGISTER_SCHEDULE,
	};

	for (Schedule schedule;;)
	{
		system("cls");
		cout <<
			"극장 관리 시스템\n"
			" > 상영 일정 관리\n"
			"  > 상영 일정 등록\n"
			"\n";

		if (0 != schedule.screen.getNumber()
			|| 0 != schedule.date.getValue()
			|| 0 != schedule.movie.getCode()
			|| 0 != schedule.getStartTime())
		{
			cout << "새 스케쥴\n";
			if (0 != schedule.screen.getNumber())
			{
				schedule.screen.show();
			}
			if (0 != schedule.date.getValue())
			{
				schedule.date.show();
			}
			if (0 != schedule.movie.getCode())
			{
				schedule.movie.show();
			}
			if (0 != schedule.getStartTime())
			{
				schedule.showTime();
			}
			cout << endl;
		}
				
		cout <<
			"1. 상영관 설정\n"
			"2. 날짜 설정\n"
			"3. 영화 설정\n"
			"4. 시간 설정\n"
			"5. 새 스케쥴 등록\n"
			"0. 종료\n"
			"\n"
			"선택: ";

		int32_t function = 0;
		switch (inputPositiveInteger(function))
		{
		case FUNCTION_CANCEL:
			return;
		case FUNCTION_ERROR:
			cout << "\n잘못된 입력입니다.\n";
			system("pause");
			continue;
		case FUNCTION_SUCCESS:
			switch (function)
			{
			case SET_SCREEN:
				setScreen(schedule.screen);
				continue;
			case SET_DATE:
				setDate(schedule.date);
				continue;
			case SET_MOVIE:
				setMovie(schedule.movie);
				continue;
			case SET_TIME:
				cout << endl;
				if (0 == schedule.screen.getNumber())
				{
					cout << "상영관을 선택하지 않았습니다.\n";
				}
				else if (0 == schedule.date.getValue())
				{
					cout << "상영일을 선택하지 않았습니다.\n";
				}
				else if (0 == schedule.movie.getCode())
				{
					cout << "영화를 선택하지 않았습니다.\n";
				}
				else
				{
					setTime(schedule);
					continue;
				}
				system("pause");
				continue;
			case REGISTER_SCHEDULE:
				if (0 == schedule.getStartTime())
				{
					cout << "\n상영 시간을 입력하지 않았습니다.\n";
					system("pause");
					continue;
				}
			}
		}

		SQLWCHAR scheduleSql[BUFSIZ];
		swprintf_s(scheduleSql, L""
			"INSERT INTO d%d "
			"(movie_code, movie_title, age, start_time, end_time, screen) "
			"VALUES (?, ?, ?, ?, ?, ?);",
			schedule.date.getValue());
		SQLWCHAR seatSql[BUFSIZ];
		swprintf_s(seatSql, L"SELECT * INTO d%ds%dt%d FROM screen%d;",
			schedule.date.getValue(), schedule.screen.getNumber(), schedule.getStartTime(),
			schedule.screen.getNumber());

		if (SQL_SUCCESS == schedule.bindParameter()
			&& SQL_SUCCESS == schedule.execute(MDF_SCHEDULE, scheduleSql)
			&& SQL_SUCCESS == schedule.execute(MDF_SEAT, seatSql))
		{
			schedule.initialize();
			cout << "\n상영 일정이 등록 되었습니다.\n";
		}
		else
		{
			cout << "\n상영 일정 등록을 실패했습니다.\n";
		}
		system("pause");
	}
}
Exemple #26
0
void QLabelImage::showLoadingPixmap()
{ 
    setMovie(loadingMovie);
    loadingMovie->start();
}
Exemple #27
0
bool imageViewer::openImage(QString &filename,QString start,bool ask,bool showMessage,bool emitSignal,bool fromCache)
{
  QImage tempImage;
  QFile fi(filename);
  QFileInfo finf(filename);
  QString cacheFileName;
  jp2IO jp2;
  displayMBoxEvent *stmb=0;
  editorScene ed;
  bool success=false;
  bool cacheHit=false;



  if(activeMovie)
  {
    activeMovie=false;
    qm.stop();
  }
  if (filename.isEmpty()&&!ask) return false;
  if(ask)
  {
    dirDialog dd((QWidget *)this,"Browse");
    filename=dd.openFileName(start,"*");
  }
  if(filename.isEmpty())
  {
    imageFileName="";
    return false;
  }

  if(fromCache)
  {
    cacheFileName=finf.absolutePath()+"/cache/"+finf.baseName()+finf.created().toString()+".png";
    if(tempImage.load(cacheFileName))
    {
      cacheHit=true;
      success=true;
      orgWidth=tempImage.text("orgWidth").toInt();
      orgHeight=tempImage.text("orgHeight").toInt();
    }
  }
  if(!success)
  {
    if(tempImage.load(filename))
    {
      success=true;
    }
    else if(ed.load(fi))
    {
      success=true;
      tempImage=QImage(ed.renderImage(0,0)->copy());
    }
    else if(jp2.check(filename))
    {
      tempImage=jp2.decode(filename);
      if(!tempImage.isNull())
      {
        success=true;
      }
    }
  }

  if(!success)
  {
    if(showMessage)
    {
      stmb= new displayMBoxEvent("Image Loader",QString("Unable to load image:\n%1").arg(filename));
      QApplication::postEvent( dispatcherPtr, stmb );  // Qt will delete it when done
    }
    validImage=false;
    imageFileName="";
    return false;
  }

  if(fromCache)
  {
    sourceImage=QImage();

    if(!cacheHit)
    {
      orgWidth=tempImage.width();
      orgHeight=tempImage.height();
      tempImage=tempImage.scaledToWidth(120, Qt::FastTransformation);
      // save cacheImage for next time
      tempImage.setText("orgWidth",QString::number(orgWidth));
      tempImage.setText("orgHeight",QString::number(orgHeight));
      tempImage.save(cacheFileName,"PNG");
    }
    displayedImage=tempImage;
  }
  else
  {
    sourceImage=tempImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
    orgWidth=tempImage.width();
    orgHeight=tempImage.height();
    displayedImage=sourceImage;
  }

  imageFileName=filename;

  QFileInfo finfo(filename);
  if (finfo.suffix().toLower()=="gif")
  {
    //we will try a animated gif
    qm.setFileName(filename);
    if(qm.isValid())
    {
      if(qm.frameCount()>1)
      {
        activeMovie=true;
        setMovie(&qm);
        qm.start();
        displayedImage=QImage();
      }
      else
      {
        displayImage();  // we have a single image gif
      }
    }
  }
  else
  {
    displayImage();
  }
  validImage=true;
  if (emitSignal) emit imageChanged();
  return true;
}