make defining screens with main window type as non-pointer possible
This commit is contained in:
@@ -51,16 +51,15 @@ const SongInfo::Metadata SongInfo::Tags[] =
|
||||
};
|
||||
|
||||
SongInfo::SongInfo()
|
||||
{
|
||||
w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
|
||||
}
|
||||
: Screen(NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone))
|
||||
{ }
|
||||
|
||||
void SongInfo::resize()
|
||||
{
|
||||
size_t x_offset, width;
|
||||
getWindowResizeParams(x_offset, width);
|
||||
w->resize(width, MainHeight);
|
||||
w->moveTo(x_offset, MainStartY);
|
||||
w.resize(width, MainHeight);
|
||||
w.moveTo(x_offset, MainStartY);
|
||||
hasToBeResized = 0;
|
||||
}
|
||||
|
||||
@@ -91,10 +90,10 @@ void SongInfo::switchTo()
|
||||
myOldScreen = myScreen;
|
||||
myScreen = this;
|
||||
|
||||
w->clear();
|
||||
w->reset();
|
||||
w.clear();
|
||||
w.reset();
|
||||
PrepareSong(*s);
|
||||
w->flush();
|
||||
w.flush();
|
||||
|
||||
// redraw header after we're done with the file, since reading it from disk
|
||||
// takes a bit of time and having header updated before content of a window
|
||||
@@ -112,24 +111,24 @@ void SongInfo::PrepareSong(MPD::Song &s)
|
||||
TagLib::FileRef f(path_to_file.c_str());
|
||||
# endif // HAVE_TAGLIB_H
|
||||
|
||||
*w << NC::fmtBold << Config.color1 << L"Filename: " << NC::fmtBoldEnd << Config.color2 << s.getName() << '\n' << NC::clEnd;
|
||||
*w << NC::fmtBold << L"Directory: " << NC::fmtBoldEnd << Config.color2;
|
||||
ShowTag(*w, s.getDirectory());
|
||||
*w << L"\n\n" << NC::clEnd;
|
||||
*w << NC::fmtBold << L"Length: " << NC::fmtBoldEnd << Config.color2 << s.getLength() << '\n' << NC::clEnd;
|
||||
w << NC::fmtBold << Config.color1 << L"Filename: " << NC::fmtBoldEnd << Config.color2 << s.getName() << '\n' << NC::clEnd;
|
||||
w << NC::fmtBold << L"Directory: " << NC::fmtBoldEnd << Config.color2;
|
||||
ShowTag(w, s.getDirectory());
|
||||
w << L"\n\n" << NC::clEnd;
|
||||
w << NC::fmtBold << L"Length: " << NC::fmtBoldEnd << Config.color2 << s.getLength() << '\n' << NC::clEnd;
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
if (!f.isNull())
|
||||
{
|
||||
*w << NC::fmtBold << L"Bitrate: " << NC::fmtBoldEnd << Config.color2 << f.audioProperties()->bitrate() << L" kbps\n" << NC::clEnd;
|
||||
*w << NC::fmtBold << L"Sample rate: " << NC::fmtBoldEnd << Config.color2 << f.audioProperties()->sampleRate() << L" Hz\n" << NC::clEnd;
|
||||
*w << NC::fmtBold << L"Channels: " << NC::fmtBoldEnd << Config.color2 << (f.audioProperties()->channels() == 1 ? L"Mono" : L"Stereo") << '\n' << NC::clDefault;
|
||||
w << NC::fmtBold << L"Bitrate: " << NC::fmtBoldEnd << Config.color2 << f.audioProperties()->bitrate() << L" kbps\n" << NC::clEnd;
|
||||
w << NC::fmtBold << L"Sample rate: " << NC::fmtBoldEnd << Config.color2 << f.audioProperties()->sampleRate() << L" Hz\n" << NC::clEnd;
|
||||
w << NC::fmtBold << L"Channels: " << NC::fmtBoldEnd << Config.color2 << (f.audioProperties()->channels() == 1 ? L"Mono" : L"Stereo") << '\n' << NC::clDefault;
|
||||
}
|
||||
# endif // HAVE_TAGLIB_H
|
||||
*w << NC::clDefault;
|
||||
w << NC::clDefault;
|
||||
|
||||
for (const Metadata *m = Tags; m->Name; ++m)
|
||||
{
|
||||
*w << NC::fmtBold << '\n' << ToWString(m->Name) << L": " << NC::fmtBoldEnd;
|
||||
ShowTag(*w, s.getTags(m->Get, Config.tags_separator));
|
||||
w << NC::fmtBold << '\n' << ToWString(m->Name) << L": " << NC::fmtBoldEnd;
|
||||
ShowTag(w, s.getTags(m->Get, Config.tags_separator));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user