Qmmp
winfileassoc.h
1 /* smplayer, GUI front-end for mplayer.
2  Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19  Winfileassoc.h
20  Handles file associations in Windows
21  Author: Florin Braghis (florin@libertv.ro)
22 */
23 
24 #ifndef WINFILEASSOC_H
25 #define WINFILEASSOC_H
26 
27 #include <QString>
28 #include <QStringList>
29 
30 
34 class WinFileAssoc
35 {
36 protected:
37  QString m_ClassId; //Application ClassId
38  QString m_ClassId2; //The ClassId created by explorer if user selects 'Open With...', usually qmmp.exe
39  QString m_AppName;
40 
41 protected:
42  bool CreateClassId(const QString& executablePath, const QString& friendlyName);
43  bool VistaGetDefaultApps(const QStringList &extensions, QStringList& registeredExt);
44  int VistaSetAppsAsDefault(const QStringList& extensions);
45 public:
46  WinFileAssoc(const QString ClassId = "QmmpFileAudio", const QString AppName="Qmmp");
47  //Checks the registry to see which extensions are registered with SMPlayer
48  bool GetRegisteredExtensions(const QStringList& extensionsToCheck, QStringList& registeredExtensions);
49  bool RemoveClassId();
50  int CreateFileAssociations(const QStringList& fileExtensions);
51  int RestoreFileAssociations(const QStringList& fileExtensions);
52 };
53 
54 #endif