mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-06 12:39:54 +00:00
- Reduced default Buffer size in Stream.cpp
- Added a new TextLabel class - Added category labels to SearchLayout
This commit is contained in:
parent
f823a2462d
commit
526cb025c2
@ -43,10 +43,10 @@ class CddaDataStream : public IDataStream {
|
||||
public:
|
||||
CddaDataStream();
|
||||
virtual ~CddaDataStream();
|
||||
virtual void Destroy();
|
||||
|
||||
virtual bool Open(const char *filename, unsigned int options = 0);
|
||||
virtual bool Close();
|
||||
virtual void Destroy();
|
||||
virtual PositionType Read(void* buffer, PositionType readBytes);
|
||||
virtual bool SetPosition(PositionType position);
|
||||
virtual PositionType Position();
|
||||
|
@ -45,7 +45,7 @@ using musik::core::PluginFactory;
|
||||
static std::string TAG = "Stream";
|
||||
|
||||
Stream::Stream(unsigned int options)
|
||||
: preferedBufferSampleSize(4096)
|
||||
: preferedBufferSampleSize(2048)
|
||||
, options(options)
|
||||
, decoderSampleRate(0)
|
||||
, decoderSamplePosition(0)
|
||||
|
@ -49,6 +49,7 @@ using namespace musik::box;
|
||||
using namespace cursespp;
|
||||
|
||||
#define SEARCH_HEIGHT 3
|
||||
#define LABEL_HEIGHT 1
|
||||
|
||||
SearchLayout::SearchLayout(PlaybackService& playback, LibraryPtr library)
|
||||
: LayoutBase() {
|
||||
@ -75,13 +76,19 @@ void SearchLayout::Layout() {
|
||||
size_t inputX = x + ((cx - inputWidth) / 2);
|
||||
this->input->MoveAndResize(inputX, 0, cx / 2, SEARCH_HEIGHT);
|
||||
|
||||
size_t labelY = SEARCH_HEIGHT;
|
||||
size_t categoryWidth = cx / 3;
|
||||
size_t categoryY = SEARCH_HEIGHT;
|
||||
size_t categoryY = labelY + LABEL_HEIGHT;
|
||||
size_t categoryHeight = cy - SEARCH_HEIGHT;
|
||||
size_t lastCategoryWidth = cx - (categoryWidth * 2);
|
||||
|
||||
this->albumsLabel->MoveAndResize(0, labelY, categoryWidth, 1);
|
||||
this->albums->MoveAndResize(0, categoryY, categoryWidth, categoryHeight);
|
||||
|
||||
this->artistsLabel->MoveAndResize(categoryWidth, labelY, categoryWidth, 1);
|
||||
this->artists->MoveAndResize(categoryWidth, categoryY, categoryWidth, categoryHeight);
|
||||
|
||||
this->genresLabel->MoveAndResize(categoryWidth * 2, labelY, lastCategoryWidth, 1);
|
||||
this->genres->MoveAndResize(categoryWidth * 2, categoryY, lastCategoryWidth, categoryHeight);
|
||||
}
|
||||
|
||||
@ -90,6 +97,11 @@ void SearchLayout::Layout() {
|
||||
this->AddWindow(view); \
|
||||
view->SetFocusOrder(order);
|
||||
|
||||
#define CREATE_LABEL(view, text) \
|
||||
view.reset(new cursespp::TextLabel()); \
|
||||
view->SetText(text, cursespp::TextLabel::AlignCenter); \
|
||||
this->AddWindow(view);
|
||||
|
||||
void SearchLayout::InitializeWindows(PlaybackService& playback) {
|
||||
this->input.reset(new cursespp::TextInput());
|
||||
this->input->TextChanged.connect(this, &SearchLayout::OnInputChanged);
|
||||
@ -101,6 +113,10 @@ void SearchLayout::InitializeWindows(PlaybackService& playback) {
|
||||
CREATE_CATEGORY(this->artists, constants::Track::ARTIST, 2);
|
||||
CREATE_CATEGORY(this->genres, constants::Track::GENRE, 3);
|
||||
|
||||
CREATE_LABEL(this->albumsLabel, "albums");
|
||||
CREATE_LABEL(this->artistsLabel, "artists");
|
||||
CREATE_LABEL(this->genresLabel, "genres");
|
||||
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include <cursespp/LayoutBase.h>
|
||||
#include <cursespp/TextInput.h>
|
||||
#include <cursespp/TextLabel.h>
|
||||
|
||||
#include <app/window/CategoryListView.h>
|
||||
#include <app/window/TrackListView.h>
|
||||
@ -77,8 +78,11 @@ namespace musik {
|
||||
std::string value);
|
||||
|
||||
musik::core::LibraryPtr library;
|
||||
std::shared_ptr<CategoryListView> artists;
|
||||
std::shared_ptr<cursespp::TextLabel> albumsLabel;
|
||||
std::shared_ptr<CategoryListView> albums;
|
||||
std::shared_ptr<cursespp::TextLabel> artistsLabel;
|
||||
std::shared_ptr<CategoryListView> artists;
|
||||
std::shared_ptr<cursespp::TextLabel> genresLabel;
|
||||
std::shared_ptr<CategoryListView> genres;
|
||||
std::shared_ptr<cursespp::TextInput> input;
|
||||
};
|
||||
|
@ -33,44 +33,12 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Text.h"
|
||||
|
||||
#include "Duration.h"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace musik {
|
||||
namespace box {
|
||||
namespace text {
|
||||
void Truncate(std::string& str, size_t len) {
|
||||
/* not a simple substr anymore, gotta deal with multi-byte
|
||||
characters... */
|
||||
if (u8len(str) > len) {
|
||||
std::string::iterator it = str.begin();
|
||||
std::string::iterator end = str.end();
|
||||
|
||||
size_t c = 0;
|
||||
while (c < len && it != str.end()) {
|
||||
try {
|
||||
utf8::next(it, end);
|
||||
}
|
||||
catch (...) {
|
||||
/* invalid encoding, just treat as a single char */
|
||||
++it;
|
||||
}
|
||||
|
||||
++c;
|
||||
}
|
||||
|
||||
str = std::string(str.begin(), it);
|
||||
}
|
||||
}
|
||||
|
||||
void Ellipsize(std::string& str, size_t len) {
|
||||
if (u8len(str) > len) {
|
||||
Truncate(str, len - 2);
|
||||
str += "..";
|
||||
}
|
||||
}
|
||||
|
||||
namespace duration {
|
||||
std::string Duration(int seconds) {
|
||||
int mins = (seconds / 60);
|
||||
int secs = seconds - (mins * 60);
|
47
src/musikbox/app/util/Duration.h
Executable file
47
src/musikbox/app/util/Duration.h
Executable file
@ -0,0 +1,47 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007-2016 musikcube team
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
namespace musik {
|
||||
namespace box {
|
||||
namespace duration {
|
||||
std::string Duration(std::string& str);
|
||||
std::string Duration(int seconds);
|
||||
std::string Duration(double seconds);
|
||||
}
|
||||
}
|
||||
}
|
@ -38,10 +38,10 @@
|
||||
#include <cursespp/SingleLineEntry.h>
|
||||
#include <cursespp/MultiLineEntry.h>
|
||||
#include <cursespp/IMessage.h>
|
||||
#include <cursespp/Text.h>
|
||||
|
||||
#include <core/library/LocalLibraryConstants.h>
|
||||
|
||||
#include <app/util/Text.h>
|
||||
#include <app/query/CategoryListViewQuery.h>
|
||||
|
||||
#include "CategoryListView.h"
|
||||
@ -51,7 +51,8 @@ using musik::core::audio::ITransport;
|
||||
using musik::core::IQuery;
|
||||
using namespace musik::core::library::constants;
|
||||
using namespace musik::box;
|
||||
using cursespp::SingleLineEntry;
|
||||
|
||||
using namespace cursespp;
|
||||
|
||||
#define WINDOW_MESSAGE_QUERY_COMPLETED 1002
|
||||
|
||||
|
@ -35,9 +35,10 @@
|
||||
#include <stdafx.h>
|
||||
#include "EntryWithHeader.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <app/util/Text.h>
|
||||
#include <cursespp/Text.h>
|
||||
|
||||
using namespace musik::box;
|
||||
using namespace cursespp;
|
||||
|
||||
EntryWithHeader::EntryWithHeader(
|
||||
const std::string& header, const std::string& value)
|
||||
@ -70,7 +71,7 @@ size_t EntryWithHeader::GetLineCount() {
|
||||
std::string EntryWithHeader::GetLine(size_t line) {
|
||||
if (line == 0) {
|
||||
std::string ellipsized = this->header;
|
||||
musik::box::text::Ellipsize(ellipsized, this->width);
|
||||
text::Ellipsize(ellipsized, this->width);
|
||||
return ellipsized;
|
||||
}
|
||||
|
||||
|
@ -37,13 +37,14 @@
|
||||
#include <cursespp/Colors.h>
|
||||
#include <cursespp/SingleLineEntry.h>
|
||||
#include <cursespp/IMessage.h>
|
||||
#include <cursespp/Text.h>
|
||||
|
||||
#include "TrackListView.h"
|
||||
|
||||
#include <core/library/LocalLibraryConstants.h>
|
||||
|
||||
#include <app/util/Text.h>
|
||||
#include <app/window/EntryWithHeader.h>
|
||||
#include <app/util/Duration.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/format/group.hpp>
|
||||
@ -195,7 +196,7 @@ IScrollAdapter::EntryPtr TrackListView::Adapter::GetEntry(size_t index) {
|
||||
text::Ellipsize(artist, ARTIST_COL_WIDTH);
|
||||
text::Ellipsize(album, ALBUM_COL_WIDTH);
|
||||
text::Ellipsize(title, column1CharacterCount);
|
||||
duration = text::Duration(duration);
|
||||
duration = duration::Duration(duration);
|
||||
|
||||
std::string text = boost::str(
|
||||
boost::format("%s %s %s %s %s")
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <cursespp/Colors.h>
|
||||
#include <cursespp/Message.h>
|
||||
|
||||
#include <app/util/Text.h>
|
||||
#include <app/util/Duration.h>
|
||||
|
||||
#include <core/debug.h>
|
||||
#include <core/library/LocalLibraryConstants.h>
|
||||
@ -201,8 +201,8 @@ void TransportWindow::Update() {
|
||||
int secondsCurrent = (int) round(transport.Position());
|
||||
int secondsTotal = boost::lexical_cast<int>(duration);
|
||||
|
||||
std::string currentTime = text::Duration(std::min(secondsCurrent, secondsTotal));
|
||||
std::string totalTime = text::Duration(secondsTotal);
|
||||
std::string currentTime = duration::Duration(std::min(secondsCurrent, secondsTotal));
|
||||
std::string totalTime = duration::Duration(secondsTotal);
|
||||
|
||||
size_t timerWidth =
|
||||
this->GetContentWidth() -
|
||||
|
73
src/musikbox/cursespp/Text.cpp
Executable file
73
src/musikbox/cursespp/Text.cpp
Executable file
@ -0,0 +1,73 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007-2016 musikcube team
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Text.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace cursespp {
|
||||
namespace text {
|
||||
void Truncate(std::string& str, size_t len) {
|
||||
/* not a simple substr anymore, gotta deal with multi-byte
|
||||
characters... */
|
||||
if (u8len(str) > len) {
|
||||
std::string::iterator it = str.begin();
|
||||
std::string::iterator end = str.end();
|
||||
|
||||
size_t c = 0;
|
||||
while (c < len && it != str.end()) {
|
||||
try {
|
||||
utf8::next(it, end);
|
||||
}
|
||||
catch (...) {
|
||||
/* invalid encoding, just treat as a single char */
|
||||
++it;
|
||||
}
|
||||
|
||||
++c;
|
||||
}
|
||||
|
||||
str = std::string(str.begin(), it);
|
||||
}
|
||||
}
|
||||
|
||||
void Ellipsize(std::string& str, size_t len) {
|
||||
if (u8len(str) > len) {
|
||||
Truncate(str, len - 2);
|
||||
str += "..";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -36,14 +36,9 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
namespace musik {
|
||||
namespace box {
|
||||
namespace text {
|
||||
void Truncate(std::string& str, size_t len);
|
||||
void Ellipsize(std::string& str, size_t len);
|
||||
std::string Duration(std::string& str);
|
||||
std::string Duration(int seconds);
|
||||
std::string Duration(double seconds);
|
||||
}
|
||||
namespace cursespp {
|
||||
namespace text {
|
||||
void Truncate(std::string& str, size_t len);
|
||||
void Ellipsize(std::string& str, size_t len);
|
||||
}
|
||||
}
|
104
src/musikbox/cursespp/TextLabel.cpp
Executable file
104
src/musikbox/cursespp/TextLabel.cpp
Executable file
@ -0,0 +1,104 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007-2016 musikcube team
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdafx.h>
|
||||
|
||||
#include <cursespp/Screen.h>
|
||||
#include <cursespp/Colors.h>
|
||||
#include <cursespp/MessageQueue.h>
|
||||
#include <cursespp/Message.h>
|
||||
#include <cursespp/Text.h>
|
||||
|
||||
#include "TextLabel.h"
|
||||
|
||||
using namespace cursespp;
|
||||
|
||||
inline static void redrawContents(
|
||||
IWindow &window,
|
||||
const TextLabel::Alignment alignment,
|
||||
const std::string& text)
|
||||
{
|
||||
WINDOW* c = window.GetContent();
|
||||
werase(c);
|
||||
|
||||
int len = (int) u8len(text);
|
||||
int cx = window.GetContentWidth();
|
||||
|
||||
if (len > cx) {
|
||||
std::string ellipsized = text;
|
||||
text::Ellipsize(ellipsized, cx);
|
||||
wprintw(c, ellipsized.c_str());
|
||||
}
|
||||
else if (alignment == TextLabel::AlignLeft) {
|
||||
wprintw(c, text.c_str());
|
||||
}
|
||||
else { /* center */
|
||||
int leftPad =
|
||||
(alignment == TextLabel::AlignRight)
|
||||
? (cx - len)
|
||||
: (cx - len) / 2;
|
||||
|
||||
std::string padded;
|
||||
for (int i = 0; i < leftPad; i++) {
|
||||
padded += " ";
|
||||
}
|
||||
|
||||
padded += text;
|
||||
wprintw(c, padded.c_str());
|
||||
}
|
||||
|
||||
window.Repaint();
|
||||
}
|
||||
|
||||
TextLabel::TextLabel()
|
||||
: Window()
|
||||
, alignment(AlignLeft) {
|
||||
this->SetFrameVisible(false);
|
||||
}
|
||||
|
||||
TextLabel::~TextLabel() {
|
||||
}
|
||||
|
||||
void TextLabel::Show() {
|
||||
Window::Show();
|
||||
redrawContents(*this, this->alignment, this->buffer);
|
||||
}
|
||||
|
||||
void TextLabel::SetText(const std::string& value, const Alignment alignment) {
|
||||
if (value != this->buffer || alignment != this->alignment) {
|
||||
this->buffer = value;
|
||||
this->alignment = alignment;
|
||||
redrawContents(*this, alignment, buffer);
|
||||
}
|
||||
}
|
70
src/musikbox/cursespp/TextLabel.h
Executable file
70
src/musikbox/cursespp/TextLabel.h
Executable file
@ -0,0 +1,70 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007-2016 musikcube team
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cursespp/curses_config.h>
|
||||
#include <cursespp/Window.h>
|
||||
#include <cursespp/IInput.h>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
namespace cursespp {
|
||||
class TextLabel :
|
||||
#if (__clang_major__ == 7 && __clang_minor__ == 3)
|
||||
public std::enable_shared_from_this<TextInput>,
|
||||
#endif
|
||||
public cursespp::Window {
|
||||
public:
|
||||
enum Alignment {
|
||||
AlignLeft,
|
||||
AlignCenter,
|
||||
AlignRight
|
||||
};
|
||||
|
||||
TextLabel();
|
||||
virtual ~TextLabel();
|
||||
|
||||
virtual void SetText(
|
||||
const std::string& value,
|
||||
const Alignment alignment = AlignLeft);
|
||||
|
||||
virtual std::string GetText() { return this->buffer; }
|
||||
|
||||
virtual void Show();
|
||||
|
||||
private:
|
||||
std::string buffer;
|
||||
Alignment alignment;
|
||||
};
|
||||
}
|
@ -124,9 +124,9 @@
|
||||
<ClCompile Include="app\query\NowPlayingTrackListQuery.cpp" />
|
||||
<ClCompile Include="app\query\CategoryTrackListQuery.cpp" />
|
||||
<ClCompile Include="app\service\PlaybackService.cpp" />
|
||||
<ClCompile Include="app\util\Duration.cpp" />
|
||||
<ClCompile Include="app\util\GlobalHotkeys.cpp" />
|
||||
<ClCompile Include="app\util\SystemInfo.cpp" />
|
||||
<ClCompile Include="app\util\Text.cpp" />
|
||||
<ClCompile Include="app\window\CategoryListView.cpp" />
|
||||
<ClCompile Include="app\window\EntryWithHeader.cpp" />
|
||||
<ClCompile Include="app\window\LogWindow.cpp" />
|
||||
@ -144,7 +144,9 @@
|
||||
<ClCompile Include="cursespp\ScrollAdapterBase.cpp" />
|
||||
<ClCompile Include="cursespp\SimpleScrollAdapter.cpp" />
|
||||
<ClCompile Include="cursespp\SingleLineEntry.cpp" />
|
||||
<ClCompile Include="cursespp\Text.cpp" />
|
||||
<ClCompile Include="cursespp\TextInput.cpp" />
|
||||
<ClCompile Include="cursespp\TextLabel.cpp" />
|
||||
<ClCompile Include="cursespp\Window.cpp" />
|
||||
<ClCompile Include="cursespp\WindowLayout.cpp" />
|
||||
<ClCompile Include="cursespp\Message.cpp" />
|
||||
@ -166,9 +168,9 @@
|
||||
<ClInclude Include="app\query\TrackListQueryBase.h" />
|
||||
<ClInclude Include="app\query\CategoryTrackListQuery.h" />
|
||||
<ClInclude Include="app\service\PlaybackService.h" />
|
||||
<ClInclude Include="app\util\Duration.h" />
|
||||
<ClInclude Include="app\util\GlobalHotkeys.h" />
|
||||
<ClInclude Include="app\util\SystemInfo.h" />
|
||||
<ClInclude Include="app\util\Text.h" />
|
||||
<ClInclude Include="app\window\CategoryListView.h" />
|
||||
<ClInclude Include="app\window\EntryWithHeader.h" />
|
||||
<ClInclude Include="app\window\LogWindow.h" />
|
||||
@ -199,7 +201,9 @@
|
||||
<ClInclude Include="cursespp\ScrollAdapterBase.h" />
|
||||
<ClInclude Include="cursespp\SimpleScrollAdapter.h" />
|
||||
<ClInclude Include="cursespp\SingleLineEntry.h" />
|
||||
<ClInclude Include="cursespp\Text.h" />
|
||||
<ClInclude Include="cursespp\TextInput.h" />
|
||||
<ClInclude Include="cursespp\TextLabel.h" />
|
||||
<ClInclude Include="cursespp\Window.h" />
|
||||
<ClInclude Include="cursespp\WindowLayout.h" />
|
||||
<ClInclude Include="cursespp\Message.h" />
|
||||
|
@ -60,9 +60,6 @@
|
||||
<ClCompile Include="app\util\GlobalHotkeys.cpp">
|
||||
<Filter>app\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="app\util\Text.cpp">
|
||||
<Filter>app\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cursespp\LayoutStack.cpp">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClCompile>
|
||||
@ -105,6 +102,15 @@
|
||||
<ClCompile Include="app\layout\SearchLayout.cpp">
|
||||
<Filter>app\layout</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cursespp\TextLabel.cpp">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cursespp\Text.cpp">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="app\util\Duration.cpp">
|
||||
<Filter>app\util</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
@ -195,9 +201,6 @@
|
||||
<ClInclude Include="app\util\GlobalHotkeys.h">
|
||||
<Filter>app\util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="app\util\Text.h">
|
||||
<Filter>app\util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cursespp\LayoutStack.h">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClInclude>
|
||||
@ -252,6 +255,15 @@
|
||||
<ClInclude Include="app\layout\SearchLayout.h">
|
||||
<Filter>app\layout</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cursespp\TextLabel.h">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cursespp\Text.h">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="app\util\Duration.h">
|
||||
<Filter>app\util</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="cursespp">
|
||||
|
Loading…
x
Reference in New Issue
Block a user