summaryrefslogtreecommitdiffstats
path: root/tools/designer/examples/sizeaware/sizeaware.cpp
blob: 621d36eadf7fbe39a0aac257fe0c29c8ab75964c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "sizeaware.h"
#include <ntqsettings.h>


SizeAware::SizeAware( TQDialog *parent, const char *name, bool modal )
    : TQDialog( parent, name, modal )
{
    if ( company().isEmpty() )
	setCompany( "UnknownCompany" );
    if ( settingsFile().isEmpty() ) 
	setSettingsFile( "UnknownFile" );

    TQSettings settings;
    settings.insertSearchPath( TQSettings::Windows, "/" + company() );
    settings.insertSearchPath( TQSettings::Unix, "/Opt/" + company() + "/share" );
    int width  = settings.readNumEntry( "/" + settingsFile() + "/width",  640 );
    int height = settings.readNumEntry( "/" + settingsFile() + "/height", 480 );
    resize( width, height );
}


SizeAware::~SizeAware()
{
    // NOOP
}

void SizeAware::destroy()
{
    TQSettings settings;
    settings.insertSearchPath( TQSettings::Windows, "/" + company() );
    settings.insertSearchPath( TQSettings::Unix, "/Opt/" + company() + "/share" );
    settings.writeEntry( "/" + settingsFile() + "/width",   width() );
    settings.writeEntry( "/" + settingsFile() + "/height",  height() );
    close( TRUE );
}