|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
|
|
|
|
|
kmidframe.cpp - The main widget of KMid
|
|
|
|
|
tdemidframe.cpp - The main widget of KMid
|
|
|
|
|
Copyright (C) 1997,98 Antonio Larrosa Jimenez
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
@ -50,39 +50,39 @@
|
|
|
|
|
#include <kedittoolbar.h>
|
|
|
|
|
#include <dcopclient.h>
|
|
|
|
|
|
|
|
|
|
#include "kmidframe.h"
|
|
|
|
|
#include "kmidclient.h"
|
|
|
|
|
#include "tdemidframe.h"
|
|
|
|
|
#include "tdemidclient.h"
|
|
|
|
|
#include "midicfgdlg.h"
|
|
|
|
|
#include "collectdlg.h"
|
|
|
|
|
#include "channelcfgdlg.h"
|
|
|
|
|
#include "channelview.h"
|
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
|
kmidFrame::kmidFrame(const char *name)
|
|
|
|
|
tdemidFrame::tdemidFrame(const char *name)
|
|
|
|
|
:KMainWindow(0, name)
|
|
|
|
|
{
|
|
|
|
|
kmidclient=new kmidClient(this,actionCollection(), "KMidClient");
|
|
|
|
|
kmidclient->setSongType(1);
|
|
|
|
|
kmidclient->show();
|
|
|
|
|
setCentralWidget( kmidclient );
|
|
|
|
|
tdemidclient=new tdemidClient(this,actionCollection(), "KMidClient");
|
|
|
|
|
tdemidclient->setSongType(1);
|
|
|
|
|
tdemidclient->show();
|
|
|
|
|
setCentralWidget( tdemidclient );
|
|
|
|
|
/*
|
|
|
|
|
kKeysAccel=new KAccel(this);
|
|
|
|
|
kKeysAccel->insertItem(i18n("Play/Pause"),"Play/Pause", Key_Space);
|
|
|
|
|
kKeysAccel->connectItem("Play/Pause", TQT_TQOBJECT(this), TQT_SLOT(spacePressed()));
|
|
|
|
|
kKeysAccel->insertItem(i18n("Stop"),"Stop", Key_Backspace);
|
|
|
|
|
kKeysAccel->connectItem("Stop",kmidclient,TQT_SLOT(song_Stop()));
|
|
|
|
|
kKeysAccel->connectItem("Stop",tdemidclient,TQT_SLOT(song_Stop()));
|
|
|
|
|
kKeysAccel->insertItem(i18n("Previous Song"),"Previous Song", Key_Left);
|
|
|
|
|
kKeysAccel->connectItem("Previous Song",kmidclient,TQT_SLOT(song_PlayPrevSong()));
|
|
|
|
|
kKeysAccel->connectItem("Previous Song",tdemidclient,TQT_SLOT(song_PlayPrevSong()));
|
|
|
|
|
kKeysAccel->insertItem(i18n("Next Song"),"Next Song", Key_Right);
|
|
|
|
|
kKeysAccel->connectItem("Next Song",kmidclient,TQT_SLOT(song_PlayNextSong()));
|
|
|
|
|
kKeysAccel->connectItem("Next Song",tdemidclient,TQT_SLOT(song_PlayNextSong()));
|
|
|
|
|
kKeysAccel->insertItem(i18n("Scroll Down Karaoke"),"Scroll down karaoke",Key_Down);
|
|
|
|
|
kKeysAccel->connectItem("Scroll Down karaoke",kmidclient->getKDisplayText(),TQT_SLOT(ScrollDown()));
|
|
|
|
|
kKeysAccel->connectItem("Scroll Down karaoke",tdemidclient->getKDisplayText(),TQT_SLOT(ScrollDown()));
|
|
|
|
|
kKeysAccel->insertItem(i18n("Scroll Up Karaoke"),"Scroll up karaoke",Key_Up);
|
|
|
|
|
kKeysAccel->connectItem("Scroll Up Karaoke",kmidclient->getKDisplayText(),TQT_SLOT(ScrollUp()));
|
|
|
|
|
kKeysAccel->connectItem("Scroll Up Karaoke",tdemidclient->getKDisplayText(),TQT_SLOT(ScrollUp()));
|
|
|
|
|
kKeysAccel->insertItem(i18n("Scroll Page Down Karaoke"),"Scroll page down karaoke",Key_PageDown);
|
|
|
|
|
kKeysAccel->connectItem("Scroll Page Down Karaoke",kmidclient->getKDisplayText(),TQT_SLOT(ScrollPageDown()));
|
|
|
|
|
kKeysAccel->connectItem("Scroll Page Down Karaoke",tdemidclient->getKDisplayText(),TQT_SLOT(ScrollPageDown()));
|
|
|
|
|
kKeysAccel->insertItem(i18n("Scroll Page Up Karaoke"),"Scroll page up karaoke",Key_PageUp);
|
|
|
|
|
kKeysAccel->connectItem("Scroll Page Up Karaoke",kmidclient->getKDisplayText(),TQT_SLOT(ScrollPageUp()));
|
|
|
|
|
kKeysAccel->connectItem("Scroll Page Up Karaoke",tdemidclient->getKDisplayText(),TQT_SLOT(ScrollPageUp()));
|
|
|
|
|
|
|
|
|
|
kKeysAccel->readSettings();
|
|
|
|
|
*/
|
|
|
|
@ -92,25 +92,25 @@ kmidFrame::kmidFrame(const char *name)
|
|
|
|
|
KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), actionCollection());
|
|
|
|
|
|
|
|
|
|
(void)new KAction(i18n("&Play"), "player_play", TQt::Key_Space,
|
|
|
|
|
TQT_TQOBJECT(kmidclient), TQT_SLOT(slotPlay()), actionCollection(), "song_play");
|
|
|
|
|
(void)new KAction(i18n("P&ause"), "player_pause", TQt::Key_P, TQT_TQOBJECT(kmidclient),
|
|
|
|
|
TQT_TQOBJECT(tdemidclient), TQT_SLOT(slotPlay()), actionCollection(), "song_play");
|
|
|
|
|
(void)new KAction(i18n("P&ause"), "player_pause", TQt::Key_P, TQT_TQOBJECT(tdemidclient),
|
|
|
|
|
TQT_SLOT(slotPause()), actionCollection(), "song_pause");
|
|
|
|
|
(void)new KAction(i18n("&Stop"), "player_stop", TQt::Key_Backspace,
|
|
|
|
|
TQT_TQOBJECT(kmidclient), TQT_SLOT(slotStop()), actionCollection(), "song_stop");
|
|
|
|
|
TQT_TQOBJECT(tdemidclient), TQT_SLOT(slotStop()), actionCollection(), "song_stop");
|
|
|
|
|
|
|
|
|
|
(void)new KAction(i18n("P&revious Song"), "player_start", Key_Left,
|
|
|
|
|
TQT_TQOBJECT(kmidclient), TQT_SLOT(slotPrevSong()), actionCollection(),
|
|
|
|
|
TQT_TQOBJECT(tdemidclient), TQT_SLOT(slotPrevSong()), actionCollection(),
|
|
|
|
|
"song_previous");
|
|
|
|
|
(void)new KAction(i18n("&Next Song"), "player_end", Key_Right,
|
|
|
|
|
TQT_TQOBJECT(kmidclient), TQT_SLOT(slotNextSong()), actionCollection(),
|
|
|
|
|
TQT_TQOBJECT(tdemidclient), TQT_SLOT(slotNextSong()), actionCollection(),
|
|
|
|
|
"song_next");
|
|
|
|
|
(void)new KToggleAction(i18n("&Loop"), 0, TQT_TQOBJECT(this), TQT_SLOT(song_Loop()),
|
|
|
|
|
actionCollection(), "song_loop");
|
|
|
|
|
|
|
|
|
|
(void)new KAction(i18n("Rewind"), "2leftarrow", 0, TQT_TQOBJECT(kmidclient),
|
|
|
|
|
(void)new KAction(i18n("Rewind"), "2leftarrow", 0, TQT_TQOBJECT(tdemidclient),
|
|
|
|
|
TQT_SLOT(slotRewind()), actionCollection(), "song_rewind");
|
|
|
|
|
|
|
|
|
|
(void)new KAction(i18n("Forward"), "2rightarrow", 0, TQT_TQOBJECT(kmidclient),
|
|
|
|
|
(void)new KAction(i18n("Forward"), "2rightarrow", 0, TQT_TQOBJECT(tdemidclient),
|
|
|
|
|
TQT_SLOT(slotForward()), actionCollection(), "song_forward");
|
|
|
|
|
|
|
|
|
|
(void)new KAction(i18n("&Organize..."), 0, TQT_TQOBJECT(this), TQT_SLOT(collect_organize()),
|
|
|
|
@ -173,7 +173,7 @@ kmidFrame::kmidFrame(const char *name)
|
|
|
|
|
TQT_SLOT(options_MidiSetup()), actionCollection(), "midi_setup");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setupGUI((ToolBar | Keys | StatusBar | Save | Create ), "kmidui.rc" );
|
|
|
|
|
setupGUI((ToolBar | Keys | StatusBar | Save | Create ), "tdemidui.rc" );
|
|
|
|
|
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
@ -212,13 +212,13 @@ kmidFrame::kmidFrame(const char *name)
|
|
|
|
|
|
|
|
|
|
setAcceptDrops(true);
|
|
|
|
|
|
|
|
|
|
connect( kmidclient, TQT_SIGNAL( mustRechooseTextEvent() ),
|
|
|
|
|
connect( tdemidclient, TQT_SIGNAL( mustRechooseTextEvent() ),
|
|
|
|
|
this, TQT_SLOT( rechooseTextEvent() ) );
|
|
|
|
|
|
|
|
|
|
connect( kmidclient, TQT_SIGNAL( stopPause() ),
|
|
|
|
|
connect( tdemidclient, TQT_SIGNAL( stopPause() ),
|
|
|
|
|
this, TQT_SLOT( song_stopPause() ) );
|
|
|
|
|
|
|
|
|
|
// connect( kmidclient, TQT_SIGNAL( channelView_Destroyed() ),
|
|
|
|
|
// connect( tdemidclient, TQT_SIGNAL( channelView_Destroyed() ),
|
|
|
|
|
// this, TQT_SLOT( channelViewDestroyed() ) );
|
|
|
|
|
|
|
|
|
|
TDECmdLineArgs * args = TDECmdLineArgs::parsedArgs();
|
|
|
|
@ -240,17 +240,17 @@ kmidFrame::kmidFrame(const char *name)
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kmidclient->setActiveCollection(c);
|
|
|
|
|
tdemidclient->setActiveCollection(c);
|
|
|
|
|
|
|
|
|
|
/// kmidclient->openURL((kapp->argv())[1]);
|
|
|
|
|
/// tdemidclient->openURL((kapp->argv())[1]);
|
|
|
|
|
/* if ((cfg->readNumEntry("AutomaticTextEventChooser",1))==1)
|
|
|
|
|
{
|
|
|
|
|
if (kmidclient->ChooseTypeOfTextEvents()==1)
|
|
|
|
|
if (tdemidclient->ChooseTypeOfTextEvents()==1)
|
|
|
|
|
options_Text();
|
|
|
|
|
else
|
|
|
|
|
options_Lyrics();
|
|
|
|
|
}*/
|
|
|
|
|
if (kmidclient->midiFileName()!=NULL) kmidclient->play();
|
|
|
|
|
if (tdemidclient->midiFileName()!=NULL) tdemidclient->play();
|
|
|
|
|
cfg->writeEntry("AutoAddToCollection",backautoadd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -266,15 +266,15 @@ kmidFrame::kmidFrame(const char *name)
|
|
|
|
|
if (!client->isRegistered()) // just in case we're embeeded
|
|
|
|
|
{
|
|
|
|
|
client->attach();
|
|
|
|
|
client->registerAs("kmid");
|
|
|
|
|
client->registerAs("tdemid");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kmidFrame::~kmidFrame()
|
|
|
|
|
tdemidFrame::~tdemidFrame()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::file_Open()
|
|
|
|
|
void tdemidFrame::file_Open()
|
|
|
|
|
{
|
|
|
|
|
KURL url = KFileDialog::getOpenURL(TQString(), "*.kar *.mid *.kar.gz *.mid.gz\n*.kar *.kar.gz\n*.mid *.mid.gz\n*",this);
|
|
|
|
|
|
|
|
|
@ -292,55 +292,55 @@ void kmidFrame::file_Open()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void kmidFrame::song_stopPause()
|
|
|
|
|
void tdemidFrame::song_stopPause()
|
|
|
|
|
{
|
|
|
|
|
if (kmidclient->isPaused())
|
|
|
|
|
if (tdemidclient->isPaused())
|
|
|
|
|
{
|
|
|
|
|
// song_Pause();
|
|
|
|
|
((KToggleAction*)actionCollection()->action("song_pause"))->setChecked(false);
|
|
|
|
|
kmidclient->pause();
|
|
|
|
|
tdemidclient->pause();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::options_FileType(int i)
|
|
|
|
|
void tdemidFrame::options_FileType(int i)
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
cfg->writeEntry("TypeOfMidiFile",i);
|
|
|
|
|
kmidclient->setSongType(1-i);
|
|
|
|
|
tdemidclient->setSongType(1-i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::options_DisplayEvents(int i)
|
|
|
|
|
void tdemidFrame::options_DisplayEvents(int i)
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
cfg->writeEntry("TypeOfTextEvents",(i==0)?1:5);
|
|
|
|
|
cfg->sync();
|
|
|
|
|
kmidclient->repaintText((i==0)?1:5);
|
|
|
|
|
tdemidclient->repaintText((i==0)?1:5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::options_AutomaticText()
|
|
|
|
|
void tdemidFrame::options_AutomaticText()
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
cfg->writeEntry("AutomaticTextEventChooser",1-cfg->readNumEntry("AutomaticTextEventChooser",1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::options_FontChange()
|
|
|
|
|
void tdemidFrame::options_FontChange()
|
|
|
|
|
{
|
|
|
|
|
KFontDialog *kfd=new KFontDialog(this);
|
|
|
|
|
TQFont font;
|
|
|
|
|
font=*kmidclient->getFont();
|
|
|
|
|
font=*tdemidclient->getFont();
|
|
|
|
|
kfd->getFont(font);
|
|
|
|
|
delete kfd;
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
cfg->writeEntry("KaraokeFont",font);
|
|
|
|
|
cfg->sync();
|
|
|
|
|
kmidclient->fontChanged();
|
|
|
|
|
tdemidclient->fontChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int kmidFrame::autoAddSongToCollection(const TQString& filename,int setactive)
|
|
|
|
|
int tdemidFrame::autoAddSongToCollection(const TQString& filename,int setactive)
|
|
|
|
|
{
|
|
|
|
|
int r;
|
|
|
|
|
SLManager *slman;
|
|
|
|
@ -350,20 +350,20 @@ int kmidFrame::autoAddSongToCollection(const TQString& filename,int setactive)
|
|
|
|
|
if (cfg->readNumEntry("AutoAddToCollection",0)==0)
|
|
|
|
|
{
|
|
|
|
|
r=0;
|
|
|
|
|
slman=kmidclient->getSLManager();
|
|
|
|
|
slman=tdemidclient->getSLManager();
|
|
|
|
|
if (setactive) slman->createTemporaryCollection();
|
|
|
|
|
sl=slman->getCollection(0);
|
|
|
|
|
if (filename==NULL) sl->AddSong(kmidclient->midiFileName());
|
|
|
|
|
if (filename==NULL) sl->AddSong(tdemidclient->midiFileName());
|
|
|
|
|
else sl->AddSong(TQFile::encodeName(filename));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
slman=kmidclient->getSLManager();
|
|
|
|
|
sl=slman->getCollection(kmidclient->getActiveCollection());
|
|
|
|
|
r=kmidclient->getActiveCollection();
|
|
|
|
|
slman=tdemidclient->getSLManager();
|
|
|
|
|
sl=slman->getCollection(tdemidclient->getActiveCollection());
|
|
|
|
|
r=tdemidclient->getActiveCollection();
|
|
|
|
|
if (sl==NULL) return 0;
|
|
|
|
|
int id;
|
|
|
|
|
if (filename==NULL) id=sl->AddSong(kmidclient->midiFileName());
|
|
|
|
|
if (filename==NULL) id=sl->AddSong(tdemidclient->midiFileName());
|
|
|
|
|
else id=sl->AddSong(TQFile::encodeName(filename));
|
|
|
|
|
if (setactive)
|
|
|
|
|
{
|
|
|
|
@ -373,17 +373,17 @@ int kmidFrame::autoAddSongToCollection(const TQString& filename,int setactive)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::urlDrop_slot(TQDropEvent* e)
|
|
|
|
|
void tdemidFrame::urlDrop_slot(TQDropEvent* e)
|
|
|
|
|
{
|
|
|
|
|
dropEvent(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::dragEnterEvent(TQDragEnterEvent* e)
|
|
|
|
|
void tdemidFrame::dragEnterEvent(TQDragEnterEvent* e)
|
|
|
|
|
{
|
|
|
|
|
e->accept(KURLDrag::canDecode(e));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::dropEvent( TQDropEvent * event )
|
|
|
|
|
void tdemidFrame::dropEvent( TQDropEvent * event )
|
|
|
|
|
{
|
|
|
|
|
KURL::List list;
|
|
|
|
|
KURLDrag::decode(event, list);
|
|
|
|
@ -412,58 +412,58 @@ void kmidFrame::dropEvent( TQDropEvent * event )
|
|
|
|
|
|
|
|
|
|
if (!first)
|
|
|
|
|
{
|
|
|
|
|
kmidclient->setActiveCollection(c);
|
|
|
|
|
tdemidclient->setActiveCollection(c);
|
|
|
|
|
|
|
|
|
|
if ((!kmidclient->isPlaying())&&(kmidclient->midiFileName()!=NULL))
|
|
|
|
|
kmidclient->play();
|
|
|
|
|
if ((!tdemidclient->isPlaying())&&(tdemidclient->midiFileName()!=NULL))
|
|
|
|
|
tdemidclient->play();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::shuttingDown()
|
|
|
|
|
void tdemidFrame::shuttingDown()
|
|
|
|
|
{
|
|
|
|
|
if (kmidclient->isPlaying()==1)
|
|
|
|
|
if (tdemidclient->isPlaying()==1)
|
|
|
|
|
{
|
|
|
|
|
// kmidclient->stop();
|
|
|
|
|
kmidclient->shuttingDown();
|
|
|
|
|
// tdemidclient->stop();
|
|
|
|
|
tdemidclient->shuttingDown();
|
|
|
|
|
}
|
|
|
|
|
kmidclient->saveCollections();
|
|
|
|
|
tdemidclient->saveCollections();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::saveProperties(TDEConfig *cfg)
|
|
|
|
|
void tdemidFrame::saveProperties(TDEConfig *cfg)
|
|
|
|
|
{
|
|
|
|
|
kmidclient->saveCollections();
|
|
|
|
|
int play=kmidclient->isPlaying();
|
|
|
|
|
cfg->writeEntry("File",kmidclient->midiFileName());
|
|
|
|
|
cfg->writeEntry("ActiveCollection",kmidclient->getActiveCollection());
|
|
|
|
|
cfg->writeEntry("ActiveSong",kmidclient->getSelectedSong());
|
|
|
|
|
tdemidclient->saveCollections();
|
|
|
|
|
int play=tdemidclient->isPlaying();
|
|
|
|
|
cfg->writeEntry("File",tdemidclient->midiFileName());
|
|
|
|
|
cfg->writeEntry("ActiveCollection",tdemidclient->getActiveCollection());
|
|
|
|
|
cfg->writeEntry("ActiveSong",tdemidclient->getSelectedSong());
|
|
|
|
|
cfg->writeEntry("Playing",play);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::readProperties(TDEConfig *cfg)
|
|
|
|
|
void tdemidFrame::readProperties(TDEConfig *cfg)
|
|
|
|
|
{
|
|
|
|
|
int activecol=cfg->readNumEntry("ActiveCollection",0);
|
|
|
|
|
int activesong=cfg->readNumEntry("ActiveSong",0);
|
|
|
|
|
int wasplaying=cfg->readNumEntry("Playing",0);
|
|
|
|
|
SLManager *slman=kmidclient->getSLManager();
|
|
|
|
|
SLManager *slman=tdemidclient->getSLManager();
|
|
|
|
|
SongList *sl=slman->getCollection(activecol);
|
|
|
|
|
sl->setActiveSong(activesong);
|
|
|
|
|
kmidclient->setActiveCollection(activecol);
|
|
|
|
|
kmidclient->slotSelectSong(activesong-1);
|
|
|
|
|
tdemidclient->setActiveCollection(activecol);
|
|
|
|
|
tdemidclient->slotSelectSong(activesong-1);
|
|
|
|
|
|
|
|
|
|
if ((activecol==0)&&(wasplaying)) // It was the temporary collection,
|
|
|
|
|
{ // surely the user would like to continue
|
|
|
|
|
// hearing the song
|
|
|
|
|
TQString s = cfg->readPathEntry("File");
|
|
|
|
|
int c=autoAddSongToCollection(s,1);
|
|
|
|
|
kmidclient->setActiveCollection(c);
|
|
|
|
|
tdemidclient->setActiveCollection(c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((wasplaying)&&(kmidclient->midiFileName()!=NULL)) kmidclient->play();
|
|
|
|
|
if ((wasplaying)&&(tdemidclient->midiFileName()!=NULL)) tdemidclient->play();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::options_MidiSetup()
|
|
|
|
|
void tdemidFrame::options_MidiSetup()
|
|
|
|
|
{
|
|
|
|
|
if (kmidclient->devman()->checkInit()<0)
|
|
|
|
|
if (tdemidclient->devman()->checkInit()<0)
|
|
|
|
|
{
|
|
|
|
|
KMessageBox::error(this,
|
|
|
|
|
i18n("Could not open /dev/sequencer to get some info.\nProbably there is another program using it."));
|
|
|
|
@ -471,33 +471,33 @@ void kmidFrame::options_MidiSetup()
|
|
|
|
|
}
|
|
|
|
|
MidiConfigDialog *dlg;
|
|
|
|
|
|
|
|
|
|
dlg=new MidiConfigDialog(kmidclient->devman(),NULL,"MidiDialog");
|
|
|
|
|
dlg=new MidiConfigDialog(tdemidclient->devman(),NULL,"MidiDialog");
|
|
|
|
|
if (dlg->exec() == TQDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
cfg->writeEntry("MidiPortNumber",MidiConfigDialog::selecteddevice);
|
|
|
|
|
kmidclient->setMidiDevice(MidiConfigDialog::selecteddevice);
|
|
|
|
|
tdemidclient->setMidiDevice(MidiConfigDialog::selecteddevice);
|
|
|
|
|
cfg->setGroup("Midimapper");
|
|
|
|
|
cfg->writePathEntry("LoadFile",
|
|
|
|
|
(MidiConfigDialog::selectedmap==NULL)? TQString():MidiConfigDialog::selectedmap);
|
|
|
|
|
kmidclient->setMidiMapFilename(MidiConfigDialog::selectedmap);
|
|
|
|
|
tdemidclient->setMidiMapFilename(MidiConfigDialog::selectedmap);
|
|
|
|
|
}
|
|
|
|
|
delete dlg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::collect_organize()
|
|
|
|
|
void tdemidFrame::collect_organize()
|
|
|
|
|
{
|
|
|
|
|
CollectionDialog *dlg;
|
|
|
|
|
SLManager *slman=new SLManager(*kmidclient->getSLManager());
|
|
|
|
|
int idx=kmidclient->getActiveCollection();
|
|
|
|
|
SLManager *slman=new SLManager(*tdemidclient->getSLManager());
|
|
|
|
|
int idx=tdemidclient->getActiveCollection();
|
|
|
|
|
|
|
|
|
|
dlg=new CollectionDialog(slman,idx,NULL,"MidiDialog");
|
|
|
|
|
if (dlg->exec() == TQDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
kmidclient->setSLManager(slman);
|
|
|
|
|
kmidclient->setActiveCollection(CollectionDialog::selectedC);
|
|
|
|
|
kmidclient->slotSelectSong(
|
|
|
|
|
tdemidclient->setSLManager(slman);
|
|
|
|
|
tdemidclient->setActiveCollection(CollectionDialog::selectedC);
|
|
|
|
|
tdemidclient->slotSelectSong(
|
|
|
|
|
(slman->getCollection(CollectionDialog::selectedC))->getActiveSongID()-1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -507,14 +507,14 @@ void kmidFrame::collect_organize()
|
|
|
|
|
delete dlg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::rechooseTextEvent()
|
|
|
|
|
void tdemidFrame::rechooseTextEvent()
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
if ((cfg->readNumEntry("AutomaticTextEventChooser",1))==1)
|
|
|
|
|
{
|
|
|
|
|
int t=kmidclient->ChooseTypeOfTextEvents();
|
|
|
|
|
kmidclient->repaintText(t);
|
|
|
|
|
int t=tdemidclient->ChooseTypeOfTextEvents();
|
|
|
|
|
tdemidclient->repaintText(t);
|
|
|
|
|
if (t==1)
|
|
|
|
|
((KSelectAction*)actionCollection()->action("display_events"))->setCurrentItem(0);
|
|
|
|
|
else
|
|
|
|
@ -522,26 +522,26 @@ void kmidFrame::rechooseTextEvent()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::song_Loop()
|
|
|
|
|
void tdemidFrame::song_Loop()
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
int i=1-cfg->readNumEntry("Loop",0);
|
|
|
|
|
cfg->writeEntry("Loop",i);
|
|
|
|
|
cfg->sync();
|
|
|
|
|
kmidclient->setSongLoop(i);
|
|
|
|
|
tdemidclient->setSongLoop(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::collect_PlayOrder(int i)
|
|
|
|
|
void tdemidFrame::collect_PlayOrder(int i)
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
cfg->writeEntry("CollectionPlayMode", i);
|
|
|
|
|
cfg->sync();
|
|
|
|
|
kmidclient->setCollectionPlayMode(i);
|
|
|
|
|
tdemidclient->setCollectionPlayMode(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::collect_AutoAdd()
|
|
|
|
|
void tdemidFrame::collect_AutoAdd()
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
@ -549,7 +549,7 @@ void kmidFrame::collect_AutoAdd()
|
|
|
|
|
cfg->sync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::file_SaveLyrics()
|
|
|
|
|
void tdemidFrame::file_SaveLyrics()
|
|
|
|
|
{
|
|
|
|
|
KURL url = KFileDialog::getSaveURL(TQString(),"*",this);
|
|
|
|
|
|
|
|
|
@ -573,120 +573,120 @@ void kmidFrame::file_SaveLyrics()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FILE *fh=fopen(TQFile::encodeName(filename),"wt");
|
|
|
|
|
kmidclient->saveLyrics(fh);
|
|
|
|
|
tdemidclient->saveLyrics(fh);
|
|
|
|
|
fclose(fh);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::spacePressed()
|
|
|
|
|
void tdemidFrame::spacePressed()
|
|
|
|
|
{
|
|
|
|
|
if (!kmidclient->isPlaying()) kmidclient->play();
|
|
|
|
|
if (!tdemidclient->isPlaying()) tdemidclient->play();
|
|
|
|
|
else pause();
|
|
|
|
|
}
|
|
|
|
|
void kmidFrame::options_ShowVolumeBar()
|
|
|
|
|
void tdemidFrame::options_ShowVolumeBar()
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *cfg=kapp->config();
|
|
|
|
|
cfg->setGroup("KMid");
|
|
|
|
|
int i=1-cfg->readNumEntry("ShowVolumeBar",0);
|
|
|
|
|
cfg->writeEntry("ShowVolumeBar",i);
|
|
|
|
|
kmidclient->visibleVolumeBar(i);
|
|
|
|
|
tdemidclient->visibleVolumeBar(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::options_ShowChannelView()
|
|
|
|
|
void tdemidFrame::options_ShowChannelView()
|
|
|
|
|
{
|
|
|
|
|
if (!((KToggleAction*)actionCollection()->action("toggle_channelview"))->isChecked())
|
|
|
|
|
{
|
|
|
|
|
kmidclient->visibleChannelView(0);
|
|
|
|
|
tdemidclient->visibleChannelView(0);
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
kmidclient->visibleChannelView(1);
|
|
|
|
|
connect (kmidclient->getChannelView(),TQT_SIGNAL(destroyMe()),this,TQT_SLOT(channelViewDestroyed()));
|
|
|
|
|
tdemidclient->visibleChannelView(1);
|
|
|
|
|
connect (tdemidclient->getChannelView(),TQT_SIGNAL(destroyMe()),this,TQT_SLOT(channelViewDestroyed()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::channelViewDestroyed()
|
|
|
|
|
void tdemidFrame::channelViewDestroyed()
|
|
|
|
|
{
|
|
|
|
|
kmidclient->channelViewDestroyed();
|
|
|
|
|
tdemidclient->channelViewDestroyed();
|
|
|
|
|
((KToggleAction*)actionCollection()->action("toggle_channelview"))->setChecked(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::options_ChannelViewOptions()
|
|
|
|
|
void tdemidFrame::options_ChannelViewOptions()
|
|
|
|
|
{
|
|
|
|
|
ChannelViewConfigDialog *dlg;
|
|
|
|
|
|
|
|
|
|
dlg=new ChannelViewConfigDialog(NULL,"ChannelViewConfigDialog");
|
|
|
|
|
if (dlg->exec() == TQDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
if (kmidclient->getChannelView())
|
|
|
|
|
kmidclient->getChannelView()->lookMode(
|
|
|
|
|
if (tdemidclient->getChannelView())
|
|
|
|
|
tdemidclient->getChannelView()->lookMode(
|
|
|
|
|
ChannelViewConfigDialog::selectedmode );
|
|
|
|
|
}
|
|
|
|
|
delete dlg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::openURL( const TQString url )
|
|
|
|
|
void tdemidFrame::openURL( const TQString url )
|
|
|
|
|
{
|
|
|
|
|
int c=autoAddSongToCollection(url,1);
|
|
|
|
|
kmidclient->setActiveCollection(c);
|
|
|
|
|
tdemidclient->setActiveCollection(c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*void kmidFrame::play()
|
|
|
|
|
/*void tdemidFrame::play()
|
|
|
|
|
{
|
|
|
|
|
kmidclient->play();
|
|
|
|
|
tdemidclient->play();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::pause()
|
|
|
|
|
void tdemidFrame::pause()
|
|
|
|
|
{
|
|
|
|
|
// kmidclient->pause();
|
|
|
|
|
// tdemidclient->pause();
|
|
|
|
|
((KAction*)actionCollection()->action("pause"))->activate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::stop()
|
|
|
|
|
void tdemidFrame::stop()
|
|
|
|
|
{
|
|
|
|
|
kmidclient->stop();
|
|
|
|
|
tdemidclient->stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::rewind()
|
|
|
|
|
void tdemidFrame::rewind()
|
|
|
|
|
{
|
|
|
|
|
kmidclient->rewind();
|
|
|
|
|
tdemidclient->rewind();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::forward()
|
|
|
|
|
void tdemidFrame::forward()
|
|
|
|
|
{
|
|
|
|
|
kmidclient->forward();
|
|
|
|
|
tdemidclient->forward();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::seek(int ms)
|
|
|
|
|
void tdemidFrame::seek(int ms)
|
|
|
|
|
{
|
|
|
|
|
kmidclient->timebarChange(ms);
|
|
|
|
|
tdemidclient->timebarChange(ms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::prevSong()
|
|
|
|
|
void tdemidFrame::prevSong()
|
|
|
|
|
{
|
|
|
|
|
kmidclient->prevSong();
|
|
|
|
|
tdemidclient->prevSong();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::nextSong()
|
|
|
|
|
void tdemidFrame::nextSong()
|
|
|
|
|
{
|
|
|
|
|
kmidclient->nextSong();
|
|
|
|
|
tdemidclient->nextSong();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setSongLoop(int i)
|
|
|
|
|
void tdemidFrame::setSongLoop(int i)
|
|
|
|
|
{
|
|
|
|
|
((KToggleAction*)actionCollection()->action("song_loop"))->setChecked(i!=0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setVolume(int i)
|
|
|
|
|
void tdemidFrame::setVolume(int i)
|
|
|
|
|
{
|
|
|
|
|
kmidclient->volumebarChange(200-i);
|
|
|
|
|
tdemidclient->volumebarChange(200-i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setTempo(int i)
|
|
|
|
|
void tdemidFrame::setTempo(int i)
|
|
|
|
|
{
|
|
|
|
|
kmidclient->changeTempo(i);
|
|
|
|
|
tdemidclient->changeTempo(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setSongType( int i )
|
|
|
|
|
void tdemidFrame::setSongType( int i )
|
|
|
|
|
{
|
|
|
|
|
KSelectAction *tmplistaction=
|
|
|
|
|
((KSelectAction*)actionCollection()->action("file_type"));
|
|
|
|
@ -694,30 +694,30 @@ void kmidFrame::setSongType( int i )
|
|
|
|
|
tmplistaction->setCurrentItem(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setLyricEvents( int i )
|
|
|
|
|
void tdemidFrame::setLyricEvents( int i )
|
|
|
|
|
{
|
|
|
|
|
KSelectAction *tmplistaction=
|
|
|
|
|
((KSelectAction*)actionCollection()->action("display_events"));
|
|
|
|
|
tmplistaction->setCurrentItem(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::selectSong(int i)
|
|
|
|
|
void tdemidFrame::selectSong(int i)
|
|
|
|
|
{
|
|
|
|
|
kmidclient->getComboSongs()->setCurrentItem(i-1);
|
|
|
|
|
kmidclient->selectSong(i-1);
|
|
|
|
|
tdemidclient->getComboSongs()->setCurrentItem(i-1);
|
|
|
|
|
tdemidclient->selectSong(i-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setActiveCollection( int i )
|
|
|
|
|
void tdemidFrame::setActiveCollection( int i )
|
|
|
|
|
{
|
|
|
|
|
kmidclient->setActiveCollection(i);
|
|
|
|
|
tdemidclient->setActiveCollection(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setCollectionPlayMode(int i)
|
|
|
|
|
void tdemidFrame::setCollectionPlayMode(int i)
|
|
|
|
|
{
|
|
|
|
|
((KSelectAction*)actionCollection()->action("play_order"))->setCurrentItem(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void kmidFrame::setMidiDevice(int i)
|
|
|
|
|
void tdemidFrame::setMidiDevice(int i)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -725,4 +725,4 @@ void kmidFrame::setMidiDevice(int i)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "kmidframe.moc"
|
|
|
|
|
#include "tdemidframe.moc"
|