Fixed memory leak in FString move assignment operator

This commit is contained in:
Markus Gans 2020-05-24 23:55:08 +02:00
parent 6c6b70ed9e
commit 59830cbd05
64 changed files with 254 additions and 230 deletions

View File

@ -1,6 +1,7 @@
2020-05-24 Markus Gans <guru.mail@muenster.de> 2020-05-24 Markus Gans <guru.mail@muenster.de>
* New class FStringStream implements input and output operations * New class FStringStream implements input and output operations
on FString based streams on FString based streams
* Fixed memory leak in FString move assignment operator
2020-05-21 Markus Gans <guru.mail@muenster.de> 2020-05-21 Markus Gans <guru.mail@muenster.de>
* Fixed the event queue in FApplication * Fixed the event queue in FApplication

View File

@ -69,8 +69,8 @@ int main (int argc, char* argv[])
finalcut::FApplication app(argc, argv); finalcut::FApplication app(argc, argv);
finalcut::FDialog dialog(&app); finalcut::FDialog dialog(&app);
dialog.setText ("A dialog"); dialog.setText ("A dialog");
const finalcut::FPoint position(25, 5); const finalcut::FPoint position{25, 5};
const finalcut::FSize size(30, 10); const finalcut::FSize size{30, 10};
dialog.setGeometry (position, size); dialog.setGeometry (position, size);
finalcut::FWidget::setMainWidget(&dialog); finalcut::FWidget::setMainWidget(&dialog);
dialog.show(); dialog.show();
@ -126,8 +126,8 @@ dialog.setText ("A dialog");
The title bar of the dialog box gets the text "A dialog". The title bar of the dialog box gets the text "A dialog".
```cpp ```cpp
finalcut::FPoint position(25, 5); finalcut::FPoint position{25, 5};
finalcut::FSize size(30, 10); finalcut::FSize size{30, 10};
dialog.setGeometry (position, size); dialog.setGeometry (position, size);
``` ```
The dialog window gets a width of 30 and a height of 10 characters. The dialog window gets a width of 30 and a height of 10 characters.
@ -206,11 +206,11 @@ int main (int argc, char* argv[])
// The object dialog is managed by app // The object dialog is managed by app
FDialog* dialog = new FDialog(&app); FDialog* dialog = new FDialog(&app);
dialog->setText ("Window Title"); dialog->setText ("Window Title");
dialog->setGeometry (FPoint(25, 5), FSize(40, 8)); dialog->setGeometry (FPoint{25, 5}, FSize{40, 8});
// The object input is managed by dialog // The object input is managed by dialog
FLineEdit* input = new FLineEdit("predefined text", dialog); FLineEdit* input = new FLineEdit("predefined text", dialog);
input->setGeometry(FPoint(8, 2), FSize(29, 1)); input->setGeometry(FPoint{8, 2}, FSize{29, 1});
input->setLabelText (L"&Input"); input->setLabelText (L"&Input");
// The object label is managed by dialog // The object label is managed by dialog
@ -218,7 +218,7 @@ int main (int argc, char* argv[])
"adipiscing elit, sed do eiusmod tempor " "adipiscing elit, sed do eiusmod tempor "
"incididunt ut labore et dolore magna aliqua." "incididunt ut labore et dolore magna aliqua."
, dialog ); , dialog );
label->setGeometry (FPoint(2, 4), FSize(36, 1)); label->setGeometry (FPoint{2, 4}, FSize{36, 1});
FWidget::setMainWidget(dialog); FWidget::setMainWidget(dialog);
dialog->show(); dialog->show();
return app.exec(); return app.exec();
@ -322,13 +322,13 @@ class dialogWidget : public FDialog
{ {
public: public:
explicit dialogWidget (FWidget* parent = nullptr) explicit dialogWidget (FWidget* parent = nullptr)
: FDialog(parent) : FDialog{parent}
{ {
setText ("Dialog"); setText ("Dialog");
setGeometry (FPoint(25, 5), FSize(23, 4)); setGeometry (FPoint{25, 5}, FSize{23, 4});
label.setGeometry (FPoint(1, 1), FSize(10, 1)); label.setGeometry (FPoint{1, 1}, FSize{10, 1});
label.setAlignment (fc::alignRight); label.setAlignment (fc::alignRight);
value.setGeometry (FPoint(11, 1), FSize(10, 1)); value.setGeometry (FPoint{11, 1}, FSize{10, 1});
id = addTimer(100); id = addTimer(100);
} }
@ -500,14 +500,14 @@ int main (int argc, char* argv[])
FApplication app(argc, argv); FApplication app(argc, argv);
FDialog dialog(&app); FDialog dialog(&app);
dialog.setText ("A dialog with callback function"); dialog.setText ("A dialog with callback function");
dialog.setGeometry (FRect(25, 5, 45, 9)); dialog.setGeometry (FRect{25, 5, 45, 9});
FLabel label (&dialog); FLabel label (&dialog);
label = "The button has never been pressed before"; label = "The button has never been pressed before";
label.setGeometry (FPoint(2, 2), FSize(41, 1)); label.setGeometry (FPoint{2, 2}, FSize{41, 1});
FButton button (&dialog); FButton button (&dialog);
// Character follows '&' will be used as the accelerator key // Character follows '&' will be used as the accelerator key
button = "&Click me"; button = "&Click me";
button.setGeometry (FPoint(15, 5), FSize(14, 1)); button.setGeometry (FPoint{15, 5}, FSize{14, 1});
// Connect the button signal "clicked" with the callback function // Connect the button signal "clicked" with the callback function
button.addCallback button.addCallback
@ -553,9 +553,9 @@ int main (int argc, char* argv[])
FApplication app(argc, argv); FApplication app(argc, argv);
FDialog dialog(&app); FDialog dialog(&app);
dialog.setText ("Lambda expression as callback"); dialog.setText ("Lambda expression as callback");
dialog.setGeometry (FRect(25, 5, 45, 9)); dialog.setGeometry (FRect{25, 5, 45, 9});
FButton button ("&bottom", &dialog); FButton button ("&bottom", &dialog);
button.setGeometry (FPoint(15, 5), FSize(14, 1)); button.setGeometry (FPoint{15, 5}, FSize{14, 1});
// Connect the button signal "clicked" with the lambda expression // Connect the button signal "clicked" with the lambda expression
button.addCallback button.addCallback
@ -567,12 +567,12 @@ int main (int argc, char* argv[])
if ( button.getY() != 2 ) if ( button.getY() != 2 )
{ {
button.setPos (FPoint(15, 2)); button.setPos (FPoint{15, 2});
button.setText("&top"); button.setText("&top");
} }
else else
{ {
button.setPos (FPoint(15, 5)); button.setPos (FPoint{15, 5});
button.setText("&bottom"); button.setText("&bottom");
} }
@ -619,8 +619,8 @@ class dialogWidget : public FDialog
: FDialog(parent) : FDialog(parent)
{ {
setText ("Callback method"); setText ("Callback method");
setGeometry (FPoint(25, 5), FSize(25, 7)); setGeometry (FPoint{25, 5}, FSize{25, 7});
button.setGeometry (FPoint(7, 3), FSize(10, 1)); button.setGeometry (FPoint{7, 3}, FSize{10, 1});
// Connect the button signal "clicked" with the callback method // Connect the button signal "clicked" with the callback method
button.addCallback button.addCallback
@ -678,16 +678,16 @@ class dialogWidget : public FDialog
{ {
public: public:
explicit dialogWidget (FWidget* parent = nullptr) explicit dialogWidget (FWidget* parent = nullptr)
: FDialog(parent) : FDialog{parent}
{ {
setGeometry (FPoint(25, 5), FSize(22, 7)); setGeometry (FPoint{25, 5}, FSize{22, 7});
setText ("Emit signal"); setText ("Emit signal");
const FSize size(5, 1); const FSize size{5, 1};
label.setGeometry (FPoint(8, 1), size); label.setGeometry (FPoint{8, 1}, size);
label.setAlignment (fc::alignRight); label.setAlignment (fc::alignRight);
label.setForegroundColor (fc::Black); label.setForegroundColor (fc::Black);
plus.setGeometry (FPoint(3, 3), size); plus.setGeometry (FPoint{3, 3}, size);
minus.setGeometry (FPoint(13, 3), size); minus.setGeometry (FPoint{13, 3}, size);
plus.setNoUnderline(); plus.setNoUnderline();
minus.setNoUnderline(); minus.setNoUnderline();
@ -987,15 +987,15 @@ class dialogWidget : public FDialog
{ {
public: public:
explicit dialogWidget (FWidget* parent = nullptr) explicit dialogWidget (FWidget* parent = nullptr)
: FDialog(parent) : FDialog{parent}
{ {
setText ("Dialog"); setText ("Dialog");
setResizeable(); setResizeable();
button.setGeometry (FPoint(1, 1), FSize(12, 1), false); button.setGeometry (FPoint{1, 1}, FSize{12, 1}, false);
input.setGeometry (FPoint(2, 3), FSize(12, 1), false); input.setGeometry (FPoint{2, 3}, FSize{12, 1}, false);
// Set dialog geometry and calling adjustSize() // Set dialog geometry and calling adjustSize()
setGeometry (FPoint(25, 5), FSize(40, 12)); setGeometry (FPoint{25, 5}), FSize{40, 12});
setMinimumSize (FSize(25, 9)); setMinimumSize (FSize{25, 9});
} }
private: private:
@ -1011,14 +1011,14 @@ class dialogWidget : public FDialog
auto y = int((getDesktopHeight() - getHeight()) / 2); auto y = int((getDesktopHeight() - getHeight()) / 2);
checkMinValue(x); checkMinValue(x);
checkMinValue(y); checkMinValue(y);
setPos (FPoint(x, y), false); setPos (FPoint{x, y}, false);
} }
void adjustWidgets() void adjustWidgets()
{ {
const auto bx = int(getWidth() - button.getWidth() - 3); const auto bx = int(getWidth() - button.getWidth() - 3);
const auto by = int(getHeight() - 4); const auto by = int(getHeight() - 4);
button.setPos (FPoint(bx, by), false); button.setPos (FPoint{bx, by}, false);
input.setWidth (getWidth() - 4); input.setWidth (getWidth() - 4);
const auto ly = int(getHeight() / 2) - 1; const auto ly = int(getHeight() / 2) - 1;
input.setY (ly, false); input.setY (ly, false);
@ -1046,10 +1046,10 @@ class dialogWidget : public FDialog
// Calling super class method draw() // Calling super class method draw()
FDialog::draw(); FDialog::draw();
print() << FPoint (3, 3) print() << FPoint{3, 3}
<< FColorPair (fc::Black, fc::White) << FColorPair{fc::Black, fc::White}
<< "Text on " << "Text on "
<< FColorPair (fc::Blue, fc::Yellow) << FColorPair{fc::Blue, fc::Yellow}
<< "top"; << "top";
} }
@ -1129,12 +1129,12 @@ class dialogWidget : public FDialog
{ {
public: public:
explicit dialogWidget (FWidget* parent = nullptr) explicit dialogWidget (FWidget* parent = nullptr)
: FDialog(parent) : FDialog{parent}
{ {
setText ("Dialog"); setText ("Dialog");
setGeometry (FPoint(28, 2), FSize(24, 21)); setGeometry (FPoint{28, 2}, FSize{24, 21});
scrollview.setGeometry(FPoint(1, 1), FSize(22, 11)); scrollview.setGeometry(FPoint{1, 1}, FSize{22, 11});
scrollview.setScrollSize(FSize(60, 27)); scrollview.setScrollSize(FSize{60, 27});
const auto& wc = getFWidgetColors(); const auto& wc = getFWidgetColors();
setColor (wc.label_inactive_fg, wc.dialog_bg); setColor (wc.label_inactive_fg, wc.dialog_bg);
scrollview.clearArea(); scrollview.clearArea();
@ -1144,25 +1144,25 @@ class dialogWidget : public FDialog
static std::vector<direction> d static std::vector<direction> d
{ {
{"NW", FPoint(3, 13), FPoint(1, 1), black}, {"NW", FPoint{3, 13}, FPoint{1, 1}, black},
{"N", FPoint(10, 13), FPoint(21, 1), red}, {"N", FPoint{10, 13}, FPoint{21, 1}, red},
{"NE", FPoint(17, 13), FPoint(41, 1), black}, {"NE", FPoint{17, 13}, FPoint{41, 1}, black},
{"W", FPoint(3, 15), FPoint(1, 10), black}, {"W", FPoint{3, 15}, FPoint{1, 10}, black},
{"*", FPoint(10, 15), FPoint(21, 10), black}, {"*", FPoint{10, 15}, FPoint{21, 10}, black},
{"E", FPoint(17, 15), FPoint(41, 10), black}, {"E", FPoint{17, 15}, FPoint{41, 10}, black},
{"SW", FPoint(3, 17), FPoint(1, 19), black}, {"SW", FPoint{3, 17}, FPoint{1, 19}, black},
{"S", FPoint(10, 17), FPoint(21, 19), cyan}, {"S", FPoint{10, 17}, FPoint{21, 19}, cyan},
{"SE", FPoint(17, 17), FPoint(41, 19), black} {"SE", FPoint{17, 17}, FPoint{41, 19}, black}
}; };
for (auto&& b : d) for (auto&& b : d)
{ {
scrollview.print() << std::get<2>(b) + FPoint(10, 5) scrollview.print() << std::get<2>(b) + FPoint{10, 5}
<< std::get<3>(b) << std::get<0>(b); << std::get<3>(b) << std::get<0>(b);
auto edit = new FLineEdit("direction " + std::get<0>(b), &scrollview); auto edit = new FLineEdit("direction " + std::get<0>(b), &scrollview);
edit->setGeometry(std::get<2>(b) + FPoint(1, 1), FSize(17, 1)); edit->setGeometry(std::get<2>(b) + FPoint{1, 1}, FSize{17, 1});
auto btn = new FButton(std::get<0>(b), this); auto btn = new FButton(std::get<0>(b), this);
btn->setGeometry(std::get<1>(b), FSize(4, 1)); btn->setGeometry(std::get<1>(b), FSize{4, 1});
btn->unsetShadow(); btn->unsetShadow();
btn->addCallback btn->addCallback
( (

View File

@ -74,7 +74,7 @@ class SegmentView final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
SegmentView::SegmentView (finalcut::FWidget* parent) SegmentView::SegmentView (finalcut::FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor

View File

@ -92,7 +92,7 @@ class Background final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Background::Background (finalcut::FWidget* parent) Background::Background (finalcut::FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor

View File

@ -62,7 +62,7 @@ class Button final : public finalcut::FButton
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Button::Button (finalcut::FWidget* parent) Button::Button (finalcut::FWidget* parent)
: finalcut::FButton(parent) : finalcut::FButton{parent}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -245,7 +245,7 @@ class Calc final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Calc::Calc (FWidget* parent) Calc::Calc (FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor

View File

@ -73,7 +73,7 @@ class CheckList final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
CheckList::CheckList (finalcut::FWidget* parent) CheckList::CheckList (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor

View File

@ -83,7 +83,7 @@ class EventDialog final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
EventDialog::EventDialog (finalcut::FWidget* parent) EventDialog::EventDialog (finalcut::FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor
@ -263,7 +263,7 @@ class EventLog final : public finalcut::FDialog, public std::ostringstream
//---------------------------------------------------------------------- //----------------------------------------------------------------------
EventLog::EventLog (finalcut::FWidget* parent) EventLog::EventLog (finalcut::FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor

View File

@ -44,7 +44,7 @@ class Keyboard final : public finalcut::FWidget
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Keyboard::Keyboard (finalcut::FWidget* parent) Keyboard::Keyboard (finalcut::FWidget* parent)
: finalcut::FWidget(parent) : finalcut::FWidget{parent}
{ {
setFWidgetColors().term_fg = finalcut::fc::Default; setFWidgetColors().term_fg = finalcut::fc::Default;
setFWidgetColors().term_bg = finalcut::fc::Default; setFWidgetColors().term_bg = finalcut::fc::Default;

View File

@ -105,7 +105,7 @@ class Listbox final : public FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Listbox::Listbox (FWidget* parent) Listbox::Listbox (FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
auto temp = std::make_shared<FString>(); auto temp = std::make_shared<FString>();
temp_str = temp; temp_str = temp;

View File

@ -68,7 +68,7 @@ class Listview final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Listview::Listview (finalcut::FWidget* parent) Listview::Listview (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Set FListView geometry // Set FListView geometry
listView.setGeometry(FPoint{2, 1}, FSize{33, 14}); listView.setGeometry(FPoint{2, 1}, FSize{33, 14});

View File

@ -53,7 +53,7 @@ class Mandelbrot final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Mandelbrot::Mandelbrot (finalcut::FWidget* parent) Mandelbrot::Mandelbrot (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
FDialog::setText ("Mandelbrot set"); FDialog::setText ("Mandelbrot set");
} }

View File

@ -117,7 +117,7 @@ class Menu final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Menu::Menu (finalcut::FWidget* parent) Menu::Menu (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Menu bar itms // Menu bar itms
File.setStatusbarMessage ("File management commands"); File.setStatusbarMessage ("File management commands");

View File

@ -72,7 +72,7 @@ class ColorChooser final : public finalcut::FWidget
//---------------------------------------------------------------------- //----------------------------------------------------------------------
ColorChooser::ColorChooser (finalcut::FWidget* parent) ColorChooser::ColorChooser (finalcut::FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
FWidget::setSize (FSize{8, 12}); FWidget::setSize (FSize{8, 12});
setFixedSize (FSize{8, 12}); setFixedSize (FSize{8, 12});
@ -226,7 +226,7 @@ class Brushes final : public finalcut::FWidget
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Brushes::Brushes (finalcut::FWidget* parent) Brushes::Brushes (finalcut::FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
FWidget::setSize (FSize{8, 4}); FWidget::setSize (FSize{8, 4});
setFixedSize (FSize{8, 4}); setFixedSize (FSize{8, 4});
@ -379,7 +379,7 @@ class MouseDraw final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
MouseDraw::MouseDraw (finalcut::FWidget* parent) MouseDraw::MouseDraw (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
FDialog::setText ("Drawing with the mouse"); FDialog::setText ("Drawing with the mouse");
c_chooser.setPos (FPoint{1, 1}); c_chooser.setPos (FPoint{1, 1});

View File

@ -80,9 +80,9 @@ class RotoZoomer final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
RotoZoomer::RotoZoomer (finalcut::FWidget* parent, bool b, int l) RotoZoomer::RotoZoomer (finalcut::FWidget* parent, bool b, int l)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
, benchmark(b) , benchmark{b}
, loops(l) , loops{l}
{ {
FDialog::setText ("Rotozoomer effect"); FDialog::setText ("Rotozoomer effect");

View File

@ -72,7 +72,7 @@ class Scrollview final : public finalcut::FScrollView
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Scrollview::Scrollview (finalcut::FWidget* parent) Scrollview::Scrollview (finalcut::FWidget* parent)
: finalcut::FScrollView(parent) : finalcut::FScrollView{parent}
{ {
// Sets the navigation button geometry // Sets the navigation button geometry
go_east.setGeometry (FPoint{1, 1}, FSize{5, 1}); go_east.setGeometry (FPoint{1, 1}, FSize{5, 1});
@ -214,7 +214,7 @@ class Scrollviewdemo final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent) Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
FDialog::setGeometry (FPoint{16, 3}, FSize{50, 19}); FDialog::setGeometry (FPoint{16, 3}, FSize{50, 19});
FDialog::setText ("Scrolling viewport example"); FDialog::setText ("Scrolling viewport example");

View File

@ -73,7 +73,7 @@ class AttribDlg final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
AttribDlg::AttribDlg (finalcut::FWidget* parent) AttribDlg::AttribDlg (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
FDialog::setText ( "A terminal attributes test (" FDialog::setText ( "A terminal attributes test ("
+ finalcut::FString{finalcut::FTerm::getTermType()} + finalcut::FString{finalcut::FTerm::getTermType()}
@ -243,7 +243,7 @@ class AttribDemo final : public finalcut::FWidget
//---------------------------------------------------------------------- //----------------------------------------------------------------------
AttribDemo::AttribDemo (finalcut::FWidget* parent) AttribDemo::AttribDemo (finalcut::FWidget* parent)
: finalcut::FWidget(parent) : finalcut::FWidget{parent}
{ {
if ( finalcut::FTerm::isMonochron() ) if ( finalcut::FTerm::isMonochron() )
last_color = 1; last_color = 1;

View File

@ -46,7 +46,7 @@ class Timer final : public finalcut::FWidget
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Timer::Timer (finalcut::FWidget* parent) Timer::Timer (finalcut::FWidget* parent)
: finalcut::FWidget(parent) : finalcut::FWidget{parent}
{ {
addTimer (60000); // 1-minute timer addTimer (60000); // 1-minute timer
const int id = addTimer (50); // 50-millisecond timer const int id = addTimer (50); // 50-millisecond timer

View File

@ -71,8 +71,8 @@ class Transparent final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Transparent::Transparent ( finalcut::FWidget* parent Transparent::Transparent ( finalcut::FWidget* parent
, Transparent::trans_type tt ) , Transparent::trans_type tt )
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
, type(tt) , type{tt}
{ {
// Set statusbar text for this window // Set statusbar text for this window
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor
@ -191,7 +191,7 @@ class MainWindow final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
MainWindow::MainWindow (finalcut::FWidget* parent) MainWindow::MainWindow (finalcut::FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
// The memory allocation for the following three sub windows occurs // The memory allocation for the following three sub windows occurs
// with the operator new. The lifetime of the generated widget // with the operator new. The lifetime of the generated widget

View File

@ -326,7 +326,7 @@ Treeview::TreeItem Treeview::oceania[] =
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Treeview::Treeview (finalcut::FWidget* parent) Treeview::Treeview (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Set FListView geometry // Set FListView geometry
listView.setGeometry(FPoint{2, 1}, FSize{53, 14}); listView.setGeometry(FPoint{2, 1}, FSize{53, 14});

View File

@ -76,7 +76,7 @@ class ProgressDialog final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
ProgressDialog::ProgressDialog (finalcut::FWidget* parent) ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor
@ -218,7 +218,7 @@ class TextWindow final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
TextWindow::TextWindow (finalcut::FWidget* parent) TextWindow::TextWindow (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
scrollText.ignorePadding(); scrollText.ignorePadding();
scrollText.setGeometry (FPoint{1, 2}, FSize{getWidth(), getHeight() - 1}); scrollText.setGeometry (FPoint{1, 2}, FSize{getWidth(), getHeight() - 1});
@ -369,7 +369,7 @@ class MyDialog final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
MyDialog::MyDialog (finalcut::FWidget* parent) MyDialog::MyDialog (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
init(); init();
} }

View File

@ -73,7 +73,7 @@ class Watch final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Watch::Watch (FWidget* parent) Watch::Watch (FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Dialog settings // Dialog settings
// Avoids calling a virtual function from the constructor // Avoids calling a virtual function from the constructor

View File

@ -66,7 +66,7 @@ class SmallWindow final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
SmallWindow::SmallWindow (finalcut::FWidget* parent) SmallWindow::SmallWindow (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
const auto& wc = getFWidgetColors(); const auto& wc = getFWidgetColors();
const wchar_t arrow_up = fc::BlackUpPointingTriangle; const wchar_t arrow_up = fc::BlackUpPointingTriangle;
@ -240,7 +240,7 @@ class Window final : public finalcut::FDialog
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Window::Window (finalcut::FWidget* parent) Window::Window (finalcut::FWidget* parent)
: finalcut::FDialog(parent) : finalcut::FDialog{parent}
{ {
// Menu bar item // Menu bar item
File.setStatusbarMessage ("File management commands"); File.setStatusbarMessage ("File management commands");

View File

@ -71,7 +71,7 @@ bool FApplication::quit_now {false};
FApplication::FApplication ( const int& _argc FApplication::FApplication ( const int& _argc
, char* _argv[] , char* _argv[]
, bool disable_alt_screen ) , bool disable_alt_screen )
: FWidget(processParameters(_argc, _argv), disable_alt_screen) : FWidget{processParameters(_argc, _argv), disable_alt_screen}
, app_argc{_argc} , app_argc{_argc}
, app_argv{_argv} , app_argv{_argv}
{ {
@ -103,6 +103,8 @@ FApplication::~FApplication() // destructor
if ( eventInQueue() ) if ( eventInQueue() )
event_queue.clear(); event_queue.clear();
destroyLog();
} }
@ -117,8 +119,8 @@ FApplication* FApplication::getApplicationObject()
FApplication::FLogPtr& FApplication::getLog() FApplication::FLogPtr& FApplication::getLog()
{ {
// Global logger object // Global logger object
static FLogPtr logger(std::make_shared<FLogger>()); static FLogPtr* logger = new FLogPtr();
return logger; return *logger;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -373,6 +375,7 @@ void FApplication::init (uInt64 key_time, uInt64 dblclick_time)
mouse->setDblclickInterval (dblclick_time); mouse->setDblclickInterval (dblclick_time);
// Initialize logging // Initialize logging
setLog (std::make_shared<FLogger>());
getLog()->setLineEnding(FLog::CRLF); getLog()->setLineEnding(FLog::CRLF);
} }
@ -478,6 +481,13 @@ inline FStartOptions& FApplication::getStartOptions()
return FStartOptions::getFStartOptions(); return FStartOptions::getFStartOptions();
} }
//----------------------------------------------------------------------
inline void FApplication::destroyLog()
{
FLogPtr* logger = &(getLog());
delete logger;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FApplication::findKeyboardWidget() inline void FApplication::findKeyboardWidget()
{ {

View File

@ -36,14 +36,14 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FButton::FButton(FWidget* parent) FButton::FButton(FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FButton::FButton (const FString& txt, FWidget* parent) FButton::FButton (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget{parent}
, text{txt} , text{txt}
{ {
init(); init();

View File

@ -39,14 +39,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FButtonGroup::FButtonGroup(FWidget* parent) FButtonGroup::FButtonGroup(FWidget* parent)
: FScrollView(parent) : FScrollView{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FButtonGroup::FButtonGroup (const FString& txt, FWidget* parent) FButtonGroup::FButtonGroup (const FString& txt, FWidget* parent)
: FScrollView(parent) : FScrollView{parent}
, text{txt} , text{txt}
{ {
init(); init();

View File

@ -33,14 +33,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckBox::FCheckBox(FWidget* parent) FCheckBox::FCheckBox(FWidget* parent)
: FToggleButton(parent) : FToggleButton{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckBox::FCheckBox (const FString& txt, FWidget* parent) FCheckBox::FCheckBox (const FString& txt, FWidget* parent)
: FToggleButton(txt, parent) : FToggleButton{txt, parent}
{ {
init(); init();
} }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2015-2019 Markus Gans * * Copyright 2015-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -34,14 +34,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckMenuItem::FCheckMenuItem (FWidget* parent) FCheckMenuItem::FCheckMenuItem (FWidget* parent)
: FMenuItem(parent) : FMenuItem{parent}
{ {
init (parent); init (parent);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckMenuItem::FCheckMenuItem (const FString& txt, FWidget* parent) FCheckMenuItem::FCheckMenuItem (const FString& txt, FWidget* parent)
: FMenuItem(txt, parent) : FMenuItem{txt, parent}
{ {
init (parent); init (parent);
} }

View File

@ -44,7 +44,7 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDropDownListBox::FDropDownListBox (FWidget* parent) FDropDownListBox::FDropDownListBox (FWidget* parent)
: FWindow(parent) : FWindow{parent}
{ {
init(); init();
} }
@ -169,7 +169,7 @@ bool FDropDownListBox::containsWidget (const FPoint& p)
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FComboBox::FComboBox (FWidget* parent) FComboBox::FComboBox (FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
} }

View File

@ -42,14 +42,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialog::FDialog (FWidget* parent) FDialog::FDialog (FWidget* parent)
: FWindow(parent) : FWindow{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialog::FDialog (const FString& txt, FWidget* parent) FDialog::FDialog (const FString& txt, FWidget* parent)
: FWindow(parent) : FWindow{parent}
, tb_text{txt} , tb_text{txt}
{ {
init(); init();

View File

@ -33,14 +33,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialogListMenu::FDialogListMenu(FWidget* parent) FDialogListMenu::FDialogListMenu(FWidget* parent)
: FMenu(parent) : FMenu{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FDialogListMenu::FDialogListMenu (const FString& txt, FWidget* parent) FDialogListMenu::FDialogListMenu (const FString& txt, FWidget* parent)
: FMenu(txt, parent) : FMenu{txt, parent}
{ {
init(); init();
} }

View File

@ -53,7 +53,7 @@ bool FEvent::wasSent() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKeyEvent::FKeyEvent (fc::events ev_type, FKey key_num) // constructor FKeyEvent::FKeyEvent (fc::events ev_type, FKey key_num) // constructor
: FEvent(ev_type) : FEvent{ev_type}
, k{key_num} , k{key_num}
{ } { }
@ -86,7 +86,7 @@ FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
, const FPoint& pos , const FPoint& pos
, const FPoint& termPos , const FPoint& termPos
, int button ) , int button )
: FEvent(ev_type) : FEvent{ev_type}
, p{pos} , p{pos}
, tp{termPos} , tp{termPos}
, b{button} , b{button}
@ -96,7 +96,7 @@ FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
FMouseEvent::FMouseEvent ( fc::events ev_type // constructor FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
, const FPoint& pos , const FPoint& pos
, int button ) , int button )
: FMouseEvent(ev_type, pos, FPoint{}, button) : FMouseEvent{ev_type, pos, FPoint{}, button}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -140,7 +140,7 @@ FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
, const FPoint& pos , const FPoint& pos
, const FPoint& termPos , const FPoint& termPos
, int wheel ) , int wheel )
: FEvent(ev_type) : FEvent{ev_type}
, p{pos} , p{pos}
, tp{termPos} , tp{termPos}
, w{wheel} , w{wheel}
@ -150,7 +150,7 @@ FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
FWheelEvent::FWheelEvent ( fc::events ev_type // constructor FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
, const FPoint& pos , const FPoint& pos
, int wheel ) , int wheel )
: FWheelEvent(ev_type, pos, FPoint{}, wheel) : FWheelEvent{ev_type, pos, FPoint{}, wheel}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -191,7 +191,7 @@ int FWheelEvent::getWheel() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FFocusEvent::FFocusEvent (fc::events ev_type) // constructor FFocusEvent::FFocusEvent (fc::events ev_type) // constructor
: FEvent(ev_type) : FEvent{ev_type}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -236,7 +236,7 @@ void FFocusEvent::ignore()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FAccelEvent::FAccelEvent (fc::events ev_type, void* focused) // constructor FAccelEvent::FAccelEvent (fc::events ev_type, void* focused) // constructor
: FEvent(ev_type) : FEvent{ev_type}
, focus_widget{focused} , focus_widget{focused}
{ } { }
@ -266,7 +266,7 @@ void FAccelEvent::ignore()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FResizeEvent::FResizeEvent (fc::events ev_type) // constructor FResizeEvent::FResizeEvent (fc::events ev_type) // constructor
: FEvent(ev_type) : FEvent{ev_type}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -291,7 +291,7 @@ void FResizeEvent::ignore()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FShowEvent::FShowEvent (fc::events ev_type) // constructor FShowEvent::FShowEvent (fc::events ev_type) // constructor
: FEvent(ev_type) : FEvent{ev_type}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -304,7 +304,7 @@ FShowEvent::~FShowEvent() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FHideEvent::FHideEvent (fc::events ev_type) // constructor FHideEvent::FHideEvent (fc::events ev_type) // constructor
: FEvent(ev_type) : FEvent{ev_type}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -317,7 +317,7 @@ FHideEvent::~FHideEvent() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCloseEvent::FCloseEvent (fc::events ev_type) // constructor FCloseEvent::FCloseEvent (fc::events ev_type) // constructor
: FEvent(ev_type) : FEvent{ev_type}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -342,7 +342,7 @@ void FCloseEvent::ignore()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTimerEvent::FTimerEvent (fc::events ev_type, int timer_id) // constructor FTimerEvent::FTimerEvent (fc::events ev_type, int timer_id) // constructor
: FEvent(ev_type) : FEvent{ev_type}
, id{timer_id} , id{timer_id}
{ } { }
@ -360,7 +360,7 @@ int FTimerEvent::getTimerId() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FUserEvent::FUserEvent (fc::events ev_type, int user_event_id) // constructor FUserEvent::FUserEvent (fc::events ev_type, int user_event_id) // constructor
: FEvent(ev_type) : FEvent{ev_type}
, uid{user_event_id} , uid{user_event_id}
{ } { }

View File

@ -99,14 +99,14 @@ FSystem* FFileDialog::fsystem{nullptr};
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FFileDialog::FFileDialog (FWidget* parent) FFileDialog::FFileDialog (FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FFileDialog::FFileDialog (const FFileDialog& fdlg) FFileDialog::FFileDialog (const FFileDialog& fdlg)
: FDialog(fdlg.getParentWidget()) : FDialog{fdlg.getParentWidget()}
{ {
if ( fdlg.directory ) if ( fdlg.directory )
setPath(fdlg.directory); setPath(fdlg.directory);
@ -119,9 +119,9 @@ FFileDialog::FFileDialog ( const FString& dirname
, const FString& filter , const FString& filter
, DialogType type , DialogType type
, FWidget* parent ) , FWidget* parent )
: FDialog(parent) : FDialog{parent}
, filter_pattern(filter) , filter_pattern{filter}
, dlg_type(type) , dlg_type{type}
{ {
if ( ! dirname.isNull() ) if ( ! dirname.isNull() )
setPath(dirname); setPath(dirname);

View File

@ -40,15 +40,15 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLabel::FLabel(FWidget* parent) FLabel::FLabel(FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLabel::FLabel (const FString& txt, FWidget* parent) FLabel::FLabel (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget{parent}
, text(txt) , text{txt}
{ {
init(); init();
setText(txt); setText(txt);

View File

@ -42,7 +42,7 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLineEdit::FLineEdit (FWidget* parent) FLineEdit::FLineEdit (FWidget* parent)
: FWidget(parent) : FWidget{parent}
, label{new FLabel("", parent)} , label{new FLabel("", parent)}
{ {
init(); init();
@ -50,8 +50,8 @@ FLineEdit::FLineEdit (FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FLineEdit::FLineEdit (const FString& txt, FWidget* parent) FLineEdit::FLineEdit (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget{parent}
, text(txt) , text{txt}
, label{new FLabel("", parent)} , label{new FLabel("", parent)}
{ {
init(); init();

View File

@ -45,16 +45,16 @@ FListBoxItem::FListBoxItem()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const FListBoxItem& item) FListBoxItem::FListBoxItem (const FListBoxItem& item)
: text(item.text) : text{item.text}
, data_pointer(item.data_pointer) , data_pointer{item.data_pointer}
, brackets(item.brackets) , brackets{item.brackets}
, selected(item.selected) , selected{item.selected}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListBoxItem::FListBoxItem (const FString& txt, FDataPtr data) FListBoxItem::FListBoxItem (const FString& txt, FDataPtr data)
: text(txt) : text{txt}
, data_pointer(data) , data_pointer{data}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -87,7 +87,7 @@ FListBoxItem& FListBoxItem::operator = (const FListBoxItem& item)
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListBox::FListBox (FWidget* parent) FListBox::FListBox (FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
} }

View File

@ -170,9 +170,9 @@ bool sortDescendingByNumber (const FObject* lhs, const FObject* rhs)
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewItem::FListViewItem (const FListViewItem& item) FListViewItem::FListViewItem (const FListViewItem& item)
: FObject(item.getParent()) : FObject{item.getParent()}
, column_list(item.column_list) , column_list{item.column_list}
, data_pointer(item.data_pointer) , data_pointer{item.data_pointer}
{ {
auto parent = getParent(); auto parent = getParent();
@ -191,7 +191,7 @@ FListViewItem::FListViewItem (const FListViewItem& item)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewItem::FListViewItem (iterator parent_iter) FListViewItem::FListViewItem (iterator parent_iter)
: FObject((*parent_iter)->getParent()) : FObject{(*parent_iter)->getParent()}
{ {
insert (this, parent_iter); insert (this, parent_iter);
} }
@ -200,9 +200,9 @@ FListViewItem::FListViewItem (iterator parent_iter)
FListViewItem::FListViewItem ( const FStringList& cols FListViewItem::FListViewItem ( const FStringList& cols
, FDataPtr data , FDataPtr data
, iterator parent_iter ) , iterator parent_iter )
: FObject(nullptr) : FObject{nullptr}
, column_list(cols) , column_list{cols}
, data_pointer(data) , data_pointer{data}
{ {
if ( cols.empty() ) if ( cols.empty() )
return; return;
@ -496,7 +496,7 @@ FListViewIterator::FListViewIterator()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator::FListViewIterator (iterator iter) FListViewIterator::FListViewIterator (iterator iter)
: node(iter) : node{iter}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -505,16 +505,16 @@ FListViewIterator::~FListViewIterator() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator::FListViewIterator (const FListViewIterator& i) FListViewIterator::FListViewIterator (const FListViewIterator& i)
: iter_path(i.iter_path) // copy constructor : iter_path{i.iter_path} // copy constructor
, node(i.node) , node{i.node}
, position(i.position) , position{i.position}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListViewIterator::FListViewIterator (FListViewIterator&& i) noexcept FListViewIterator::FListViewIterator (FListViewIterator&& i) noexcept
: iter_path(std::move(i.iter_path)) // move constructor : iter_path{std::move(i.iter_path)} // move constructor
, node(std::move(i.node)) , node{std::move(i.node)}
, position(std::move(i.position)) , position{std::move(i.position)}
{ } { }
// FListViewIterator operators // FListViewIterator operators
@ -683,7 +683,7 @@ void FListViewIterator::parentElement()
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FListView::FListView (FWidget* parent) FListView::FListView (FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
} }

View File

@ -45,15 +45,15 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenu::FMenu(FWidget* parent) FMenu::FMenu(FWidget* parent)
: FWindow(parent) : FWindow{parent}
{ {
init(parent); init(parent);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenu::FMenu (const FString& txt, FWidget* parent) FMenu::FMenu (const FString& txt, FWidget* parent)
: FWindow(parent) : FWindow{parent}
, menuitem(txt, parent) , menuitem{txt, parent}
{ {
init(parent); init(parent);
} }

View File

@ -42,7 +42,7 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuBar::FMenuBar(FWidget* parent) FMenuBar::FMenuBar(FWidget* parent)
: FWindow(parent) : FWindow{parent}
{ {
init(); init();
} }

View File

@ -42,24 +42,24 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuItem::FMenuItem (FWidget* parent) FMenuItem::FMenuItem (FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init (parent); init (parent);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuItem::FMenuItem (const FString& txt, FWidget* parent) FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget{parent}
, text(txt) , text{txt}
{ {
init (parent); init (parent);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuItem::FMenuItem (FKey k, const FString& txt, FWidget* parent) FMenuItem::FMenuItem (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget{parent}
, text(txt) , text{txt}
, accel_key(k) , accel_key{k}
{ {
init (parent); init (parent);
} }

View File

@ -50,7 +50,7 @@ static const char* const button_text[] =
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMessageBox::FMessageBox (FWidget* parent) FMessageBox::FMessageBox (FWidget* parent)
: FDialog(parent) : FDialog{parent}
{ {
setTitlebarText("Message for you"); setTitlebarText("Message for you");
init(FMessageBox::Ok, 0, 0); init(FMessageBox::Ok, 0, 0);
@ -58,15 +58,15 @@ FMessageBox::FMessageBox (FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMessageBox::FMessageBox (const FMessageBox& mbox) FMessageBox::FMessageBox (const FMessageBox& mbox)
: FDialog(mbox.getParentWidget()) : FDialog{mbox.getParentWidget()}
, headline_text(mbox.headline_text) , headline_text{mbox.headline_text}
, text(mbox.text) , text{mbox.text}
, text_components(mbox.text_components) , text_components{mbox.text_components}
, max_line_width(mbox.max_line_width) , max_line_width{mbox.max_line_width}
, emphasis_color(mbox.emphasis_color) , emphasis_color{mbox.emphasis_color}
, num_buttons(mbox.num_buttons) , num_buttons{mbox.num_buttons}
, text_num_lines(mbox.text_num_lines) , text_num_lines{mbox.text_num_lines}
, center_text(mbox.center_text) , center_text{mbox.center_text}
{ {
setTitlebarText (mbox.getTitlebarText()); setTitlebarText (mbox.getTitlebarText());
init ( mbox.button_digit[0] init ( mbox.button_digit[0]
@ -81,8 +81,8 @@ FMessageBox::FMessageBox ( const FString& caption
, int button1 , int button1
, int button2 , int button2
, FWidget* parent ) , FWidget* parent )
: FDialog(parent) : FDialog{parent}
, text(message) , text{message}
{ {
setTitlebarText(caption); setTitlebarText(caption);
init(button0, button1, button2); init(button0, button1, button2);

View File

@ -308,7 +308,7 @@ bool FMouse::isDblclickTimeout (const timeval* time)
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseGPM::FMouseGPM() FMouseGPM::FMouseGPM()
: FMouse() : FMouse{}
{ {
gpm_ev.x = -1; gpm_ev.x = -1;
} }

View File

@ -43,7 +43,7 @@ const FString* fc::emptyFString::empty_string{nullptr};
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FObject::FObject (FObject* parent) FObject::FObject (FObject* parent)
: parent_obj(parent) : parent_obj{parent}
{ {
if ( parent ) // add object to parent if ( parent ) // add object to parent
{ {

View File

@ -36,7 +36,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FOptiMove::FOptiMove (int baud) FOptiMove::FOptiMove (int baud)
: baudrate(baud) : baudrate{baud}
{ {
assert ( baud >= 0 ); assert ( baud >= 0 );

View File

@ -36,7 +36,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FProgressbar::FProgressbar(FWidget* parent) FProgressbar::FProgressbar(FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
unsetFocusable(); unsetFocusable();
setShadow(); setShadow();

View File

@ -33,14 +33,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioButton::FRadioButton(FWidget* parent) FRadioButton::FRadioButton(FWidget* parent)
: FToggleButton(parent) : FToggleButton{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioButton::FRadioButton (const FString& txt, FWidget* parent) FRadioButton::FRadioButton (const FString& txt, FWidget* parent)
: FToggleButton(txt, parent) : FToggleButton{txt, parent}
{ {
init(); init();
} }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2015-2019 Markus Gans * * Copyright 2015-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -34,14 +34,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioMenuItem::FRadioMenuItem (FWidget* parent) FRadioMenuItem::FRadioMenuItem (FWidget* parent)
: FMenuItem(parent) : FMenuItem{parent}
{ {
init (parent); init (parent);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioMenuItem::FRadioMenuItem (const FString& txt, FWidget* parent) FRadioMenuItem::FRadioMenuItem (const FString& txt, FWidget* parent)
: FMenuItem(txt, parent) : FMenuItem{txt, parent}
{ {
init (parent); init (parent);
} }

View File

@ -36,18 +36,18 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRect::FRect (const FPoint& p, const FSize& s) FRect::FRect (const FPoint& p, const FSize& s)
: X1(p.getX()) : X1{p.getX()}
, Y1(p.getY()) , Y1{p.getY()}
, X2(p.getX() + int(s.getWidth()) - 1) , X2{p.getX() + int(s.getWidth()) - 1}
, Y2(p.getY() + int(s.getHeight()) - 1) , Y2{p.getY() + int(s.getHeight()) - 1}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRect::FRect (const FPoint& p1, const FPoint& p2) FRect::FRect (const FPoint& p1, const FPoint& p2)
: X1(p1.getX()) : X1{p1.getX()}
, Y1(p1.getY()) , Y1{p1.getY()}
, X2(p2.getX()) , X2{p2.getX()}
, Y2(p2.getY()) , Y2{p2.getY()}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -37,7 +37,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FScrollbar::FScrollbar(FWidget* parent) FScrollbar::FScrollbar(FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
// The default scrollbar orientation is vertical // The default scrollbar orientation is vertical
setGeometry(FPoint{1, 1}, FSize{1, length}, false); setGeometry(FPoint{1, 1}, FSize{1, length}, false);
@ -46,7 +46,7 @@ FScrollbar::FScrollbar(FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FScrollbar::FScrollbar(fc::orientation o, FWidget* parent) FScrollbar::FScrollbar(fc::orientation o, FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
setOrientation (o); setOrientation (o);
init(); init();

View File

@ -38,7 +38,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FScrollView::FScrollView (FWidget* parent) FScrollView::FScrollView (FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(parent); init(parent);
} }

View File

@ -42,7 +42,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSpinBox::FSpinBox (FWidget* parent) FSpinBox::FSpinBox (FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
} }

View File

@ -36,16 +36,16 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStatusKey::FStatusKey(FWidget* parent) FStatusKey::FStatusKey(FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init (parent); init (parent);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStatusKey::FStatusKey (FKey k, const FString& txt, FWidget* parent) FStatusKey::FStatusKey (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget{parent}
, text(txt) , text{txt}
, key(k) , key{k}
{ {
init (parent); init (parent);
} }
@ -126,7 +126,7 @@ void FStatusKey::processActivate()
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStatusBar::FStatusBar(FWidget* parent) FStatusBar::FStatusBar(FWidget* parent)
: FWindow(parent) : FWindow{parent}
{ {
init(); init();
} }

View File

@ -76,16 +76,15 @@ FString::FString (const FString& s) // copy constructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString::FString (FString&& s) noexcept // move constructor FString::FString (FString&& s) noexcept // move constructor
: string{std::move(s.string)}
, length{s.length}
, bufsize{s.bufsize}
, c_string{std::move(s.c_string)}
{ {
string = std::move(s.string);
c_string = std::move(s.c_string);
length = s.length;
bufsize = s.bufsize;
s.string = nullptr; s.string = nullptr;
s.c_string = nullptr;
s.length = 0; s.length = 0;
s.bufsize = 0; s.bufsize = 0;
s.c_string = nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -175,22 +174,34 @@ FString::~FString() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString& FString::operator = (const FString& s) FString& FString::operator = (const FString& s)
{ {
_assign (s.string); if ( &s != this )
_assign (s.string);
return *this; return *this;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString& FString::operator = (FString&& s) noexcept FString& FString::operator = (FString&& s) noexcept
{ {
string = std::move(s.string); if ( &s != this )
c_string = std::move(s.c_string); {
length = s.length; if ( string )
bufsize = s.bufsize; delete[](string);
if ( c_string )
delete[](c_string);
string = std::move(s.string);
length = s.length;
bufsize = s.bufsize;
c_string = std::move(s.c_string);
s.string = nullptr;
s.length = 0;
s.bufsize = 0;
s.c_string = nullptr;
}
s.string = nullptr;
s.c_string = nullptr;
s.length = 0;
s.bufsize = 0;
return *this; return *this;
} }

View File

@ -44,7 +44,7 @@ FStringStream::FStringStream (const FString& str, openmode mode)
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStringStream::FStringStream (FStringStream&& sstream) FStringStream::FStringStream (FStringStream&& sstream) noexcept
: std::wiostream{std::move(sstream)} : std::wiostream{std::move(sstream)}
, buffer{std::move(sstream.buffer)} , buffer{std::move(sstream.buffer)}
{ {
@ -65,7 +65,7 @@ FStringStream& FStringStream::operator = (FStringStream&& sstream)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FStringStream::swap (FStringStream& sstream) void FStringStream::swap (FStringStream& sstream) noexcept
{ {
std::wiostream::swap(sstream); std::wiostream::swap(sstream);
buffer.swap(sstream.buffer); buffer.swap(sstream.buffer);

View File

@ -35,14 +35,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSwitch::FSwitch(FWidget* parent) FSwitch::FSwitch(FWidget* parent)
: FToggleButton(parent) : FToggleButton{parent}
{ {
setButtonWidth(11); setButtonWidth(11);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSwitch::FSwitch (const FString& txt, FWidget* parent) FSwitch::FSwitch (const FString& txt, FWidget* parent)
: FToggleButton(txt, parent) : FToggleButton{txt, parent}
, switch_offset_pos(txt.getLength() + 1) , switch_offset_pos(txt.getLength() + 1)
{ {
setButtonWidth(11); setButtonWidth(11);

View File

@ -42,7 +42,7 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTextView::FTextView(FWidget* parent) FTextView::FTextView(FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
} }

View File

@ -40,7 +40,7 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FToggleButton::FToggleButton (FWidget* parent) FToggleButton::FToggleButton (FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
@ -55,7 +55,7 @@ FToggleButton::FToggleButton (FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FToggleButton::FToggleButton (const FString& txt, FWidget* parent) FToggleButton::FToggleButton (const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
FToggleButton::setText(txt); // call own method FToggleButton::setText(txt); // call own method
init(); init();

View File

@ -34,14 +34,14 @@ namespace finalcut
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FToolTip::FToolTip (FWidget* parent) FToolTip::FToolTip (FWidget* parent)
: FWindow(parent) : FWindow{parent}
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FToolTip::FToolTip (const FString& txt, FWidget* parent) FToolTip::FToolTip (const FString& txt, FWidget* parent)
: FWindow(parent) : FWindow{parent}
, text{txt} , text{txt}
{ {
init(); init();

View File

@ -60,8 +60,8 @@ uInt FWidget::modal_dialog_counter{};
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget::FWidget (FWidget* parent, bool disable_alt_screen) FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
: FVTerm( ! (bool(parent) || root_widget), disable_alt_screen) : FVTerm{ ! (bool(parent) || root_widget), disable_alt_screen}
, FObject(parent) , FObject{parent}
{ {
// init bit field with 0 // init bit field with 0
memset (&flags, 0, sizeof(flags)); memset (&flags, 0, sizeof(flags));

View File

@ -44,7 +44,7 @@ FWindow* FWindow::previous_window{nullptr};
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWindow::FWindow(FWidget* parent) FWindow::FWindow(FWidget* parent)
: FWidget(parent) : FWidget{parent}
{ {
setWindowWidget(); setWindowWidget();
FRect geometry {getTermGeometry()}; FRect geometry {getTermGeometry()};

View File

@ -149,6 +149,7 @@ class FApplication : public FWidget
void init (uInt64, uInt64); void init (uInt64, uInt64);
static void cmd_options (const int&, char*[]); static void cmd_options (const int&, char*[]);
static FStartOptions& getStartOptions(); static FStartOptions& getStartOptions();
void destroyLog();
void findKeyboardWidget(); void findKeyboardWidget();
bool isKeyPressed() const; bool isKeyPressed() const;
void keyPressed(); void keyPressed();

View File

@ -350,7 +350,7 @@ inline FListBox::FListBox ( Iterator first
, Iterator last , Iterator last
, InsertConverter convert , InsertConverter convert
, FWidget* parent ) , FWidget* parent )
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
@ -366,7 +366,7 @@ template <typename Container, typename LazyConverter>
inline FListBox::FListBox ( Container container inline FListBox::FListBox ( Container container
, LazyConverter convert , LazyConverter convert
, FWidget* parent ) , FWidget* parent )
: FWidget(parent) : FWidget{parent}
{ {
init(); init();
insert (container, convert); insert (container, convert);

View File

@ -69,7 +69,7 @@ class FStringStream : public std::wiostream
FStringStream (const FStringStream&) = delete; FStringStream (const FStringStream&) = delete;
// Move constructor // Move constructor
FStringStream (FStringStream&&); FStringStream (FStringStream&&) noexcept;
// Destructor // Destructor
~FStringStream(); ~FStringStream();
@ -81,7 +81,7 @@ class FStringStream : public std::wiostream
FStringStream& operator = (FStringStream&& sstream); FStringStream& operator = (FStringStream&& sstream);
virtual const FString getClassName() const; virtual const FString getClassName() const;
void swap (FStringStream&); void swap (FStringStream&) noexcept;
void clear(); void clear();
std::wstringbuf* rdbuf() const; std::wstringbuf* rdbuf() const;
FString str() const; FString str() const;
@ -111,7 +111,7 @@ inline FString FStringStream::str() const
// FStringStream non-member function // FStringStream non-member function
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void swap (FStringStream& a, FStringStream& b) inline void swap (FStringStream& a, FStringStream& b) noexcept
{ a.swap(b); } { a.swap(b); }

View File

@ -35,7 +35,7 @@ namespace finalcut
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
SGRoptimizer::SGRoptimizer (attributebuffer& sequence) SGRoptimizer::SGRoptimizer (attributebuffer& sequence)
: seq(sequence) : seq{sequence}
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -447,6 +447,7 @@ void FStringTest::assignmentTest()
CPPUNIT_ASSERT ( ! s9 ); CPPUNIT_ASSERT ( ! s9 );
CPPUNIT_ASSERT ( s9.isNull() ); CPPUNIT_ASSERT ( s9.isNull() );
CPPUNIT_ASSERT ( s9.isEmpty() ); CPPUNIT_ASSERT ( s9.isEmpty() );
finalcut::FString s10("abc"); finalcut::FString s10("abc");
const finalcut::FString s11 = std::move(s10); const finalcut::FString s11 = std::move(s10);
CPPUNIT_ASSERT ( s11 ); CPPUNIT_ASSERT ( s11 );