blob: 379a0d0cd9ca51a83e076dd0e2ee7c3c6dd48fac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#include "soundkonverterapp.h"
#include "soundkonverter.h"
#include <tqstringlist.h>
#include <tqfile.h>
#include <tqmovie.h>
#include <tdeglobal.h>
#include <tdestartupinfo.h>
#include <tdecmdlineargs.h>
#include <dcopclient.h>
#include <ksystemtray.h>
#include <kstandarddirs.h>
soundKonverterApp::soundKonverterApp()
: KUniqueApplication()
{}
soundKonverterApp::~soundKonverterApp()
{}
int soundKonverterApp::newInstance()
{
// register ourselves as a dcop client
if( !dcopClient()->isRegistered() )
dcopClient()->registerAs( name(), false );
// see if we are starting with session management
if( restoringSession() )
{
RESTORE( soundKonverter );
}
else
{
// no session.. just start up normally
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
if( !mainWidget() )
{
soundKonverter *widget = new soundKonverter();
setMainWidget(widget);
//widget->show();
}
else
TDEStartupInfo::setNewStartupId( mainWidget(), kapp->startupId());
soundKonverter *widget = ::tqt_cast<soundKonverter*>( mainWidget() );
widget->increaseInstances();
TQCString notify = args->getOption( "command" );
if( !notify.isNull() ) {
widget->setNotify( notify );
}
TQCString profile = args->getOption( "profile" );
if( !profile.isNull() ) {
widget->profile = profile;
}
TQCString format = args->getOption( "format" );
if( !format.isNull() ) {
widget->format = format;
}
TQCString directory = args->getOption( "output" );
if( !directory.isNull() ) {
widget->directory = directory;
}
TQCString device = args->getOption( "rip" );
if( !device.isNull() ) {
if( !args->isSet( "invisible" ) ) {
widget->visible = true;
widget->show();
widget->systemTray->hide();
widget->systemTray->setPixmap( 0 );
}
widget->device = device;
widget->showCdDialog( false );
}
widget->autoclose = args->isSet( "autoclose" );
if( args->isSet( "invisible" ) ) {
widget->visible = false;
widget->autoclose = true;
widget->hide();
widget->systemTray->show();
TDEStandardDirs* stdDirs = new TDEStandardDirs();
widget->systemTray->setMovie( TQMovie(stdDirs->findResource("data","soundkonverter/pics/systray.mng")) );
delete stdDirs;
}
else {
widget->visible = true;
widget->show();
widget->systemTray->hide();
widget->systemTray->setPixmap( 0 );
}
// add the files to the file lists depending on the used switch
if( args->isSet( "replaygain" ) ) {
TQStringList replayGainFiles;
for( int i = 0; i < args->count(); i++ ) {
replayGainFiles.append(KURL::encode_string(args->arg(i)));
}
if(!replayGainFiles.isEmpty())
widget->openArgReplayGainFiles(replayGainFiles);
}
// else if( args->isSet( "repair" ) ) {
// TQStringList repairFiles;
// for( int i = 0; i < args->count(); i++ ) {
// repairFiles.append(TQFile::decodeName(args->arg(i)));
// }
// if(!repairFiles.isEmpty())
// widget->openArgRepairFiles(repairFiles);
// }
else {
TQStringList files;
for( int i = 0; i < args->count(); i++ )
{
files.append(KURL::encode_string(args->arg(i)));
}
if(!files.isEmpty())
widget->openArgFiles(files);
}
args->clear();
}
return 0;
}
#include "soundkonverterapp.moc"
|