#include <tdeuniqueapplication.h>
#include <tdecmdlineargs.h>
#include <tdeaboutdata.h>
#include <tdelocale.h>

#include "ui/tmixapp.h"
#include "ui/backendcontroller.h"
#include <stdlib.h>

static TDECmdLineOptions options[] = { TDECmdLineLastOption };

int main( int argc, char *argv[] )
{
    TDEAboutData about(
        "tmix", I18N_NOOP("TMix"),
        "0.2",
        "Trinity audio mixer",
        TDEAboutData::License_GPL,
        "(c) 2026 Trinity Desktop Project"
    );

    TDECmdLineArgs::init( argc, argv, &about );
    TDECmdLineArgs::addCmdLineOptions( options );
    TDEUniqueApplication::addCmdLineOptions();

    if (! TDEUniqueApplication::start() )
      exit(-1);

    TmixApp app;
    app.disableSessionManagement();

    // No parent — we delete ctrl explicitly before app exits so that
    // TmixTray's X11 teardown happens while the display is still open.
    BackendController *ctrl = new BackendController;
    ctrl->start();

    int ret = app.exec();
    delete ctrl;
    return ret;
}
