Skip to content

Commit

Permalink
jamulussoftware#1993 resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
pljones committed Sep 5, 2021
2 parents 3c96ded + ce370e9 commit a8853b6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/audiomixerboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,9 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo )

// Label text --------------------------------------------------------------

QString strModText = cChanInfo.strName;
QString strModText = cChanInfo.strName;
QTextBoundaryFinder tbfName ( QTextBoundaryFinder::Grapheme, cChanInfo.strName );
int iBreakPos;

// apply break position and font size depending on the selected design
if ( eDesign == GD_SLIMFADER )
Expand All @@ -652,22 +654,28 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo )
plblLabel->setStyleSheet ( "QLabel { color: black; }" );

// break at every 4th character
for ( int iInsPos = 4; iInsPos <= strModText.size() - 1; iInsPos += 4 + 1 )
{
strModText.insert ( iInsPos, "\n" );
}
iBreakPos = 4;
}
else
{
// in normal mode use bold font
plblLabel->setStyleSheet ( "QLabel { color: black; font: bold; }" );

// break text at predefined position
const int iBreakPos = MAX_LEN_FADER_TAG / 2;
iBreakPos = MAX_LEN_FADER_TAG / 2;
}

if ( strModText.length() > iBreakPos )
int iInsPos = iBreakPos;
int iCount = 0;
int iLineNumber = 0;
while ( tbfName.toNextBoundary() != -1 )
{
++iCount;
if ( iCount == iInsPos )
{
strModText.insert ( iBreakPos, QString ( "\n" ) );
strModText.insert ( tbfName.position() + iLineNumber, QString ( "\n" ) );
iLineNumber++;
iInsPos += iBreakPos;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/audiomixerboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <QListWidget>
#include <QMenu>
#include <QMutex>
#include <QTextBoundaryFinder>
#include "global.h"
#include "util.h"
#include "levelmeter.h"
Expand Down
13 changes: 13 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,19 @@ void CLanguageComboBox::OnLanguageActivated ( int iLanguageIdx )
emit LanguageChanged ( itemData ( iLanguageIdx ).toString() );
}
}

static inline QString TruncateString ( QString str, int position )
{
QTextBoundaryFinder tbfString ( QTextBoundaryFinder::Grapheme, str );

tbfString.setPosition ( position );
if ( !tbfString.isAtBoundary() )
{
tbfString.toPreviousBoundary();
position = tbfString.position();
}
return str.left ( position );
}
#endif

/******************************************************************************\
Expand Down
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
# include <QDateTime>
# include <QDesktopServices>
# include <QKeyEvent>
# include <QTextBoundaryFinder>
# include "ui_aboutdlgbase.h"
#endif
#include <QFile>
Expand Down

0 comments on commit a8853b6

Please sign in to comment.