My Media Player BETA 1.1, Corretto qualche bug e aggiunta nuova funzione!

« Older   Newer »
  Share  
Gianlu-thebest
CAT_IMG Posted on 14/3/2010, 14:25     +1   -1




Ciao a tutti ho finito l'ultima beta di my media player, ho corretto alcuni bug e ciuccia un po meno di cpu ma in più due nuove funzioni:

SLIDER FUNZIONANTE
CONFIGURAZIONE INIZIALE PERFEZIONATA


SPOILER (click to view)
CODICE
#Region include
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <SliderConstants.au3>
#include <GUISlider.au3>
#include <audio.au3>
#include <func.au3>
#include <file.au3>
#EndRegion include
#NoTrayIcon
Global $ex
#Region Configurazione
If Not FileExists("conf.ini") Or Not FileExists("pic")        Then
       MsgBox(0,"Configurazione","Premere OK per iniziare la configurazione...")
       ProgressOn("Configurazione","Configurazione in corso... Attendere...")
       If Not FileExists("conf.ini") Then
               _FileCreate("conf.ini")
               $ex=False
               EndIf
       Sleep(500)
       ProgressSet(5)
       If $ex = False Then
       IniWrite("conf.ini","Trasparenza","trasparenza",255)
       EndIf
       ProgressSet(10)
       Sleep(500)
       ProgressSet(15)
       If Not FileExists("pic") Then
       DirCreate("pic")
       InetGet("HTTP://fileinternealt.altervista.org/File/mmp.bmp","pic\mmp.bmp")
       If $ex = False Then
       IniWrite("conf.ini","Messaggio","novita'","no")
       EndIf
       ProgressSet(20,"Scaricamento file...")
       InetGet("HTTP://fileinternealt.altervista.org/File/play.bmp","pic\play.bmp")
       ProgressSet(35)
       InetGet("HTTP://fileinternealt.altervista.org/File/stop.bmp","pic\stop.bmp")
       ProgressSet(45)
       InetGet("HTTP://fileinternealt.altervista.org/File/pause.bmp","pic\pause.bmp")
       ProgressSet(55)
       InetGet("HTTP://fileinternealt.altervista.org/File/close.bmp","pic\close.bmp")
       ProgressSet(65)
       InetGet("HTTP://fileinternealt.altervista.org/File/icona.ico","icona.ico")
       ProgressSet(75)
       InetGet("HTTP://fileinternealt.altervista.org/File/novità.txt","novità.txt")
       ProgressSet(85)
       InetGet("HTTP://fileinternealt.altervista.org/File/novita'.txt","novita'.txt")
       ProgressSet(95)
       InetGet("HTTP://fileinternealt.altervista.org/File/skin.bmp","pic\skin.bmp")
       EndIf
       ProgressOff()
       MsgBox(0,"Attendere...","Configurazione completata, attendere...",2)
       Sleep(1000)
EndIf
#EndRegion Configurazione

;==================================================================================================================================
; INI INI INI

$trasparenza = IniRead("conf.ini","Trasparenza","trasparenza","")
$messaggio = IniRead("conf.ini","Messaggio","novita'","")

;==================================================================================================================================
;        messaggi

If $messaggio = "no" Then
       $messaggio_file = FileRead("Novita'.txt")
       MsgBox(0,"Novità",$messaggio_file)
       IniWrite("conf.ini","Messaggio","novita'","si")
EndIf

;==================================================================================================================================
; Variabili
Global Const $colore = 0x0034ac
Global Const $desktop = @DesktopHeight
Global Const $colore2 = 0x87d2ee
$4 = ''

#Region GUI


$Gui = GUICreate("My Media Player 2 BETA 1.1", 800, 630,10,10,BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX))
GUISetIcon(@ScriptDir & "\icona.ico")

$skin = GUICtrlCreatePic("pic\skin.bmp",0,0,800,630)
GUICtrlSetState(-1,128)
GUICtrlSetResizing($skin,1)

;==================================================================================================================================
;~ Creazione menu

$menu_file = GUICtrlCreateMenu("File")
       $menu_file_open = GUICtrlCreateMenuItem("Apri file",$menu_file)
       $menu_file_space = GUICtrlCreateMenuItem("",$menu_file)
       $menu_file_exit = GUICtrlCreateMenuItem("Esci",$menu_file)

$menu_opzioni = GUICtrlCreateMenu("Opzioni")
       $menu_opzioni_trans_on = GUICtrlCreateMenuItem("Attiva trasparenza",$menu_opzioni)
       $menu_opzioni_trans_off = GUICtrlCreateMenuItem("Disattiva trasparenza",$menu_opzioni)
       $menu_opzioni_space =GUICtrlCreateMenuItem("",$menu_opzioni)
       $menu_opzioni_ripristino = GUICtrlCreateMenuItem("Ripristina Impostazioni",$menu_opzioni)

$menu_help = GUICtrlCreateMenu("?")
       $menu_help_Info = GUICtrlCreateMenuItem("Info",$menu_help)
       $menu_help_changelog = GUICtrlCreateMenuItem("Changelog",$menu_help)
;~         $menu_help_agg = GUICtrlCreateMenuItem("Controlla aggiornamenti",$menu_help)

;==================================================================================================================================
;~ Creazione LABEL

GUICtrlCreateLabel('Benvenuti su my Media player!',300,20)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
$b = GUICtrlCreateLabel("Artista: ",50,250)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
$c = GUICtrlCreateLabel("Titolo: " ,50,275)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
$d = Guictrlcreatelabel("Album: ",50,300)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
GUICtrlCreateLabel("Durata: ",50,325)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
GUICtrlCreateLabel("Volume: ",400,530)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
GUICtrlCreateLabel("Stato: ",50,350)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
GUICtrlCreateLabel("File: ",50,225)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlSetBkColor(-1,-2)

;==================================================================================================================================
;~ Creazione Bottoni

$5 = GUICtrlCreateButton("Apri File",200,20)

;~ Immagini

$0 = GUICtrlCreatePic("pic\mmp.bmp",5,5,90,90)
$1 = GUICtrlCreatePic("pic\play.bmp",300,535,50,50)
$2 = GUICtrlCreatePic("pic\stop.bmp",250,535,50,50)
$3 = GUICtrlCreatePic("pic\pause.bmp",350,535,50,50)
$6 = GUICtrlCreatePic("pic\close.bmp",200,535,50,50)
$10 = GUICtrlCreateIcon("icona.ico",-1,470,10,50,50)


;~ Creazione Input
$inputvolume = GUICtrlCreateInput("",445,527,40,20)
$inputdurata = GUICtrlCreateInput("",100,325,100,20)
$inputstato = GUICtrlCreateInput("Apri un file!",100,350)
$file = GUICtrlCreateInput("Nessuno",100,225,100,20)

;~ Creazione slider
$slider = GUICtrlCreateSlider(410,550,180,25,$TBS_NOTICKS)
GUICtrlSetBkColor($slider,$colore)

$sliderd=_GUICtrlSlider_Create($GUI,10,375,200,30)
_GUICtrlSlider_SetToolTips(-1,"Progresso canzone")

; Stato Comandi e GUI
GUISetState(@SW_SHOW,$GUI)

If $desktop = 768 Then
WinMove("My Media Player","Durata:",0,103)
ElseIf $desktop = 864 Then
WinMove("My Media Player","Durata:",0,200)
ElseIf $desktop = 960 Then
WinMove("My Media Player","Durata:",0,298)
EndIf

;        altro...

WinSetTrans("My Media Player","Durata:",$trasparenza)


#EndRegion GUI

GUICtrlSetData($slider,60)

#Region Tip
GUICtrlSetTip($1,"Play")
GUICtrlSetTip($2,"Stop")
GUICtrlSetTip($3,"Pausa")
GUICtrlSetTip($6,"Chiude un file musicale")
GUICtrlSetTip($10,"My Media Player 2")
GUICtrlSetTip($5,"Apre un file multimediale")
GUICtrlSetTip($slider,"Regola il volume")
GUICtrlSetTip($inputstato,"Stato della canzone")
#EndRegion Tip

$var=1

#Region While
While 1
       GUICtrlSetData($inputdurata, _Soundlength($4) & " / " & _SoundPos($4))
       _volume()
       _GUICtrlSlider_SetPos($sliderd,_SoundPos($4,2))
       
       _MSG()

WEnd

#EndRegion While

;======================================================================================================================================================================================================================================================

#Region Func


Func _artist()
                       If FileExists($4) Then
                       _SoundClose($4)
               $4 = FileOpenDialog("Apri Canzone",@UserProfileDir & "\Documenti\Musica",'All(*.*)|Audio(*.mp3)|Audio(*.wma)|Audio(*.wav)')
                       $artist1 = _GetExtProperty($4, 16)
                       $title1 = _GetExtProperty($4, 10)
                       $album1 = _GetExtProperty($4, 17)
                       GUICtrlDelete($b)
                       GUICtrlDelete($c)
                       GUICtrlDelete($d)
                       If $artist1 = 0 Then
                       $b = GUICtrlCreateLabel("Artista: Sconosciuto",50,250)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               Else
                       $b = GUICtrlCreateLabel("Artista: "&$artist1,50,250)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               EndIf
                       If $title1 = 0 Then
                       $c = GUICtrlCreateLabel("Titolo: Sconosciuto",50,275)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               Else
                       $c = GUICtrlCreateLabel("Titolo: "&$title1,50,275)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
                       EndIf
                       If $album1 = 0 Then
                       $d = Guictrlcreatelabel("Album: Sconsociuto",50,300)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               Else
                       $d = Guictrlcreatelabel("Album: "&$album1,50,300)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
                       EndIf
       ElseIf Not FileExists($4) Then
               $4 = FileOpenDialog("Apri Canzone",@UserProfileDir & "\Documenti\Musica",'All(*.*)|Audio(*.mp3)|Audio(*.wma)|Audio(*.wav)')
                       $artist1 = _GetExtProperty($Path, 16)
                       $title1 = _GetExtProperty($Path, 10)
                       $album1 = _GetExtProperty($Path, 17)
                       GUICtrlDelete($b)
                       GUICtrlDelete($c)
                       GUICtrlDelete($d)
                       If $artist1 = 0 Then
                       $b = GUICtrlCreateLabel("Artista: Sconosciuto",50,250)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               Else
                       $b = GUICtrlCreateLabel("Artista: "&$artist1,50,250)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               EndIf
                       If $title1 = 0 Then
                       $c = GUICtrlCreateLabel("Titolo: Sconosciuto",50,275)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               Else
                       $c = GUICtrlCreateLabel("Titolo: "&$title1,50,275)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
                       EndIf
                       If $album1 = 0 Then
                       $d = Guictrlcreatelabel("Album: Sconsociuto",50,300)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
               Else
                       $d = Guictrlcreatelabel("Album: "&$album1,50,300)
                       GUICtrlSetColor(-1,0xFFFFFF)
                       GUICtrlSetBkColor(-1,-2)
                       EndIf
               EndIf
                       $4_o=_SoundOpen($4)
                       _SoundPlay($4)
EndFunc; ==> _Artist()

Func _volume()
       
       $vol = 0 + GUICtrlRead ($slider)
   SoundSetWaveVolume ($vol)
       GUICtrlSetData ($inputvolume, $vol)
EndFunc ; ==> _volume()

Func _MSG()

$msg = GUIGetMsg()
               Switch $msg
               Case $menu_opzioni_ripristino
                       FileDelete("conf.ini")
                       GUIDelete($GUI)
                       Sleep(100)
                       MsgBox(0,"Configurazione","Premere OK per iniziare la configurazione...")
                       ProgressOn("Configurazione","Configurazione in corso... Attendere...",2)
                       _FileCreate("conf.ini")
                       Sleep(500)
                       ProgressSet(5)
                       IniWrite("conf.ini","Trasparenza","trasparenza",255)
                       ProgressSet(10)
                       Sleep(500)
                       IniWrite("conf.ini","Messaggio","novita'","no")
                       ProgressOff()
                       MsgBox(0,"Attendere...","Configurazione completata, attendere...",2)
                       Sleep(1000)
                       MsgBox(0,"","Il programma si chiuderà, riaprirlo per completare la configurazione!",4)
                       Exit
               Case $menu_help_changelog
                       MsgBox(0,"ChangeLog",$messaggio_file)
               Case $menu_opzioni_trans_on
                       $transparence_input = InputBox("Trasparenza","Inserisci la trasparenza a numeri da 1 a 255 qui sotto"&@cr&"(255 è opaco)",150)
                       If $transparence_input = 0 Then
                               WinSetTrans("My Media Player","Durata:",255)
                               IniWrite("conf.ini","Trasparenza","trasparenza",255)
                               Else
                               WinSetTrans("My Media Player","Durata:",$transparence_input)
                               IniWrite("conf.ini","Trasparenza","trasparenza",$transparence_input)
                       EndIf
               Case $menu_opzioni_trans_off
                       WinSetTrans("My Media Player","Durata:",255)
                       IniWrite("conf.ini","Trasparenza","trasparenza",255)
               Case $menu_help_info
                       $messaggio_file = FileRead("novita'.txt")
                       MsgBox(64,"Info","My Media Player è stato realizzato da Gianlu-thebest, perchè"&@CR&"voleva creare un lettore multimediale decente"&@CR&"in confronto a WMP"&@CR&"Versione BETA 2.1.0")
               Case $menu_file_exit
                       Exit
               Case $menu_file_open
                       _artist()
                       _GUICtrlSlider_SetRangeMax($sliderd,_SoundLength($4,2))
                       GUICtrlSetData($file,"File: "&StringSplit($4,"\",1))
                       $st = _SoundStatus($4)
                       If $st = 'playing' Then GUICtrlSetData($inputstato,'Play')
                               If $st = 'paused' Then GUICtrlSetData($inputstato,'Pausa')
                                       If $st = 'stopped'Then GUICtrlSetData($inputstato,"Stop")
               Case $5
                       _artist()
                       _GUICtrlSlider_SetRangeMax($sliderd,_SoundLength($4,2))
                       GUICtrlSetData($file,"File: "&$4)
                       $st = _SoundStatus($4)
                       If $st = 'playing' Then GUICtrlSetData($inputstato,'Play')
                               If $st = 'paused' Then GUICtrlSetData($inputstato,'Pausa')
                                       If $st = 'stopped'Then GUICtrlSetData($inputstato,"Stop")
               Case $1
                       _SoundPlay($4)
                       $st = _SoundStatus($4)
                       If $st = 'playing' Then GUICtrlSetData($inputstato,'Play')
                               If $st = 'paused' Then GUICtrlSetData($inputstato,'Pausa')
                                       If $st = 'stopped'Then GUICtrlSetData($inputstato,"Stop")
               Case $2
                       _SoundStop($4)
                       $st = _SoundStatus($4)
                       If $st = 'playing' Then GUICtrlSetData($inputstato,'Play')
                               If $st = 'paused' Then GUICtrlSetData($inputstato,'Pausa')
                                       If $st = 'stopped'Then GUICtrlSetData($inputstato,"Stop")
               Case $3
                       _SoundPause($4)
                       $st = _SoundStatus($4)
                       If $st = 'playing' Then GUICtrlSetData($inputstato,'Play')
                               If $st = 'paused' Then GUICtrlSetData($inputstato,'Pausa')
                                       If $st = 'stopped'Then GUICtrlSetData($inputstato,"Stop")
               Case $6
                       _SoundClose($4)
                       $4 = ''
                       GUICtrlSetData($file,"File: Nessuno")
                       GUICtrlSetData($inputstato,"Apri un file!")
               Case $GUI_EVENT_CLOSE
                       _SoundClose($4)
                       Exit
               EndSwitch

EndFunc
#EndRegion Func


Download attachment
My_Media_Player.rar ( Number of downloads: 6 )

 
Top
-Anubi-
CAT_IMG Posted on 14/3/2010, 16:55     +1   -1




Bravo !
 
Top
Gianlu-thebest
CAT_IMG Posted on 14/3/2010, 16:57     +1   -1




Grazie!
 
Top
-Anubi-
CAT_IMG Posted on 14/3/2010, 17:05     +1   -1




Prego !
 
Top
Gianlu-thebest
CAT_IMG Posted on 14/3/2010, 17:24     +1   -1




Non c'è di che!

SPOILER (click to view)
ahah xD la gara a chi è più gentile
 
Top
-Anubi-
CAT_IMG Posted on 14/3/2010, 17:27     +1   -1




Ma si figuri xD !
 
Top
Gianlu-thebest
CAT_IMG Posted on 14/3/2010, 18:45     +1   -1




XDXDXDXD
 
Top
CAT_IMG Posted on 14/3/2010, 22:18     +1   -1

So creare belle gui

Group:
Bannato
Posts:
555
Reputazione:
0

Status:


ma lo slider non si può usare per cambiare il punto della canzone? se non si può a questo punto metti una progressbar che sta meglio!
 
Top
Gianlu-thebest
CAT_IMG Posted on 15/3/2010, 14:56     +1   -1




CITAZIONE (nr5 @ 14/3/2010, 22:18)
ma lo slider non si può usare per cambiare il punto della canzone? se non si può a questo punto metti una progressbar che sta meglio!

ancora no :( devo capire come fare... qualche aiuto?
 
Top
8 replies since 14/3/2010, 14:25   80 views
  Share