forked from jfperini/radit
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3bec0d4
commit c9d2800
Showing
14 changed files
with
903 additions
and
903 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
/** | ||
* Aleatorio | ||
* ----------------------------------------- | ||
* | ||
* - Implements random systems | ||
* - avoid repetition of audios files | ||
* | ||
* @author Victor Algaba | ||
*/ | ||
#ifndef ALEATORIO_H | ||
#define ALEATORIO_H | ||
|
||
#include <QDirModel> | ||
#include <QStatusBar> | ||
#include <QVariant> | ||
#include <QLabel> | ||
#include <QFileSystemModel> | ||
|
||
class Aleatorio | ||
{ | ||
private: | ||
QList<QString> results; | ||
QList<int> Sacado; | ||
QString Path; | ||
int TotalFicheros; | ||
int NumeroAleatorio(int range_starts, int range_ends); //get random number | ||
bool Repetido(int numero);//checks whether the file was repeated | ||
void Todos();// If they are all set to 0 reproducios index | ||
void Nuevo(int ultimo);//marks the last for us to be the first | ||
void CrearIndice(const QString url); | ||
void DeleteIndex(); | ||
double Count(const QString url); | ||
|
||
public: | ||
Aleatorio(const QString url,QLabel *w_Label); | ||
~Aleatorio(); | ||
QString FicheroPath(); | ||
QString Cancion; //para los titulos | ||
}; | ||
#endif // ALEATORIO_H | ||
/** | ||
* Aleatorio | ||
* ----------------------------------------- | ||
* | ||
* - Implements random systems | ||
* - avoid repetition of audios files | ||
* | ||
* @author Victor Algaba | ||
*/ | ||
#ifndef ALEATORIO_H | ||
#define ALEATORIO_H | ||
|
||
#include <QDirModel> | ||
#include <QStatusBar> | ||
#include <QVariant> | ||
#include <QLabel> | ||
#include <QFileSystemModel> | ||
|
||
class Aleatorio | ||
{ | ||
private: | ||
QList<QString> results; | ||
QList<int> Sacado; | ||
QString Path; | ||
int TotalFicheros; | ||
int NumeroAleatorio(int range_starts, int range_ends); //get random number | ||
bool Repetido(int numero);//checks whether the file was repeated | ||
void Todos();// If they are all set to 0 reproducios index | ||
void Nuevo(int ultimo);//marks the last for us to be the first | ||
void CrearIndice(const QString url); | ||
void DeleteIndex(); | ||
double Count(const QString url); | ||
|
||
public: | ||
Aleatorio(const QString url,QLabel *w_Label); | ||
~Aleatorio(); | ||
QString FicheroPath(); | ||
QString Cancion; //para los titulos | ||
}; | ||
#endif // ALEATORIO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,107 @@ | ||
/**************************************************************************** | ||
** | ||
** Copyright (C) 2010 Victor Algaba . | ||
** All rights reserved. | ||
** Contact: (www.radit.org) | ||
** | ||
** ************************************************************************* | ||
**Crea un fichero indice.dat | ||
** | ||
** | ||
****************************************************************************/ | ||
#include <QDirIterator> | ||
#include <QList> | ||
#include <QDebug> | ||
|
||
#include "AleatorioIndice.h" | ||
|
||
|
||
|
||
AleatorioIndice::AleatorioIndice(const QString url){ | ||
|
||
urlx=url; | ||
|
||
|
||
QFile fexiste( url + "/index.dat" ); | ||
if(fexiste.exists()) | ||
return; | ||
fexiste.close(); | ||
|
||
|
||
|
||
|
||
|
||
|
||
QList<QString> list; | ||
|
||
QStringList filters; | ||
filters << "*.mp3" << "*.mp2" << "*.mp1" << "*.ogg" << "*.wav" << "*.aif" <<"*.wma" <<"*.flac"; | ||
QDirIterator it(url,filters, QDir::Files|QDir::NoSymLinks, QDirIterator::Subdirectories); | ||
|
||
|
||
while (it.hasNext()) { | ||
QString qstr = it.next(); | ||
list << qstr ; | ||
|
||
} | ||
|
||
|
||
QFile file( url + "/index.dat" ); | ||
if( !file.open( QIODevice::WriteOnly ) ) | ||
return; | ||
|
||
QDataStream stream( &file ); | ||
stream.setVersion( QDataStream::Qt_4_2 ); | ||
|
||
stream << list; | ||
|
||
file.close(); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
//******************************************************************************* | ||
|
||
AleatorioIndice::~AleatorioIndice(){ | ||
|
||
|
||
|
||
} | ||
|
||
//***************************************************************************** | ||
QDataStream AleatorioIndice::Load(){ | ||
|
||
QList<QString> list; | ||
|
||
QFile file( urlx + "/test.dat"); | ||
file.open( QIODevice::ReadOnly ); | ||
|
||
QDataStream stream( &file ); | ||
stream.setVersion( QDataStream::Qt_4_2 ); | ||
|
||
stream >> list; | ||
|
||
file.close(); | ||
|
||
|
||
//qDebug() << list[0]; | ||
//qDebug() << list[1]; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
/**************************************************************************** | ||
** | ||
** Copyright (C) 2010 Victor Algaba . | ||
** All rights reserved. | ||
** Contact: (www.blackpanther.hu) | ||
** | ||
** ************************************************************************* | ||
**Crea un fichero indice.dat | ||
** | ||
** | ||
****************************************************************************/ | ||
#include <QDirIterator> | ||
#include <QList> | ||
#include <QDebug> | ||
|
||
#include "AleatorioIndice.h" | ||
|
||
|
||
|
||
AleatorioIndice::AleatorioIndice(const QString url){ | ||
|
||
urlx=url; | ||
|
||
|
||
QFile fexiste( url + "/index.dat" ); | ||
if(fexiste.exists()) | ||
return; | ||
fexiste.close(); | ||
|
||
|
||
|
||
|
||
|
||
|
||
QList<QString> list; | ||
|
||
QStringList filters; | ||
filters << "*.mp3" << "*.mp2" << "*.mp1" << "*.ogg" << "*.wav" << "*.aif" <<"*.wma" <<"*.flac"; | ||
QDirIterator it(url,filters, QDir::Files|QDir::NoSymLinks, QDirIterator::Subdirectories); | ||
|
||
|
||
while (it.hasNext()) { | ||
QString qstr = it.next(); | ||
list << qstr ; | ||
|
||
} | ||
|
||
|
||
QFile file( url + "/index.dat" ); | ||
if( !file.open( QIODevice::WriteOnly ) ) | ||
return; | ||
|
||
QDataStream stream( &file ); | ||
stream.setVersion( QDataStream::Qt_4_2 ); | ||
|
||
stream << list; | ||
|
||
file.close(); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
//******************************************************************************* | ||
|
||
AleatorioIndice::~AleatorioIndice(){ | ||
|
||
|
||
|
||
} | ||
|
||
//***************************************************************************** | ||
QDataStream AleatorioIndice::Load(){ | ||
|
||
QList<QString> list; | ||
|
||
QFile file( urlx + "/test.dat"); | ||
file.open( QIODevice::ReadOnly ); | ||
|
||
QDataStream stream( &file ); | ||
stream.setVersion( QDataStream::Qt_4_2 ); | ||
|
||
stream >> list; | ||
|
||
file.close(); | ||
|
||
|
||
//qDebug() << list[0]; | ||
//qDebug() << list[1]; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
|
Oops, something went wrong.